Currently, WebContext counts how many times API for enabling/disabling private browsing was called. This is unnecessarily roundabout - we can watch actual WebPreferences objects instead. <rdar://problem/13078036>
Created attachment 205844 [details] proposed patch
Attachment 205844 [details] did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebKit2/ChangeLog', u'Source/WebKit2/UIProcess/API/C/WKPreferences.cpp', u'Source/WebKit2/UIProcess/WebContext.cpp', u'Source/WebKit2/UIProcess/WebContext.h', u'Source/WebKit2/UIProcess/WebPreferences.cpp', u'Source/WebKit2/UIProcess/WebPreferences.h', u'Source/WebKit2/WebProcess/WebPage/WebPage.cpp']" exit_code: 1 Source/WebKit2/UIProcess/WebContext.cpp:53: Alphabetical sorting problem. [build/include_order] [4] Total errors found: 1 in 5 files If any of these errors are false positives, please file a bug against check-webkit-style.
Comment on attachment 205844 [details] proposed patch View in context: https://bugs.webkit.org/attachment.cgi?id=205844&action=review > Source/WebKit2/ChangeLog:17 > + API was called, rely on WebPrefences tracking. typo WebPreferences* > Source/WebKit2/ChangeLog:36 > + WebContext to know when any page groups are in provate brosing mode. provate brosing!!! > Source/WebKit2/UIProcess/WebPreferences.cpp:67 > + if (privateBrowsingEnabled()) { > + if (!privateBrowsingPageGroupCount++) > + WebContext::willStartUsingPrivateBrowsing(); > + } I think doing a compare with the postincrement makes this less readable than: if (privateBrowsingEnabled()) { if (!privateBrowsingPageGroupCount) WebContext::willStartUsingPrivateBrowsing(); ++privateBrowsingPageGroupCount; } > Source/WebKit2/UIProcess/WebPreferences.cpp:76 > + if (privateBrowsingEnabled()) { > + if (!--privateBrowsingPageGroupCount) > + WebContext::willStopUsingPrivateBrowsing(); > + } I think doing a compare with the preincrement makes this less readable than: if (privateBrowsingEnabled()) { --privateBrowsingPageGroupCount; if (!privateBrowsingPageGroupCount) WebContext::willStopUsingPrivateBrowsing(); }
Committed <http://trac.webkit.org/changeset/152273>. In addition to addressing review feedback, made one more change - in WebPreferences::addPageGroup and WebPreferences::removePageGroup, I check that the group is actually added or removed.