summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorfischman@chromium.org <fischman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-10 18:54:52 +0000
committerfischman@chromium.org <fischman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-10 18:54:52 +0000
commitd0fb8a7b6c1ad978ef24ac55f0fa0c8c13d41c90 (patch)
tree10513b24a8bf5c865f4f8ff257c175c5c678e10d /content
parentffd3171d20188358d55ed7b1715d2f35f793da53 (diff)
downloadchromium_src-d0fb8a7b6c1ad978ef24ac55f0fa0c8c13d41c90.zip
chromium_src-d0fb8a7b6c1ad978ef24ac55f0fa0c8c13d41c90.tar.gz
chromium_src-d0fb8a7b6c1ad978ef24ac55f0fa0c8c13d41c90.tar.bz2
Look before blindly downcasting WebGraphicsContext3D to WebGraphicsContext3DCommandBufferImpl.
BUG=112108 Review URL: http://codereview.chromium.org/9666030 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@126039 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/renderer/render_view_impl.cc8
-rw-r--r--content/renderer/render_view_impl.h7
2 files changed, 13 insertions, 2 deletions
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
index 0774415..336e296 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -443,6 +443,7 @@ RenderViewImpl::RenderViewImpl(
cached_has_main_frame_vertical_scrollbar_(false),
context_has_swapbuffers_complete_callback_(false),
queried_for_swapbuffers_complete_callback_(false),
+ context_is_web_graphics_context_3d_command_buffer_impl_(false),
ALLOW_THIS_IN_INITIALIZER_LIST(cookie_jar_(this)),
geolocation_dispatcher_(NULL),
input_tag_speech_dispatcher_(NULL),
@@ -1573,6 +1574,7 @@ WebGraphicsContext3D* RenderViewImpl::createGraphicsContext3D(
if (!context->Initialize(attributes))
return NULL;
+ context_is_web_graphics_context_3d_command_buffer_impl_ = true;
return context.release();
}
}
@@ -2135,15 +2137,17 @@ WebMediaPlayer* RenderViewImpl::createMediaPlayer(
collection->AddAudioRenderer(audio_renderer);
}
-#if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL)
// Currently only cros/arm has any HW video decode support in
// GpuVideoDecodeAccelerator so we don't even try to use it on other
// platforms. This is a startup-time optimization. When new VDA
// implementations are added, relax the #if above.
+#if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL)
+ // Note we don't actually use the result of this blind down-cast unless it's
+ // valid (not NULL and of the right type).
WebGraphicsContext3DCommandBufferImpl* context3d =
static_cast<WebGraphicsContext3DCommandBufferImpl*>(
webview()->graphicsContext3D());
- if (context3d) {
+ if (context_is_web_graphics_context_3d_command_buffer_impl_ && context3d) {
MessageLoop* factories_loop =
RenderThreadImpl::current()->compositor_thread() ?
RenderThreadImpl::current()->compositor_thread()->GetWebThread()
diff --git a/content/renderer/render_view_impl.h b/content/renderer/render_view_impl.h
index 8527302..f127067 100644
--- a/content/renderer/render_view_impl.h
+++ b/content/renderer/render_view_impl.h
@@ -1166,6 +1166,13 @@ class RenderViewImpl : public RenderWidget,
bool context_has_swapbuffers_complete_callback_;
bool queried_for_swapbuffers_complete_callback_;
+ // Whether the WebGraphicsContext3D handed out by createGraphicsContext3D() a
+ // WebGraphicsContext3DCommandBufferImpl. This is a HACK required by the fact
+ // that there's no other way to tell whether webview()->graphicsContext3D()
+ // has a ContentGLContext (and thus a CommandBufferProxy & associated
+ // route_id) or not.
+ bool context_is_web_graphics_context_3d_command_buffer_impl_;
+
// Helper objects ------------------------------------------------------------
RendererWebCookieJarImpl cookie_jar_;