Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4094)

Unified Diff: cc/layers/video_layer_impl.cc

Issue 1033563002: cc: Various code safety improvements in video compositing code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: cc/layers/video_layer_impl.cc
diff --git a/cc/layers/video_layer_impl.cc b/cc/layers/video_layer_impl.cc
index 228f2ccdc8404341b54770e8271d8dfad4e1f9e6..28037cca1587a420e7aaf62ac9694dbbaad1eae1 100644
--- a/cc/layers/video_layer_impl.cc
+++ b/cc/layers/video_layer_impl.cc
@@ -30,18 +30,23 @@ scoped_ptr<VideoLayerImpl> VideoLayerImpl::Create(
int id,
VideoFrameProvider* provider,
media::VideoRotation video_rotation) {
- scoped_ptr<VideoLayerImpl> layer(
- new VideoLayerImpl(tree_impl, id, video_rotation));
- layer->SetProviderClientImpl(VideoFrameProviderClientImpl::Create(provider));
- DCHECK(tree_impl->proxy()->IsImplThread());
DCHECK(tree_impl->proxy()->IsMainThreadBlocked());
- return layer.Pass();
+ DCHECK(tree_impl->proxy()->IsImplThread());
+
+ scoped_refptr<VideoFrameProviderClientImpl> provider_client_impl =
+ VideoFrameProviderClientImpl::Create(provider);
+
+ return make_scoped_ptr(
+ new VideoLayerImpl(tree_impl, id, provider_client_impl, video_rotation));
}
-VideoLayerImpl::VideoLayerImpl(LayerTreeImpl* tree_impl,
- int id,
- media::VideoRotation video_rotation)
+VideoLayerImpl::VideoLayerImpl(
+ LayerTreeImpl* tree_impl,
+ int id,
+ scoped_refptr<VideoFrameProviderClientImpl> provider_client_impl,
+ media::VideoRotation video_rotation)
: LayerImpl(tree_impl, id),
+ provider_client_impl_(provider_client_impl),
frame_(nullptr),
video_rotation_(video_rotation) {
}
@@ -61,18 +66,13 @@ VideoLayerImpl::~VideoLayerImpl() {
scoped_ptr<LayerImpl> VideoLayerImpl::CreateLayerImpl(
LayerTreeImpl* tree_impl) {
- return make_scoped_ptr(new VideoLayerImpl(tree_impl, id(), video_rotation_));
-}
-
-void VideoLayerImpl::PushPropertiesTo(LayerImpl* layer) {
- LayerImpl::PushPropertiesTo(layer);
-
- VideoLayerImpl* other = static_cast<VideoLayerImpl*>(layer);
- other->SetProviderClientImpl(provider_client_impl_);
+ return make_scoped_ptr(new VideoLayerImpl(
+ tree_impl, id(), provider_client_impl_, video_rotation_));
}
void VideoLayerImpl::DidBecomeActive() {
- provider_client_impl_->SetActiveVideoLayer(this);
+ if (!provider_client_impl_->Started())
+ provider_client_impl_->Start(this);
}
bool VideoLayerImpl::WillDraw(DrawMode draw_mode,
@@ -364,11 +364,6 @@ void VideoLayerImpl::SetNeedsRedraw() {
layer_tree_impl()->SetNeedsRedraw();
}
-void VideoLayerImpl::SetProviderClientImpl(
- scoped_refptr<VideoFrameProviderClientImpl> provider_client_impl) {
- provider_client_impl_ = provider_client_impl;
-}
-
const char* VideoLayerImpl::LayerTypeAsString() const {
return "cc::VideoLayerImpl";
}

Powered by Google App Engine
This is Rietveld 408576698