[go: nahoru, domu]

blob: ce878602a117264c2426c8d55e9f6356e7529eaa [file] [log] [blame]
boliub887d3272015-03-19 00:29:261// Copyright 2015 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "android_webview/browser/child_frame.h"
6
boliu7b1edda2016-11-07 17:38:117#include <utility>
8
9#include "base/trace_event/trace_event.h"
boliub887d3272015-03-19 00:29:2610#include "cc/output/compositor_frame.h"
11
12namespace android_webview {
13
boliu7b1edda2016-11-07 17:38:1114ChildFrame::ChildFrame(
15 scoped_refptr<content::SynchronousCompositor::FrameFuture> frame_future,
danakjc7afae52017-06-20 21:12:4116 uint32_t layer_tree_frame_sink_id,
boliu7b1edda2016-11-07 17:38:1117 std::unique_ptr<cc::CompositorFrame> frame,
18 const CompositorID& compositor_id,
19 bool viewport_rect_for_tile_priority_empty,
20 const gfx::Transform& transform_for_tile_priority,
21 bool offscreen_pre_raster,
22 bool is_layer)
23 : frame_future(std::move(frame_future)),
danakjc7afae52017-06-20 21:12:4124 layer_tree_frame_sink_id(layer_tree_frame_sink_id),
boliuf4e574852016-03-22 19:33:1725 frame(std::move(frame)),
hush45918a82015-12-17 03:50:5926 compositor_id(compositor_id),
boliu7441045ad2015-06-29 21:08:1227 viewport_rect_for_tile_priority_empty(
28 viewport_rect_for_tile_priority_empty),
boliub887d3272015-03-19 00:29:2629 transform_for_tile_priority(transform_for_tile_priority),
30 offscreen_pre_raster(offscreen_pre_raster),
boliu7441045ad2015-06-29 21:08:1231 is_layer(is_layer) {}
boliub887d3272015-03-19 00:29:2632
33ChildFrame::~ChildFrame() {
34}
35
boliu7b1edda2016-11-07 17:38:1136void ChildFrame::WaitOnFutureIfNeeded() {
37 if (!frame_future)
38 return;
39
40 TRACE_EVENT0("android_webview", "GetFrame");
41 DCHECK(!frame);
42 auto frame_ptr = frame_future->GetFrame();
43 if (frame_ptr) {
danakjc7afae52017-06-20 21:12:4144 layer_tree_frame_sink_id = frame_ptr->layer_tree_frame_sink_id;
boliu7b1edda2016-11-07 17:38:1145 frame = std::move(frame_ptr->frame);
46 }
47 frame_future = nullptr;
48}
49
fanjinsongdb647e042017-06-09 20:26:4550} // namespace android_webview