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

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

Issue 2418383002: sync compositor: Signal async frame on IO thread (Closed)
Patch Set: typo Created 4 years, 1 month 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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 frame_future) { 186 frame_future) {
187 base::AutoLock lock(lock_); 187 base::AutoLock lock(lock_);
188 DCHECK(!child_frame_.get()); 188 DCHECK(!child_frame_.get());
189 child_frame_ = std::move(frame); 189 child_frame_ = std::move(frame);
190 frame_future_ = std::move(frame_future); 190 frame_future_ = std::move(frame_future);
191 } 191 }
192 192
193 std::unique_ptr<ChildFrame> RenderThreadManager::GetSynchronousCompositorFrame( 193 std::unique_ptr<ChildFrame> RenderThreadManager::GetSynchronousCompositorFrame(
194 scoped_refptr<content::SynchronousCompositor::FrameFuture> frame_future, 194 scoped_refptr<content::SynchronousCompositor::FrameFuture> frame_future,
195 std::unique_ptr<ChildFrame> child_frame) { 195 std::unique_ptr<ChildFrame> child_frame) {
196 if (!frame_future)
197 return nullptr;
196 DCHECK(!child_frame->frame.get()); 198 DCHECK(!child_frame->frame.get());
197 std::unique_ptr<content::SynchronousCompositor::Frame> frame = 199 std::unique_ptr<content::SynchronousCompositor::Frame> frame =
198 frame_future->getFrame(); 200 frame_future->getFrame();
199 std::unique_ptr<cc::CompositorFrame> compositor_frame = 201 std::unique_ptr<cc::CompositorFrame> compositor_frame =
200 std::move(frame->frame); 202 std::move(frame->frame);
201 return base::MakeUnique<ChildFrame>( 203 return base::MakeUnique<ChildFrame>(
202 frame->compositor_frame_sink_id, std::move(compositor_frame), 204 frame->compositor_frame_sink_id, std::move(compositor_frame),
203 child_frame->compositor_id, 205 child_frame->compositor_id,
204 child_frame->viewport_rect_for_tile_priority_empty, 206 child_frame->viewport_rect_for_tile_priority_empty,
205 child_frame->transform_for_tile_priority, 207 child_frame->transform_for_tile_priority,
206 child_frame->offscreen_pre_raster, child_frame->is_layer); 208 child_frame->offscreen_pre_raster, child_frame->is_layer);
207 } 209 }
208 210
209 std::unique_ptr<ChildFrame> RenderThreadManager::PassFrameOnRT() { 211 std::unique_ptr<ChildFrame> RenderThreadManager::PassFrameOnRT() {
210 base::AutoLock lock(lock_); 212 base::AutoLock lock(lock_);
211 hardware_renderer_has_frame_ = 213 hardware_renderer_has_frame_ =
212 hardware_renderer_has_frame_ || child_frame_.get(); 214 hardware_renderer_has_frame_ || child_frame_.get();
213 if (async_on_draw_hardware_ && child_frame_.get()) {
214 return GetSynchronousCompositorFrame(std::move(frame_future_),
215 std::move(child_frame_));
216 }
217 return std::move(child_frame_); 215 return std::move(child_frame_);
218 } 216 }
219 217
218 scoped_refptr<content::SynchronousCompositor::FrameFuture>
219 RenderThreadManager::PassFrameFutureOnRT() {
220 base::AutoLock lock(lock_);
221 return std::move(frame_future_);
222 }
223
220 std::unique_ptr<ChildFrame> RenderThreadManager::PassUncommittedFrameOnUI() { 224 std::unique_ptr<ChildFrame> RenderThreadManager::PassUncommittedFrameOnUI() {
221 base::AutoLock lock(lock_); 225 base::AutoLock lock(lock_);
222 if (async_on_draw_hardware_ && child_frame_.get()) { 226 if (async_on_draw_hardware_ && child_frame_.get()) {
223 return GetSynchronousCompositorFrame(std::move(frame_future_), 227 return GetSynchronousCompositorFrame(std::move(frame_future_),
224 std::move(child_frame_)); 228 std::move(child_frame_));
225 } 229 }
226 return std::move(child_frame_); 230 return std::move(child_frame_);
227 } 231 }
228 232
229 void RenderThreadManager::PostExternalDrawConstraintsToChildCompositorOnRT( 233 void RenderThreadManager::PostExternalDrawConstraintsToChildCompositorOnRT(
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 : render_thread_manager_(render_thread_manager) { 427 : render_thread_manager_(render_thread_manager) {
424 DCHECK(!render_thread_manager_->IsInsideHardwareRelease()); 428 DCHECK(!render_thread_manager_->IsInsideHardwareRelease());
425 render_thread_manager_->SetInsideHardwareRelease(true); 429 render_thread_manager_->SetInsideHardwareRelease(true);
426 } 430 }
427 431
428 RenderThreadManager::InsideHardwareReleaseReset::~InsideHardwareReleaseReset() { 432 RenderThreadManager::InsideHardwareReleaseReset::~InsideHardwareReleaseReset() {
429 render_thread_manager_->SetInsideHardwareRelease(false); 433 render_thread_manager_->SetInsideHardwareRelease(false);
430 } 434 }
431 435
432 } // namespace android_webview 436 } // namespace android_webview
OLDNEW
« no previous file with comments | « android_webview/browser/render_thread_manager.h ('k') | content/browser/android/synchronous_compositor_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698