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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 DestroyWindow(static_cast<HWND>(compositor_window_)); | 162 DestroyWindow(static_cast<HWND>(compositor_window_)); |
163 compositor_window_ = NULL; | 163 compositor_window_ = NULL; |
164 } | 164 } |
165 #elif defined(OS_LINUX) | 165 #elif defined(OS_LINUX) |
166 ChildThread* gpu_thread = ChildThread::current(); | 166 ChildThread* gpu_thread = ChildThread::current(); |
167 gpu_thread->Send( | 167 gpu_thread->Send( |
168 new GpuHostMsg_ReleaseXID(handle_)); | 168 new GpuHostMsg_ReleaseXID(handle_)); |
169 #endif // defined(OS_WIN) | 169 #endif // defined(OS_WIN) |
170 } | 170 } |
171 | 171 |
172 void GpuCommandBufferStub::OnMessageReceived(const IPC::Message& message) { | 172 bool GpuCommandBufferStub::OnMessageReceived(const IPC::Message& message) { |
| 173 bool handled = true; |
173 IPC_BEGIN_MESSAGE_MAP(GpuCommandBufferStub, message) | 174 IPC_BEGIN_MESSAGE_MAP(GpuCommandBufferStub, message) |
174 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Initialize, OnInitialize); | 175 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Initialize, OnInitialize); |
175 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_GetState, OnGetState); | 176 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_GetState, OnGetState); |
176 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_AsyncGetState, OnAsyncGetState); | 177 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_AsyncGetState, OnAsyncGetState); |
177 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Flush, OnFlush); | 178 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Flush, OnFlush); |
178 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_AsyncFlush, OnAsyncFlush); | 179 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_AsyncFlush, OnAsyncFlush); |
179 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_CreateTransferBuffer, | 180 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_CreateTransferBuffer, |
180 OnCreateTransferBuffer); | 181 OnCreateTransferBuffer); |
181 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_DestroyTransferBuffer, | 182 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_DestroyTransferBuffer, |
182 OnDestroyTransferBuffer); | 183 OnDestroyTransferBuffer); |
183 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_GetTransferBuffer, | 184 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_GetTransferBuffer, |
184 OnGetTransferBuffer); | 185 OnGetTransferBuffer); |
185 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_ResizeOffscreenFrameBuffer, | 186 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_ResizeOffscreenFrameBuffer, |
186 OnResizeOffscreenFrameBuffer); | 187 OnResizeOffscreenFrameBuffer); |
187 #if defined(OS_MACOSX) | 188 #if defined(OS_MACOSX) |
188 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SetWindowSize, OnSetWindowSize); | 189 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SetWindowSize, OnSetWindowSize); |
189 #endif // defined(OS_MACOSX) | 190 #endif // defined(OS_MACOSX) |
190 IPC_MESSAGE_UNHANDLED_ERROR() | 191 IPC_MESSAGE_UNHANDLED(handled = false) |
191 IPC_END_MESSAGE_MAP() | 192 IPC_END_MESSAGE_MAP() |
| 193 DCHECK(handled); |
| 194 return handled; |
192 } | 195 } |
193 | 196 |
194 bool GpuCommandBufferStub::Send(IPC::Message* message) { | 197 bool GpuCommandBufferStub::Send(IPC::Message* message) { |
195 return channel_->Send(message); | 198 return channel_->Send(message); |
196 } | 199 } |
197 | 200 |
198 void GpuCommandBufferStub::OnInitialize( | 201 void GpuCommandBufferStub::OnInitialize( |
199 int32 size, | 202 int32 size, |
200 base::SharedMemoryHandle* ring_buffer) { | 203 base::SharedMemoryHandle* ring_buffer) { |
201 DCHECK(!command_buffer_.get()); | 204 DCHECK(!command_buffer_.get()); |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 new GpuHostMsg_ResizeXID(handle_, size, &result)); | 384 new GpuHostMsg_ResizeXID(handle_, size, &result)); |
382 #elif defined(OS_WIN) | 385 #elif defined(OS_WIN) |
383 HWND hwnd = static_cast<HWND>(compositor_window_); | 386 HWND hwnd = static_cast<HWND>(compositor_window_); |
384 UINT swp_flags = SWP_NOSENDCHANGING | SWP_NOOWNERZORDER | SWP_NOCOPYBITS | | 387 UINT swp_flags = SWP_NOSENDCHANGING | SWP_NOOWNERZORDER | SWP_NOCOPYBITS | |
385 SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_DEFERERASE; | 388 SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_DEFERERASE; |
386 SetWindowPos(hwnd, NULL, 0, 0, size.width(), size.height(), swp_flags); | 389 SetWindowPos(hwnd, NULL, 0, 0, size.width(), size.height(), swp_flags); |
387 #endif // defined(OS_LINUX) | 390 #endif // defined(OS_LINUX) |
388 } | 391 } |
389 | 392 |
390 #endif // defined(ENABLE_GPU) | 393 #endif // defined(ENABLE_GPU) |
OLD | NEW |