| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "ui/compositor/test/in_process_context_provider.h" | 5 #include "ui/compositor/test/in_process_context_provider.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 capabilities_.gpu = context_->GetImplementation()->capabilities(); | 121 capabilities_.gpu = context_->GetImplementation()->capabilities(); |
| 122 | 122 |
| 123 std::string unique_context_name = | 123 std::string unique_context_name = |
| 124 base::StringPrintf("%s-%p", debug_name_.c_str(), context_.get()); | 124 base::StringPrintf("%s-%p", debug_name_.c_str(), context_.get()); |
| 125 context_->GetImplementation()->TraceBeginCHROMIUM( | 125 context_->GetImplementation()->TraceBeginCHROMIUM( |
| 126 "gpu_toplevel", unique_context_name.c_str()); | 126 "gpu_toplevel", unique_context_name.c_str()); |
| 127 | 127 |
| 128 return true; | 128 return true; |
| 129 } | 129 } |
| 130 | 130 |
| 131 void InProcessContextProvider::DetachFromThread() { |
| 132 context_thread_checker_.DetachFromThread(); |
| 133 } |
| 134 |
| 131 cc::ContextProvider::Capabilities | 135 cc::ContextProvider::Capabilities |
| 132 InProcessContextProvider::ContextCapabilities() { | 136 InProcessContextProvider::ContextCapabilities() { |
| 133 DCHECK(context_thread_checker_.CalledOnValidThread()); | 137 DCHECK(context_thread_checker_.CalledOnValidThread()); |
| 134 return capabilities_; | 138 return capabilities_; |
| 135 } | 139 } |
| 136 | 140 |
| 137 gpu::gles2::GLES2Interface* InProcessContextProvider::ContextGL() { | 141 gpu::gles2::GLES2Interface* InProcessContextProvider::ContextGL() { |
| 138 DCHECK(context_thread_checker_.CalledOnValidThread()); | 142 DCHECK(context_thread_checker_.CalledOnValidThread()); |
| 139 | 143 |
| 140 return context_->GetImplementation(); | 144 return context_->GetImplementation(); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 return; | 231 return; |
| 228 destroyed_ = true; | 232 destroyed_ = true; |
| 229 } | 233 } |
| 230 if (!lost_context_callback_.is_null()) | 234 if (!lost_context_callback_.is_null()) |
| 231 base::ResetAndReturn(&lost_context_callback_).Run(); | 235 base::ResetAndReturn(&lost_context_callback_).Run(); |
| 232 if (gr_context_) | 236 if (gr_context_) |
| 233 gr_context_->abandonContext(); | 237 gr_context_->abandonContext(); |
| 234 } | 238 } |
| 235 | 239 |
| 236 } // namespace ui | 240 } // namespace ui |
| OLD | NEW |