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/macros.h" | 10 #include "base/macros.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 !window_, /* is_offscreen */ | 89 !window_, /* is_offscreen */ |
90 window_, gfx::Size(1, 1), | 90 window_, gfx::Size(1, 1), |
91 (shared_context_ ? shared_context_->context_.get() : nullptr), attribs_, | 91 (shared_context_ ? shared_context_->context_.get() : nullptr), attribs_, |
92 gpu_preference, gpu::GLInProcessContextSharedMemoryLimits(), | 92 gpu_preference, gpu::GLInProcessContextSharedMemoryLimits(), |
93 gpu_memory_buffer_manager_, image_factory_)); | 93 gpu_memory_buffer_manager_, image_factory_)); |
94 | 94 |
95 if (!context_) | 95 if (!context_) |
96 return false; | 96 return false; |
97 } | 97 } |
98 | 98 |
99 capabilities_.gpu = context_->GetImplementation()->capabilities(); | |
100 | |
101 std::string unique_context_name = | 99 std::string unique_context_name = |
102 base::StringPrintf("%s-%p", debug_name_.c_str(), context_.get()); | 100 base::StringPrintf("%s-%p", debug_name_.c_str(), context_.get()); |
103 context_->GetImplementation()->TraceBeginCHROMIUM( | 101 context_->GetImplementation()->TraceBeginCHROMIUM( |
104 "gpu_toplevel", unique_context_name.c_str()); | 102 "gpu_toplevel", unique_context_name.c_str()); |
105 | 103 |
106 return true; | 104 return true; |
107 } | 105 } |
108 | 106 |
109 void InProcessContextProvider::DetachFromThread() { | 107 void InProcessContextProvider::DetachFromThread() { |
110 context_thread_checker_.DetachFromThread(); | 108 context_thread_checker_.DetachFromThread(); |
111 } | 109 } |
112 | 110 |
113 cc::ContextProvider::Capabilities | 111 gpu::Capabilities InProcessContextProvider::ContextCapabilities() { |
114 InProcessContextProvider::ContextCapabilities() { | |
115 DCHECK(context_thread_checker_.CalledOnValidThread()); | 112 DCHECK(context_thread_checker_.CalledOnValidThread()); |
116 return capabilities_; | 113 return context_->GetImplementation()->capabilities(); |
117 } | 114 } |
118 | 115 |
119 gpu::gles2::GLES2Interface* InProcessContextProvider::ContextGL() { | 116 gpu::gles2::GLES2Interface* InProcessContextProvider::ContextGL() { |
120 DCHECK(context_thread_checker_.CalledOnValidThread()); | 117 DCHECK(context_thread_checker_.CalledOnValidThread()); |
121 | 118 |
122 return context_->GetImplementation(); | 119 return context_->GetImplementation(); |
123 } | 120 } |
124 | 121 |
125 gpu::ContextSupport* InProcessContextProvider::ContextSupport() { | 122 gpu::ContextSupport* InProcessContextProvider::ContextSupport() { |
126 DCHECK(context_thread_checker_.CalledOnValidThread()); | 123 DCHECK(context_thread_checker_.CalledOnValidThread()); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 if (gr_context_) | 156 if (gr_context_) |
160 gr_context_->FreeGpuResources(); | 157 gr_context_->FreeGpuResources(); |
161 } | 158 } |
162 | 159 |
163 void InProcessContextProvider::SetLostContextCallback( | 160 void InProcessContextProvider::SetLostContextCallback( |
164 const LostContextCallback& lost_context_callback) { | 161 const LostContextCallback& lost_context_callback) { |
165 // Pixel tests do not test lost context. | 162 // Pixel tests do not test lost context. |
166 } | 163 } |
167 | 164 |
168 } // namespace ui | 165 } // namespace ui |
OLD | NEW |