Chromium Code Reviews| 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 86 context_thread_checker_.CalledOnValidThread()); | 86 context_thread_checker_.CalledOnValidThread()); |
| 87 } | 87 } |
| 88 | 88 |
| 89 bool InProcessContextProvider::BindToCurrentThread() { | 89 bool InProcessContextProvider::BindToCurrentThread() { |
| 90 // This is called on the thread the context will be used. | 90 // This is called on the thread the context will be used. |
| 91 DCHECK(context_thread_checker_.CalledOnValidThread()); | 91 DCHECK(context_thread_checker_.CalledOnValidThread()); |
| 92 | 92 |
| 93 if (!context_) { | 93 if (!context_) { |
| 94 gfx::GpuPreference gpu_preference = gfx::PreferDiscreteGpu; | 94 gfx::GpuPreference gpu_preference = gfx::PreferDiscreteGpu; |
| 95 context_.reset(gpu::GLInProcessContext::Create( | 95 context_.reset(gpu::GLInProcessContext::Create( |
| 96 nullptr, /* service */ | 96 nullptr, /* service */ |
| 97 nullptr, /* surface */ | 97 nullptr, /* surface */ |
| 98 true, /* is_offscreen */ | 98 !window_, /* is_offscreen */ |
| 99 window_, | 99 window_, gfx::Size(1, 1), nullptr, /* share_context */ |
|
tfarina
2015/02/28 00:19:28
I know this is was formatted by clang. But one arg
danakj
2015/02/28 00:21:09
i don't disagree.
| |
| 100 gfx::Size(1, 1), | 100 true, /* share_resources */ |
| 101 nullptr, /* share_context */ | 101 attribs_, gpu_preference, gpu::GLInProcessContextSharedMemoryLimits(), |
| 102 true, /* share_resources */ | 102 nullptr, nullptr)); |
| 103 attribs_, | |
| 104 gpu_preference, | |
| 105 gpu::GLInProcessContextSharedMemoryLimits(), | |
| 106 nullptr, | |
| 107 nullptr)); | |
| 108 | 103 |
| 109 if (!context_) | 104 if (!context_) |
| 110 return false; | 105 return false; |
| 111 | 106 |
| 112 context_->SetContextLostCallback(base::Bind( | 107 context_->SetContextLostCallback(base::Bind( |
| 113 &InProcessContextProvider::OnLostContext, base::Unretained(this))); | 108 &InProcessContextProvider::OnLostContext, base::Unretained(this))); |
| 114 } | 109 } |
| 115 | 110 |
| 116 capabilities_.gpu = context_->GetImplementation()->capabilities(); | 111 capabilities_.gpu = context_->GetImplementation()->capabilities(); |
| 117 | 112 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 222 return; | 217 return; |
| 223 destroyed_ = true; | 218 destroyed_ = true; |
| 224 } | 219 } |
| 225 if (!lost_context_callback_.is_null()) | 220 if (!lost_context_callback_.is_null()) |
| 226 base::ResetAndReturn(&lost_context_callback_).Run(); | 221 base::ResetAndReturn(&lost_context_callback_).Run(); |
| 227 if (gr_context_) | 222 if (gr_context_) |
| 228 gr_context_->abandonContext(); | 223 gr_context_->abandonContext(); |
| 229 } | 224 } |
| 230 | 225 |
| 231 } // namespace ui | 226 } // namespace ui |
| OLD | NEW |