| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_processor.h" | 5 #include "gpu/command_buffer/service/gpu_processor.h" |
| 6 | 6 |
| 7 #include "app/gfx/gl/gl_bindings.h" | 7 #include "app/gfx/gl/gl_bindings.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/debug/trace_event.h" |
| 10 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
| 11 #include "app/gfx/gl/gl_context.h" | 12 #include "app/gfx/gl/gl_context.h" |
| 12 | 13 |
| 13 using ::base::SharedMemory; | 14 using ::base::SharedMemory; |
| 14 | 15 |
| 15 static size_t kNumThrottleFences = 1; | 16 static size_t kNumThrottleFences = 1; |
| 16 | 17 |
| 17 namespace gpu { | 18 namespace gpu { |
| 18 | 19 |
| 19 GPUProcessor::GPUProcessor(CommandBuffer* command_buffer, | 20 GPUProcessor::GPUProcessor(CommandBuffer* command_buffer, |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 parser_.reset(); | 115 parser_.reset(); |
| 115 } | 116 } |
| 116 | 117 |
| 117 #if defined(OS_MACOSX) | 118 #if defined(OS_MACOSX) |
| 118 namespace { | 119 namespace { |
| 119 const unsigned int kMaxOutstandingSwapBuffersCallsPerOnscreenContext = 1; | 120 const unsigned int kMaxOutstandingSwapBuffersCallsPerOnscreenContext = 1; |
| 120 } | 121 } |
| 121 #endif | 122 #endif |
| 122 | 123 |
| 123 void GPUProcessor::ProcessCommands() { | 124 void GPUProcessor::ProcessCommands() { |
| 125 TRACE_EVENT0("GPU_PERF", "GPUProcessor::ProcessCommands"); |
| 124 CommandBuffer::State state = command_buffer_->GetState(); | 126 CommandBuffer::State state = command_buffer_->GetState(); |
| 125 if (state.error != error::kNoError) | 127 if (state.error != error::kNoError) |
| 126 return; | 128 return; |
| 127 | 129 |
| 128 if (decoder_.get()) { | 130 if (decoder_.get()) { |
| 129 if (!decoder_->MakeCurrent()) { | 131 if (!decoder_->MakeCurrent()) { |
| 130 LOG(ERROR) << "Context lost because MakeCurrent failed."; | 132 LOG(ERROR) << "Context lost because MakeCurrent failed."; |
| 131 command_buffer_->SetParseError(error::kLostContext); | 133 command_buffer_->SetParseError(error::kLostContext); |
| 132 return; | 134 return; |
| 133 } | 135 } |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 | 233 |
| 232 void GPUProcessor::SetSwapBuffersCallback( | 234 void GPUProcessor::SetSwapBuffersCallback( |
| 233 Callback0::Type* callback) { | 235 Callback0::Type* callback) { |
| 234 wrapped_swap_buffers_callback_.reset(callback); | 236 wrapped_swap_buffers_callback_.reset(callback); |
| 235 decoder_->SetSwapBuffersCallback( | 237 decoder_->SetSwapBuffersCallback( |
| 236 NewCallback(this, | 238 NewCallback(this, |
| 237 &GPUProcessor::WillSwapBuffers)); | 239 &GPUProcessor::WillSwapBuffers)); |
| 238 } | 240 } |
| 239 | 241 |
| 240 } // namespace gpu | 242 } // namespace gpu |
| OLD | NEW |