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, &GpuCommandBufferStub::ResizeCallback)); |
269 } else { | 266 } else { |
270 processor_.reset(); | 267 processor_.reset(); |
271 command_buffer_.reset(); | 268 command_buffer_.reset(); |
272 } | 269 } |
273 } | 270 } |
274 } | 271 } |
275 } | 272 } |
276 | 273 |
277 void GpuCommandBufferStub::OnGetState(gpu::CommandBuffer::State* state) { | 274 void GpuCommandBufferStub::OnGetState(gpu::CommandBuffer::State* state) { |
278 *state = command_buffer_->GetState(); | 275 *state = command_buffer_->GetState(); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 | 365 |
369 void GpuCommandBufferStub::AcceleratedSurfaceBuffersSwapped( | 366 void GpuCommandBufferStub::AcceleratedSurfaceBuffersSwapped( |
370 uint64 swap_buffers_count) { | 367 uint64 swap_buffers_count) { |
371 processor_->set_acknowledged_swap_buffers_count(swap_buffers_count); | 368 processor_->set_acknowledged_swap_buffers_count(swap_buffers_count); |
372 // Wake up the GpuProcessor to start doing work again. | 369 // Wake up the GpuProcessor to start doing work again. |
373 processor_->ScheduleProcessCommands(); | 370 processor_->ScheduleProcessCommands(); |
374 } | 371 } |
375 #endif // defined(OS_MACOSX) | 372 #endif // defined(OS_MACOSX) |
376 | 373 |
377 void GpuCommandBufferStub::ResizeCallback(gfx::Size size) { | 374 void GpuCommandBufferStub::ResizeCallback(gfx::Size size) { |
378 if (handle_ == gfx::kNullPluginWindow) | 375 if (handle_ == gfx::kNullPluginWindow) { |
379 return; | 376 processor_->decoder()->ResizeOffscreenFrameBuffer(size); |
380 | 377 processor_->decoder()->UpdateOffscreenFrameBufferSize(); |
| 378 } else { |
381 #if defined(OS_LINUX) | 379 #if defined(OS_LINUX) |
382 GpuThread* gpu_thread = channel_->gpu_thread(); | 380 GpuThread* gpu_thread = channel_->gpu_thread(); |
383 bool result = false; | 381 bool result = false; |
384 gpu_thread->Send( | 382 gpu_thread->Send( |
385 new GpuHostMsg_ResizeXID(handle_, size, &result)); | 383 new GpuHostMsg_ResizeXID(handle_, size, &result)); |
386 #elif defined(OS_WIN) | 384 #elif defined(OS_WIN) |
387 HWND hwnd = static_cast<HWND>(compositor_window_); | 385 HWND hwnd = static_cast<HWND>(compositor_window_); |
388 UINT swp_flags = SWP_NOSENDCHANGING | SWP_NOOWNERZORDER | SWP_NOCOPYBITS | | 386 UINT swp_flags = SWP_NOSENDCHANGING | SWP_NOOWNERZORDER | SWP_NOCOPYBITS | |
389 SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_DEFERERASE; | 387 SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_DEFERERASE; |
390 SetWindowPos(hwnd, NULL, 0, 0, size.width(), size.height(), swp_flags); | 388 SetWindowPos(hwnd, NULL, 0, 0, size.width(), size.height(), swp_flags); |
391 #endif // defined(OS_LINUX) | 389 #endif // defined(OS_LINUX) |
| 390 } |
392 } | 391 } |
393 | 392 |
394 #endif // defined(ENABLE_GPU) | 393 #endif // defined(ENABLE_GPU) |
OLD | NEW |