| 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(OS_WIN) | 5 #if defined(OS_WIN) |
| 6 #include <windows.h> | 6 #include <windows.h> |
| 7 #endif | 7 #endif |
| 8 | 8 |
| 9 #include "content/common/gpu/gpu_channel.h" | 9 #include "content/common/gpu/gpu_channel.h" |
| 10 | 10 |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 IPC_MESSAGE_HANDLER(GpuChannelMsg_Initialize, OnInitialize) | 253 IPC_MESSAGE_HANDLER(GpuChannelMsg_Initialize, OnInitialize) |
| 254 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuChannelMsg_CreateOffscreenCommandBuffer, | 254 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuChannelMsg_CreateOffscreenCommandBuffer, |
| 255 OnCreateOffscreenCommandBuffer) | 255 OnCreateOffscreenCommandBuffer) |
| 256 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuChannelMsg_DestroyCommandBuffer, | 256 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuChannelMsg_DestroyCommandBuffer, |
| 257 OnDestroyCommandBuffer) | 257 OnDestroyCommandBuffer) |
| 258 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuChannelMsg_CreateOffscreenSurface, | 258 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuChannelMsg_CreateOffscreenSurface, |
| 259 OnCreateOffscreenSurface) | 259 OnCreateOffscreenSurface) |
| 260 IPC_MESSAGE_HANDLER(GpuChannelMsg_DestroySurface, OnDestroySurface) | 260 IPC_MESSAGE_HANDLER(GpuChannelMsg_DestroySurface, OnDestroySurface) |
| 261 IPC_MESSAGE_HANDLER(GpuChannelMsg_CreateTransportTexture, | 261 IPC_MESSAGE_HANDLER(GpuChannelMsg_CreateTransportTexture, |
| 262 OnCreateTransportTexture) | 262 OnCreateTransportTexture) |
| 263 IPC_MESSAGE_HANDLER(GpuChannelMsg_Echo, OnEcho); |
| 263 IPC_MESSAGE_UNHANDLED(handled = false) | 264 IPC_MESSAGE_UNHANDLED(handled = false) |
| 264 IPC_END_MESSAGE_MAP() | 265 IPC_END_MESSAGE_MAP() |
| 265 DCHECK(handled) << msg.type(); | 266 DCHECK(handled) << msg.type(); |
| 266 return handled; | 267 return handled; |
| 267 } | 268 } |
| 268 | 269 |
| 269 void GpuChannel::HandleDeferredMessages() { | 270 void GpuChannel::HandleDeferredMessages() { |
| 270 // Empty the deferred queue so OnMessageRecieved does not defer on that | 271 // Empty the deferred queue so OnMessageRecieved does not defer on that |
| 271 // account and to prevent an infinite loop if the scheduler is unscheduled | 272 // account and to prevent an infinite loop if the scheduler is unscheduled |
| 272 // as a result of handling already deferred messages. | 273 // as a result of handling already deferred messages. |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 host_id, route_id)); | 405 host_id, route_id)); |
| 405 router_.AddRoute(route_id, transport.get()); | 406 router_.AddRoute(route_id, transport.get()); |
| 406 transport_textures_.AddWithID(transport.release(), route_id); | 407 transport_textures_.AddWithID(transport.release(), route_id); |
| 407 | 408 |
| 408 IPC::Message* msg = new GpuTransportTextureHostMsg_TransportTextureCreated( | 409 IPC::Message* msg = new GpuTransportTextureHostMsg_TransportTextureCreated( |
| 409 host_id, route_id); | 410 host_id, route_id); |
| 410 Send(msg); | 411 Send(msg); |
| 411 #endif | 412 #endif |
| 412 } | 413 } |
| 413 | 414 |
| 415 void GpuChannel::OnEcho(const IPC::Message& message) { |
| 416 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnEcho"); |
| 417 Send(new IPC::Message(message)); |
| 418 } |
| 419 |
| 414 bool GpuChannel::Init(base::MessageLoopProxy* io_message_loop, | 420 bool GpuChannel::Init(base::MessageLoopProxy* io_message_loop, |
| 415 base::WaitableEvent* shutdown_event) { | 421 base::WaitableEvent* shutdown_event) { |
| 416 // Check whether we're already initialized. | 422 // Check whether we're already initialized. |
| 417 if (channel_.get()) | 423 if (channel_.get()) |
| 418 return true; | 424 return true; |
| 419 | 425 |
| 420 // Map renderer ID to a (single) channel to that process. | 426 // Map renderer ID to a (single) channel to that process. |
| 421 std::string channel_name = GetChannelName(); | 427 std::string channel_name = GetChannelName(); |
| 422 channel_.reset(new IPC::SyncChannel( | 428 channel_.reset(new IPC::SyncChannel( |
| 423 channel_name, | 429 channel_name, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 436 | 442 |
| 437 #if defined(OS_POSIX) | 443 #if defined(OS_POSIX) |
| 438 int GpuChannel::GetRendererFileDescriptor() { | 444 int GpuChannel::GetRendererFileDescriptor() { |
| 439 int fd = -1; | 445 int fd = -1; |
| 440 if (channel_.get()) { | 446 if (channel_.get()) { |
| 441 fd = channel_->GetClientFileDescriptor(); | 447 fd = channel_->GetClientFileDescriptor(); |
| 442 } | 448 } |
| 443 return fd; | 449 return fd; |
| 444 } | 450 } |
| 445 #endif // defined(OS_POSIX) | 451 #endif // defined(OS_POSIX) |
| OLD | NEW |