OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/renderer/pepper/ppb_graphics_3d_impl.h" | 5 #include "content/renderer/pepper/ppb_graphics_3d_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
178 return platform_context_->GetGpuControl(); | 178 return platform_context_->GetGpuControl(); |
179 } | 179 } |
180 | 180 |
181 int32 PPB_Graphics3D_Impl::DoSwapBuffers() { | 181 int32 PPB_Graphics3D_Impl::DoSwapBuffers() { |
182 // We do not have a GLES2 implementation when using an OOP proxy. | 182 // We do not have a GLES2 implementation when using an OOP proxy. |
183 // The plugin-side proxy is responsible for adding the SwapBuffers command | 183 // The plugin-side proxy is responsible for adding the SwapBuffers command |
184 // to the command buffer in that case. | 184 // to the command buffer in that case. |
185 if (gles2_impl()) | 185 if (gles2_impl()) |
186 gles2_impl()->SwapBuffers(); | 186 gles2_impl()->SwapBuffers(); |
187 | 187 |
188 // Since the backing texture has been updated, a new sync point should be | |
189 // inserted. | |
190 platform_context_->InsertSyncPointForBackingMailbox(); | |
191 | |
188 if (bound_to_instance_) { | 192 if (bound_to_instance_) { |
189 // If we are bound to the instance, we need to ask the compositor | 193 // If we are bound to the instance, we need to ask the compositor |
190 // to commit our backing texture so that the graphics appears on the page. | 194 // to commit our backing texture so that the graphics appears on the page. |
191 // When the backing texture will be committed we get notified via | 195 // When the backing texture will be committed we get notified via |
192 // ViewFlushedPaint(). | 196 // ViewFlushedPaint(). |
193 // | 197 // |
194 // Don't need to check for NULL from GetPluginInstance since when we're | 198 // Don't need to check for NULL from GetPluginInstance since when we're |
195 // bound, we know our instance is valid. | 199 // bound, we know our instance is valid. |
196 HostGlobals::Get()->GetInstance(pp_instance())->CommitBackingTexture(); | 200 HostGlobals::Get()->GetInstance(pp_instance())->CommitBackingTexture( |
201 InsertSyncPoint()); | |
danakj
2014/03/03 23:31:42
Oops, this gotta go.
danakj
2014/03/03 23:33:16
Fixed.
| |
197 commit_pending_ = true; | 202 commit_pending_ = true; |
198 } else { | 203 } else { |
199 // Wait for the command to complete on the GPU to allow for throttling. | 204 // Wait for the command to complete on the GPU to allow for throttling. |
200 platform_context_->Echo(base::Bind(&PPB_Graphics3D_Impl::OnSwapBuffers, | 205 platform_context_->Echo(base::Bind(&PPB_Graphics3D_Impl::OnSwapBuffers, |
201 weak_ptr_factory_.GetWeakPtr())); | 206 weak_ptr_factory_.GetWeakPtr())); |
202 } | 207 } |
203 | 208 |
204 | 209 |
205 return PP_OK_COMPLETIONPENDING; | 210 return PP_OK_COMPLETIONPENDING; |
206 } | 211 } |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
327 PPP_GRAPHICS_3D_INTERFACE)); | 332 PPP_GRAPHICS_3D_INTERFACE)); |
328 // We have to check *again* that the instance exists, because it could have | 333 // We have to check *again* that the instance exists, because it could have |
329 // been deleted during GetPluginInterface(). Even the PluginModule could be | 334 // been deleted during GetPluginInterface(). Even the PluginModule could be |
330 // deleted, but in that case, the instance should also be gone, so the | 335 // deleted, but in that case, the instance should also be gone, so the |
331 // GetInstance check covers both cases. | 336 // GetInstance check covers both cases. |
332 if (ppp_graphics_3d && HostGlobals::Get()->GetInstance(this_pp_instance)) | 337 if (ppp_graphics_3d && HostGlobals::Get()->GetInstance(this_pp_instance)) |
333 ppp_graphics_3d->Graphics3DContextLost(this_pp_instance); | 338 ppp_graphics_3d->Graphics3DContextLost(this_pp_instance); |
334 } | 339 } |
335 | 340 |
336 } // namespace content | 341 } // namespace content |
OLD | NEW |