| 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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 FROM_HERE, base::Bind(&FakeWindow::InitializeOnRT, base::Unretained(this), | 174 FROM_HERE, base::Bind(&FakeWindow::InitializeOnRT, base::Unretained(this), |
| 175 &completion)); | 175 &completion)); |
| 176 completion.Wait(); | 176 completion.Wait(); |
| 177 } | 177 } |
| 178 | 178 |
| 179 void FakeWindow::InitializeOnRT(base::WaitableEvent* sync) { | 179 void FakeWindow::InitializeOnRT(base::WaitableEvent* sync) { |
| 180 CheckCurrentlyOnRT(); | 180 CheckCurrentlyOnRT(); |
| 181 surface_ = gl::init::CreateOffscreenGLSurface(surface_size_); | 181 surface_ = gl::init::CreateOffscreenGLSurface(surface_size_); |
| 182 DCHECK(surface_); | 182 DCHECK(surface_); |
| 183 DCHECK(surface_->GetHandle()); | 183 DCHECK(surface_->GetHandle()); |
| 184 context_ = gl::init::CreateGLContext(nullptr, surface_.get(), | 184 context_ = |
| 185 gfx::PreferDiscreteGpu); | 185 gl::init::CreateGLContext(nullptr, surface_.get(), gl::PreferDiscreteGpu); |
| 186 DCHECK(context_); | 186 DCHECK(context_); |
| 187 sync->Signal(); | 187 sync->Signal(); |
| 188 } | 188 } |
| 189 | 189 |
| 190 void FakeWindow::DestroyOnRT(base::WaitableEvent* sync) { | 190 void FakeWindow::DestroyOnRT(base::WaitableEvent* sync) { |
| 191 CheckCurrentlyOnRT(); | 191 CheckCurrentlyOnRT(); |
| 192 if (context_) { | 192 if (context_) { |
| 193 DCHECK(!context_->IsCurrent(surface_.get())); | 193 DCHECK(!context_->IsCurrent(surface_.get())); |
| 194 context_ = nullptr; | 194 context_ = nullptr; |
| 195 surface_ = nullptr; | 195 surface_ = nullptr; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 | 260 |
| 261 bool FakeFunctor::RequestInvokeGL(bool wait_for_completion) { | 261 bool FakeFunctor::RequestInvokeGL(bool wait_for_completion) { |
| 262 DCHECK(window_); | 262 DCHECK(window_); |
| 263 window_->RequestInvokeGL(this, wait_for_completion); | 263 window_->RequestInvokeGL(this, wait_for_completion); |
| 264 return true; | 264 return true; |
| 265 } | 265 } |
| 266 | 266 |
| 267 void FakeFunctor::DetachFunctorFromView() {} | 267 void FakeFunctor::DetachFunctorFromView() {} |
| 268 | 268 |
| 269 } // namespace android_webview | 269 } // namespace android_webview |
| OLD | NEW |