Changeset 164398 in webkit


Ignore:
Timestamp:
Feb 19, 2014 3:43:05 PM (10 years ago)
Author:
oliver@apple.com
Message:

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:
Location:
trunk/Source/WebKit2
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r164388 r164398  
     12014-02-19  Oliver Hunt  <oliver@apple.com>
     2
     3        Add WK2 SPI to get bytecode profile from web process
     4        https://bugs.webkit.org/show_bug.cgi?id=129069
     5
     6        Reviewed by Anders Carlsson.
     7
     8        Simple patch to allow asynchronous fetching of the
     9        bytecode profiler output from the WebProcess.
     10
     11        * UIProcess/API/C/WKPage.cpp:
     12        (WKPageGetBytecodeProfile):
     13        * UIProcess/API/C/WKPagePrivate.h:
     14        * UIProcess/WebPageProxy.cpp:
     15        (WebKit::WebPageProxy::getBytecodeProfile):
     16        * UIProcess/WebPageProxy.h:
     17        * WebProcess/WebPage/WebPage.cpp:
     18        (WebKit::WebPage::getBytecodeProfile):
     19        * WebProcess/WebPage/WebPage.h:
     20        * WebProcess/WebPage/WebPage.messages.in:
     21
    1222014-02-19  Beth Dakin  <bdakin@apple.com>
    223
  • trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp

    r164271 r164398  
    15051505}
    15061506
     1507void WKPageGetBytecodeProfile(WKPageRef pageRef, void* context, WKPageGetBytecodeProfileFunction callback)
     1508{
     1509    toImpl(pageRef)->getBytecodeProfile(StringCallback::create(context, callback));
     1510}
     1511
    15071512void WKPageGetSelectionAsWebArchiveData(WKPageRef pageRef, void* context, WKPageGetSelectionAsWebArchiveDataFunction callback)
    15081513{
  • trunk/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h

    r159059 r164398  
    9191WK_EXPORT void WKPageSetMayStartMediaWhenInWindow(WKPageRef page, bool mayStartMedia);
    9292
     93typedef void (*WKPageGetBytecodeProfileFunction)(WKStringRef, WKErrorRef, void*);
     94WK_EXPORT void WKPageGetBytecodeProfile(WKPageRef page, void* context, WKPageGetBytecodeProfileFunction function);
     95   
    9396WK_EXPORT WKArrayRef WKPageCopyRelatedPages(WKPageRef page);
    9497
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp

    r164382 r164398  
    19751975}
    19761976
     1977void WebPageProxy::getBytecodeProfile(PassRefPtr<StringCallback> prpCallback)
     1978{
     1979    RefPtr<StringCallback> callback = prpCallback;
     1980    if (!isValid()) {
     1981        callback->invalidate();
     1982        return;
     1983    }
     1984   
     1985    uint64_t callbackID = callback->callbackID();
     1986    m_loadDependentStringCallbackIDs.add(callbackID);
     1987    m_stringCallbacks.set(callbackID, callback.get());
     1988    m_process->send(Messages::WebPage::GetBytecodeProfile(callbackID), m_pageID);
     1989}
     1990   
    19771991#if ENABLE(MHTML)
    19781992void WebPageProxy::getContentsAsMHTMLData(PassRefPtr<DataCallback> prpCallback, bool useBinaryEncoding)
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.h

    r164382 r164398  
    666666
    667667    void getContentsAsString(PassRefPtr<StringCallback>);
     668    void getBytecodeProfile(PassRefPtr<StringCallback>);
     669
    668670#if ENABLE(MHTML)
    669671    void getContentsAsMHTMLData(PassRefPtr<DataCallback>, bool useBinaryEncoding);
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp

    r164364 r164398  
    42424242}
    42434243
     4244void WebPage::getBytecodeProfile(uint64_t callbackID)
     4245{
     4246    ASSERT(JSDOMWindow::commonVM()->m_perBytecodeProfiler);
     4247    if (!JSDOMWindow::commonVM()->m_perBytecodeProfiler)
     4248        send(Messages::WebPageProxy::StringCallback(String(), callbackID));
     4249    String result = JSDOMWindow::commonVM()->m_perBytecodeProfiler->toJSON();
     4250    ASSERT(result.length());
     4251    send(Messages::WebPageProxy::StringCallback(result, callbackID));
     4252}
     4253
    42444254} // namespace WebKit
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h

    r164337 r164398  
    718718    PassRefPtr<WebCore::DocumentLoader> createDocumentLoader(WebCore::Frame&, const WebCore::ResourceRequest&, const WebCore::SubstituteData&);
    719719
     720    void getBytecodeProfile(uint64_t callbackID);
     721
    720722private:
    721723    WebPage(uint64_t pageID, const WebPageCreationParameters&);
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in

    r164358 r164398  
    326326
    327327    SetThumbnailScale(double scale)
     328
     329    GetBytecodeProfile(uint64_t callbackID)
     330
    328331}
Note: See TracChangeset for help on using the changeset viewer.