| 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 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 // Wake up the GpuScheduler to start doing work again. | 395 // Wake up the GpuScheduler to start doing work again. |
| 396 scheduler_->SetScheduled(true); | 396 scheduler_->SetScheduled(true); |
| 397 } | 397 } |
| 398 #endif // defined(OS_MACOSX) | 398 #endif // defined(OS_MACOSX) |
| 399 | 399 |
| 400 void GpuCommandBufferStub::ResizeCallback(gfx::Size size) { | 400 void GpuCommandBufferStub::ResizeCallback(gfx::Size size) { |
| 401 if (handle_ == gfx::kNullPluginWindow) { | 401 if (handle_ == gfx::kNullPluginWindow) { |
| 402 scheduler_->decoder()->ResizeOffscreenFrameBuffer(size); | 402 scheduler_->decoder()->ResizeOffscreenFrameBuffer(size); |
| 403 scheduler_->decoder()->UpdateOffscreenFrameBufferSize(); | 403 scheduler_->decoder()->UpdateOffscreenFrameBufferSize(); |
| 404 } else { | 404 } else { |
| 405 #if defined(OS_LINUX) && !defined(TOUCH_UI) || defined(OS_WIN) | 405 #if defined(TOOLKIT_USES_GTK) && !defined(TOUCH_UI) || defined(OS_WIN) |
| 406 GpuChannelManager* gpu_channel_manager = channel_->gpu_channel_manager(); | 406 GpuChannelManager* gpu_channel_manager = channel_->gpu_channel_manager(); |
| 407 gpu_channel_manager->Send( | 407 gpu_channel_manager->Send( |
| 408 new GpuHostMsg_ResizeView(renderer_id_, | 408 new GpuHostMsg_ResizeView(renderer_id_, |
| 409 render_view_id_, | 409 render_view_id_, |
| 410 route_id_, | 410 route_id_, |
| 411 size)); | 411 size)); |
| 412 | 412 |
| 413 scheduler_->SetScheduled(false); | 413 scheduler_->SetScheduled(false); |
| 414 #endif | 414 #endif |
| 415 } | 415 } |
| 416 } | 416 } |
| 417 | 417 |
| 418 void GpuCommandBufferStub::ViewResized() { | 418 void GpuCommandBufferStub::ViewResized() { |
| 419 #if defined(OS_LINUX) && !defined(TOUCH_UI) || defined(OS_WIN) | 419 #if defined(TOOLKIT_USES_GTK) && !defined(TOUCH_UI) || defined(OS_WIN) |
| 420 DCHECK(handle_ != gfx::kNullPluginWindow); | 420 DCHECK(handle_ != gfx::kNullPluginWindow); |
| 421 scheduler_->SetScheduled(true); | 421 scheduler_->SetScheduled(true); |
| 422 | 422 |
| 423 // Recreate the view surface to match the window size. TODO(apatrick): this is | 423 // Recreate the view surface to match the window size. TODO(apatrick): this is |
| 424 // likely not necessary on all platforms. | 424 // likely not necessary on all platforms. |
| 425 gfx::GLContext* context = scheduler_->decoder()->GetGLContext(); | 425 gfx::GLContext* context = scheduler_->decoder()->GetGLContext(); |
| 426 gfx::GLSurface* surface = scheduler_->decoder()->GetGLSurface(); | 426 gfx::GLSurface* surface = scheduler_->decoder()->GetGLSurface(); |
| 427 context->ReleaseCurrent(surface); | 427 context->ReleaseCurrent(surface); |
| 428 if (surface) { | 428 if (surface) { |
| 429 surface->Destroy(); | 429 surface->Destroy(); |
| 430 surface->Initialize(); | 430 surface->Initialize(); |
| 431 } | 431 } |
| 432 #endif | 432 #endif |
| 433 } | 433 } |
| 434 | 434 |
| 435 void GpuCommandBufferStub::ReportState() { | 435 void GpuCommandBufferStub::ReportState() { |
| 436 gpu::CommandBuffer::State state = command_buffer_->GetState(); | 436 gpu::CommandBuffer::State state = command_buffer_->GetState(); |
| 437 if (state.error == gpu::error::kLostContext && | 437 if (state.error == gpu::error::kLostContext && |
| 438 gfx::GLContext::LosesAllContextsOnContextLost()) { | 438 gfx::GLContext::LosesAllContextsOnContextLost()) { |
| 439 channel_->LoseAllContexts(); | 439 channel_->LoseAllContexts(); |
| 440 } else { | 440 } else { |
| 441 IPC::Message* msg = new GpuCommandBufferMsg_UpdateState(route_id_, state); | 441 IPC::Message* msg = new GpuCommandBufferMsg_UpdateState(route_id_, state); |
| 442 msg->set_unblock(true); | 442 msg->set_unblock(true); |
| 443 Send(msg); | 443 Send(msg); |
| 444 } | 444 } |
| 445 } | 445 } |
| 446 | 446 |
| 447 #endif // defined(ENABLE_GPU) | 447 #endif // defined(ENABLE_GPU) |
| OLD | NEW |