| OLD | NEW |
| 1 // Copyright 2010 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "cc/layers/video_layer.h" | 5 #include "cc/layers/video_layer.h" |
| 6 | 6 |
| 7 #include "cc/layers/video_layer_impl.h" | 7 #include "cc/layers/video_layer_impl.h" |
| 8 | 8 |
| 9 namespace cc { | 9 namespace cc { |
| 10 | 10 |
| 11 scoped_refptr<VideoLayer> VideoLayer::Create( | 11 scoped_refptr<VideoLayer> VideoLayer::Create( |
| 12 const LayerSettings& settings, |
| 12 VideoFrameProvider* provider, | 13 VideoFrameProvider* provider, |
| 13 media::VideoRotation video_rotation) { | 14 media::VideoRotation video_rotation) { |
| 14 return make_scoped_refptr(new VideoLayer(provider, video_rotation)); | 15 return make_scoped_refptr(new VideoLayer(settings, provider, video_rotation)); |
| 15 } | 16 } |
| 16 | 17 |
| 17 VideoLayer::VideoLayer(VideoFrameProvider* provider, | 18 VideoLayer::VideoLayer(const LayerSettings& settings, |
| 19 VideoFrameProvider* provider, |
| 18 media::VideoRotation video_rotation) | 20 media::VideoRotation video_rotation) |
| 19 : provider_(provider), video_rotation_(video_rotation) { | 21 : Layer(settings), provider_(provider), video_rotation_(video_rotation) { |
| 20 DCHECK(provider_); | 22 DCHECK(provider_); |
| 21 } | 23 } |
| 22 | 24 |
| 23 VideoLayer::~VideoLayer() {} | 25 VideoLayer::~VideoLayer() {} |
| 24 | 26 |
| 25 scoped_ptr<LayerImpl> VideoLayer::CreateLayerImpl(LayerTreeImpl* tree_impl) { | 27 scoped_ptr<LayerImpl> VideoLayer::CreateLayerImpl(LayerTreeImpl* tree_impl) { |
| 26 scoped_ptr<VideoLayerImpl> impl = | 28 scoped_ptr<VideoLayerImpl> impl = |
| 27 VideoLayerImpl::Create(tree_impl, id(), provider_, video_rotation_); | 29 VideoLayerImpl::Create(tree_impl, id(), provider_, video_rotation_); |
| 28 return impl.Pass(); | 30 return impl.Pass(); |
| 29 } | 31 } |
| 30 | 32 |
| 31 bool VideoLayer::Update(ResourceUpdateQueue* queue, | 33 bool VideoLayer::Update(ResourceUpdateQueue* queue, |
| 32 const OcclusionTracker<Layer>* occlusion) { | 34 const OcclusionTracker<Layer>* occlusion) { |
| 33 bool updated = Layer::Update(queue, occlusion); | 35 bool updated = Layer::Update(queue, occlusion); |
| 34 | 36 |
| 35 // Video layer doesn't update any resources from the main thread side, | 37 // Video layer doesn't update any resources from the main thread side, |
| 36 // but repaint rects need to be sent to the VideoLayerImpl via commit. | 38 // but repaint rects need to be sent to the VideoLayerImpl via commit. |
| 37 // | 39 // |
| 38 // This is the inefficient legacy redraw path for videos. It's better to | 40 // This is the inefficient legacy redraw path for videos. It's better to |
| 39 // communicate this directly to the VideoLayerImpl. | 41 // communicate this directly to the VideoLayerImpl. |
| 40 updated |= !update_rect_.IsEmpty(); | 42 updated |= !update_rect_.IsEmpty(); |
| 41 | 43 |
| 42 return updated; | 44 return updated; |
| 43 } | 45 } |
| 44 | 46 |
| 45 } // namespace cc | 47 } // namespace cc |
| OLD | NEW |