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

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

Issue 2347563003: Added FrameFuture class (Closed)
Patch Set: Code review Created 4 years, 2 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/browser_view_renderer.h" 5 #include "android_webview/browser/browser_view_renderer.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "android_webview/browser/browser_view_renderer_client.h" 9 #include "android_webview/browser/browser_view_renderer_client.h"
10 #include "android_webview/browser/child_frame.h" 10 #include "android_webview/browser/child_frame.h"
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 } 239 }
240 240
241 content::SynchronousCompositor::Frame frame = compositor_->DemandDrawHw( 241 content::SynchronousCompositor::Frame frame = compositor_->DemandDrawHw(
242 size_, viewport_rect_for_tile_priority, transform_for_tile_priority); 242 size_, viewport_rect_for_tile_priority, transform_for_tile_priority);
243 if (!frame.frame) { 243 if (!frame.frame) {
244 TRACE_EVENT_INSTANT0("android_webview", "NoNewFrame", 244 TRACE_EVENT_INSTANT0("android_webview", "NoNewFrame",
245 TRACE_EVENT_SCOPE_THREAD); 245 TRACE_EVENT_SCOPE_THREAD);
246 return current_compositor_frame_consumer_->HasFrameOnUI(); 246 return current_compositor_frame_consumer_->HasFrameOnUI();
247 } 247 }
248 248
249 OnDrawHardwareProcessFrame(std::move(frame));
250 return true;
251 }
252
253 void BrowserViewRenderer::OnDrawHardwareProcessFrame(
254 content::SynchronousCompositor::Frame frame) {
255 TRACE_EVENT0("android_webview",
256 "BrowserViewRenderer::OnDrawHardwareProcessFrame");
257 if (!frame.frame)
258 return;
259
260 gfx::Transform transform_for_tile_priority =
261 external_draw_constraints_.transform;
262 gfx::Rect viewport_rect_for_tile_priority =
263 ComputeViewportRectForTilePriority();
264 std::unique_ptr<ChildFrame> child_frame = base::MakeUnique<ChildFrame>( 249 std::unique_ptr<ChildFrame> child_frame = base::MakeUnique<ChildFrame>(
265 frame.compositor_frame_sink_id, std::move(frame.frame), compositor_id_, 250 frame.compositor_frame_sink_id, std::move(frame.frame), compositor_id_,
266 viewport_rect_for_tile_priority.IsEmpty(), transform_for_tile_priority, 251 viewport_rect_for_tile_priority.IsEmpty(), transform_for_tile_priority,
267 offscreen_pre_raster_, external_draw_constraints_.is_layer); 252 offscreen_pre_raster_, external_draw_constraints_.is_layer);
268 253
269 ReturnUnusedResource( 254 ReturnUnusedResource(
270 current_compositor_frame_consumer_->PassUncommittedFrameOnUI()); 255 current_compositor_frame_consumer_->PassUncommittedFrameOnUI());
271 current_compositor_frame_consumer_->SetFrameOnUI(std::move(child_frame)); 256 current_compositor_frame_consumer_->SetFrameOnUI(std::move(child_frame),
257 nullptr);
258
259 return true;
260 }
261
262 void BrowserViewRenderer::OnDrawHardwareProcessFrameFuture(
263 const scoped_refptr<content::SynchronousCompositor::FrameFuture>&
264 frame_future) {
265 gfx::Transform transform_for_tile_priority =
266 external_draw_constraints_.transform;
267 gfx::Rect viewport_rect_for_tile_priority =
268 ComputeViewportRectForTilePriority();
269
270 ReturnUnusedResource(
271 current_compositor_frame_consumer_->PassUncommittedFrameOnUI());
272 current_compositor_frame_consumer_->SetFrameOnUI(
273 base::MakeUnique<ChildFrame>(
274 0, nullptr, compositor_id_, viewport_rect_for_tile_priority.IsEmpty(),
275 transform_for_tile_priority, offscreen_pre_raster_,
276 external_draw_constraints_.is_layer),
277 frame_future);
272 } 278 }
273 279
274 gfx::Rect BrowserViewRenderer::ComputeViewportRectForTilePriority() { 280 gfx::Rect BrowserViewRenderer::ComputeViewportRectForTilePriority() {
275 // If the WebView is on a layer, WebView does not know what transform is 281 // If the WebView is on a layer, WebView does not know what transform is
276 // applied onto the layer so global visible rect does not make sense here. 282 // applied onto the layer so global visible rect does not make sense here.
277 // In this case, just use the surface rect for tiling. 283 // In this case, just use the surface rect for tiling.
278 // Leave viewport_rect_for_tile_priority empty if offscreen_pre_raster_ is on. 284 // Leave viewport_rect_for_tile_priority empty if offscreen_pre_raster_ is on.
279 gfx::Rect viewport_rect_for_tile_priority; 285 gfx::Rect viewport_rect_for_tile_priority;
280 286
281 if (!offscreen_pre_raster_ && !external_draw_constraints_.is_layer) { 287 if (!offscreen_pre_raster_ && !external_draw_constraints_.is_layer) {
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after
767 base::StringAppendF(&str, 773 base::StringAppendF(&str,
768 "overscroll_rounding_error_: %s ", 774 "overscroll_rounding_error_: %s ",
769 overscroll_rounding_error_.ToString().c_str()); 775 overscroll_rounding_error_.ToString().c_str());
770 base::StringAppendF( 776 base::StringAppendF(
771 &str, "on_new_picture_enable: %d ", on_new_picture_enable_); 777 &str, "on_new_picture_enable: %d ", on_new_picture_enable_);
772 base::StringAppendF(&str, "clear_view: %d ", clear_view_); 778 base::StringAppendF(&str, "clear_view: %d ", clear_view_);
773 return str; 779 return str;
774 } 780 }
775 781
776 } // namespace android_webview 782 } // namespace android_webview
OLDNEW
« no previous file with comments | « android_webview/browser/browser_view_renderer.h ('k') | android_webview/browser/compositor_frame_consumer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698