| Index: android_webview/browser/child_frame.cc
|
| diff --git a/android_webview/browser/child_frame.cc b/android_webview/browser/child_frame.cc
|
| index 560e20c4b0c18cb350e34f7aca33c29f24520547..62963518a54d5bf159be3136620a2b5216d85266 100644
|
| --- a/android_webview/browser/child_frame.cc
|
| +++ b/android_webview/browser/child_frame.cc
|
| @@ -4,18 +4,24 @@
|
|
|
| #include "android_webview/browser/child_frame.h"
|
|
|
| +#include <utility>
|
| +
|
| +#include "base/trace_event/trace_event.h"
|
| #include "cc/output/compositor_frame.h"
|
|
|
| namespace android_webview {
|
|
|
| -ChildFrame::ChildFrame(uint32_t compositor_frame_sink_id,
|
| - std::unique_ptr<cc::CompositorFrame> frame,
|
| - const CompositorID& compositor_id,
|
| - bool viewport_rect_for_tile_priority_empty,
|
| - const gfx::Transform& transform_for_tile_priority,
|
| - bool offscreen_pre_raster,
|
| - bool is_layer)
|
| - : compositor_frame_sink_id(compositor_frame_sink_id),
|
| +ChildFrame::ChildFrame(
|
| + scoped_refptr<content::SynchronousCompositor::FrameFuture> frame_future,
|
| + uint32_t compositor_frame_sink_id,
|
| + std::unique_ptr<cc::CompositorFrame> frame,
|
| + const CompositorID& compositor_id,
|
| + bool viewport_rect_for_tile_priority_empty,
|
| + const gfx::Transform& transform_for_tile_priority,
|
| + bool offscreen_pre_raster,
|
| + bool is_layer)
|
| + : frame_future(std::move(frame_future)),
|
| + compositor_frame_sink_id(compositor_frame_sink_id),
|
| frame(std::move(frame)),
|
| compositor_id(compositor_id),
|
| viewport_rect_for_tile_priority_empty(
|
| @@ -27,4 +33,18 @@ ChildFrame::ChildFrame(uint32_t compositor_frame_sink_id,
|
| ChildFrame::~ChildFrame() {
|
| }
|
|
|
| +void ChildFrame::WaitOnFutureIfNeeded() {
|
| + if (!frame_future)
|
| + return;
|
| +
|
| + TRACE_EVENT0("android_webview", "GetFrame");
|
| + DCHECK(!frame);
|
| + auto frame_ptr = frame_future->GetFrame();
|
| + if (frame_ptr) {
|
| + compositor_frame_sink_id = frame_ptr->compositor_frame_sink_id;
|
| + frame = std::move(frame_ptr->frame);
|
| + }
|
| + frame_future = nullptr;
|
| +}
|
| +
|
| } // namespace webview
|
|
|