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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 capabilities_.gpu = context_->GetImplementation()->capabilities(); | 115 capabilities_.gpu = context_->GetImplementation()->capabilities(); |
116 | 116 |
117 std::string unique_context_name = | 117 std::string unique_context_name = |
118 base::StringPrintf("%s-%p", debug_name_.c_str(), context_.get()); | 118 base::StringPrintf("%s-%p", debug_name_.c_str(), context_.get()); |
119 context_->GetImplementation()->TraceBeginCHROMIUM( | 119 context_->GetImplementation()->TraceBeginCHROMIUM( |
120 "gpu_toplevel", unique_context_name.c_str()); | 120 "gpu_toplevel", unique_context_name.c_str()); |
121 | 121 |
122 return true; | 122 return true; |
123 } | 123 } |
124 | 124 |
125 void InProcessContextProvider::DetachFromThread() { | |
126 context_thread_checker_.DetachFromThread(); | |
127 } | |
128 | |
129 cc::ContextProvider::Capabilities | 125 cc::ContextProvider::Capabilities |
130 InProcessContextProvider::ContextCapabilities() { | 126 InProcessContextProvider::ContextCapabilities() { |
131 DCHECK(context_thread_checker_.CalledOnValidThread()); | 127 DCHECK(context_thread_checker_.CalledOnValidThread()); |
132 return capabilities_; | 128 return capabilities_; |
133 } | 129 } |
134 | 130 |
135 gpu::gles2::GLES2Interface* InProcessContextProvider::ContextGL() { | 131 gpu::gles2::GLES2Interface* InProcessContextProvider::ContextGL() { |
136 DCHECK(context_thread_checker_.CalledOnValidThread()); | 132 DCHECK(context_thread_checker_.CalledOnValidThread()); |
137 | 133 |
138 return context_->GetImplementation(); | 134 return context_->GetImplementation(); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 return; | 221 return; |
226 destroyed_ = true; | 222 destroyed_ = true; |
227 } | 223 } |
228 if (!lost_context_callback_.is_null()) | 224 if (!lost_context_callback_.is_null()) |
229 base::ResetAndReturn(&lost_context_callback_).Run(); | 225 base::ResetAndReturn(&lost_context_callback_).Run(); |
230 if (gr_context_) | 226 if (gr_context_) |
231 gr_context_->abandonContext(); | 227 gr_context_->abandonContext(); |
232 } | 228 } |
233 | 229 |
234 } // namespace ui | 230 } // namespace ui |
OLD | NEW |