Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / content / renderer / pepper / ppb_graphics_3d_impl.cc
index a4ff059..7486abc 100644 (file)
@@ -81,9 +81,11 @@ PP_Resource PPB_Graphics3D_Impl::Create(PP_Instance instance,
 }
 
 // static
-PP_Resource PPB_Graphics3D_Impl::CreateRaw(PP_Instance instance,
-                                           PP_Resource share_context,
-                                           const int32_t* attrib_list) {
+PP_Resource PPB_Graphics3D_Impl::CreateRaw(
+    PP_Instance instance,
+    PP_Resource share_context,
+    const int32_t* attrib_list,
+    base::SharedMemoryHandle* shared_state_handle) {
   PPB_Graphics3D_API* share_api = NULL;
   if (share_context) {
     EnterResourceNoLock<PPB_Graphics3D_API> enter(share_context, true);
@@ -93,7 +95,7 @@ PP_Resource PPB_Graphics3D_Impl::CreateRaw(PP_Instance instance,
   }
   scoped_refptr<PPB_Graphics3D_Impl> graphics_3d(
       new PPB_Graphics3D_Impl(instance));
-  if (!graphics_3d->InitRaw(share_api, attrib_list))
+  if (!graphics_3d->InitRaw(share_api, attrib_list, shared_state_handle))
     return 0;
   return graphics_3d->GetReference();
 }
@@ -207,7 +209,7 @@ int32 PPB_Graphics3D_Impl::DoSwapBuffers() {
 
 bool PPB_Graphics3D_Impl::Init(PPB_Graphics3D_API* share_context,
                                const int32_t* attrib_list) {
-  if (!InitRaw(share_context, attrib_list))
+  if (!InitRaw(share_context, attrib_list, NULL))
     return false;
 
   gpu::gles2::GLES2Implementation* share_gles2 = NULL;
@@ -219,8 +221,10 @@ bool PPB_Graphics3D_Impl::Init(PPB_Graphics3D_API* share_context,
   return CreateGLES2Impl(kCommandBufferSize, kTransferBufferSize, share_gles2);
 }
 
-bool PPB_Graphics3D_Impl::InitRaw(PPB_Graphics3D_API* share_context,
-                                  const int32_t* attrib_list) {
+bool PPB_Graphics3D_Impl::InitRaw(
+    PPB_Graphics3D_API* share_context,
+    const int32_t* attrib_list,
+    base::SharedMemoryHandle* shared_state_handle) {
   PepperPluginInstanceImpl* plugin_instance =
       HostGlobals::Get()->GetInstance(pp_instance());
   if (!plugin_instance)
@@ -289,6 +293,8 @@ bool PPB_Graphics3D_Impl::InitRaw(PPB_Graphics3D_API* share_context,
     return false;
   if (!command_buffer_->Initialize())
     return false;
+  if (shared_state_handle)
+    *shared_state_handle = command_buffer_->GetSharedStateHandle();
   mailbox_ = gpu::Mailbox::Generate();
   if (!command_buffer_->ProduceFrontBuffer(mailbox_))
     return false;