Summary: | Add ObjC API for setting initialization data for the WKWebProcessPlugIn | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Sam Weinig <sam> | ||||||
Component: | New Bugs | Assignee: | Sam Weinig <sam> | ||||||
Status: | RESOLVED FIXED | ||||||||
Severity: | Normal | ||||||||
Priority: | P2 | ||||||||
Version: | 528+ (Nightly build) | ||||||||
Hardware: | Unspecified | ||||||||
OS: | Unspecified | ||||||||
Attachments: |
|
Description
Sam Weinig
2012-12-02 16:48:21 PST
Created attachment 177162 [details]
Patch
Created attachment 177163 [details]
Patch
Comment on attachment 177163 [details] Patch 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>". Committed r148376: <http://trac.webkit.org/changeset/148376> |