Changeset 106371 in webkit


Ignore:
Timestamp:
Jan 31, 2012 11:11:54 AM (12 years ago)
Author:
piman@chromium.org
Message:

Merge WebGraphicsContext3D creation and initialization, and move it to
WebViewClient.
https://bugs.webkit.org/show_bug.cgi?id=76593

Reviewed by Darin Fisher.

Source/WebKit/chromium:

  • public/WebViewClient.h:

(WebKit::WebViewClient::createGraphicsContext3D):

  • public/platform/WebGraphicsContext3D.h:

(WebKit::WebGraphicsContext3D::initialize):

  • public/platform/WebKitPlatformSupport.h:
  • src/GraphicsContext3DChromium.cpp:

Tools:

  • DumpRenderTree/chromium/TestWebPlugin.cpp:

(TestWebPlugin::TestWebPlugin):
(TestWebPlugin::initialize):

  • DumpRenderTree/chromium/TestWebPlugin.h:
  • DumpRenderTree/chromium/WebViewHost.cpp:

(WebViewHost::createGraphicsContext3D):
(WebViewHost::createPlugin):

  • DumpRenderTree/chromium/WebViewHost.h:
Location:
trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/chromium/ChangeLog

    r106353 r106371  
     12012-01-31  Antoine Labour  <piman@chromium.org>
     2
     3        Merge WebGraphicsContext3D creation and initialization, and move it to
     4        WebViewClient.
     5        https://bugs.webkit.org/show_bug.cgi?id=76593
     6
     7        Reviewed by Darin Fisher.
     8
     9        * public/WebViewClient.h:
     10        (WebKit::WebViewClient::createGraphicsContext3D):
     11        * public/platform/WebGraphicsContext3D.h:
     12        (WebKit::WebGraphicsContext3D::initialize):
     13        * public/platform/WebKitPlatformSupport.h:
     14        * src/GraphicsContext3DChromium.cpp:
     15
    1162012-01-26  Hans Wennborg  <hans@chromium.org>
    217
  • trunk/Source/WebKit/chromium/public/WebViewClient.h

    r103215 r106371  
    4343#include "WebWidgetClient.h"
    4444#include "platform/WebColor.h"
     45#include "platform/WebGraphicsContext3D.h"
    4546#include "platform/WebString.h"
    4647
     
    110111    virtual WebStorageNamespace* createSessionStorageNamespace(unsigned quota) { return 0; }
    111112
     113    // Creates a graphics context associated with the client's WebView.
     114    // renderDirectlyToWebView means whether the context should be setup to
     115    // render directly to the WebView (e.g. compositor context), or to an
     116    // offscreen surface (e.g. WebGL context).
     117    virtual WebGraphicsContext3D* createGraphicsContext3D(const WebGraphicsContext3D::Attributes&, bool renderDirectlyToWebView) { return 0; }
     118
    112119    // Misc ----------------------------------------------------------------
    113120
  • trunk/Source/WebKit/chromium/public/platform/WebGraphicsContext3D.h

    r106320 r106371  
    134134    virtual ~WebGraphicsContext3D() {}
    135135
    136     // Initializes the graphics context; should be the first operation performed
    137     // on newly-constructed instances. Returns true on success.
    138     virtual bool initialize(Attributes, WebView*, bool renderDirectlyToWebView) = 0;
     136    // This function is deprecated and will be removed soon.
     137    virtual bool initialize(Attributes, WebView*, bool renderDirectlyToWebView) { return false; }
    139138
    140139    // Makes the OpenGL context current on the current thread. Returns true on
  • trunk/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h

    r101335 r106371  
    3737#include "WebData.h"
    3838#include "WebGamepads.h"
     39#include "WebGraphicsContext3D.h"
    3940#include "WebLocalizedString.h"
    4041#include "WebSerializedScriptValue.h"
     
    314315    virtual void callOnMainThread(void (*func)(void*), void* context) { }
    315316
    316     // WebGL --------------------------------------------------------------
    317 
    318     // May return null if WebGL is not supported.
    319     // Returns newly allocated WebGraphicsContext3D instance.
    320     virtual WebGraphicsContext3D* createGraphicsContext3D() { return 0; }
     317    // GPU ----------------------------------------------------------------
     318    //
     319    // May return null if GPU is not supported.
     320    // Returns newly allocated and initialized offscreen WebGraphicsContext3D instance.
     321    virtual WebGraphicsContext3D* createOffscreenGraphicsContext3D(const WebGraphicsContext3D::Attributes&) { return 0; }
    321322
    322323    // Audio --------------------------------------------------------------
  • trunk/Source/WebKit/chromium/src/GraphicsContext3DChromium.cpp

    r106320 r106371  
    4747#include "ImageData.h"
    4848#include "WebKit.h"
    49 #include "platform/WebKitPlatformSupport.h"
     49#include "WebViewClient.h"
    5050#include "WebViewImpl.h"
    5151#include "platform/WebGraphicsContext3D.h"
     52#include "platform/WebKitPlatformSupport.h"
    5253
    5354#include <stdio.h>
     
    152153    webAttributes.shareResources = attrs.shareResources;
    153154    webAttributes.forUseOnAnotherThread = threadUsage == GraphicsContext3DPrivate::ForUseOnAnotherThread;
    154     OwnPtr<WebKit::WebGraphicsContext3D> webContext = adoptPtr(WebKit::webKitPlatformSupport()->createGraphicsContext3D());
    155     if (!webContext)
    156         return 0;
    157155
    158156    Chrome* chrome = static_cast<Chrome*>(hostWindow);
    159157    WebKit::WebViewImpl* webViewImpl = chrome ? static_cast<WebKit::WebViewImpl*>(chrome->client()->webView()) : 0;
    160 
    161     if (!webContext->initialize(webAttributes, webViewImpl, renderDirectlyToHostWindow))
     158    OwnPtr<WebKit::WebGraphicsContext3D> webContext;
     159    if (!webViewImpl || !webViewImpl->client()) {
     160        if (renderDirectlyToHostWindow)
     161            return 0;
     162        webContext = adoptPtr(WebKit::webKitPlatformSupport()->createOffscreenGraphicsContext3D(webAttributes));
     163    } else
     164        webContext = adoptPtr(webViewImpl->client()->createGraphicsContext3D(webAttributes, renderDirectlyToHostWindow));
     165    if (!webContext)
    162166        return 0;
    163167
  • trunk/Tools/ChangeLog

    r106369 r106371  
     12012-01-31  Antoine Labour  <piman@chromium.org>
     2
     3        Merge WebGraphicsContext3D creation and initialization, and move it to
     4        WebViewClient.
     5        https://bugs.webkit.org/show_bug.cgi?id=76593
     6
     7        Reviewed by Darin Fisher.
     8
     9        * DumpRenderTree/chromium/TestWebPlugin.cpp:
     10        (TestWebPlugin::TestWebPlugin):
     11        (TestWebPlugin::initialize):
     12        * DumpRenderTree/chromium/TestWebPlugin.h:
     13        * DumpRenderTree/chromium/WebViewHost.cpp:
     14        (WebViewHost::createGraphicsContext3D):
     15        (WebViewHost::createPlugin):
     16        * DumpRenderTree/chromium/WebViewHost.h:
     17
    1182012-01-31  Gabor Rapcsanyi  <rgabor@webkit.org>
    219
  • trunk/Tools/DumpRenderTree/chromium/TestWebPlugin.cpp

    r102044 r106371  
    3333#include "WebPluginContainer.h"
    3434#include "WebPluginParams.h"
     35#include "WebViewClient.h"
    3536#include <wtf/Assertions.h>
    3637#include <wtf/text/CString.h>
     
    6263}
    6364
    64 TestWebPlugin::TestWebPlugin(WebKit::WebFrame* frame,
     65TestWebPlugin::TestWebPlugin(WebKit::WebViewClient* webViewClient,
     66                             WebKit::WebFrame* frame,
    6567                             const WebKit::WebPluginParams& params)
    66     : m_frame(frame)
     68    : m_webViewClient(webViewClient)
     69    , m_frame(frame)
    6770    , m_container(0)
    6871    , m_context(0)
     
    102105bool TestWebPlugin::initialize(WebPluginContainer* container)
    103106{
    104     m_context = webKitPlatformSupport()->createGraphicsContext3D();
     107    WebGraphicsContext3D::Attributes attrs;
     108    m_context = m_webViewClient->createGraphicsContext3D(attrs, false);
    105109    if (!m_context)
    106         return false;
    107 
    108     WebGraphicsContext3D::Attributes attrs;
    109     if (!m_context->initialize(attrs, m_frame->view(), false))
    110110        return false;
    111111
  • trunk/Tools/DumpRenderTree/chromium/TestWebPlugin.h

    r102044 r106371  
    3232namespace WebKit {
    3333class WebGraphicsContext3D;
     34class WebViewClient;
    3435}
    3536
     
    4546class TestWebPlugin : public WebKit::WebPlugin {
    4647public:
    47     TestWebPlugin(WebKit::WebFrame*, const WebKit::WebPluginParams&);
     48    TestWebPlugin(WebKit::WebViewClient*, WebKit::WebFrame*, const WebKit::WebPluginParams&);
    4849    virtual ~TestWebPlugin();
    4950
     
    116117                         const WTF::CString& fragmentSource);
    117118
     119    WebKit::WebViewClient* m_webViewClient;
    118120    WebKit::WebFrame* m_frame;
    119121    WebKit::WebPluginContainer* m_container;
  • trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp

    r106353 r106371  
    273273}
    274274
     275WebKit::WebGraphicsContext3D* WebViewHost::createGraphicsContext3D(const WebKit::WebGraphicsContext3D::Attributes& attributes, bool direct)
     276{
     277    if (!webView())
     278        return 0;
     279    return webkit_support::CreateGraphicsContext3D(attributes, webView(), direct);
     280}
     281
    275282void WebViewHost::didAddMessageToConsole(const WebConsoleMessage& message, const WebString& sourceName, unsigned sourceLine)
    276283{
     
    907914{
    908915    if (params.mimeType == TestWebPlugin::mimeType())
    909         return new TestWebPlugin(frame, params);
     916        return new TestWebPlugin(this, frame, params);
    910917
    911918    return webkit_support::CreateWebPlugin(frame, params);
  • trunk/Tools/DumpRenderTree/chromium/WebViewHost.h

    r106353 r106371  
    130130    virtual WebKit::WebWidget* createPopupMenu(const WebKit::WebPopupMenuInfo&);
    131131    virtual WebKit::WebStorageNamespace* createSessionStorageNamespace(unsigned quota);
     132    virtual WebKit::WebGraphicsContext3D* createGraphicsContext3D(const WebKit::WebGraphicsContext3D::Attributes&, bool direct);
    132133    virtual void didAddMessageToConsole(const WebKit::WebConsoleMessage&, const WebKit::WebString& sourceName, unsigned sourceLine);
    133134    virtual void didStartLoading();
Note: See TracChangeset for help on using the changeset viewer.