Changeset 164451 in webkit


Ignore:
Timestamp:
Feb 20, 2014, 3:11:52 PM (11 years ago)
Author:
dino@apple.com
Message:

Add an unresolved WebGLPolicy and an API to resolve it
https://bugs.webkit.org/show_bug.cgi?id=129109

Reviewed by Anders Carlsson.

Source/WebCore:

Add a third WebGLLoadPolicy which is "pending" allowing the page
to go ahead with creating the WebGLRenderingContext and resolve the policy
at a later time. Add a new API resolveWebGLLoadPolicy to do the resolution.

  • html/HTMLCanvasElement.cpp:

(WebCore::HTMLCanvasElement::getContext): WebGLBlock -> WebGLBlockCreation

  • loader/FrameLoaderClient.h:

(WebCore::FrameLoaderClient::webGLPolicyForURL): WebGLAllow -> WebGLAllowCreation.
(WebCore::FrameLoaderClient::resolveWebGLPolicyForURL): New method.

  • loader/FrameLoaderTypes.h: Add WebGLPendingCreation.

Source/WebKit2:

Add a third WebGLLoadPolicy which is "pending" allowing the page
to go ahead with creating the WebGLRenderingContext and resolve the policy
at a later time. Add a new API resolveWebGLLoadPolicy to do the resolution.

  • UIProcess/API/APILoaderClient.h:

(API::LoaderClient::webGLLoadPolicy): New return value.
(API::LoaderClient::resolveWebGLLoadPolicy): New method definition.

  • UIProcess/API/C/WKAPICast.h:

(WebKit::toWebGLLoadPolicy): Change names of return types.

  • UIProcess/API/C/WKPage.cpp:

(WKPageSetPageLoaderClient): New stubs.

  • UIProcess/API/C/WKPageLoaderClient.h: New policy type kWKWebGLLoadPolicyPending.
  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::resolveWebGLPolicyForURL): New method.

  • UIProcess/WebPageProxy.h:
  • UIProcess/WebPageProxy.messages.in: New message.
  • WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:

(WebKit::WebFrameLoaderClient::webGLPolicyForURL):
(WebKit::WebFrameLoaderClient::resolveWebGLPolicyForURL):

  • WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::webGLPolicyForURL):
(WebKit::WebPage::resolveWebGLPolicyForURL):

  • WebProcess/WebPage/WebPage.h:

Tools:

Add a new entry for resolveWebGLLoadPolicy.

  • WebKitTestRunner/TestController.cpp:

(WTR::TestController::createWebViewWithOptions):

