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

Side by Side Diff: android_webview/browser/test/fake_window.cc

Issue 2480373002: Refactor context creation parameters into a struct. (Closed)
Patch Set: Created 4 years, 1 month 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "android_webview/browser/test/fake_window.h" 5 #include "android_webview/browser/test/fake_window.h"
6 6
7 #include "android_webview/browser/browser_view_renderer.h" 7 #include "android_webview/browser/browser_view_renderer.h"
8 #include "android_webview/browser/child_frame.h" 8 #include "android_webview/browser/child_frame.h"
9 #include "android_webview/browser/render_thread_manager.h" 9 #include "android_webview/browser/render_thread_manager.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 FROM_HERE, base::Bind(&FakeWindow::InitializeOnRT, base::Unretained(this), 182 FROM_HERE, base::Bind(&FakeWindow::InitializeOnRT, base::Unretained(this),
183 &completion)); 183 &completion));
184 completion.Wait(); 184 completion.Wait();
185 } 185 }
186 186
187 void FakeWindow::InitializeOnRT(base::WaitableEvent* sync) { 187 void FakeWindow::InitializeOnRT(base::WaitableEvent* sync) {
188 CheckCurrentlyOnRT(); 188 CheckCurrentlyOnRT();
189 surface_ = gl::init::CreateOffscreenGLSurface(surface_size_); 189 surface_ = gl::init::CreateOffscreenGLSurface(surface_size_);
190 DCHECK(surface_); 190 DCHECK(surface_);
191 DCHECK(surface_->GetHandle()); 191 DCHECK(surface_->GetHandle());
192 gl::GLContextAttribs context_attribs;
193 context_attribs.gpu_preference = gl::PreferDiscreteGpu;
piman 2016/11/07 21:01:01 nit: ditto.
Geoff Lang 2016/11/07 21:36:20 Done.
192 context_ = 194 context_ =
193 gl::init::CreateGLContext(nullptr, surface_.get(), gl::PreferDiscreteGpu); 195 gl::init::CreateGLContext(nullptr, surface_.get(), context_attribs);
194 DCHECK(context_); 196 DCHECK(context_);
195 sync->Signal(); 197 sync->Signal();
196 } 198 }
197 199
198 void FakeWindow::DestroyOnRT(base::WaitableEvent* sync) { 200 void FakeWindow::DestroyOnRT(base::WaitableEvent* sync) {
199 CheckCurrentlyOnRT(); 201 CheckCurrentlyOnRT();
200 if (context_) { 202 if (context_) {
201 DCHECK(!context_->IsCurrent(surface_.get())); 203 DCHECK(!context_->IsCurrent(surface_.get()));
202 context_ = nullptr; 204 context_ = nullptr;
203 surface_ = nullptr; 205 surface_ = nullptr;
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 270
269 bool FakeFunctor::RequestInvokeGL(bool wait_for_completion) { 271 bool FakeFunctor::RequestInvokeGL(bool wait_for_completion) {
270 DCHECK(window_); 272 DCHECK(window_);
271 window_->RequestInvokeGL(this, wait_for_completion); 273 window_->RequestInvokeGL(this, wait_for_completion);
272 return true; 274 return true;
273 } 275 }
274 276
275 void FakeFunctor::DetachFunctorFromView() {} 277 void FakeFunctor::DetachFunctorFromView() {}
276 278
277 } // namespace android_webview 279 } // namespace android_webview
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698