Roll src/third_party/WebKit 2146135:dc7c4b0 (svn 202183:202185)
[chromium-blink-merge.git] / cc / layers / video_layer.cc
blobcae00aacf1d02f0631d2ef09f2c6984c20111a38
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"
9 namespace cc {
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) {
22 DCHECK(provider_);
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_);
30 return impl.Pass();
33 bool VideoLayer::Update() {
34 bool updated = Layer::Update();
36 // Video layer doesn't update any resources from the main thread side,
37 // but repaint rects need to be sent to the VideoLayerImpl via commit.
39 // This is the inefficient legacy redraw path for videos. It's better to
40 // communicate this directly to the VideoLayerImpl.
41 updated |= !update_rect_.IsEmpty();
43 return updated;
46 } // namespace cc