| 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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 // to commit our backing texture so that the graphics appears on the page. | 193 // to commit our backing texture so that the graphics appears on the page. |
| 194 // When the backing texture will be committed we get notified via | 194 // When the backing texture will be committed we get notified via |
| 195 // ViewFlushedPaint(). | 195 // ViewFlushedPaint(). |
| 196 // | 196 // |
| 197 // Don't need to check for NULL from GetPluginInstance since when we're | 197 // Don't need to check for NULL from GetPluginInstance since when we're |
| 198 // bound, we know our instance is valid. | 198 // bound, we know our instance is valid. |
| 199 HostGlobals::Get()->GetInstance(pp_instance())->CommitBackingTexture(); | 199 HostGlobals::Get()->GetInstance(pp_instance())->CommitBackingTexture(); |
| 200 commit_pending_ = true; | 200 commit_pending_ = true; |
| 201 } else { | 201 } else { |
| 202 // Wait for the command to complete on the GPU to allow for throttling. | 202 // Wait for the command to complete on the GPU to allow for throttling. |
| 203 command_buffer_->Echo(base::Bind(&PPB_Graphics3D_Impl::OnSwapBuffers, | 203 command_buffer_->SignalSyncPoint( |
| 204 weak_ptr_factory_.GetWeakPtr())); | 204 sync_point_, |
| 205 base::Bind(&PPB_Graphics3D_Impl::OnSwapBuffers, |
| 206 weak_ptr_factory_.GetWeakPtr())); |
| 205 } | 207 } |
| 206 | 208 |
| 207 return PP_OK_COMPLETIONPENDING; | 209 return PP_OK_COMPLETIONPENDING; |
| 208 } | 210 } |
| 209 | 211 |
| 210 bool PPB_Graphics3D_Impl::Init(PPB_Graphics3D_API* share_context, | 212 bool PPB_Graphics3D_Impl::Init(PPB_Graphics3D_API* share_context, |
| 211 const int32_t* attrib_list) { | 213 const int32_t* attrib_list) { |
| 212 if (!InitRaw(share_context, attrib_list, NULL)) | 214 if (!InitRaw(share_context, attrib_list, NULL)) |
| 213 return false; | 215 return false; |
| 214 | 216 |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 instance->module()->GetPluginInterface(PPP_GRAPHICS_3D_INTERFACE)); | 368 instance->module()->GetPluginInterface(PPP_GRAPHICS_3D_INTERFACE)); |
| 367 // We have to check *again* that the instance exists, because it could have | 369 // We have to check *again* that the instance exists, because it could have |
| 368 // been deleted during GetPluginInterface(). Even the PluginModule could be | 370 // been deleted during GetPluginInterface(). Even the PluginModule could be |
| 369 // deleted, but in that case, the instance should also be gone, so the | 371 // deleted, but in that case, the instance should also be gone, so the |
| 370 // GetInstance check covers both cases. | 372 // GetInstance check covers both cases. |
| 371 if (ppp_graphics_3d && HostGlobals::Get()->GetInstance(this_pp_instance)) | 373 if (ppp_graphics_3d && HostGlobals::Get()->GetInstance(this_pp_instance)) |
| 372 ppp_graphics_3d->Graphics3DContextLost(this_pp_instance); | 374 ppp_graphics_3d->Graphics3DContextLost(this_pp_instance); |
| 373 } | 375 } |
| 374 | 376 |
| 375 } // namespace content | 377 } // namespace content |
| OLD | NEW |