Diff
Modified: trunk/Source/WebKit2/ChangeLog (164397 => 164398)
--- trunk/Source/WebKit2/ChangeLog 2014-02-19 23:41:21 UTC (rev 164397)
+++ trunk/Source/WebKit2/ChangeLog 2014-02-19 23:43:05 UTC (rev 164398)
@@ -1,3 +1,24 @@
+2014-02-19 Oliver Hunt <[email protected]>
+
+ Add WK2 SPI to get bytecode profile from web process
+ https://bugs.webkit.org/show_bug.cgi?id=129069
+
+ Reviewed by Anders Carlsson.
+
+ Simple patch to allow asynchronous fetching of the
+ bytecode profiler output from the WebProcess.
+
+ * UIProcess/API/C/WKPage.cpp:
+ (WKPageGetBytecodeProfile):
+ * UIProcess/API/C/WKPagePrivate.h:
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::getBytecodeProfile):
+ * UIProcess/WebPageProxy.h:
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::getBytecodeProfile):
+ * WebProcess/WebPage/WebPage.h:
+ * WebProcess/WebPage/WebPage.messages.in:
+
2014-02-19 Beth Dakin <[email protected]>
Build fix.
Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp (164397 => 164398)
--- trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp 2014-02-19 23:41:21 UTC (rev 164397)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp 2014-02-19 23:43:05 UTC (rev 164398)
@@ -1504,6 +1504,11 @@
toImpl(pageRef)->getContentsAsString(StringCallback::create(context, callback));
}
+void WKPageGetBytecodeProfile(WKPageRef pageRef, void* context, WKPageGetBytecodeProfileFunction callback)
+{
+ toImpl(pageRef)->getBytecodeProfile(StringCallback::create(context, callback));
+}
+
void WKPageGetSelectionAsWebArchiveData(WKPageRef pageRef, void* context, WKPageGetSelectionAsWebArchiveDataFunction callback)
{
toImpl(pageRef)->getSelectionAsWebArchiveData(DataCallback::create(context, callback));
Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h (164397 => 164398)
--- trunk/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h 2014-02-19 23:41:21 UTC (rev 164397)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h 2014-02-19 23:43:05 UTC (rev 164398)
@@ -90,6 +90,9 @@
WK_EXPORT void WKPageSetMediaVolume(WKPageRef page, float volume);
WK_EXPORT void WKPageSetMayStartMediaWhenInWindow(WKPageRef page, bool mayStartMedia);
+typedef void (*WKPageGetBytecodeProfileFunction)(WKStringRef, WKErrorRef, void*);
+WK_EXPORT void WKPageGetBytecodeProfile(WKPageRef page, void* context, WKPageGetBytecodeProfileFunction function);
+
WK_EXPORT WKArrayRef WKPageCopyRelatedPages(WKPageRef page);
typedef void (*WKPageInvalidMessageFunction)(uint32_t messageID);
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (164397 => 164398)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2014-02-19 23:41:21 UTC (rev 164397)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2014-02-19 23:43:05 UTC (rev 164398)
@@ -1974,6 +1974,20 @@
m_process->send(Messages::WebPage::GetContentsAsString(callbackID), m_pageID);
}
+void WebPageProxy::getBytecodeProfile(PassRefPtr<StringCallback> prpCallback)
+{
+ RefPtr<StringCallback> callback = prpCallback;
+ if (!isValid()) {
+ callback->invalidate();
+ return;
+ }
+
+ uint64_t callbackID = callback->callbackID();
+ m_loadDependentStringCallbackIDs.add(callbackID);
+ m_stringCallbacks.set(callbackID, callback.get());
+ m_process->send(Messages::WebPage::GetBytecodeProfile(callbackID), m_pageID);
+}
+
#if ENABLE(MHTML)
void WebPageProxy::getContentsAsMHTMLData(PassRefPtr<DataCallback> prpCallback, bool useBinaryEncoding)
{
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (164397 => 164398)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2014-02-19 23:41:21 UTC (rev 164397)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2014-02-19 23:43:05 UTC (rev 164398)
@@ -665,6 +665,8 @@
void didFindStringMatches(const String&, Vector<Vector<WebCore::IntRect>> matchRects, int32_t firstIndexAfterSelection);
void getContentsAsString(PassRefPtr<StringCallback>);
+ void getBytecodeProfile(PassRefPtr<StringCallback>);
+
#if ENABLE(MHTML)
void getContentsAsMHTMLData(PassRefPtr<DataCallback>, bool useBinaryEncoding);
#endif
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (164397 => 164398)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2014-02-19 23:41:21 UTC (rev 164397)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2014-02-19 23:43:05 UTC (rev 164398)
@@ -4241,4 +4241,14 @@
drawingArea()->setTransform(transform);
}
+void WebPage::getBytecodeProfile(uint64_t callbackID)
+{
+ ASSERT(JSDOMWindow::commonVM()->m_perBytecodeProfiler);
+ if (!JSDOMWindow::commonVM()->m_perBytecodeProfiler)
+ send(Messages::WebPageProxy::StringCallback(String(), callbackID));
+ String result = JSDOMWindow::commonVM()->m_perBytecodeProfiler->toJSON();
+ ASSERT(result.length());
+ send(Messages::WebPageProxy::StringCallback(result, callbackID));
+}
+
} // namespace WebKit
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (164397 => 164398)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h 2014-02-19 23:41:21 UTC (rev 164397)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h 2014-02-19 23:43:05 UTC (rev 164398)
@@ -717,6 +717,8 @@
PassRefPtr<WebCore::DocumentLoader> createDocumentLoader(WebCore::Frame&, const WebCore::ResourceRequest&, const WebCore::SubstituteData&);
+ void getBytecodeProfile(uint64_t callbackID);
+
private:
WebPage(uint64_t pageID, const WebPageCreationParameters&);
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in (164397 => 164398)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in 2014-02-19 23:41:21 UTC (rev 164397)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in 2014-02-19 23:43:05 UTC (rev 164398)
@@ -325,4 +325,7 @@
SetScrollPinningBehavior(uint32_t pinning)
SetThumbnailScale(double scale)
+
+ GetBytecodeProfile(uint64_t callbackID)
+
}