| OLD | NEW |
| 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 Loading... |
| 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_ = gl::init::CreateGLContext(nullptr, surface_.get(), | 192 context_ = |
| 193 gl::GLContextAttribs()); | 193 gl::init::CreateGLContext(nullptr, surface_.get(), gl::PreferDiscreteGpu); |
| 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 Loading... |
| 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 |
| OLD | NEW |