| 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 static size_t kNumThrottleFences = 1; | 16 static size_t kNumThrottleFences = 1; |
| 17 | 17 |
| 18 namespace gpu { | 18 namespace gpu { |
| 19 | 19 |
| 20 GpuScheduler::GpuScheduler(CommandBuffer* command_buffer, | 20 GpuScheduler::GpuScheduler(CommandBuffer* command_buffer, |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 parser_.reset(); | 118 parser_.reset(); |
| 119 } | 119 } |
| 120 | 120 |
| 121 #if defined(OS_MACOSX) | 121 #if defined(OS_MACOSX) |
| 122 namespace { | 122 namespace { |
| 123 const unsigned int kMaxOutstandingSwapBuffersCallsPerOnscreenContext = 1; | 123 const unsigned int kMaxOutstandingSwapBuffersCallsPerOnscreenContext = 1; |
| 124 } | 124 } |
| 125 #endif | 125 #endif |
| 126 | 126 |
| 127 void GpuScheduler::ProcessCommands() { | 127 void GpuScheduler::ProcessCommands() { |
| 128 GPU_TRACE_EVENT0("gpu", "GpuScheduler:ProcessCommands"); | 128 TRACE_EVENT0("gpu", "GpuScheduler:ProcessCommands"); |
| 129 CommandBuffer::State state = command_buffer_->GetState(); | 129 CommandBuffer::State state = command_buffer_->GetState(); |
| 130 if (state.error != error::kNoError) | 130 if (state.error != error::kNoError) |
| 131 return; | 131 return; |
| 132 | 132 |
| 133 if (decoder_.get()) { | 133 if (decoder_.get()) { |
| 134 if (!decoder_->MakeCurrent()) { | 134 if (!decoder_->MakeCurrent()) { |
| 135 LOG(ERROR) << "Context lost because MakeCurrent failed."; | 135 LOG(ERROR) << "Context lost because MakeCurrent failed."; |
| 136 command_buffer_->SetParseError(error::kLostContext); | 136 command_buffer_->SetParseError(error::kLostContext); |
| 137 return; | 137 return; |
| 138 } | 138 } |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 NewCallback(this, | 247 NewCallback(this, |
| 248 &GpuScheduler::WillSwapBuffers)); | 248 &GpuScheduler::WillSwapBuffers)); |
| 249 } | 249 } |
| 250 | 250 |
| 251 void GpuScheduler::SetCommandProcessedCallback( | 251 void GpuScheduler::SetCommandProcessedCallback( |
| 252 Callback0::Type* callback) { | 252 Callback0::Type* callback) { |
| 253 command_processed_callback_.reset(callback); | 253 command_processed_callback_.reset(callback); |
| 254 } | 254 } |
| 255 | 255 |
| 256 } // namespace gpu | 256 } // namespace gpu |
| OLD | NEW |