Bug 103846 - Add ObjC API for setting initialization data for the WKWebProcessPlugIn
Summary: Add ObjC API for setting initialization data for the WKWebProcessPlugIn
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Sam Weinig
Depends on:
Reported: 2012-12-02 16:48 PST by Sam Weinig
Modified: 2013-04-13 19:11 PDT (History)
0 users

See Also:

Patch (7.11 KB, patch)
2012-12-02 16:53 PST, Sam Weinig
no flags Details | Formatted Diff | Diff
Patch (7.12 KB, patch)
2012-12-02 16:58 PST, Sam Weinig
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sam Weinig 2012-12-02 16:48:21 PST
Add ObjC API for setting initialization data for the WKWebProcessPlugIn
Comment 1 Sam Weinig 2012-12-02 16:53:24 PST
Created attachment 177162 [details]
Comment 2 Sam Weinig 2012-12-02 16:58:27 PST
Created attachment 177163 [details]
Comment 3 Darin Adler 2012-12-03 09:58:20 PST
Comment on attachment 177163 [details]

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

> Source/WebKit2/UIProcess/API/mac/WKProcessGroup.mm:76
> +    if ([processGroup.delegate respondsToSelector:@selector(processGroupWillCreateConnectionToWebProcessPlugIn:)]) {

I suggest using early return here instead of nesting everything inside an if statement.

> Source/WebKit2/UIProcess/API/mac/WKProcessGroup.mm:78
> +        RetainPtr<id> initializationUserData = [processGroup.delegate processGroupWillCreateConnectionToWebProcessPlugIn:processGroup];
> +        RefPtr<WebKit::ObjCObjectGraph> wkMessageBody = WebKit::ObjCObjectGraph::create(initializationUserData.get());

I don’t think we need a RetainPtr for the return value from a method that is just passed on to another function and then dropped. I suggest either using the type "id" here instead, or not using a local variable at all.

Also, why is the message body called wkMessageBody instead of just body or messageBody?

> Source/WebKit2/UIProcess/API/mac/WKProcessGroup.mm:79
> +        return (WKTypeRef)wkMessageBody.release().leakRef();

Can we come up with some type checked cast for use in cases like this rather than using a straight C cast?

> Source/WebKit2/UIProcess/API/mac/WKProcessGroup.mm:85
> +static void setUpInectedBundleClient(WKProcessGroup *processGroup, WKContextRef contextRef)

Typo here: "inected".

> Source/WebKit2/WebProcess/InjectedBundle/mac/InjectedBundleMac.mm:114
> +        RetainPtr<id> objCInitializationUserData;
> +        if (initializationUserData && initializationUserData->type() == APIObject::TypeObjCObjectGraph)
> +            objCInitializationUserData = static_cast<ObjCObjectGraph*>(initializationUserData)->rootObject();
> +        [instance webProcessPlugIn:[WKWebProcessPlugInController _shared] initializeWithObject:objCInitializationUserData.get()];

Use of RetainPtr is OK here if the return type of rootObject is a RetainPtr. But if not, then I suggest just using "id" rather than "RetainPtr<id>".
Comment 4 Sam Weinig 2013-04-13 19:11:28 PDT
Committed r148376: <http://trac.webkit.org/changeset/148376>