Chromium Code Reviews| Index: webkit/plugins/ppapi/ppb_graphics_3d_impl.cc |
| diff --git a/webkit/plugins/ppapi/ppb_graphics_3d_impl.cc b/webkit/plugins/ppapi/ppb_graphics_3d_impl.cc |
| index ce43dedeaa226afe23027a4db38955d0f033b615..3f74c65c7c360e9643f4b23dd7e884410f8a81a0 100644 |
| --- a/webkit/plugins/ppapi/ppb_graphics_3d_impl.cc |
| +++ b/webkit/plugins/ppapi/ppb_graphics_3d_impl.cc |
| @@ -8,7 +8,9 @@ |
| #include "base/message_loop.h" |
| #include "base/utf_string_conversions.h" |
| #include "gpu/command_buffer/client/gles2_implementation.h" |
| +#include "gpu/ipc/command_buffer_proxy.h" |
| #include "ppapi/c/ppp_graphics_3d.h" |
| +#include "ppapi/thunk/enter.h" |
| #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" |
| #include "third_party/WebKit/Source/WebKit/chromium/public/WebConsoleMessage.h" |
| #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" |
| @@ -19,6 +21,7 @@ |
| #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
| #include "webkit/plugins/ppapi/resource_helper.h" |
| +using ppapi::thunk::EnterResourceNoLock; |
| using ppapi::thunk::PPB_Graphics3D_API; |
| using WebKit::WebConsoleMessage; |
| using WebKit::WebFrame; |
| @@ -217,16 +220,21 @@ bool PPB_Graphics3D_Impl::InitRaw(PP_Resource share_context, |
| if (!plugin_instance) |
| return false; |
| - // TODO(alokp): Support shared context. |
| - DCHECK_EQ(0, share_context); |
| - if (share_context != 0) |
| - return false; |
| + CommandBufferProxy *share_buffer = 0; |
| + if (share_context != 0) { |
| + EnterResourceNoLock<PPB_Graphics3D_API> enter(share_context, false); |
|
piman
2012/05/15 20:59:17
It'd be nicer to do the EnterResource thing in the
(scshunt)
2012/05/16 16:39:43
Which is the thunk layer?
piman
2012/05/16 17:12:00
ppapi/thunk/ppb_graphics_3d_thunk.cc
|
| + DCHECK(enter.succeeded()); |
| + PPB_Graphics3D_Impl* graphics3d_impl = |
| + static_cast<PPB_Graphics3D_Impl*>(enter.object()); |
| + share_buffer = |
| + static_cast<CommandBufferProxy*>(graphics3d_impl->GetCommandBuffer()); |
| + } |
| platform_context_.reset(plugin_instance->CreateContext3D()); |
| if (!platform_context_.get()) |
| return false; |
| - if (!platform_context_->Init(attrib_list)) |
| + if (!platform_context_->Init(attrib_list, share_buffer)) |
| return false; |
| platform_context_->SetContextLostCallback( |