Location:
trunk
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r164449 r164451  
     12014-02-20  Dean Jackson  <dino@apple.com>
     2
     3        Add an unresolved WebGLPolicy and an API to resolve it
     4        https://bugs.webkit.org/show_bug.cgi?id=129109
     5
     6        Reviewed by Anders Carlsson.
     7
     8        Add a third WebGLLoadPolicy which is "pending" allowing the page
     9        to go ahead with creating the WebGLRenderingContext and resolve the policy
     10        at a later time. Add a new API resolveWebGLLoadPolicy to do the resolution.
     11
     12        * html/HTMLCanvasElement.cpp:
     13        (WebCore::HTMLCanvasElement::getContext): WebGLBlock -> WebGLBlockCreation
     14        * loader/FrameLoaderClient.h:
     15        (WebCore::FrameLoaderClient::webGLPolicyForURL): WebGLAllow -> WebGLAllowCreation.
     16        (WebCore::FrameLoaderClient::resolveWebGLPolicyForURL): New method.
     17        * loader/FrameLoaderTypes.h: Add WebGLPendingCreation.
     18
    1192014-02-20  Zalan Bujtas  <zalan@apple.com>
    220
  • trunk/Source/WebCore/html/HTMLCanvasElement.cpp

    r164131 r164451  
    227227                    WebGLLoadPolicy policy = page->mainFrame().loader().client().webGLPolicyForURL(topDocument.url());
    228228
    229                     if (policy == WebGLBlock)
     229                    if (policy == WebGLBlockCreation)
    230230                        return nullptr;
    231231                }
  • trunk/Source/WebCore/loader/FrameLoaderClient.h

    r164192 r164451  
    326326        // notification with the given GL_ARB_robustness guilt/innocence code (see Extensions3D.h).
    327327        virtual void didLoseWebGLContext(int) { }
    328         virtual WebGLLoadPolicy webGLPolicyForURL(const String&) const { return WebGLAllow; }
     328        virtual WebGLLoadPolicy webGLPolicyForURL(const String&) const { return WebGLAllowCreation; }
     329        virtual WebGLLoadPolicy resolveWebGLPolicyForURL(const String&) const { return WebGLAllowCreation; }
    329330#endif
    330331
  • trunk/Source/WebCore/loader/FrameLoaderTypes.h

    r162912 r164451  
    108108   
    109109    enum WebGLLoadPolicy {
    110         WebGLBlock = 0,
    111         WebGLAllow
     110        WebGLBlockCreation,
     111        WebGLAllowCreation,
     112        WebGLPendingCreation
    112113    };
    113114
  • trunk/Source/WebKit2/ChangeLog

    r164450 r164451  
     12014-02-20  Dean Jackson  <dino@apple.com>
     2
     3        Add an unresolved WebGLPolicy and an API to resolve it
     4        https://bugs.webkit.org/show_bug.cgi?id=129109
     5
     6        Reviewed by Anders Carlsson.
     7
     8        Add a third WebGLLoadPolicy which is "pending" allowing the page
     9        to go ahead with creating the WebGLRenderingContext and resolve the policy
     10        at a later time. Add a new API resolveWebGLLoadPolicy to do the resolution.
     11
     12        * UIProcess/API/APILoaderClient.h:
     13        (API::LoaderClient::webGLLoadPolicy): New return value.
     14        (API::LoaderClient::resolveWebGLLoadPolicy): New method definition.
     15        * UIProcess/API/C/WKAPICast.h:
     16        (WebKit::toWebGLLoadPolicy): Change names of return types.
     17        * UIProcess/API/C/WKPage.cpp:
     18        (WKPageSetPageLoaderClient): New stubs.
     19        * UIProcess/API/C/WKPageLoaderClient.h: New policy type kWKWebGLLoadPolicyPending.
     20        * UIProcess/WebPageProxy.cpp:
     21        (WebKit::WebPageProxy::resolveWebGLPolicyForURL): New method.
     22        * UIProcess/WebPageProxy.h:
     23        * UIProcess/WebPageProxy.messages.in: New message.
     24        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
     25        (WebKit::WebFrameLoaderClient::webGLPolicyForURL):
     26        (WebKit::WebFrameLoaderClient::resolveWebGLPolicyForURL):
     27        * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
     28        * WebProcess/WebPage/WebPage.cpp:
     29        (WebKit::WebPage::webGLPolicyForURL):
     30        (WebKit::WebPage::resolveWebGLPolicyForURL):
     31        * WebProcess/WebPage/WebPage.h:
     32
    1332014-02-20  Anders Carlsson  <andersca@apple.com>
    234
  • trunk/Source/WebKit2/UIProcess/API/APILoaderClient.h

    r164132 r164451  
    9898
    9999#if ENABLE(WEBGL)
    100     virtual WebCore::WebGLLoadPolicy webGLLoadPolicy(WebKit::WebPageProxy*, const WTF::String&) const { return WebCore::WebGLLoadPolicy::WebGLAllow; }
     100    virtual WebCore::WebGLLoadPolicy webGLLoadPolicy(WebKit::WebPageProxy*, const WTF::String&) const { return WebCore::WebGLLoadPolicy::WebGLAllowCreation; }
     101    virtual WebCore::WebGLLoadPolicy resolveWebGLLoadPolicy(WebKit::WebPageProxy*, const WTF::String&) const { return WebCore::WebGLLoadPolicy::WebGLAllowCreation; }
    101102#endif // ENABLE(WEBGL)
    102103};
  • trunk/Source/WebKit2/UIProcess/API/C/WKAPICast.h

    r162912 r164451  
    482482    switch (webGLLoadPolicy) {
    483483    case kWKWebGLLoadPolicyLoadNormally:
    484         return WebCore::WebGLAllow;
     484        return WebCore::WebGLAllowCreation;
    485485    case kWKWebGLLoadPolicyBlocked:
    486         return WebCore::WebGLBlock;
    487     }
    488    
    489     ASSERT_NOT_REACHED();
    490     return WebCore::WebGLAllow;
     486        return WebCore::WebGLBlockCreation;
     487    case kWKWebGLLoadPolicyPending:
     488        return WebCore::WebGLPendingCreation;
     489    }
     490   
     491    ASSERT_NOT_REACHED();
     492    return WebCore::WebGLAllowCreation;
    491493}
    492494
  • trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp

    r164450 r164451  
    968968        virtual WebCore::WebGLLoadPolicy webGLLoadPolicy(WebPageProxy* page, const String& url) const override
    969969        {
    970             WebCore::WebGLLoadPolicy loadPolicy = WebGLAllow;
     970            WebCore::WebGLLoadPolicy loadPolicy = WebGLAllowCreation;
    971971
    972972            if (m_client.webGLLoadPolicy)
     
    975975            return loadPolicy;
    976976        }
     977
     978        virtual WebCore::WebGLLoadPolicy resolveWebGLLoadPolicy(WebPageProxy* page, const String& url) const override
     979        {
     980            WebCore::WebGLLoadPolicy loadPolicy = WebGLAllowCreation;
     981
     982            if (m_client.resolveWebGLLoadPolicy)
     983                loadPolicy = toWebGLLoadPolicy(m_client.resolveWebGLLoadPolicy(toAPI(page), toAPI(url.impl()), m_client.base.clientInfo));
     984
     985            return loadPolicy;
     986        }
     987
    977988#endif // ENABLE(WEBGL)
    978989    };
  • trunk/Source/WebKit2/UIProcess/API/C/WKPageLoaderClient.h

    r162912 r164451  
    4646    kWKWebGLLoadPolicyBlocked = 0,
    4747    kWKWebGLLoadPolicyLoadNormally,
     48    kWKWebGLLoadPolicyPending
    4849};
    4950typedef uint32_t WKWebGLLoadPolicy;
     
    331332    // Version 4
    332333    WKPageWebGLLoadPolicyCallback                                       webGLLoadPolicy;
     334    WKPageWebGLLoadPolicyCallback                                       resolveWebGLLoadPolicy;
    333335} WKPageLoaderClientV4;
    334336
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp

    r164450 r164451  
    27522752    loadPolicy = static_cast<uint32_t>(m_loaderClient->webGLLoadPolicy(this, url));
    27532753}
     2754
     2755void WebPageProxy::resolveWebGLPolicyForURL(const String& url, uint32_t& loadPolicy)
     2756{
     2757    loadPolicy = static_cast<uint32_t>(m_loaderClient->resolveWebGLLoadPolicy(this, url));
     2758}
    27542759#endif // ENABLE(WEBGL)
    27552760
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.h

    r164450 r164451  
    968968#if ENABLE(WEBGL)
    969969    void webGLPolicyForURL(const String& url, uint32_t& loadPolicy);
     970    void resolveWebGLPolicyForURL(const String& url, uint32_t& loadPolicy);
    970971#endif // ENABLE(WEBGL)
    971972    void setToolbarsAreVisible(bool toolbarsAreVisible);
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in

    r164450 r164451  
    3636#if ENABLE(WEBGL)
    3737    WebGLPolicyForURL(String url) -> (uint32_t loadPolicy)
     38    ResolveWebGLPolicyForURL(String url) -> (uint32_t loadPolicy)
    3839#endif // ENABLE(WEBGL)
    3940    DidChangeViewportProperties(WebCore::ViewportAttributes attributes)
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp

    r164192 r164451  
    13491349        return webPage->webGLPolicyForURL(m_frame, url);
    13501350
    1351     return WebGLAllow;
     1351    return WebGLAllowCreation;
     1352}
     1353
     1354WebCore::WebGLLoadPolicy WebFrameLoaderClient::resolveWebGLPolicyForURL(const String& url) const
     1355{
     1356    if (WebPage* webPage = m_frame->page())
     1357        return webPage->resolveWebGLPolicyForURL(m_frame, url);
     1358
     1359    return WebGLAllowCreation;
    13521360}
    13531361#endif // ENABLE(WEBGL)
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h

    r164192 r164451  
    188188#if ENABLE(WEBGL)
    189189    virtual WebCore::WebGLLoadPolicy webGLPolicyForURL(const String&) const override;
     190    virtual WebCore::WebGLLoadPolicy resolveWebGLPolicyForURL(const String&) const override;
    190191#endif // ENABLE(WEBGL)
    191192
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp

    r164398 r164451  
    621621        return static_cast<WebGLLoadPolicy>(policyResult);
    622622
    623     return WebGLAllow;
     623    return WebGLAllowCreation;
     624}
     625
     626WebCore::WebGLLoadPolicy WebPage::resolveWebGLPolicyForURL(WebFrame* frame, const String& url)
     627{
     628    uint32_t policyResult = 0;
     629
     630    if (sendSync(Messages::WebPageProxy::ResolveWebGLPolicyForURL(url), Messages::WebPageProxy::ResolveWebGLPolicyForURL::Reply(policyResult)))
     631        return static_cast<WebGLLoadPolicy>(policyResult);
     632
     633    return WebGLAllowCreation;
    624634}
    625635#endif // ENABLE(WEBGL)
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h

    r164398 r164451  
    307307#if ENABLE(WEBGL)
    308308    WebCore::WebGLLoadPolicy webGLPolicyForURL(WebFrame*, const String&);
     309    WebCore::WebGLLoadPolicy resolveWebGLPolicyForURL(WebFrame*, const String&);
    309310#endif // ENABLE(WEBGL)
    310311   
  • trunk/Tools/ChangeLog

    r164379 r164451  
     12014-02-20  Dean Jackson  <dino@apple.com>
     2
     3        Add an unresolved WebGLPolicy and an API to resolve it
     4        https://bugs.webkit.org/show_bug.cgi?id=129109
     5
     6        Reviewed by Anders Carlsson.
     7
     8        Add a new entry for resolveWebGLLoadPolicy.
     9
     10        * WebKitTestRunner/TestController.cpp:
     11        (WTR::TestController::createWebViewWithOptions):
     12
    1132014-02-19  Gustavo Noronha Silva  <gustavo.noronha@collabora.com>
    214
  • trunk/Tools/WebKitTestRunner/TestController.cpp

    r164295 r164451  
    477477        pluginLoadPolicy, // pluginLoadPolicy
    478478        0, // webGLLoadPolicy
     479        0, // resolveWebGLLoadPolicy
    479480    };
    480481    WKPageSetPageLoaderClient(m_mainWebView->page(), &pageLoaderClient.base);
Note: See TracChangeset for help on using the changeset viewer.