Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/process_util.h" | 7 #include "base/process_util.h" |
| 8 #include "base/shared_memory.h" | 8 #include "base/shared_memory.h" |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "chrome/common/child_thread.h" | 10 #include "chrome/common/child_thread.h" |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 250 #if defined(OS_MACOSX) | 250 #if defined(OS_MACOSX) |
| 251 if (handle_) { | 251 if (handle_) { |
| 252 // This context conceptually puts its output directly on the | 252 // This context conceptually puts its output directly on the |
| 253 // screen, rendered by the accelerated plugin layer in | 253 // screen, rendered by the accelerated plugin layer in |
| 254 // RenderWidgetHostViewMac. Set up a pathway to notify the | 254 // RenderWidgetHostViewMac. Set up a pathway to notify the |
| 255 // browser process when its contents change. | 255 // browser process when its contents change. |
| 256 processor_->SetSwapBuffersCallback( | 256 processor_->SetSwapBuffersCallback( |
| 257 NewCallback(this, | 257 NewCallback(this, |
| 258 &GpuCommandBufferStub::SwapBuffersCallback)); | 258 &GpuCommandBufferStub::SwapBuffersCallback)); |
| 259 } | 259 } |
| 260 #elif defined(OS_LINUX) || defined(OS_WIN) | |
| 261 if (handle_) { | |
| 262 // Set up a pathway for resizing the output window at the right time | |
| 263 // relative to other GL commands. | |
| 264 processor_->SetResizeCallback( | |
| 265 NewCallback(this, | |
| 266 &GpuCommandBufferStub::ResizeCallback)); | |
| 267 } | |
| 268 #endif // defined(OS_MACOSX) | 260 #endif // defined(OS_MACOSX) |
| 261 | |
| 262 // Set up a pathway for resizing the output window or framebuffer at the | |
| 263 // right time relative to other GL commands. | |
| 264 processor_->SetResizeCallback( | |
| 265 NewCallback(this, | |
|
neb
2011/01/25 19:16:06
This can fit on the same line, no?
Antoine Labour
2011/01/25 19:32:24
Done.
| |
| 266 &GpuCommandBufferStub::ResizeCallback)); | |
| 269 } else { | 267 } else { |
| 270 processor_.reset(); | 268 processor_.reset(); |
| 271 command_buffer_.reset(); | 269 command_buffer_.reset(); |
| 272 } | 270 } |
| 273 } | 271 } |
| 274 } | 272 } |
| 275 } | 273 } |
| 276 | 274 |
| 277 void GpuCommandBufferStub::OnGetState(gpu::CommandBuffer::State* state) { | 275 void GpuCommandBufferStub::OnGetState(gpu::CommandBuffer::State* state) { |
| 278 *state = command_buffer_->GetState(); | 276 *state = command_buffer_->GetState(); |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 368 | 366 |
| 369 void GpuCommandBufferStub::AcceleratedSurfaceBuffersSwapped( | 367 void GpuCommandBufferStub::AcceleratedSurfaceBuffersSwapped( |
| 370 uint64 swap_buffers_count) { | 368 uint64 swap_buffers_count) { |
| 371 processor_->set_acknowledged_swap_buffers_count(swap_buffers_count); | 369 processor_->set_acknowledged_swap_buffers_count(swap_buffers_count); |
| 372 // Wake up the GpuProcessor to start doing work again. | 370 // Wake up the GpuProcessor to start doing work again. |
| 373 processor_->ScheduleProcessCommands(); | 371 processor_->ScheduleProcessCommands(); |
| 374 } | 372 } |
| 375 #endif // defined(OS_MACOSX) | 373 #endif // defined(OS_MACOSX) |
| 376 | 374 |
| 377 void GpuCommandBufferStub::ResizeCallback(gfx::Size size) { | 375 void GpuCommandBufferStub::ResizeCallback(gfx::Size size) { |
| 378 if (handle_ == gfx::kNullPluginWindow) | 376 if (handle_ == gfx::kNullPluginWindow) { |
| 379 return; | 377 processor_->decoder()->ResizeOffscreenFrameBuffer(size); |
| 380 | 378 processor_->decoder()->UpdateOffscreenFrameBufferSize(); |
| 379 } else { | |
| 381 #if defined(OS_LINUX) | 380 #if defined(OS_LINUX) |
| 382 GpuThread* gpu_thread = channel_->gpu_thread(); | 381 GpuThread* gpu_thread = channel_->gpu_thread(); |
| 383 bool result = false; | 382 bool result = false; |
| 384 gpu_thread->Send( | 383 gpu_thread->Send( |
| 385 new GpuHostMsg_ResizeXID(handle_, size, &result)); | 384 new GpuHostMsg_ResizeXID(handle_, size, &result)); |
| 386 #elif defined(OS_WIN) | 385 #elif defined(OS_WIN) |
| 387 HWND hwnd = static_cast<HWND>(compositor_window_); | 386 HWND hwnd = static_cast<HWND>(compositor_window_); |
| 388 UINT swp_flags = SWP_NOSENDCHANGING | SWP_NOOWNERZORDER | SWP_NOCOPYBITS | | 387 UINT swp_flags = SWP_NOSENDCHANGING | SWP_NOOWNERZORDER | SWP_NOCOPYBITS | |
| 389 SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_DEFERERASE; | 388 SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_DEFERERASE; |
| 390 SetWindowPos(hwnd, NULL, 0, 0, size.width(), size.height(), swp_flags); | 389 SetWindowPos(hwnd, NULL, 0, 0, size.width(), size.height(), swp_flags); |
| 391 #endif // defined(OS_LINUX) | 390 #endif // defined(OS_LINUX) |
| 391 } | |
| 392 } | 392 } |
| 393 | 393 |
| 394 #endif // defined(ENABLE_GPU) | 394 #endif // defined(ENABLE_GPU) |
| OLD | NEW |