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

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

Issue 2480373002: Refactor context creation parameters into a struct. (Closed)
Patch Set: address piman's comments 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 context_ = 192 context_ = gl::init::CreateGLContext(nullptr, surface_.get(),
193 gl::init::CreateGLContext(nullptr, surface_.get(), gl::PreferDiscreteGpu); 193 gl::GLContextAttribs());
Torne 2016/11/08 14:34:29 Same here
194 DCHECK(context_); 194 DCHECK(context_);
195 sync->Signal(); 195 sync->Signal();
196 } 196 }
197 197
198 void FakeWindow::DestroyOnRT(base::WaitableEvent* sync) { 198 void FakeWindow::DestroyOnRT(base::WaitableEvent* sync) {
199 CheckCurrentlyOnRT(); 199 CheckCurrentlyOnRT();
200 if (context_) { 200 if (context_) {
201 DCHECK(!context_->IsCurrent(surface_.get())); 201 DCHECK(!context_->IsCurrent(surface_.get()));
202 context_ = nullptr; 202 context_ = nullptr;
203 surface_ = nullptr; 203 surface_ = nullptr;
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 268
269 bool FakeFunctor::RequestInvokeGL(bool wait_for_completion) { 269 bool FakeFunctor::RequestInvokeGL(bool wait_for_completion) {
270 DCHECK(window_); 270 DCHECK(window_);
271 window_->RequestInvokeGL(this, wait_for_completion); 271 window_->RequestInvokeGL(this, wait_for_completion);
272 return true; 272 return true;
273 } 273 }
274 274
275 void FakeFunctor::DetachFunctorFromView() {} 275 void FakeFunctor::DetachFunctorFromView() {}
276 276
277 } // namespace android_webview 277 } // namespace android_webview
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698