| 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/location.h" | 9 #include "base/location.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 0); | 299 0); |
| 300 } | 300 } |
| 301 | 301 |
| 302 // Send context lost to plugin. This may have been caused by a PPAPI call, so | 302 // Send context lost to plugin. This may have been caused by a PPAPI call, so |
| 303 // avoid re-entering. | 303 // avoid re-entering. |
| 304 base::ThreadTaskRunnerHandle::Get()->PostTask( | 304 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 305 FROM_HERE, base::Bind(&PPB_Graphics3D_Impl::SendContextLost, | 305 FROM_HERE, base::Bind(&PPB_Graphics3D_Impl::SendContextLost, |
| 306 weak_ptr_factory_.GetWeakPtr())); | 306 weak_ptr_factory_.GetWeakPtr())); |
| 307 } | 307 } |
| 308 | 308 |
| 309 void PPB_Graphics3D_Impl::OnGpuControlLostContextMaybeReentrant() { |
| 310 // No internal state to update on lost context. |
| 311 } |
| 312 |
| 309 void PPB_Graphics3D_Impl::OnSwapBuffers() { | 313 void PPB_Graphics3D_Impl::OnSwapBuffers() { |
| 310 if (HasPendingSwap()) { | 314 if (HasPendingSwap()) { |
| 311 // If we're off-screen, no need to trigger and wait for compositing. | 315 // If we're off-screen, no need to trigger and wait for compositing. |
| 312 // Just send the swap-buffers ACK to the plugin immediately. | 316 // Just send the swap-buffers ACK to the plugin immediately. |
| 313 commit_pending_ = false; | 317 commit_pending_ = false; |
| 314 SwapBuffersACK(PP_OK); | 318 SwapBuffersACK(PP_OK); |
| 315 } | 319 } |
| 316 } | 320 } |
| 317 | 321 |
| 318 void PPB_Graphics3D_Impl::SendContextLost() { | 322 void PPB_Graphics3D_Impl::SendContextLost() { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 333 instance->module()->GetPluginInterface(PPP_GRAPHICS_3D_INTERFACE)); | 337 instance->module()->GetPluginInterface(PPP_GRAPHICS_3D_INTERFACE)); |
| 334 // We have to check *again* that the instance exists, because it could have | 338 // We have to check *again* that the instance exists, because it could have |
| 335 // been deleted during GetPluginInterface(). Even the PluginModule could be | 339 // been deleted during GetPluginInterface(). Even the PluginModule could be |
| 336 // deleted, but in that case, the instance should also be gone, so the | 340 // deleted, but in that case, the instance should also be gone, so the |
| 337 // GetInstance check covers both cases. | 341 // GetInstance check covers both cases. |
| 338 if (ppp_graphics_3d && HostGlobals::Get()->GetInstance(this_pp_instance)) | 342 if (ppp_graphics_3d && HostGlobals::Get()->GetInstance(this_pp_instance)) |
| 339 ppp_graphics_3d->Graphics3DContextLost(this_pp_instance); | 343 ppp_graphics_3d->Graphics3DContextLost(this_pp_instance); |
| 340 } | 344 } |
| 341 | 345 |
| 342 } // namespace content | 346 } // namespace content |
| OLD | NEW |