| 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 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 } | 407 } |
| 408 | 408 |
| 409 void GpuCommandBufferStub::ViewResized() { | 409 void GpuCommandBufferStub::ViewResized() { |
| 410 #if defined(OS_LINUX) && !defined(TOUCH_UI) || defined(OS_WIN) | 410 #if defined(OS_LINUX) && !defined(TOUCH_UI) || defined(OS_WIN) |
| 411 DCHECK(handle_ != gfx::kNullPluginWindow); | 411 DCHECK(handle_ != gfx::kNullPluginWindow); |
| 412 scheduler_->SetScheduled(true); | 412 scheduler_->SetScheduled(true); |
| 413 | 413 |
| 414 // Recreate the view surface to match the window size. TODO(apatrick): this is | 414 // Recreate the view surface to match the window size. TODO(apatrick): this is |
| 415 // likely not necessary on all platforms. | 415 // likely not necessary on all platforms. |
| 416 gfx::GLContext* context = scheduler_->decoder()->GetGLContext(); | 416 gfx::GLContext* context = scheduler_->decoder()->GetGLContext(); |
| 417 context->ReleaseCurrent(); | 417 gfx::GLSurface* surface = scheduler_->decoder()->GetGLSurface(); |
| 418 gfx::GLSurface* surface = context->GetSurface(); | 418 context->ReleaseCurrent(surface); |
| 419 if (surface) { | 419 if (surface) { |
| 420 surface->Destroy(); | 420 surface->Destroy(); |
| 421 surface->Initialize(); | 421 surface->Initialize(); |
| 422 } | 422 } |
| 423 #endif | 423 #endif |
| 424 } | 424 } |
| 425 | 425 |
| 426 void GpuCommandBufferStub::ReportState() { | 426 void GpuCommandBufferStub::ReportState() { |
| 427 gpu::CommandBuffer::State state = command_buffer_->GetState(); | 427 gpu::CommandBuffer::State state = command_buffer_->GetState(); |
| 428 if (state.error == gpu::error::kLostContext && | 428 if (state.error == gpu::error::kLostContext && |
| 429 gfx::GLContext::LosesAllContextsOnContextLost()) { | 429 gfx::GLContext::LosesAllContextsOnContextLost()) { |
| 430 channel_->LoseAllContexts(); | 430 channel_->LoseAllContexts(); |
| 431 } else { | 431 } else { |
| 432 IPC::Message* msg = new GpuCommandBufferMsg_UpdateState(route_id_, state); | 432 IPC::Message* msg = new GpuCommandBufferMsg_UpdateState(route_id_, state); |
| 433 msg->set_unblock(true); | 433 msg->set_unblock(true); |
| 434 Send(msg); | 434 Send(msg); |
| 435 } | 435 } |
| 436 } | 436 } |
| 437 | 437 |
| 438 #endif // defined(ENABLE_GPU) | 438 #endif // defined(ENABLE_GPU) |
| OLD | NEW |