| 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 break; | 73 break; |
| 74 } | 74 } |
| 75 default: | 75 default: |
| 76 return DefWindowProc(hwnd, message, wparam, lparam); | 76 return DefWindowProc(hwnd, message, wparam, lparam); |
| 77 } | 77 } |
| 78 return 0; | 78 return 0; |
| 79 } | 79 } |
| 80 | 80 |
| 81 bool GpuCommandBufferStub::CreateCompositorWindow() { | 81 bool GpuCommandBufferStub::CreateCompositorWindow() { |
| 82 DCHECK(handle_ != gfx::kNullPluginWindow); | 82 DCHECK(handle_ != gfx::kNullPluginWindow); |
| 83 | 83 HWND host_window = static_cast<HWND>(handle_); |
| 84 // Ask the browser to create the the host window. | |
| 85 GpuThread* gpu_thread = channel_->gpu_thread(); | |
| 86 gfx::PluginWindowHandle host_window_id = gfx::kNullPluginWindow; | |
| 87 gpu_thread->Send(new GpuHostMsg_GetCompositorHostWindow( | |
| 88 renderer_id_, | |
| 89 render_view_id_, | |
| 90 &host_window_id)); | |
| 91 if (host_window_id == gfx::kNullPluginWindow) | |
| 92 return false; | |
| 93 HWND host_window = static_cast<HWND>(host_window_id); | |
| 94 | 84 |
| 95 // Create the compositor window itself. | 85 // Create the compositor window itself. |
| 96 DCHECK(host_window); | 86 DCHECK(host_window); |
| 97 static ATOM window_class = 0; | 87 static ATOM window_class = 0; |
| 98 if (!window_class) { | 88 if (!window_class) { |
| 99 WNDCLASSEX wcex; | 89 WNDCLASSEX wcex; |
| 100 wcex.cbSize = sizeof(wcex); | 90 wcex.cbSize = sizeof(wcex); |
| 101 wcex.style = 0; | 91 wcex.style = 0; |
| 102 wcex.lpfnWndProc = CompositorWindowProc; | 92 wcex.lpfnWndProc = CompositorWindowProc; |
| 103 wcex.cbClsExtra = 0; | 93 wcex.cbClsExtra = 0; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 | 146 |
| 157 GpuCommandBufferStub::~GpuCommandBufferStub() { | 147 GpuCommandBufferStub::~GpuCommandBufferStub() { |
| 158 if (processor_.get()) { | 148 if (processor_.get()) { |
| 159 processor_->Destroy(); | 149 processor_->Destroy(); |
| 160 } | 150 } |
| 161 #if defined(OS_WIN) | 151 #if defined(OS_WIN) |
| 162 if (compositor_window_) { | 152 if (compositor_window_) { |
| 163 DestroyWindow(static_cast<HWND>(compositor_window_)); | 153 DestroyWindow(static_cast<HWND>(compositor_window_)); |
| 164 compositor_window_ = NULL; | 154 compositor_window_ = NULL; |
| 165 } | 155 } |
| 166 #elif defined(OS_LINUX) | 156 #endif // defined(OS_WIN) |
| 157 |
| 167 GpuThread* gpu_thread = channel_->gpu_thread(); | 158 GpuThread* gpu_thread = channel_->gpu_thread(); |
| 168 gpu_thread->Send( | 159 gpu_thread->Send(new GpuHostMsg_DestroyCommandBuffer( |
| 169 new GpuHostMsg_ReleaseXID(handle_)); | 160 handle_, renderer_id_, render_view_id_)); |
| 170 #endif // defined(OS_WIN) | |
| 171 } | 161 } |
| 172 | 162 |
| 173 bool GpuCommandBufferStub::OnMessageReceived(const IPC::Message& message) { | 163 bool GpuCommandBufferStub::OnMessageReceived(const IPC::Message& message) { |
| 174 bool handled = true; | 164 bool handled = true; |
| 175 IPC_BEGIN_MESSAGE_MAP(GpuCommandBufferStub, message) | 165 IPC_BEGIN_MESSAGE_MAP(GpuCommandBufferStub, message) |
| 176 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Initialize, OnInitialize); | 166 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Initialize, OnInitialize); |
| 177 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_GetState, OnGetState); | 167 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_GetState, OnGetState); |
| 178 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_AsyncGetState, OnAsyncGetState); | 168 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_AsyncGetState, OnAsyncGetState); |
| 179 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Flush, OnFlush); | 169 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Flush, OnFlush); |
| 180 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_AsyncFlush, OnAsyncFlush); | 170 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_AsyncFlush, OnAsyncFlush); |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 #elif defined(OS_WIN) | 374 #elif defined(OS_WIN) |
| 385 HWND hwnd = static_cast<HWND>(compositor_window_); | 375 HWND hwnd = static_cast<HWND>(compositor_window_); |
| 386 UINT swp_flags = SWP_NOSENDCHANGING | SWP_NOOWNERZORDER | SWP_NOCOPYBITS | | 376 UINT swp_flags = SWP_NOSENDCHANGING | SWP_NOOWNERZORDER | SWP_NOCOPYBITS | |
| 387 SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_DEFERERASE; | 377 SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_DEFERERASE; |
| 388 SetWindowPos(hwnd, NULL, 0, 0, size.width(), size.height(), swp_flags); | 378 SetWindowPos(hwnd, NULL, 0, 0, size.width(), size.height(), swp_flags); |
| 389 #endif // defined(OS_LINUX) | 379 #endif // defined(OS_LINUX) |
| 390 } | 380 } |
| 391 } | 381 } |
| 392 | 382 |
| 393 #endif // defined(ENABLE_GPU) | 383 #endif // defined(ENABLE_GPU) |
| OLD | NEW |