| 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/public/browser/draw_gl.h" | 8 #include "android_webview/public/browser/draw_gl.h" |
| 9 #include "base/message_loop/message_loop_proxy.h" | 9 #include "base/message_loop/message_loop_proxy.h" |
| 10 #include "base/synchronization/waitable_event.h" | 10 #include "base/synchronization/waitable_event.h" |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 base::MessageLoopProxy::current()->PostTask( | 112 base::MessageLoopProxy::current()->PostTask( |
| 113 FROM_HERE, | 113 FROM_HERE, |
| 114 base::Bind(&FakeWindow::OnDrawHardware, weak_ptr_factory_.GetWeakPtr())); | 114 base::Bind(&FakeWindow::OnDrawHardware, weak_ptr_factory_.GetWeakPtr())); |
| 115 } | 115 } |
| 116 | 116 |
| 117 void FakeWindow::OnDrawHardware() { | 117 void FakeWindow::OnDrawHardware() { |
| 118 CheckCurrentlyOnUIThread(); | 118 CheckCurrentlyOnUIThread(); |
| 119 DCHECK(on_draw_hardware_pending_); | 119 DCHECK(on_draw_hardware_pending_); |
| 120 on_draw_hardware_pending_ = false; | 120 on_draw_hardware_pending_ = false; |
| 121 | 121 |
| 122 view_->PrepareToDraw(gfx::Vector2d(), location_); |
| 122 hooks_->WillOnDraw(); | 123 hooks_->WillOnDraw(); |
| 123 view_->PrepareToDraw(gfx::Vector2d(), location_); | |
| 124 bool success = view_->OnDrawHardware(); | 124 bool success = view_->OnDrawHardware(); |
| 125 hooks_->DidOnDraw(success); | 125 hooks_->DidOnDraw(success); |
| 126 if (success) { | 126 if (success) { |
| 127 CreateRenderThreadIfNeeded(); | 127 CreateRenderThreadIfNeeded(); |
| 128 | 128 |
| 129 base::WaitableEvent completion(true, false); | 129 base::WaitableEvent completion(true, false); |
| 130 render_thread_loop_->PostTask( | 130 render_thread_loop_->PostTask( |
| 131 FROM_HERE, base::Bind(&FakeWindow::DrawFunctorOnRT, | 131 FROM_HERE, base::Bind(&FakeWindow::DrawFunctorOnRT, |
| 132 base::Unretained(this), &completion)); | 132 base::Unretained(this), &completion)); |
| 133 completion.Wait(); | 133 completion.Wait(); |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 surface_ = nullptr; | 231 surface_ = nullptr; |
| 232 } | 232 } |
| 233 sync->Signal(); | 233 sync->Signal(); |
| 234 } | 234 } |
| 235 | 235 |
| 236 void FakeWindow::CheckCurrentlyOnRT() { | 236 void FakeWindow::CheckCurrentlyOnRT() { |
| 237 DCHECK(rt_checker_.CalledOnValidSequencedThread()); | 237 DCHECK(rt_checker_.CalledOnValidSequencedThread()); |
| 238 } | 238 } |
| 239 | 239 |
| 240 } // namespace android_webview | 240 } // namespace android_webview |
| OLD | NEW |