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.
5 #include "cc/layers/video_layer.h"
7 #include "cc/layers/video_layer_impl.h"
11 scoped_refptr
<VideoLayer
> VideoLayer::Create(
12 const LayerSettings
& settings
,
13 VideoFrameProvider
* provider
,
14 media::VideoRotation video_rotation
) {
15 return make_scoped_refptr(new VideoLayer(settings
, provider
, video_rotation
));
18 VideoLayer::VideoLayer(const LayerSettings
& settings
,
19 VideoFrameProvider
* provider
,
20 media::VideoRotation video_rotation
)
21 : Layer(settings
), provider_(provider
), video_rotation_(video_rotation
) {
25 VideoLayer::~VideoLayer() {}
27 scoped_ptr
<LayerImpl
> VideoLayer::CreateLayerImpl(LayerTreeImpl
* tree_impl
) {
28 scoped_ptr
<VideoLayerImpl
> impl
=
29 VideoLayerImpl::Create(tree_impl
, id(), provider_
, video_rotation_
);
33 bool VideoLayer::Update(ResourceUpdateQueue
* queue
,
34 const OcclusionTracker
<Layer
>* occlusion
) {
35 bool updated
= Layer::Update(queue
, occlusion
);
37 // Video layer doesn't update any resources from the main thread side,
38 // but repaint rects need to be sent to the VideoLayerImpl via commit.
40 // This is the inefficient legacy redraw path for videos. It's better to
41 // communicate this directly to the VideoLayerImpl.
42 updated
|= !update_rect_
.IsEmpty();