Index: content/renderer/pepper/ppb_graphics_3d_impl.cc |
diff --git a/content/renderer/pepper/ppb_graphics_3d_impl.cc b/content/renderer/pepper/ppb_graphics_3d_impl.cc |
index 24c6513c12fb8119bb4d5ef6293d885dcc83d5e9..a98814db21b9538085765ea6ea5df58743e5bf12 100644 |
--- a/content/renderer/pepper/ppb_graphics_3d_impl.cc |
+++ b/content/renderer/pepper/ppb_graphics_3d_impl.cc |
@@ -143,8 +143,6 @@ gpu::GpuControl* PPB_Graphics3D_Impl::GetGpuControl() { |
int32_t PPB_Graphics3D_Impl::DoSwapBuffers(const gpu::SyncToken& sync_token) { |
DCHECK(command_buffer_); |
- if (sync_token.HasData()) |
- sync_token_ = sync_token; |
if (bound_to_instance_) { |
// If we are bound to the instance, we need to ask the compositor |
@@ -159,9 +157,8 @@ int32_t PPB_Graphics3D_Impl::DoSwapBuffers(const gpu::SyncToken& sync_token) { |
} else { |
// Wait for the command to complete on the GPU to allow for throttling. |
command_buffer_->SignalSyncToken( |
- sync_token_, |
- base::Bind(&PPB_Graphics3D_Impl::OnSwapBuffers, |
- weak_ptr_factory_.GetWeakPtr())); |
+ sync_token, base::Bind(&PPB_Graphics3D_Impl::OnSwapBuffers, |
+ weak_ptr_factory_.GetWeakPtr())); |
} |
return PP_OK_COMPLETIONPENDING; |
@@ -262,13 +259,22 @@ bool PPB_Graphics3D_Impl::InitRaw(PPB_Graphics3D_API* share_context, |
if (command_buffer_id) |
*command_buffer_id = command_buffer_->GetCommandBufferID(); |
- mailbox_ = gpu::Mailbox::Generate(); |
- if (!command_buffer_->ProduceFrontBuffer(mailbox_)) |
- return false; |
+ return true; |
+} |
+bool PPB_Graphics3D_Impl::TakeBackingMailbox(gpu::Mailbox* mailbox, |
+ gpu::SyncToken* sync_token) { |
+ *mailbox = gpu::Mailbox::Generate(); |
piman
2016/04/26 01:54:01
This is kind of costly (generate a crypto-secure n
erikchen
2016/04/27 16:31:23
Done.
|
+ command_buffer_->TakeFrontBuffer(*mailbox, sync_token); |
return true; |
} |
+void PPB_Graphics3D_Impl::ReturnBackingMailbox(const gpu::Mailbox& mailbox, |
+ const gpu::SyncToken& sync_token, |
+ bool is_lost) { |
+ command_buffer_->ReturnFrontBuffer(mailbox, sync_token, is_lost); |
+} |
+ |
void PPB_Graphics3D_Impl::OnGpuControlErrorMessage(const char* message, |
int32_t id) { |
if (!bound_to_instance_) |