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

Side by Side Diff: android_webview/browser/render_thread_manager.cc

Issue 1943963003: WIP Handle AwContents needing multiple live functors. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: PS7 comments Created 4 years, 7 months 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/render_thread_manager.h" 5 #include "android_webview/browser/render_thread_manager.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "android_webview/browser/child_frame.h" 9 #include "android_webview/browser/child_frame.h"
10 #include "android_webview/browser/compositor_frame_producer.h" 10 #include "android_webview/browser/compositor_frame_producer.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 weak_factory_on_ui_thread_(this) { 99 weak_factory_on_ui_thread_(this) {
100 DCHECK(ui_loop_->BelongsToCurrentThread()); 100 DCHECK(ui_loop_->BelongsToCurrentThread());
101 DCHECK(client_); 101 DCHECK(client_);
102 ui_thread_weak_ptr_ = weak_factory_on_ui_thread_.GetWeakPtr(); 102 ui_thread_weak_ptr_ = weak_factory_on_ui_thread_.GetWeakPtr();
103 ResetRequestInvokeGLCallback(); 103 ResetRequestInvokeGLCallback();
104 } 104 }
105 105
106 RenderThreadManager::~RenderThreadManager() { 106 RenderThreadManager::~RenderThreadManager() {
107 DCHECK(ui_loop_->BelongsToCurrentThread()); 107 DCHECK(ui_loop_->BelongsToCurrentThread());
108 if (compositor_frame_producer_) { 108 if (compositor_frame_producer_) {
109 compositor_frame_producer_->OnCompositorFrameConsumerWillDestroy(); 109 compositor_frame_producer_->RemoveCompositorFrameConsumer(this);
110 } 110 }
111 DCHECK(!hardware_renderer_.get()); 111 DCHECK(!hardware_renderer_.get());
112 } 112 }
113 113
114 void RenderThreadManager::ClientRequestInvokeGL(bool for_idle) { 114 void RenderThreadManager::ClientRequestInvokeGL(bool for_idle) {
115 if (ui_loop_->BelongsToCurrentThread()) { 115 if (ui_loop_->BelongsToCurrentThread()) {
116 if (!g_request_invoke_gl_tracker.Get().ShouldRequestOnUiThread(this)) 116 if (!g_request_invoke_gl_tracker.Get().ShouldRequestOnUiThread(this))
117 return; 117 return;
118 ClientRequestInvokeGLOnUI(); 118 ClientRequestInvokeGLOnUI();
119 } else { 119 } else {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 g_request_invoke_gl_tracker.Get().SetQueuedFunctorOnUi(this); 151 g_request_invoke_gl_tracker.Get().SetQueuedFunctorOnUi(this);
152 if (!client_->RequestInvokeGL(false)) { 152 if (!client_->RequestInvokeGL(false)) {
153 g_request_invoke_gl_tracker.Get().ResetPending(); 153 g_request_invoke_gl_tracker.Get().ResetPending();
154 LOG(ERROR) << "Failed to request GL process. Deadlock likely"; 154 LOG(ERROR) << "Failed to request GL process. Deadlock likely";
155 } 155 }
156 } 156 }
157 157
158 void RenderThreadManager::UpdateParentDrawConstraintsOnUI() { 158 void RenderThreadManager::UpdateParentDrawConstraintsOnUI() {
159 DCHECK(ui_loop_->BelongsToCurrentThread()); 159 DCHECK(ui_loop_->BelongsToCurrentThread());
160 if (compositor_frame_producer_) { 160 if (compositor_frame_producer_) {
161 compositor_frame_producer_->OnParentDrawConstraintsUpdated(); 161 compositor_frame_producer_->OnParentDrawConstraintsUpdated(this);
162 } 162 }
163 } 163 }
164 164
165 void RenderThreadManager::SetScrollOffsetOnUI(gfx::Vector2d scroll_offset) { 165 void RenderThreadManager::SetScrollOffsetOnUI(gfx::Vector2d scroll_offset) {
166 base::AutoLock lock(lock_); 166 base::AutoLock lock(lock_);
167 scroll_offset_ = scroll_offset; 167 scroll_offset_ = scroll_offset;
168 } 168 }
169 169
170 gfx::Vector2d RenderThreadManager::GetScrollOffsetOnRT() { 170 gfx::Vector2d RenderThreadManager::GetScrollOffsetOnRT() {
171 base::AutoLock lock(lock_); 171 base::AutoLock lock(lock_);
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 } 355 }
356 356
357 if (hardware_initialized) { 357 if (hardware_initialized) {
358 // Flush any invoke functors that's caused by ReleaseHardware. 358 // Flush any invoke functors that's caused by ReleaseHardware.
359 client_->RequestInvokeGL(true); 359 client_->RequestInvokeGL(true);
360 } 360 }
361 } 361 }
362 362
363 void RenderThreadManager::SetCompositorFrameProducer( 363 void RenderThreadManager::SetCompositorFrameProducer(
364 CompositorFrameProducer* compositor_frame_producer) { 364 CompositorFrameProducer* compositor_frame_producer) {
365 if (compositor_frame_producer == compositor_frame_producer_) {
boliu 2016/05/05 21:40:32 instead of the early out, relax the DCHECK instead
Tobias Sargeant 2016/05/06 12:41:09 Done.
366 return;
367 }
368 DCHECK_NE(compositor_frame_producer_ == nullptr,
369 compositor_frame_producer == nullptr);
365 compositor_frame_producer_ = compositor_frame_producer; 370 compositor_frame_producer_ = compositor_frame_producer;
366 } 371 }
367 372
368 bool RenderThreadManager::HasFrameOnUI() const { 373 bool RenderThreadManager::HasFrameOnUI() const {
369 base::AutoLock lock(lock_); 374 base::AutoLock lock(lock_);
370 return hardware_renderer_has_frame_ || child_frame_.get(); 375 return hardware_renderer_has_frame_ || child_frame_.get();
371 } 376 }
372 377
373 bool RenderThreadManager::HasFrameForHardwareRendererOnRT() const { 378 bool RenderThreadManager::HasFrameForHardwareRendererOnRT() const {
374 base::AutoLock lock(lock_); 379 base::AutoLock lock(lock_);
(...skipping 15 matching lines...) Expand all
390 : render_thread_manager_(render_thread_manager) { 395 : render_thread_manager_(render_thread_manager) {
391 DCHECK(!render_thread_manager_->IsInsideHardwareRelease()); 396 DCHECK(!render_thread_manager_->IsInsideHardwareRelease());
392 render_thread_manager_->SetInsideHardwareRelease(true); 397 render_thread_manager_->SetInsideHardwareRelease(true);
393 } 398 }
394 399
395 RenderThreadManager::InsideHardwareReleaseReset::~InsideHardwareReleaseReset() { 400 RenderThreadManager::InsideHardwareReleaseReset::~InsideHardwareReleaseReset() {
396 render_thread_manager_->SetInsideHardwareRelease(false); 401 render_thread_manager_->SetInsideHardwareRelease(false);
397 } 402 }
398 403
399 } // namespace android_webview 404 } // namespace android_webview
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698