Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(187)

Side by Side Diff: ui/compositor/test/in_process_context_provider.cc

Issue 963903002: ui: Make InProcess context on-screen if it has a window. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698