blob: 8f4428093176058d6490b2349f7c6435b30cf10a [file] [log] [blame]
[email protected]94f206c12012-08-25 00:09:141// Copyright 2010 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
[email protected]cc3cfaa2013-03-18 09:05:525#include "cc/layers/video_layer.h"
[email protected]94f206c12012-08-25 00:09:146
[email protected]cc3cfaa2013-03-18 09:05:527#include "cc/layers/video_layer_impl.h"
[email protected]94f206c12012-08-25 00:09:148
[email protected]9c88e562012-09-14 22:21:309namespace cc {
[email protected]94f206c12012-08-25 00:09:1410
[email protected]f78c3e82014-08-08 01:24:4711scoped_refptr<VideoLayer> VideoLayer::Create(
12 VideoFrameProvider* provider,
13 media::VideoRotation video_rotation) {
kylechar973a0412017-09-26 18:40:2914 return base::WrapRefCounted(new VideoLayer(provider, video_rotation));
[email protected]94f206c12012-08-25 00:09:1415}
16
loyso0940d412016-03-14 01:30:3117VideoLayer::VideoLayer(VideoFrameProvider* provider,
[email protected]f78c3e82014-08-08 01:24:4718 media::VideoRotation video_rotation)
loyso0940d412016-03-14 01:30:3119 : provider_(provider), video_rotation_(video_rotation) {
sadrul32d10972016-07-30 05:26:2120 SetMayContainVideo(true);
dalecurtise1edb312016-06-22 02:33:2121 DCHECK(provider_);
[email protected]94f206c12012-08-25 00:09:1422}
23
[email protected]50657802013-03-13 06:43:3524VideoLayer::~VideoLayer() {}
[email protected]94f206c12012-08-25 00:09:1425
danakj60bc3bc2016-04-09 00:24:4826std::unique_ptr<LayerImpl> VideoLayer::CreateLayerImpl(
27 LayerTreeImpl* tree_impl) {
danakja04855a2015-11-18 20:39:1028 return VideoLayerImpl::Create(tree_impl, id(), provider_, video_rotation_);
[email protected]94f206c12012-08-25 00:09:1429}
30
danakj5f46636a2015-06-19 00:01:4031bool VideoLayer::Update() {
32 bool updated = Layer::Update();
[email protected]c50b997292013-08-03 18:44:3033
[email protected]41084bf2013-08-02 00:36:3334 // Video layer doesn't update any resources from the main thread side,
35 // but repaint rects need to be sent to the VideoLayerImpl via commit.
36 //
37 // This is the inefficient legacy redraw path for videos. It's better to
38 // communicate this directly to the VideoLayerImpl.
khushalsagarb51998f2016-07-08 01:04:2139 updated |= !update_rect().IsEmpty();
[email protected]c50b997292013-08-03 18:44:3040
41 return updated;
[email protected]41084bf2013-08-02 00:36:3342}
43
dalecurtise1edb312016-06-22 02:33:2144void VideoLayer::StopUsingProvider() {
45 provider_ = nullptr;
46}
47
[email protected]59cb7b352012-10-30 06:45:4848} // namespace cc