| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 | 57 |
| 58 void GpuChannel::OnLatchCallback(int route_id, bool is_set_latch) { | 58 void GpuChannel::OnLatchCallback(int route_id, bool is_set_latch) { |
| 59 #if defined(ENABLE_GPU) | 59 #if defined(ENABLE_GPU) |
| 60 if (is_set_latch) { | 60 if (is_set_latch) { |
| 61 // Wake up any waiting contexts. If they are still blocked, they will re-add | 61 // Wake up any waiting contexts. If they are still blocked, they will re-add |
| 62 // themselves to the set. | 62 // themselves to the set. |
| 63 for (std::set<int32>::iterator i = latched_routes_.begin(); | 63 for (std::set<int32>::iterator i = latched_routes_.begin(); |
| 64 i != latched_routes_.end(); ++i) { | 64 i != latched_routes_.end(); ++i) { |
| 65 GpuCommandBufferStub* stub = stubs_.Lookup(*i); | 65 GpuCommandBufferStub* stub = stubs_.Lookup(*i); |
| 66 if (stub) | 66 if (stub) |
| 67 stub->scheduler()->ScheduleProcessCommands(); | 67 stub->scheduler()->SetScheduled(true); |
| 68 } | 68 } |
| 69 latched_routes_.clear(); | 69 latched_routes_.clear(); |
| 70 } else { | 70 } else { |
| 71 // Add route_id context to a set to be woken upon any set latch. | 71 // Add route_id context to a set to be woken upon any set latch. |
| 72 latched_routes_.insert(route_id); | 72 latched_routes_.insert(route_id); |
| 73 GpuCommandBufferStub* stub = stubs_.Lookup(route_id); |
| 74 if (stub) |
| 75 stub->scheduler()->SetScheduled(false); |
| 73 } | 76 } |
| 74 #endif | 77 #endif |
| 75 } | 78 } |
| 76 | 79 |
| 77 bool GpuChannel::OnMessageReceived(const IPC::Message& message) { | 80 bool GpuChannel::OnMessageReceived(const IPC::Message& message) { |
| 78 if (log_messages_) { | 81 if (log_messages_) { |
| 79 VLOG(1) << "received message @" << &message << " on channel @" << this | 82 VLOG(1) << "received message @" << &message << " on channel @" << this |
| 80 << " with type " << message.type(); | 83 << " with type " << message.type(); |
| 81 } | 84 } |
| 82 | 85 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 scoped_ptr<GpuCommandBufferStub> stub(new GpuCommandBufferStub( | 138 scoped_ptr<GpuCommandBufferStub> stub(new GpuCommandBufferStub( |
| 136 this, window, NULL, gfx::Size(), disallowed_extensions_, | 139 this, window, NULL, gfx::Size(), disallowed_extensions_, |
| 137 init_params.allowed_extensions, | 140 init_params.allowed_extensions, |
| 138 init_params.attribs, 0, *route_id, renderer_id_, render_view_id, | 141 init_params.attribs, 0, *route_id, renderer_id_, render_view_id, |
| 139 watchdog_)); | 142 watchdog_)); |
| 140 router_.AddRoute(*route_id, stub.get()); | 143 router_.AddRoute(*route_id, stub.get()); |
| 141 stubs_.AddWithID(stub.release(), *route_id); | 144 stubs_.AddWithID(stub.release(), *route_id); |
| 142 #endif // ENABLE_GPU | 145 #endif // ENABLE_GPU |
| 143 } | 146 } |
| 144 | 147 |
| 148 void GpuChannel::ViewResized(int32 command_buffer_route_id) { |
| 149 GpuCommandBufferStub* stub = stubs_.Lookup(command_buffer_route_id); |
| 150 if (stub == NULL) |
| 151 return; |
| 152 |
| 153 stub->ViewResized(); |
| 154 } |
| 155 |
| 145 #if defined(OS_MACOSX) | 156 #if defined(OS_MACOSX) |
| 146 void GpuChannel::AcceleratedSurfaceBuffersSwapped( | 157 void GpuChannel::AcceleratedSurfaceBuffersSwapped( |
| 147 int32 route_id, uint64 swap_buffers_count) { | 158 int32 route_id, uint64 swap_buffers_count) { |
| 148 GpuCommandBufferStub* stub = stubs_.Lookup(route_id); | 159 GpuCommandBufferStub* stub = stubs_.Lookup(route_id); |
| 149 if (stub == NULL) | 160 if (stub == NULL) |
| 150 return; | 161 return; |
| 151 stub->AcceleratedSurfaceBuffersSwapped(swap_buffers_count); | 162 stub->AcceleratedSurfaceBuffersSwapped(swap_buffers_count); |
| 152 } | 163 } |
| 153 | 164 |
| 154 void GpuChannel::DestroyCommandBufferByViewId(int32 render_view_id) { | 165 void GpuChannel::DestroyCommandBufferByViewId(int32 render_view_id) { |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 | 328 |
| 318 #if defined(OS_POSIX) | 329 #if defined(OS_POSIX) |
| 319 int GpuChannel::GetRendererFileDescriptor() { | 330 int GpuChannel::GetRendererFileDescriptor() { |
| 320 int fd = -1; | 331 int fd = -1; |
| 321 if (channel_.get()) { | 332 if (channel_.get()) { |
| 322 fd = channel_->GetClientFileDescriptor(); | 333 fd = channel_->GetClientFileDescriptor(); |
| 323 } | 334 } |
| 324 return fd; | 335 return fd; |
| 325 } | 336 } |
| 326 #endif // defined(OS_POSIX) | 337 #endif // defined(OS_POSIX) |
| OLD | NEW |