Bug 118266 - [WK2] Clean up private browsing session tracking
Summary: [WK2] Clean up private browsing session tracking
Alias: None
Product: WebKit
Classification: Unclassified
Component: Page Loading (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Alexey Proskuryakov
Keywords: InRadar
Depends on:
Reported: 2013-07-01 16:08 PDT by Alexey Proskuryakov
Modified: 2013-07-01 17:10 PDT (History)
1 user (show)

See Also:

proposed patch (12.41 KB, patch)
2013-07-01 16:47 PDT, Alexey Proskuryakov
beidson: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexey Proskuryakov 2013-07-01 16:08:33 PDT
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.

Comment 1 Alexey Proskuryakov 2013-07-01 16:47:43 PDT
Created attachment 205844 [details]
proposed patch
Comment 2 WebKit Commit Bot 2013-07-01 16:50:25 PDT
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 3 Brady Eidson 2013-07-01 17:01:14 PDT
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)

> 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()) {
    if (!privateBrowsingPageGroupCount)
Comment 4 Alexey Proskuryakov 2013-07-01 17:10:25 PDT
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.