RESOLVED FIXED 129141
Create SessionID class
https://bugs.webkit.org/show_bug.cgi?id=129141
Summary Create SessionID class
Martin Hock
Reported 2014-02-20 20:17:49 PST
Create SessionID class.
Attachments
patch (27.20 KB, patch)
2014-02-20 20:36 PST, Martin Hock
no flags
build (31.31 KB, patch)
2014-02-20 20:44 PST, Martin Hock
no flags
changelog (31.39 KB, patch)
2014-02-20 20:47 PST, Martin Hock
no flags
typo (31.39 KB, patch)
2014-02-20 21:36 PST, Martin Hock
no flags
symbol (12.58 KB, patch)
2014-02-21 00:10 PST, Martin Hock
no flags
rebase (31.92 KB, patch)
2014-02-21 00:14 PST, Martin Hock
no flags
make SessionID a value class per comment (69.05 KB, patch)
2014-02-21 23:36 PST, Martin Hock
no flags
build fix (69.62 KB, patch)
2014-02-22 00:13 PST, Martin Hock
no flags
whitespace (69.56 KB, patch)
2014-02-22 09:54 PST, Martin Hock
no flags
remove isSessionIDSet() (69.50 KB, patch)
2014-02-24 12:55 PST, Martin Hock
no flags
restore isSessionIDSet() (69.83 KB, patch)
2014-02-25 14:20 PST, Martin Hock
mhock: review-
fix pbxproj (68.98 KB, patch)
2014-02-25 15:13 PST, Martin Hock
sam: review+
commit-queue: commit-queue-
rebase (69.00 KB, patch)
2014-02-26 10:20 PST, Martin Hock
no flags
Martin Hock
Comment 1 2014-02-20 20:36:30 PST
Martin Hock
Comment 2 2014-02-20 20:44:54 PST
Martin Hock
Comment 3 2014-02-20 20:47:38 PST
Created attachment 224830 [details] changelog
Martin Hock
Comment 4 2014-02-20 21:36:39 PST
Martin Hock
Comment 5 2014-02-21 00:10:47 PST
Martin Hock
Comment 6 2014-02-21 00:14:05 PST
Anders Carlsson
Comment 7 2014-02-21 09:42:57 PST
Comment on attachment 224836 [details] rebase Why is this an identifier in WebCore instead of a simple POD like class?
Martin Hock
Comment 8 2014-02-21 10:13:41 PST
(In reply to comment #7) > (From update of attachment 224836 [details]) > Why is this an identifier in WebCore instead of a simple POD like class? You're talking about SessionID? I'm not sure what you're asking me to do - take it out of the WebCore namespace? Not make it noncopyable? The reason I'm putting it in WebCore is because of this patch to add session IDs to MemoryCache: https://bugs.webkit.org/show_bug.cgi?id=127794 I split this part out because that patch was getting a bit unwieldy.
Brady Eidson
Comment 9 2014-02-21 11:32:49 PST
Comment on attachment 224836 [details] rebase View in context: https://bugs.webkit.org/attachment.cgi?id=224836&action=review I think it's weird that we have a SessionID class, but we don't represent sessionIDs with it. (i.e. Page stores a uint64_t instead of a "SessionID") What is the point of the SessionID class if we don't use it to represent SessionIDs? Yes, a session ID is just a POD uint64_t, but it also has other properties (such is "is this ephemeral?") that are logically an operation on a SessionID object, rather than a question you ask about an integer. > Source/WebCore/page/Page.cpp:1500 > + return m_sessionID ? m_sessionID : settings().privateBrowsingEnabled() ? SessionID::legacyPrivateSessionID : SessionID::defaultSessionID; We may not have a rule about this, but I don't think it's at all common to stack ternary operator usage like this. It definitely makes this line harder to read than if it were written with if conditionals. > Source/WebCore/page/Page.h:402 > + void setSessionID(uint64_t sessionID) { ASSERT(sessionID); m_sessionID = sessionID; } If we don't already, we should have a style guideline on this. Please don't put multiple statements on the same line. If a function definition in a header has more than one line, it should be written fully expanded (opening brace on new line, one line per statement) > Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.cpp:154 > - if (SessionTracker::isEphemeralID(sessionID)) { > + if (SessionID::isEphemeralID(sessionID)) { If we passed around SessionID objects rather than uint64_ts, then this would read: if (sessionID.isEphermeral()) { Same comment for all usage like this.
Martin Hock
Comment 10 2014-02-21 23:36:35 PST
Created attachment 224950 [details] make SessionID a value class per comment
Martin Hock
Comment 11 2014-02-22 00:13:01 PST
Created attachment 224952 [details] build fix
Martin Hock
Comment 12 2014-02-22 09:54:19 PST
Created attachment 224973 [details] whitespace
Martin Hock
Comment 13 2014-02-24 10:20:05 PST
(In reply to comment #9) > (From update of attachment 224836 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=224836&action=review > > I think it's weird that we have a SessionID class, but we don't represent sessionIDs with it. (i.e. Page stores a uint64_t instead of a "SessionID") > > What is the point of the SessionID class if we don't use it to represent SessionIDs? > > Yes, a session ID is just a POD uint64_t, but it also has other properties (such is "is this ephemeral?") that are logically an operation on a SessionID object, rather than a question you ask about an integer. I've replaced the session ID with a class. As discussed, it's not a POD as we want to define the default constructor. > > Source/WebCore/page/Page.cpp:1500 > > + return m_sessionID ? m_sessionID : settings().privateBrowsingEnabled() ? SessionID::legacyPrivateSessionID : SessionID::defaultSessionID; > > We may not have a rule about this, but I don't think it's at all common to stack ternary operator usage like this. It definitely makes this line harder to read than if it were written with if conditionals. Done. > > Source/WebCore/page/Page.h:402 > > + void setSessionID(uint64_t sessionID) { ASSERT(sessionID); m_sessionID = sessionID; } > > If we don't already, we should have a style guideline on this. Please don't put multiple statements on the same line. If a function definition in a header has more than one line, it should be written fully expanded (opening brace on new line, one line per statement) Done. > > Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.cpp:154 > > - if (SessionTracker::isEphemeralID(sessionID)) { > > + if (SessionID::isEphemeralID(sessionID)) { > > If we passed around SessionID objects rather than uint64_ts, then this would read: > if (sessionID.isEphermeral()) { > > Same comment for all usage like this. Done.
Brady Eidson
Comment 14 2014-02-24 11:23:26 PST
Comment on attachment 224973 [details] whitespace View in context: https://bugs.webkit.org/attachment.cgi?id=224973&action=review > Source/WebCore/page/Page.h:403 > + bool isSessionIDSet() const { return m_sessionID.isValid(); } I wonder if we need this helper at all. My automatic comment would be "shouldn't this be named isSessionIDValid instead of isSessionIDSet?", and from that comment it follows that everybody who calls it could just call sessionID().isValid() instead. > Source/WebKit2/UIProcess/APISession.cpp:59 > Session::Session(bool isEphemeral) > - : m_isEphemeral(isEphemeral) > - , m_sessionID(generateID(isEphemeral)) > + : m_sessionID(generateID(isEphemeral)) Does anybody ever create one with isEphermeral == false?
Martin Hock
Comment 15 2014-02-24 12:55:03 PST
Created attachment 225086 [details] remove isSessionIDSet()
Martin Hock
Comment 16 2014-02-24 12:55:20 PST
(In reply to comment #14) > (From update of attachment 224973 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=224973&action=review > > > Source/WebCore/page/Page.h:403 > > + bool isSessionIDSet() const { return m_sessionID.isValid(); } > > I wonder if we need this helper at all. > > My automatic comment would be "shouldn't this be named isSessionIDValid instead of isSessionIDSet?", and from that comment it follows that everybody who calls it could just call sessionID().isValid() instead. Yes, that makes sense. I've made this change. > > Source/WebKit2/UIProcess/APISession.cpp:59 > > Session::Session(bool isEphemeral) > > - : m_isEphemeral(isEphemeral) > > - , m_sessionID(generateID(isEphemeral)) > > + : m_sessionID(generateID(isEphemeral)) > > Does anybody ever create one with isEphermeral == false? We have ASSERT(isEphemeral) in generateID() for now along with FIXME comments like // FIXME: support creation of non-default, non-ephemeral sessions in create(). The constructor is private, so the public create method seems like the appropriate place to put the FIXME.
Brady Eidson
Comment 17 2014-02-24 14:13:14 PST
Comment on attachment 225086 [details] remove isSessionIDSet() That efl-wk2 failure clearly isn't due to this patch.
WebKit Commit Bot
Comment 18 2014-02-24 14:43:36 PST
Comment on attachment 225086 [details] remove isSessionIDSet() Clearing flags on attachment: 225086 Committed r164611: <http://trac.webkit.org/changeset/164611>
WebKit Commit Bot
Comment 19 2014-02-24 14:43:39 PST
All reviewed patches have been landed. Closing bug.
Alexey Proskuryakov
Comment 20 2014-02-25 12:36:41 PST
This broke an API test in debug builds: Note: Google Test filter = WebKit2.PrivateBrowsingPushStateNoHistoryCallback [==========] Running 1 test from 1 test case. [----------] Global test environment set-up. [----------] 1 test from WebKit2 [ RUN ] WebKit2.PrivateBrowsingPushStateNoHistoryCallback /Volumes/Data/slave/mavericks-debug/build/Tools/TestWebKitAPI/Tests/WebKit2/PrivateBrowsingPushStateNoHistoryCallback.cpp:39: Failure Failed /Volumes/Data/slave/mavericks-debug/build/Tools/TestWebKitAPI/Tests/WebKit2/PrivateBrowsingPushStateNoHistoryCallback.cpp:39: Failure Failed [ FAILED ] WebKit2.PrivateBrowsingPushStateNoHistoryCallback (144 ms) [----------] 1 test from WebKit2 (144 ms total)
Alexey Proskuryakov
Comment 21 2014-02-25 13:24:36 PST
Rolled out in <http://trac.webkit.org/r164669>, because this change broke WebKit2.PrivateBrowsingPushStateNoHistoryCallback API test, and Martin says that it will take time to fix.
Martin Hock
Comment 22 2014-02-25 14:20:05 PST
Created attachment 225184 [details] restore isSessionIDSet() We need the isSessionIDSet() method in order for WebKit2 to properly use its settings to override an unset SessionID. Normally, when retrieving the SessionID from Page using sessionID(), we want to replace it with a valid session ID. With this method restored, the broken test passes.
Martin Hock
Comment 23 2014-02-25 14:32:30 PST
Comment on attachment 225184 [details] restore isSessionIDSet() Need to fix pbxproj!
Martin Hock
Comment 24 2014-02-25 15:13:51 PST
Created attachment 225188 [details] fix pbxproj
WebKit Commit Bot
Comment 25 2014-02-25 21:44:06 PST
Comment on attachment 225188 [details] fix pbxproj Rejecting attachment 225188 [details] from commit-queue. Failed to run "['/Volumes/Data/EWS/WebKit/Tools/Scripts/webkit-patch', '--status-host=webkit-queues.appspot.com', '--bot-id=webkit-cq-02', 'apply-attachment', '--no-update', '--non-interactive', 225188, '--port=mac']" exit_code: 2 cwd: /Volumes/Data/EWS/WebKit Last 500 characters of output: ess/WebPage/WebPage.h Hunk #1 succeeded at 191 (offset 1 line). Hunk #2 succeeded at 918 (offset 2 lines). patching file Source/WebKit2/WebProcess/WebPage/WebPage.messages.in patching file Source/WebKit2/WebProcess/WebProcess.cpp patching file Source/WebKit2/WebProcess/WebProcess.h patching file Source/WebKit2/WebProcess/WebProcess.messages.in Failed to run "[u'/Volumes/Data/EWS/WebKit/Tools/Scripts/svn-apply', '--force', '--reviewer', u'Sam Weinig']" exit_code: 1 cwd: /Volumes/Data/EWS/WebKit Full output: http://webkit-queues.appspot.com/results/5129018839924736
Martin Hock
Comment 26 2014-02-26 10:20:27 PST
WebKit Commit Bot
Comment 27 2014-02-26 10:59:48 PST
Comment on attachment 225263 [details] rebase Clearing flags on attachment: 225263 Committed r164726: <http://trac.webkit.org/changeset/164726>
WebKit Commit Bot
Comment 28 2014-02-26 10:59:52 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.