Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 204 software_)); | 204 software_)); |
| 205 router_.AddRoute(*route_id, stub.get()); | 205 router_.AddRoute(*route_id, stub.get()); |
| 206 stubs_.AddWithID(stub.release(), *route_id); | 206 stubs_.AddWithID(stub.release(), *route_id); |
| 207 #endif // ENABLE_GPU | 207 #endif // ENABLE_GPU |
| 208 } | 208 } |
| 209 | 209 |
| 210 GpuCommandBufferStub* GpuChannel::LookupCommandBuffer(int32 route_id) { | 210 GpuCommandBufferStub* GpuChannel::LookupCommandBuffer(int32 route_id) { |
| 211 return stubs_.Lookup(route_id); | 211 return stubs_.Lookup(route_id); |
| 212 } | 212 } |
| 213 | 213 |
| 214 std::vector<GpuCommandBufferStub*> GpuChannel::GetCommandBuffers() { | |
|
nduca
2012/01/27 10:10:13
Better to return the stubmap and let the code upst
Ken Russell (switch to Gerrit)
2012/01/27 19:21:24
Returning the StubMap would expose more implementa
mmocny
2012/01/27 19:51:33
I had it that way at first, but this was cleaner.
| |
| 215 std::vector<GpuCommandBufferStub*> ret; | |
| 216 for (StubMap::Iterator<GpuCommandBufferStub> it(&stubs_); | |
| 217 !it.IsAtEnd(); it.Advance()) { | |
| 218 ret.push_back(it.GetCurrentValue()); | |
| 219 } | |
| 220 return ret; | |
| 221 } | |
| 222 | |
| 214 bool GpuChannel::OnControlMessageReceived(const IPC::Message& msg) { | 223 bool GpuChannel::OnControlMessageReceived(const IPC::Message& msg) { |
| 215 // Always use IPC_MESSAGE_HANDLER_DELAY_REPLY for synchronous message handlers | 224 // Always use IPC_MESSAGE_HANDLER_DELAY_REPLY for synchronous message handlers |
| 216 // here. This is so the reply can be delayed if the scheduler is unscheduled. | 225 // here. This is so the reply can be delayed if the scheduler is unscheduled. |
| 217 bool handled = true; | 226 bool handled = true; |
| 218 IPC_BEGIN_MESSAGE_MAP(GpuChannel, msg) | 227 IPC_BEGIN_MESSAGE_MAP(GpuChannel, msg) |
| 219 IPC_MESSAGE_HANDLER(GpuChannelMsg_Initialize, OnInitialize) | 228 IPC_MESSAGE_HANDLER(GpuChannelMsg_Initialize, OnInitialize) |
| 220 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuChannelMsg_CreateOffscreenCommandBuffer, | 229 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuChannelMsg_CreateOffscreenCommandBuffer, |
| 221 OnCreateOffscreenCommandBuffer) | 230 OnCreateOffscreenCommandBuffer) |
| 222 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuChannelMsg_DestroyCommandBuffer, | 231 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuChannelMsg_DestroyCommandBuffer, |
| 223 OnDestroyCommandBuffer) | 232 OnDestroyCommandBuffer) |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 432 | 441 |
| 433 #if defined(OS_POSIX) | 442 #if defined(OS_POSIX) |
| 434 int GpuChannel::TakeRendererFileDescriptor() { | 443 int GpuChannel::TakeRendererFileDescriptor() { |
| 435 if (!channel_.get()) { | 444 if (!channel_.get()) { |
| 436 NOTREACHED(); | 445 NOTREACHED(); |
| 437 return -1; | 446 return -1; |
| 438 } | 447 } |
| 439 return channel_->TakeClientFileDescriptor(); | 448 return channel_->TakeClientFileDescriptor(); |
| 440 } | 449 } |
| 441 #endif // defined(OS_POSIX) | 450 #endif // defined(OS_POSIX) |
| OLD | NEW |