[email protected] | 94f206c1 | 2012-08-25 00:09:14 | [diff] [blame] | 1 | // 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] | cc3cfaa | 2013-03-18 09:05:52 | [diff] [blame] | 5 | #include "cc/layers/video_layer.h" |
[email protected] | 94f206c1 | 2012-08-25 00:09:14 | [diff] [blame] | 6 | |
[email protected] | cc3cfaa | 2013-03-18 09:05:52 | [diff] [blame] | 7 | #include "cc/layers/video_layer_impl.h" |
[email protected] | 94f206c1 | 2012-08-25 00:09:14 | [diff] [blame] | 8 | |
[email protected] | 9c88e56 | 2012-09-14 22:21:30 | [diff] [blame] | 9 | namespace cc { |
[email protected] | 94f206c1 | 2012-08-25 00:09:14 | [diff] [blame] | 10 | |
[email protected] | f78c3e8 | 2014-08-08 01:24:47 | [diff] [blame] | 11 | scoped_refptr<VideoLayer> VideoLayer::Create( |
12 | VideoFrameProvider* provider, | ||||
13 | media::VideoRotation video_rotation) { | ||||
kylechar | 973a041 | 2017-09-26 18:40:29 | [diff] [blame] | 14 | return base::WrapRefCounted(new VideoLayer(provider, video_rotation)); |
[email protected] | 94f206c1 | 2012-08-25 00:09:14 | [diff] [blame] | 15 | } |
16 | |||||
loyso | 0940d41 | 2016-03-14 01:30:31 | [diff] [blame] | 17 | VideoLayer::VideoLayer(VideoFrameProvider* provider, |
[email protected] | f78c3e8 | 2014-08-08 01:24:47 | [diff] [blame] | 18 | media::VideoRotation video_rotation) |
loyso | 0940d41 | 2016-03-14 01:30:31 | [diff] [blame] | 19 | : provider_(provider), video_rotation_(video_rotation) { |
sadrul | 32d1097 | 2016-07-30 05:26:21 | [diff] [blame] | 20 | SetMayContainVideo(true); |
dalecurtis | e1edb31 | 2016-06-22 02:33:21 | [diff] [blame] | 21 | DCHECK(provider_); |
[email protected] | 94f206c1 | 2012-08-25 00:09:14 | [diff] [blame] | 22 | } |
23 | |||||
[email protected] | 5065780 | 2013-03-13 06:43:35 | [diff] [blame] | 24 | VideoLayer::~VideoLayer() {} |
[email protected] | 94f206c1 | 2012-08-25 00:09:14 | [diff] [blame] | 25 | |
danakj | 60bc3bc | 2016-04-09 00:24:48 | [diff] [blame] | 26 | std::unique_ptr<LayerImpl> VideoLayer::CreateLayerImpl( |
27 | LayerTreeImpl* tree_impl) { | ||||
danakj | a04855a | 2015-11-18 20:39:10 | [diff] [blame] | 28 | return VideoLayerImpl::Create(tree_impl, id(), provider_, video_rotation_); |
[email protected] | 94f206c1 | 2012-08-25 00:09:14 | [diff] [blame] | 29 | } |
30 | |||||
danakj | 5f46636a | 2015-06-19 00:01:40 | [diff] [blame] | 31 | bool VideoLayer::Update() { |
32 | bool updated = Layer::Update(); | ||||
[email protected] | c50b99729 | 2013-08-03 18:44:30 | [diff] [blame] | 33 | |
[email protected] | 41084bf | 2013-08-02 00:36:33 | [diff] [blame] | 34 | // 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. | ||||
khushalsagar | b51998f | 2016-07-08 01:04:21 | [diff] [blame] | 39 | updated |= !update_rect().IsEmpty(); |
[email protected] | c50b99729 | 2013-08-03 18:44:30 | [diff] [blame] | 40 | |
41 | return updated; | ||||
[email protected] | 41084bf | 2013-08-02 00:36:33 | [diff] [blame] | 42 | } |
43 | |||||
dalecurtis | e1edb31 | 2016-06-22 02:33:21 | [diff] [blame] | 44 | void VideoLayer::StopUsingProvider() { |
45 | provider_ = nullptr; | ||||
46 | } | ||||
47 | |||||
[email protected] | 59cb7b35 | 2012-10-30 06:45:48 | [diff] [blame] | 48 | } // namespace cc |