Commit f2b56878 authored by piman@chromium.org's avatar piman@chromium.org

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:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@106371 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent a323c82f
2012-01-31 Antoine Labour <piman@chromium.org>
Merge WebGraphicsContext3D creation and initialization, and move it to
WebViewClient.
https://bugs.webkit.org/show_bug.cgi?id=76593
Reviewed by Darin Fisher.
* public/WebViewClient.h:
(WebKit::WebViewClient::createGraphicsContext3D):
* public/platform/WebGraphicsContext3D.h:
(WebKit::WebGraphicsContext3D::initialize):
* public/platform/WebKitPlatformSupport.h:
* src/GraphicsContext3DChromium.cpp:
2012-01-26 Hans Wennborg <hans@chromium.org>
Speech Input: move MockSpeechInputClient into Chromium DumpRenderTree implementation
......@@ -42,6 +42,7 @@
#include "WebTextDirection.h"
#include "WebWidgetClient.h"
#include "platform/WebColor.h"
#include "platform/WebGraphicsContext3D.h"
#include "platform/WebString.h"
namespace WebKit {
......@@ -109,6 +110,12 @@ public:
// Create a session storage namespace object associated with this WebView.
virtual WebStorageNamespace* createSessionStorageNamespace(unsigned quota) { return 0; }
// Creates a graphics context associated with the client's WebView.
// renderDirectlyToWebView means whether the context should be setup to
// render directly to the WebView (e.g. compositor context), or to an
// offscreen surface (e.g. WebGL context).
virtual WebGraphicsContext3D* createGraphicsContext3D(const WebGraphicsContext3D::Attributes&, bool renderDirectlyToWebView) { return 0; }
// Misc ----------------------------------------------------------------
// A new message was added to the console.
......
......@@ -133,9 +133,8 @@ public:
// This destructor needs to be public so that using classes can destroy instances if initialization fails.
virtual ~WebGraphicsContext3D() {}
// Initializes the graphics context; should be the first operation performed
// on newly-constructed instances. Returns true on success.
virtual bool initialize(Attributes, WebView*, bool renderDirectlyToWebView) = 0;
// This function is deprecated and will be removed soon.
virtual bool initialize(Attributes, WebView*, bool renderDirectlyToWebView) { return false; }
// Makes the OpenGL context current on the current thread. Returns true on
// success.
......
......@@ -36,6 +36,7 @@
#include "WebCommon.h"
#include "WebData.h"
#include "WebGamepads.h"
#include "WebGraphicsContext3D.h"
#include "WebLocalizedString.h"
#include "WebSerializedScriptValue.h"
#include "WebString.h"
......@@ -313,11 +314,11 @@ public:
// Callable from a background WebKit thread.
virtual void callOnMainThread(void (*func)(void*), void* context) { }
// WebGL --------------------------------------------------------------
// May return null if WebGL is not supported.
// Returns newly allocated WebGraphicsContext3D instance.
virtual WebGraphicsContext3D* createGraphicsContext3D() { return 0; }
// GPU ----------------------------------------------------------------
//
// May return null if GPU is not supported.
// Returns newly allocated and initialized offscreen WebGraphicsContext3D instance.
virtual WebGraphicsContext3D* createOffscreenGraphicsContext3D(const WebGraphicsContext3D::Attributes&) { return 0; }
// Audio --------------------------------------------------------------
......
......@@ -46,9 +46,10 @@
#include "ImageBuffer.h"
#include "ImageData.h"
#include "WebKit.h"
#include "platform/WebKitPlatformSupport.h"
#include "WebViewClient.h"
#include "WebViewImpl.h"
#include "platform/WebGraphicsContext3D.h"
#include "platform/WebKitPlatformSupport.h"
#include <stdio.h>
#include <wtf/FastMalloc.h>
......@@ -151,14 +152,17 @@ PassRefPtr<GraphicsContext3D> createGraphicsContext(GraphicsContext3D::Attribute
webAttributes.noExtensions = attrs.noExtensions;
webAttributes.shareResources = attrs.shareResources;
webAttributes.forUseOnAnotherThread = threadUsage == GraphicsContext3DPrivate::ForUseOnAnotherThread;
OwnPtr<WebKit::WebGraphicsContext3D> webContext = adoptPtr(WebKit::webKitPlatformSupport()->createGraphicsContext3D());
if (!webContext)
return 0;
Chrome* chrome = static_cast<Chrome*>(hostWindow);
WebKit::WebViewImpl* webViewImpl = chrome ? static_cast<WebKit::WebViewImpl*>(chrome->client()->webView()) : 0;
if (!webContext->initialize(webAttributes, webViewImpl, renderDirectlyToHostWindow))
OwnPtr<WebKit::WebGraphicsContext3D> webContext;
if (!webViewImpl || !webViewImpl->client()) {
if (renderDirectlyToHostWindow)
return 0;
webContext = adoptPtr(WebKit::webKitPlatformSupport()->createOffscreenGraphicsContext3D(webAttributes));
} else
webContext = adoptPtr(webViewImpl->client()->createGraphicsContext3D(webAttributes, renderDirectlyToHostWindow));
if (!webContext)
return 0;
return GraphicsContext3DPrivate::createGraphicsContextFromWebContext(webContext.release(), attrs, hostWindow, renderStyle, threadUsage);
......
2012-01-31 Antoine Labour <piman@chromium.org>
Merge WebGraphicsContext3D creation and initialization, and move it to
WebViewClient.
https://bugs.webkit.org/show_bug.cgi?id=76593
Reviewed by Darin Fisher.
* DumpRenderTree/chromium/TestWebPlugin.cpp:
(TestWebPlugin::TestWebPlugin):
(TestWebPlugin::initialize):
* DumpRenderTree/chromium/TestWebPlugin.h:
* DumpRenderTree/chromium/WebViewHost.cpp:
(WebViewHost::createGraphicsContext3D):
(WebViewHost::createPlugin):
* DumpRenderTree/chromium/WebViewHost.h:
2012-01-31 Gabor Rapcsanyi <rgabor@webkit.org>
[GTK] build-webkit warning.
......@@ -32,6 +32,7 @@
#include "platform/WebKitPlatformSupport.h"
#include "WebPluginContainer.h"
#include "WebPluginParams.h"
#include "WebViewClient.h"
#include <wtf/Assertions.h>
#include <wtf/text/CString.h>
......@@ -61,9 +62,11 @@ static void premultiplyAlpha(const unsigned colorIn[3], float alpha, float color
colorOut[3] = alpha;
}
TestWebPlugin::TestWebPlugin(WebKit::WebFrame* frame,
TestWebPlugin::TestWebPlugin(WebKit::WebViewClient* webViewClient,
WebKit::WebFrame* frame,
const WebKit::WebPluginParams& params)
: m_frame(frame)
: m_webViewClient(webViewClient)
, m_frame(frame)
, m_container(0)
, m_context(0)
{
......@@ -101,12 +104,9 @@ const WebString& TestWebPlugin::mimeType()
bool TestWebPlugin::initialize(WebPluginContainer* container)
{
m_context = webKitPlatformSupport()->createGraphicsContext3D();
if (!m_context)
return false;
WebGraphicsContext3D::Attributes attrs;
if (!m_context->initialize(attrs, m_frame->view(), false))
m_context = m_webViewClient->createGraphicsContext3D(attrs, false);
if (!m_context)
return false;
if (!m_context->makeContextCurrent())
......
......@@ -31,6 +31,7 @@
namespace WebKit {
class WebGraphicsContext3D;
class WebViewClient;
}
// A fake implemention of WebKit::WebPlugin for testing purposes.
......@@ -44,7 +45,7 @@ class WebGraphicsContext3D;
// opacity: [0.0 - 1.0]. Default is 1.0.
class TestWebPlugin : public WebKit::WebPlugin {
public:
TestWebPlugin(WebKit::WebFrame*, const WebKit::WebPluginParams&);
TestWebPlugin(WebKit::WebViewClient*, WebKit::WebFrame*, const WebKit::WebPluginParams&);
virtual ~TestWebPlugin();
static const WebKit::WebString& mimeType();
......@@ -115,6 +116,7 @@ private:
unsigned loadProgram(const WTF::CString& vertexSource,
const WTF::CString& fragmentSource);
WebKit::WebViewClient* m_webViewClient;
WebKit::WebFrame* m_frame;
WebKit::WebPluginContainer* m_container;
......
......@@ -272,6 +272,13 @@ WebStorageNamespace* WebViewHost::createSessionStorageNamespace(unsigned quota)
return WebKit::WebStorageNamespace::createSessionStorageNamespace(quota);
}
WebKit::WebGraphicsContext3D* WebViewHost::createGraphicsContext3D(const WebKit::WebGraphicsContext3D::Attributes& attributes, bool direct)
{
if (!webView())
return 0;
return webkit_support::CreateGraphicsContext3D(attributes, webView(), direct);
}
void WebViewHost::didAddMessageToConsole(const WebConsoleMessage& message, const WebString& sourceName, unsigned sourceLine)
{
// This matches win DumpRenderTree's UIDelegate.cpp.
......@@ -906,7 +913,7 @@ void WebViewHost::exitFullScreen()
WebPlugin* WebViewHost::createPlugin(WebFrame* frame, const WebPluginParams& params)
{
if (params.mimeType == TestWebPlugin::mimeType())
return new TestWebPlugin(frame, params);
return new TestWebPlugin(this, frame, params);
return webkit_support::CreateWebPlugin(frame, params);
}
......
......@@ -129,6 +129,7 @@ class WebViewHost : public WebKit::WebSpellCheckClient, public WebKit::WebViewCl
virtual WebKit::WebWidget* createPopupMenu(WebKit::WebPopupType);
virtual WebKit::WebWidget* createPopupMenu(const WebKit::WebPopupMenuInfo&);
virtual WebKit::WebStorageNamespace* createSessionStorageNamespace(unsigned quota);
virtual WebKit::WebGraphicsContext3D* createGraphicsContext3D(const WebKit::WebGraphicsContext3D::Attributes&, bool direct);
virtual void didAddMessageToConsole(const WebKit::WebConsoleMessage&, const WebKit::WebString& sourceName, unsigned sourceLine);
virtual void didStartLoading();
virtual void didStopLoading();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment