Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #if defined(ENABLE_GPU) | 5 #if defined(ENABLE_GPU) |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
| 9 #include "base/process_util.h" | 9 #include "base/process_util.h" |
| 10 #include "base/shared_memory.h" | 10 #include "base/shared_memory.h" |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 388 "GpuCommandBufferStub::AcceleratedSurfaceBuffersSwapped"); | 388 "GpuCommandBufferStub::AcceleratedSurfaceBuffersSwapped"); |
| 389 | 389 |
| 390 // Multiple swapbuffers may get consolidated together into a single | 390 // Multiple swapbuffers may get consolidated together into a single |
| 391 // AcceleratedSurfaceBuffersSwapped call. Since OnSwapBuffers expects to be | 391 // AcceleratedSurfaceBuffersSwapped call. Since OnSwapBuffers expects to be |
| 392 // called one time for every swap, make up the difference here. | 392 // called one time for every swap, make up the difference here. |
| 393 uint64 delta = swap_buffers_count - | 393 uint64 delta = swap_buffers_count - |
| 394 scheduler_->acknowledged_swap_buffers_count(); | 394 scheduler_->acknowledged_swap_buffers_count(); |
| 395 | 395 |
| 396 scheduler_->set_acknowledged_swap_buffers_count(swap_buffers_count); | 396 scheduler_->set_acknowledged_swap_buffers_count(swap_buffers_count); |
| 397 | 397 |
| 398 for(uint64 i = 0; i < delta; i++) | 398 for(uint64 i = 0; i < delta; i++) { |
| 399 OnSwapBuffers(); | 399 OnSwapBuffers(); |
| 400 | 400 |
| 401 // Wake up the GpuScheduler to start doing work again. | 401 // Wake up the GpuScheduler to start doing work again. |
| 402 scheduler_->SetScheduled(true); | 402 scheduler_->SetScheduled(true); |
|
jbates
2011/06/07 16:47:52
This was a bug that would allow the scheduled_coun
| |
| 403 } | |
| 403 } | 404 } |
| 404 #endif // defined(OS_MACOSX) | 405 #endif // defined(OS_MACOSX) |
| 405 | 406 |
| 407 void GpuCommandBufferStub::CommandBufferWasDestroyed() { | |
| 408 TRACE_EVENT0("gpu", "GpuCommandBufferStub::CommandBufferWasDestroyed"); | |
| 409 while (!scheduler_->IsScheduled()) | |
| 410 scheduler_->SetScheduled(true); | |
| 411 // Handle all deferred messages now, because the stub route is about to be | |
| 412 // removed by the GpuChannel. The PostTask handling may not work if the route | |
| 413 // is already removed. | |
| 414 HandleDeferredMessages(); | |
| 415 } | |
| 416 | |
| 406 void GpuCommandBufferStub::ResizeCallback(gfx::Size size) { | 417 void GpuCommandBufferStub::ResizeCallback(gfx::Size size) { |
| 407 if (handle_ == gfx::kNullPluginWindow) { | 418 if (handle_ == gfx::kNullPluginWindow) { |
| 408 scheduler_->decoder()->ResizeOffscreenFrameBuffer(size); | 419 scheduler_->decoder()->ResizeOffscreenFrameBuffer(size); |
| 409 scheduler_->decoder()->UpdateOffscreenFrameBufferSize(); | 420 scheduler_->decoder()->UpdateOffscreenFrameBufferSize(); |
| 410 } else { | 421 } else { |
| 411 #if defined(TOOLKIT_USES_GTK) && !defined(TOUCH_UI) || defined(OS_WIN) | 422 #if defined(TOOLKIT_USES_GTK) && !defined(TOUCH_UI) || defined(OS_WIN) |
| 412 GpuChannelManager* gpu_channel_manager = channel_->gpu_channel_manager(); | 423 GpuChannelManager* gpu_channel_manager = channel_->gpu_channel_manager(); |
| 413 gpu_channel_manager->Send( | 424 gpu_channel_manager->Send( |
| 414 new GpuHostMsg_ResizeView(renderer_id_, | 425 new GpuHostMsg_ResizeView(renderer_id_, |
| 415 render_view_id_, | 426 render_view_id_, |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 444 gfx::GLContext::LosesAllContextsOnContextLost()) { | 455 gfx::GLContext::LosesAllContextsOnContextLost()) { |
| 445 channel_->LoseAllContexts(); | 456 channel_->LoseAllContexts(); |
| 446 } else { | 457 } else { |
| 447 IPC::Message* msg = new GpuCommandBufferMsg_UpdateState(route_id_, state); | 458 IPC::Message* msg = new GpuCommandBufferMsg_UpdateState(route_id_, state); |
| 448 msg->set_unblock(true); | 459 msg->set_unblock(true); |
| 449 Send(msg); | 460 Send(msg); |
| 450 } | 461 } |
| 451 } | 462 } |
| 452 | 463 |
| 453 #endif // defined(ENABLE_GPU) | 464 #endif // defined(ENABLE_GPU) |
| OLD | NEW |