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

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: Address comments. 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..cd050d18927e65d3d3e208b8a9e44a0678689ae2 100644
--- a/cc/layers/video_layer_impl.cc
+++ b/cc/layers/video_layer_impl.cc
@@ -30,24 +30,29 @@ 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) {
}
VideoLayerImpl::~VideoLayerImpl() {
- if (!provider_client_impl_->Stopped()) {
+ if (!provider_client_impl_->Destroyed()) {
// In impl side painting, we may have a pending and active layer
// associated with the video provider at the same time. Both have a ref
// on the VideoFrameProviderClientImpl, but we stop when the first
@@ -55,20 +60,14 @@ VideoLayerImpl::~VideoLayerImpl() {
// the main thread is blocked for this commit.
DCHECK(layer_tree_impl()->proxy()->IsImplThread());
DCHECK(layer_tree_impl()->proxy()->IsMainThreadBlocked());
- provider_client_impl_->Stop();
+ provider_client_impl_->Destroy();
}
}
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() {
@@ -275,12 +274,9 @@ void VideoLayerImpl::AppendQuads(RenderPass* render_pass,
StreamVideoDrawQuad* stream_video_quad =
render_pass->CreateAndAppendDrawQuad<StreamVideoDrawQuad>();
stream_video_quad->SetNew(
- shared_quad_state,
- quad_rect,
- opaque_rect,
- visible_quad_rect,
+ shared_quad_state, quad_rect, opaque_rect, visible_quad_rect,
frame_resources_[0],
- scale * provider_client_impl_->stream_texture_matrix());
+ scale * provider_client_impl_->StreamTextureMatrix());
break;
}
case VideoFrameExternalResources::IO_SURFACE: {
@@ -364,11 +360,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