Bug 105364 - Notify context client of change to table, and allow client to get a copy of it
Summary: Notify context client of change to table, and allow client to get a copy of it
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac OS X 10.8
: P2 Normal
Assignee: Jon Lee
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2012-12-18 16:26 PST by Jon Lee
Modified: 2012-12-19 12:03 PST (History)
5 users (show)

See Also:


Attachments
Patch (8.89 KB, patch)
2012-12-19 00:37 PST, Jon Lee
beidson: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jon Lee 2012-12-18 16:26:42 PST
When a new origin hash is added, notify the context client of the change. The client can then request from the context a copy of the table for its own record keeping, such as saving to disk.
Comment 1 Radar WebKit Bug Importer 2012-12-18 16:27:02 PST
<rdar://problem/12906267>
Comment 2 Jon Lee 2012-12-19 00:37:55 PST
Created attachment 180108 [details]
Patch
Comment 3 Brady Eidson 2012-12-19 11:24:36 PST
Comment on attachment 180108 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=180108&action=review

> Source/WebKit2/UIProcess/Plugins/PlugInAutoStartProvider.cpp:55
>      m_context->sendToAllProcesses(Messages::WebProcess::DidAddPlugInAutoStartOrigin(plugInOriginHash));
> +    m_context->client().plugInAutoStartOriginHashesChanged(m_context);
>  }

Is it expected that a client will always call WKContextCopyPlugInAutoStartOriginHashes in response to this client callback?

If so, we should just pass the new hashes along with it.

And - if so - we might not even need the autoStartOriginsTableCopy accessor at all.

> Source/WebKit2/UIProcess/Plugins/PlugInAutoStartProvider.cpp:69
> +    ImmutableDictionary::MapType map;
> +    AutoStartTable::const_iterator itEnd = m_autoStartTable.end();
> +    for (AutoStartTable::const_iterator it = m_autoStartTable.begin(); it != itEnd; ++it) {
> +        Vector<RefPtr<APIObject> > hashes;

Just call itEnd "end", please.  That's what we do everywhere else.

> Source/WebKit2/UIProcess/Plugins/PlugInAutoStartProvider.cpp:71
> +        HashSet<unsigned>::iterator valueItEnd = it->value.end();
> +        for (HashSet<unsigned>::iterator valueIt = it->value.begin(); valueIt != valueItEnd; ++valueIt)

And "valueItEnd" should just be "valueEnd"
Comment 4 Jon Lee 2012-12-19 11:29:47 PST
Comment on attachment 180108 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=180108&action=review

>> Source/WebKit2/UIProcess/Plugins/PlugInAutoStartProvider.cpp:55
>>  }
> 
> Is it expected that a client will always call WKContextCopyPlugInAutoStartOriginHashes in response to this client callback?
> 
> If so, we should just pass the new hashes along with it.
> 
> And - if so - we might not even need the autoStartOriginsTableCopy accessor at all.

No. The client may choose to aggregate these callbacks, and only invoke WKContextCopyPlugInAutoStartOriginHashes periodically.

>> Source/WebKit2/UIProcess/Plugins/PlugInAutoStartProvider.cpp:69
>> +        Vector<RefPtr<APIObject> > hashes;
> 
> Just call itEnd "end", please.  That's what we do everywhere else.

Done.

>> Source/WebKit2/UIProcess/Plugins/PlugInAutoStartProvider.cpp:71
>> +        for (HashSet<unsigned>::iterator valueIt = it->value.begin(); valueIt != valueItEnd; ++valueIt)
> 
> And "valueItEnd" should just be "valueEnd"

Done.
Comment 5 Brady Eidson 2012-12-19 11:34:13 PST
Comment on attachment 180108 [details]
Patch

r+ assuming Jon made the changes he said he made.
Comment 6 Jon Lee 2012-12-19 12:03:04 PST
Committed r138185: <http://trac.webkit.org/changeset/138185>