summaryrefslogtreecommitdiffstats
path: root/chrome/plugin
diff options
context:
space:
mode:
authorapatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-15 21:12:51 +0000
committerapatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-15 21:12:51 +0000
commit52a838a34ea1b0febd12a966ebb008f0f88c1a81 (patch)
treed6dc50d4dd700ec85c46c43f3a6d310bfb6d7634 /chrome/plugin
parent46e30824394b82a38a1902bcc990c2777dbe1f00 (diff)
downloadchromium_src-52a838a34ea1b0febd12a966ebb008f0f88c1a81.zip
chromium_src-52a838a34ea1b0febd12a966ebb008f0f88c1a81.tar.gz
chromium_src-52a838a34ea1b0febd12a966ebb008f0f88c1a81.tar.bz2
Fix Pepper 3D GLContext initialization.
TEST=try BUG=none Review URL: http://codereview.chromium.org/3009001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@52533 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/plugin')
-rw-r--r--chrome/plugin/webplugin_delegate_stub.cc19
1 files changed, 17 insertions, 2 deletions
diff --git a/chrome/plugin/webplugin_delegate_stub.cc b/chrome/plugin/webplugin_delegate_stub.cc
index 0f47bd8..5b719ac 100644
--- a/chrome/plugin/webplugin_delegate_stub.cc
+++ b/chrome/plugin/webplugin_delegate_stub.cc
@@ -23,6 +23,10 @@
#include "webkit/glue/plugins/webplugin_delegate_impl.h"
#include "webkit/glue/webcursor.h"
+#if defined(ENABLE_GPU)
+#include "app/gfx/gl/gl_context.h"
+#endif
+
using WebKit::WebBindings;
using WebKit::WebCursorInfo;
using webkit_glue::WebPlugin;
@@ -61,6 +65,13 @@ WebPluginDelegateStub::~WebPluginDelegateStub() {
in_destructor_ = true;
child_process_logging::SetActiveURL(page_url_);
+#if defined(ENABLE_GPU)
+ // Make sure there is no command buffer before destroying the window handle.
+ // The GPU service code might otherwise asynchronously perform an operation
+ // using the window handle.
+ command_buffer_stub_.reset();
+#endif
+
if (channel_->in_send()) {
// The delegate or an npobject is in the callstack, so don't delete it
// right away.
@@ -385,15 +396,19 @@ void WebPluginDelegateStub::OnInstallMissingPlugin() {
}
void WebPluginDelegateStub::OnCreateCommandBuffer(int* route_id) {
+ *route_id = 0;
#if defined(ENABLE_GPU)
+ // Fail to create the command buffer if some GL implementation cannot be
+ // initialized.
+ if (!gfx::GLContext::InitializeOneOff())
+ return;
+
command_buffer_stub_.reset(new CommandBufferStub(
channel_,
instance_id_,
delegate_->windowed_handle()));
*route_id = command_buffer_stub_->route_id();
-#else
- *route_id = 0;
#endif // ENABLE_GPU
}