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 #include "gpu/command_buffer/service/gpu_scheduler.h" | 5 #include "gpu/command_buffer/service/gpu_scheduler.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/debug/trace_event.h" |
9 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
10 #include "gpu/common/gpu_trace_event.h" | |
11 #include "ui/gfx/gl/gl_context.h" | 11 #include "ui/gfx/gl/gl_context.h" |
12 #include "ui/gfx/gl/gl_bindings.h" | 12 #include "ui/gfx/gl/gl_bindings.h" |
13 | 13 |
14 using ::base::SharedMemory; | 14 using ::base::SharedMemory; |
15 | 15 |
16 namespace gpu { | 16 namespace gpu { |
17 | 17 |
18 GpuScheduler::GpuScheduler(CommandBuffer* command_buffer, | 18 GpuScheduler::GpuScheduler(CommandBuffer* command_buffer, |
19 gles2::ContextGroup* group) | 19 gles2::ContextGroup* group) |
20 : command_buffer_(command_buffer), | 20 : command_buffer_(command_buffer), |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 CommandBuffer::State state = command_buffer_->GetState(); | 121 CommandBuffer::State state = command_buffer_->GetState(); |
122 parser_->set_put(state.put_offset); | 122 parser_->set_put(state.put_offset); |
123 | 123 |
124 if (sync) | 124 if (sync) |
125 ProcessCommands(); | 125 ProcessCommands(); |
126 else | 126 else |
127 ScheduleProcessCommands(); | 127 ScheduleProcessCommands(); |
128 } | 128 } |
129 | 129 |
130 void GpuScheduler::ProcessCommands() { | 130 void GpuScheduler::ProcessCommands() { |
131 GPU_TRACE_EVENT0("gpu", "GpuScheduler:ProcessCommands"); | 131 TRACE_EVENT0("gpu", "GpuScheduler:ProcessCommands"); |
132 CommandBuffer::State state = command_buffer_->GetState(); | 132 CommandBuffer::State state = command_buffer_->GetState(); |
133 if (state.error != error::kNoError) | 133 if (state.error != error::kNoError) |
134 return; | 134 return; |
135 | 135 |
136 if (unscheduled_count_ > 0) | 136 if (unscheduled_count_ > 0) |
137 return; | 137 return; |
138 | 138 |
139 if (decoder_.get()) { | 139 if (decoder_.get()) { |
140 if (!decoder_->MakeCurrent()) { | 140 if (!decoder_->MakeCurrent()) { |
141 LOG(ERROR) << "Context lost because MakeCurrent failed."; | 141 LOG(ERROR) << "Context lost because MakeCurrent failed."; |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 command_processed_callback_.reset(callback); | 241 command_processed_callback_.reset(callback); |
242 } | 242 } |
243 | 243 |
244 void GpuScheduler::ScheduleProcessCommands() { | 244 void GpuScheduler::ScheduleProcessCommands() { |
245 MessageLoop::current()->PostTask( | 245 MessageLoop::current()->PostTask( |
246 FROM_HERE, | 246 FROM_HERE, |
247 method_factory_.NewRunnableMethod(&GpuScheduler::ProcessCommands)); | 247 method_factory_.NewRunnableMethod(&GpuScheduler::ProcessCommands)); |
248 } | 248 } |
249 | 249 |
250 } // namespace gpu | 250 } // namespace gpu |
OLD | NEW |