OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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_impl.h" | 5 #include "cc/layers/video_layer_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 int id, | 32 int id, |
33 VideoFrameProvider* provider, | 33 VideoFrameProvider* provider, |
34 media::VideoRotation video_rotation) { | 34 media::VideoRotation video_rotation) { |
35 DCHECK(tree_impl->task_runner_provider()->IsMainThreadBlocked()); | 35 DCHECK(tree_impl->task_runner_provider()->IsMainThreadBlocked()); |
36 DCHECK(tree_impl->task_runner_provider()->IsImplThread()); | 36 DCHECK(tree_impl->task_runner_provider()->IsImplThread()); |
37 | 37 |
38 scoped_refptr<VideoFrameProviderClientImpl> provider_client_impl = | 38 scoped_refptr<VideoFrameProviderClientImpl> provider_client_impl = |
39 VideoFrameProviderClientImpl::Create( | 39 VideoFrameProviderClientImpl::Create( |
40 provider, tree_impl->GetVideoFrameControllerClient()); | 40 provider, tree_impl->GetVideoFrameControllerClient()); |
41 | 41 |
42 return make_scoped_ptr( | 42 return make_scoped_ptr(new VideoLayerImpl( |
43 new VideoLayerImpl(tree_impl, id, provider_client_impl, video_rotation)); | 43 tree_impl, id, std::move(provider_client_impl), video_rotation)); |
44 } | 44 } |
45 | 45 |
46 VideoLayerImpl::VideoLayerImpl( | 46 VideoLayerImpl::VideoLayerImpl( |
47 LayerTreeImpl* tree_impl, | 47 LayerTreeImpl* tree_impl, |
48 int id, | 48 int id, |
49 const scoped_refptr<VideoFrameProviderClientImpl>& provider_client_impl, | 49 scoped_refptr<VideoFrameProviderClientImpl> provider_client_impl, |
50 media::VideoRotation video_rotation) | 50 media::VideoRotation video_rotation) |
51 : LayerImpl(tree_impl, id), | 51 : LayerImpl(tree_impl, id), |
52 provider_client_impl_(provider_client_impl), | 52 provider_client_impl_(std::move(provider_client_impl)), |
53 frame_(nullptr), | 53 frame_(nullptr), |
54 video_rotation_(video_rotation) { | 54 video_rotation_(video_rotation) {} |
55 } | |
56 | 55 |
57 VideoLayerImpl::~VideoLayerImpl() { | 56 VideoLayerImpl::~VideoLayerImpl() { |
58 if (!provider_client_impl_->Stopped()) { | 57 if (!provider_client_impl_->Stopped()) { |
59 // In impl side painting, we may have a pending and active layer | 58 // In impl side painting, we may have a pending and active layer |
60 // associated with the video provider at the same time. Both have a ref | 59 // associated with the video provider at the same time. Both have a ref |
61 // on the VideoFrameProviderClientImpl, but we stop when the first | 60 // on the VideoFrameProviderClientImpl, but we stop when the first |
62 // LayerImpl (the one on the pending tree) is destroyed since we know | 61 // LayerImpl (the one on the pending tree) is destroyed since we know |
63 // the main thread is blocked for this commit. | 62 // the main thread is blocked for this commit. |
64 DCHECK(layer_tree_impl()->task_runner_provider()->IsImplThread()); | 63 DCHECK(layer_tree_impl()->task_runner_provider()->IsImplThread()); |
65 DCHECK(layer_tree_impl()->task_runner_provider()->IsMainThreadBlocked()); | 64 DCHECK(layer_tree_impl()->task_runner_provider()->IsMainThreadBlocked()); |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 void VideoLayerImpl::SetNeedsRedraw() { | 412 void VideoLayerImpl::SetNeedsRedraw() { |
414 SetUpdateRect(gfx::UnionRects(update_rect(), gfx::Rect(bounds()))); | 413 SetUpdateRect(gfx::UnionRects(update_rect(), gfx::Rect(bounds()))); |
415 layer_tree_impl()->SetNeedsRedraw(); | 414 layer_tree_impl()->SetNeedsRedraw(); |
416 } | 415 } |
417 | 416 |
418 const char* VideoLayerImpl::LayerTypeAsString() const { | 417 const char* VideoLayerImpl::LayerTypeAsString() const { |
419 return "cc::VideoLayerImpl"; | 418 return "cc::VideoLayerImpl"; |
420 } | 419 } |
421 | 420 |
422 } // namespace cc | 421 } // namespace cc |
OLD | NEW |