summaryrefslogtreecommitdiffstats
path: root/components/test_runner/test_plugin.cc
diff options
context:
space:
mode:
authordanakj <danakj@chromium.org>2016-03-22 12:58:24 -0700
committerCommit bot <commit-bot@chromium.org>2016-03-22 20:00:16 +0000
commit11e6d011bc903cb926b1b6c40795c14f5af48384 (patch)
tree89a3e3788c6ab1a238ec14a3e2452d575e5e0238 /components/test_runner/test_plugin.cc
parent840cab012a5c84ea39f564babc3ea5f92fedf023 (diff)
downloadchromium_src-11e6d011bc903cb926b1b6c40795c14f5af48384.zip
chromium_src-11e6d011bc903cb926b1b6c40795c14f5af48384.tar.gz
chromium_src-11e6d011bc903cb926b1b6c40795c14f5af48384.tar.bz2
Make Platform return a WebGraphicsContext3DProvider* always.
Currently we return a WebGraphicsContext3DProvider* for the shared main thread context (for canvas), but we return a WebGraphicsContext3D* for webgl. After this CL, Platform will return a WebGraphicsContext3DProvider* for webgl also, which can grab the WebGraphicsContext3D* and the GLES2Interface* off it. This is largely in preparation for exposing gpu::ContextSupport (or something wrapping it) on WebGraphicsContext3DProvider so that we can expose lost context callbacks through there instead of on WebGraphicsContext3D. R=kbr@chromium.org, pfeldman@chromium.org, piman@chromium.org TBR=pfeldman BUG=584497 CQ_INCLUDE_TRYBOTS=tryserver.chromium.win:win_optional_gpu_tests_rel Review URL: https://codereview.chromium.org/1822993002 Cr-Commit-Position: refs/heads/master@{#382657}
Diffstat (limited to 'components/test_runner/test_plugin.cc')
-rw-r--r--components/test_runner/test_plugin.cc17
1 files changed, 10 insertions, 7 deletions
diff --git a/components/test_runner/test_plugin.cc b/components/test_runner/test_plugin.cc
index 155fd6b..08aed02 100644
--- a/components/test_runner/test_plugin.cc
+++ b/components/test_runner/test_plugin.cc
@@ -20,6 +20,7 @@
#include "third_party/WebKit/public/platform/Platform.h"
#include "third_party/WebKit/public/platform/WebCompositorSupport.h"
#include "third_party/WebKit/public/platform/WebGraphicsContext3D.h"
+#include "third_party/WebKit/public/platform/WebGraphicsContext3DProvider.h"
#include "third_party/WebKit/public/platform/WebTaskRunner.h"
#include "third_party/WebKit/public/platform/WebThread.h"
#include "third_party/WebKit/public/platform/WebTraceLocation.h"
@@ -173,9 +174,12 @@ TestPlugin::~TestPlugin() {
bool TestPlugin::initialize(blink::WebPluginContainer* container) {
blink::WebGraphicsContext3D::Attributes attrs;
- context_ =
- blink::Platform::current()->createOffscreenGraphicsContext3D(attrs);
- gl_ = context_ ? context_->getGLES2Interface() : nullptr;
+ blink::WebGraphicsContext3D::WebGraphicsInfo gl_info;
+ context_provider_ = make_scoped_ptr(
+ blink::Platform::current()->createOffscreenGraphicsContext3DProvider(
+ attrs, nullptr, &gl_info));
+ context_ = context_provider_ ? context_provider_->context3d() : nullptr;
+ gl_ = context_provider_ ? context_provider_->contextGL() : nullptr;
if (!InitScene())
return false;
@@ -205,8 +209,7 @@ void TestPlugin::destroy() {
DestroyScene();
gl_ = nullptr;
- delete context_;
- context_ = nullptr;
+ context_provider_.reset();
container_ = nullptr;
frame_ = nullptr;
@@ -240,7 +243,7 @@ void TestPlugin::updateGeometry(
if (rect_.isEmpty()) {
texture_mailbox_ = cc::TextureMailbox();
- } else if (context_) {
+ } else if (gl_) {
gl_->Viewport(0, 0, rect_.width, rect_.height);
gl_->BindTexture(GL_TEXTURE_2D, color_texture_);
@@ -359,7 +362,7 @@ bool TestPlugin::ParseBoolean(const blink::WebString& string) {
}
bool TestPlugin::InitScene() {
- if (!context_)
+ if (!gl_)
return true;
float color[4];