Add callback mechanism for the getting the source of a frame
<rdar://problem/8364681>
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.
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 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?
(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.
Fixed in r67311.