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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 InProcessContextProvider::~InProcessContextProvider() { | 76 InProcessContextProvider::~InProcessContextProvider() { |
77 DCHECK(main_thread_checker_.CalledOnValidThread() || | 77 DCHECK(main_thread_checker_.CalledOnValidThread() || |
78 context_thread_checker_.CalledOnValidThread()); | 78 context_thread_checker_.CalledOnValidThread()); |
79 } | 79 } |
80 | 80 |
81 bool InProcessContextProvider::BindToCurrentThread() { | 81 bool InProcessContextProvider::BindToCurrentThread() { |
82 // This is called on the thread the context will be used. | 82 // This is called on the thread the context will be used. |
83 DCHECK(context_thread_checker_.CalledOnValidThread()); | 83 DCHECK(context_thread_checker_.CalledOnValidThread()); |
84 | 84 |
85 if (!context_) { | 85 if (!context_) { |
86 gfx::GpuPreference gpu_preference = gfx::PreferDiscreteGpu; | 86 gl::GpuPreference gpu_preference = gl::PreferDiscreteGpu; |
87 context_.reset(gpu::GLInProcessContext::Create( | 87 context_.reset(gpu::GLInProcessContext::Create( |
88 nullptr, /* service */ | 88 nullptr, /* service */ |
89 nullptr, /* surface */ | 89 nullptr, /* surface */ |
90 !window_, /* is_offscreen */ | 90 !window_, /* is_offscreen */ |
91 window_, gfx::Size(1, 1), | 91 window_, gfx::Size(1, 1), |
92 (shared_context_ ? shared_context_->context_.get() : nullptr), attribs_, | 92 (shared_context_ ? shared_context_->context_.get() : nullptr), attribs_, |
93 gpu_preference, gpu::SharedMemoryLimits(), gpu_memory_buffer_manager_, | 93 gpu_preference, gpu::SharedMemoryLimits(), gpu_memory_buffer_manager_, |
94 image_factory_)); | 94 image_factory_)); |
95 | 95 |
96 if (!context_) | 96 if (!context_) |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 if (gr_context_) | 154 if (gr_context_) |
155 gr_context_->FreeGpuResources(); | 155 gr_context_->FreeGpuResources(); |
156 } | 156 } |
157 | 157 |
158 void InProcessContextProvider::SetLostContextCallback( | 158 void InProcessContextProvider::SetLostContextCallback( |
159 const LostContextCallback& lost_context_callback) { | 159 const LostContextCallback& lost_context_callback) { |
160 // Pixel tests do not test lost context. | 160 // Pixel tests do not test lost context. |
161 } | 161 } |
162 | 162 |
163 } // namespace ui | 163 } // namespace ui |
OLD | NEW |