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..9ddcc744c1a0bfe94e365db1bb28e475781cb6f7 100644 |
| --- a/webkit/plugins/ppapi/ppb_graphics_3d_impl.cc |
| +++ b/webkit/plugins/ppapi/ppb_graphics_3d_impl.cc |
| @@ -8,6 +8,7 @@ |
| #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 "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" |
| #include "third_party/WebKit/Source/WebKit/chromium/public/WebConsoleMessage.h" |
| @@ -76,7 +77,7 @@ PPB_Graphics3D_Impl::~PPB_Graphics3D_Impl() { |
| // static |
| PP_Resource PPB_Graphics3D_Impl::Create(PP_Instance instance, |
| - PP_Resource share_context, |
| + PPB_Graphics3D_API* share_context, |
| const int32_t* attrib_list) { |
| scoped_refptr<PPB_Graphics3D_Impl> graphics_3d( |
| new PPB_Graphics3D_Impl(instance)); |
| @@ -86,7 +87,7 @@ PP_Resource PPB_Graphics3D_Impl::Create(PP_Instance instance, |
| } |
| PP_Resource PPB_Graphics3D_Impl::CreateRaw(PP_Instance instance, |
| - PP_Resource share_context, |
| + PPB_Graphics3D_API* share_context, |
| const int32_t* attrib_list) { |
| scoped_refptr<PPB_Graphics3D_Impl> graphics_3d( |
| new PPB_Graphics3D_Impl(instance)); |
| @@ -199,7 +200,7 @@ int32 PPB_Graphics3D_Impl::DoSwapBuffers() { |
| return PP_OK_COMPLETIONPENDING; |
| } |
| -bool PPB_Graphics3D_Impl::Init(PP_Resource share_context, |
| +bool PPB_Graphics3D_Impl::Init(PPB_Graphics3D_API* share_context, |
| const int32_t* attrib_list) { |
| if (!InitRaw(share_context, attrib_list)) |
| return false; |
| @@ -211,22 +212,24 @@ bool PPB_Graphics3D_Impl::Init(PP_Resource share_context, |
| return CreateGLES2Impl(kCommandBufferSize, kTransferBufferSize); |
|
piman
2012/05/17 00:05:58
Actually, I'm just realizing, this will also need
(scshunt)
2012/05/17 16:55:45
Currently I believe we only use the Raw codepath.
|
| } |
| -bool PPB_Graphics3D_Impl::InitRaw(PP_Resource share_context, |
| +bool PPB_Graphics3D_Impl::InitRaw(PPB_Graphics3D_API* share_context, |
| const int32_t* attrib_list) { |
| PluginInstance* plugin_instance = ResourceHelper::GetPluginInstance(this); |
| if (!plugin_instance) |
| return false; |
| - // TODO(alokp): Support shared context. |
| - DCHECK_EQ(0, share_context); |
| - if (share_context != 0) |
| - return false; |
| + PluginDelegate::PlatformContext3D* share_platform_context = 0; |
|
piman
2012/05/16 23:38:45
nit: s/0/NULL/
(scshunt)
2012/05/17 16:55:45
picked.
|
| + if (share_context) { |
| + PPB_Graphics3D_Impl* share_graphics = |
| + static_cast<PPB_Graphics3D_Impl*>(share_context); |
|
piman
2012/05/16 23:38:45
nit: indent +4
(scshunt)
2012/05/17 16:55:45
Also picked.
|
| + share_platform_context = share_graphics->platform_context(); |
| + } |
| 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_platform_context)) |
| return false; |
| platform_context_->SetContextLostCallback( |