Bug 45604 - Add callback mechanism for the getting the source of a frame
Summary: Add callback mechanism for the getting the source of a frame
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2010-09-11 17:55 PDT by Sam Weinig
Modified: 2010-09-11 18:18 PDT (History)
1 user (show)

See Also:


Attachments
Patch (21.60 KB, patch)
2010-09-11 18:02 PDT, Sam Weinig
mitz: 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 2010-09-11 17:55:51 PDT
Add callback mechanism for the getting the source of a frame
Comment 1 Sam Weinig 2010-09-11 17:56:43 PDT
<rdar://problem/8364681>
Comment 2 Sam Weinig 2010-09-11 18:02:18 PDT
Created attachment 67321 [details]
Patch

In addition to this approach, we may want the ability to tell WebKit to open up a new WKView with  the source thus avoiding two potential copies of the source over the wire.
Comment 3 WebKit Review Bot 2010-09-11 18:03:22 PDT
Attachment 67321 [details] did not pass style-queue:

Failed to run "['WebKitTools/Scripts/check-webkit-style']" exit_code: 1
WebKit2/UIProcess/API/C/WKPage.cpp:260:  WKPageGetSourceForFrame_b is incorrectly named. Don't use underscores in your identifier names.  [readability/naming] [4]
Total errors found: 1 in 15 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 4 mitz 2010-09-11 18:13:16 PDT
Comment on attachment 67321 [details]
Patch

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

> WebKit2/UIProcess/WebPageProxy.cpp:1177
> +    Vector<RefPtr<FrameSourceCallback> > frameSourceCallbacks;
> +    copyValuesToVector(m_frameSourceCallbacks, frameSourceCallbacks);
> +    m_frameSourceCallbacks.clear();
> +    for (size_t i = 0, size = frameSourceCallbacks.size(); i < size; ++i)
> +        frameSourceCallbacks[i]->invalidate();
> +
Consider factoring common code out of processDidExit() and close().

> WebKit2/UIProcess/WebPageProxy.h:82
>  typedef GenericCallback<WKStringRef, WTF::StringImpl*> RenderTreeExternalRepresentationCallback;
>  typedef GenericCallback<WKStringRef, WTF::StringImpl*> ScriptReturnValueCallback;
> +typedef GenericCallback<WKStringRef, WTF::StringImpl*> FrameSourceCallback;
>  
Maybe keep these sorted?

> WebKit2/UIProcess/WebPageProxy.h:243
>  
>      void didReceiveEvent(WebEvent::Type);
> +
>      void didRunJavaScriptInMainFrame(const WTF::String&, uint64_t);
Why the new newline?
Comment 5 Sam Weinig 2010-09-11 18:16:15 PDT
(In reply to comment #4)
> (From update of attachment 67321 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=67321&action=prettypatch
> 
> > WebKit2/UIProcess/WebPageProxy.cpp:1177
> > +    Vector<RefPtr<FrameSourceCallback> > frameSourceCallbacks;
> > +    copyValuesToVector(m_frameSourceCallbacks, frameSourceCallbacks);
> > +    m_frameSourceCallbacks.clear();
> > +    for (size_t i = 0, size = frameSourceCallbacks.size(); i < size; ++i)
> > +        frameSourceCallbacks[i]->invalidate();
> > +
> Consider factoring common code out of processDidExit() and close().

Considered, but not doing it in this patch.

> > WebKit2/UIProcess/WebPageProxy.h:82
> >  typedef GenericCallback<WKStringRef, WTF::StringImpl*> RenderTreeExternalRepresentationCallback;
> >  typedef GenericCallback<WKStringRef, WTF::StringImpl*> ScriptReturnValueCallback;
> > +typedef GenericCallback<WKStringRef, WTF::StringImpl*> FrameSourceCallback;
> >  
> Maybe keep these sorted?

Ok.

> 
> > WebKit2/UIProcess/WebPageProxy.h:243
> >  
> >      void didReceiveEvent(WebEvent::Type);
> > +
> >      void didRunJavaScriptInMainFrame(const WTF::String&, uint64_t);
> Why the new newline?

Paragraphing.
Comment 6 Sam Weinig 2010-09-11 18:18:08 PDT
Fixed in r67311.