Chromium Code Reviews| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 45 hooks_(hooks), | 45 hooks_(hooks), |
| 46 surface_size_(100, 100), | 46 surface_size_(100, 100), |
| 47 location_(location), | 47 location_(location), |
| 48 on_draw_hardware_pending_(false), | 48 on_draw_hardware_pending_(false), |
| 49 functor_(nullptr), | 49 functor_(nullptr), |
| 50 context_current_(false), | 50 context_current_(false), |
| 51 weak_ptr_factory_(this) { | 51 weak_ptr_factory_(this) { |
| 52 CheckCurrentlyOnUIThread(); | 52 CheckCurrentlyOnUIThread(); |
| 53 DCHECK(view_); | 53 DCHECK(view_); |
| 54 view_->OnAttachedToWindow(location_.width(), location_.height()); | 54 view_->OnAttachedToWindow(location_.width(), location_.height()); |
| 55 view_->SetWindowVisibility(true); | |
| 56 view_->SetViewVisibility(true); | |
|
hush (inactive)
2015/01/14 02:06:12
what does it do?
boliu
2015/01/14 02:08:20
WindowVisible is used when scheduling fallback tic
| |
| 55 } | 57 } |
| 56 | 58 |
| 57 FakeWindow::~FakeWindow() { | 59 FakeWindow::~FakeWindow() { |
| 58 CheckCurrentlyOnUIThread(); | 60 CheckCurrentlyOnUIThread(); |
| 59 } | 61 } |
| 60 | 62 |
| 61 void FakeWindow::Detach() { | 63 void FakeWindow::Detach() { |
| 62 CheckCurrentlyOnUIThread(); | 64 CheckCurrentlyOnUIThread(); |
| 63 view_->OnDetachedFromWindow(); | 65 view_->OnDetachedFromWindow(); |
| 64 | 66 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 110 base::MessageLoopProxy::current()->PostTask( | 112 base::MessageLoopProxy::current()->PostTask( |
| 111 FROM_HERE, | 113 FROM_HERE, |
| 112 base::Bind(&FakeWindow::OnDrawHardware, weak_ptr_factory_.GetWeakPtr())); | 114 base::Bind(&FakeWindow::OnDrawHardware, weak_ptr_factory_.GetWeakPtr())); |
| 113 } | 115 } |
| 114 | 116 |
| 115 void FakeWindow::OnDrawHardware() { | 117 void FakeWindow::OnDrawHardware() { |
| 116 CheckCurrentlyOnUIThread(); | 118 CheckCurrentlyOnUIThread(); |
| 117 DCHECK(on_draw_hardware_pending_); | 119 DCHECK(on_draw_hardware_pending_); |
| 118 on_draw_hardware_pending_ = false; | 120 on_draw_hardware_pending_ = false; |
| 119 | 121 |
| 122 hooks_->WillOnDraw(); | |
| 120 bool success = view_->OnDrawHardware(); | 123 bool success = view_->OnDrawHardware(); |
| 124 hooks_->DidOnDraw(success); | |
| 121 if (success) { | 125 if (success) { |
| 122 CreateRenderThreadIfNeeded(); | 126 CreateRenderThreadIfNeeded(); |
| 123 | 127 |
| 124 base::WaitableEvent completion(true, false); | 128 base::WaitableEvent completion(true, false); |
| 125 render_thread_loop_->PostTask( | 129 render_thread_loop_->PostTask( |
| 126 FROM_HERE, base::Bind(&FakeWindow::DrawFunctorOnRT, | 130 FROM_HERE, base::Bind(&FakeWindow::DrawFunctorOnRT, |
| 127 base::Unretained(this), &completion)); | 131 base::Unretained(this), &completion)); |
| 128 completion.Wait(); | 132 completion.Wait(); |
| 129 } | 133 } |
| 130 } | 134 } |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 226 surface_ = nullptr; | 230 surface_ = nullptr; |
| 227 } | 231 } |
| 228 sync->Signal(); | 232 sync->Signal(); |
| 229 } | 233 } |
| 230 | 234 |
| 231 void FakeWindow::CheckCurrentlyOnRT() { | 235 void FakeWindow::CheckCurrentlyOnRT() { |
| 232 DCHECK(rt_checker_.CalledOnValidSequencedThread()); | 236 DCHECK(rt_checker_.CalledOnValidSequencedThread()); |
| 233 } | 237 } |
| 234 | 238 |
| 235 } // namespace android_webview | 239 } // namespace android_webview |
| OLD | NEW |