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

Side by Side Diff: cc/layers/video_layer_impl.cc

Issue 1411663002: cc: Split Proxy to eliminate unnecessary dependencies on the impl side (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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 unified diff | Download patch
OLDNEW
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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "cc/layers/video_frame_provider_client_impl.h" 9 #include "cc/layers/video_frame_provider_client_impl.h"
10 #include "cc/quads/io_surface_draw_quad.h" 10 #include "cc/quads/io_surface_draw_quad.h"
11 #include "cc/quads/stream_video_draw_quad.h" 11 #include "cc/quads/stream_video_draw_quad.h"
12 #include "cc/quads/texture_draw_quad.h" 12 #include "cc/quads/texture_draw_quad.h"
13 #include "cc/quads/yuv_video_draw_quad.h" 13 #include "cc/quads/yuv_video_draw_quad.h"
14 #include "cc/resources/resource_provider.h" 14 #include "cc/resources/resource_provider.h"
15 #include "cc/resources/single_release_callback_impl.h" 15 #include "cc/resources/single_release_callback_impl.h"
16 #include "cc/trees/layer_tree_impl.h" 16 #include "cc/trees/layer_tree_impl.h"
17 #include "cc/trees/occlusion.h" 17 #include "cc/trees/occlusion.h"
18 #include "cc/trees/proxy.h" 18 #include "cc/trees/thread_verifier.h"
19 #include "media/base/video_frame.h" 19 #include "media/base/video_frame.h"
20 20
21 #if defined(VIDEO_HOLE) 21 #if defined(VIDEO_HOLE)
22 #include "cc/quads/solid_color_draw_quad.h" 22 #include "cc/quads/solid_color_draw_quad.h"
23 #endif // defined(VIDEO_HOLE) 23 #endif // defined(VIDEO_HOLE)
24 24
25 namespace cc { 25 namespace cc {
26 26
27 // static 27 // static
28 scoped_ptr<VideoLayerImpl> VideoLayerImpl::Create( 28 scoped_ptr<VideoLayerImpl> VideoLayerImpl::Create(
29 LayerTreeImpl* tree_impl, 29 LayerTreeImpl* tree_impl,
30 int id, 30 int id,
31 VideoFrameProvider* provider, 31 VideoFrameProvider* provider,
32 media::VideoRotation video_rotation) { 32 media::VideoRotation video_rotation) {
33 DCHECK(tree_impl->proxy()->IsMainThreadBlocked()); 33 DCHECK(tree_impl->thread_verifier()->IsMainThreadBlocked());
34 DCHECK(tree_impl->proxy()->IsImplThread()); 34 DCHECK(tree_impl->thread_verifier()->IsImplThread());
35 35
36 scoped_refptr<VideoFrameProviderClientImpl> provider_client_impl = 36 scoped_refptr<VideoFrameProviderClientImpl> provider_client_impl =
37 VideoFrameProviderClientImpl::Create( 37 VideoFrameProviderClientImpl::Create(
38 provider, tree_impl->GetVideoFrameControllerClient()); 38 provider, tree_impl->GetVideoFrameControllerClient());
39 39
40 return make_scoped_ptr( 40 return make_scoped_ptr(
41 new VideoLayerImpl(tree_impl, id, provider_client_impl, video_rotation)); 41 new VideoLayerImpl(tree_impl, id, provider_client_impl, video_rotation));
42 } 42 }
43 43
44 VideoLayerImpl::VideoLayerImpl( 44 VideoLayerImpl::VideoLayerImpl(
45 LayerTreeImpl* tree_impl, 45 LayerTreeImpl* tree_impl,
46 int id, 46 int id,
47 const scoped_refptr<VideoFrameProviderClientImpl>& provider_client_impl, 47 const scoped_refptr<VideoFrameProviderClientImpl>& provider_client_impl,
48 media::VideoRotation video_rotation) 48 media::VideoRotation video_rotation)
49 : LayerImpl(tree_impl, id), 49 : LayerImpl(tree_impl, id),
50 provider_client_impl_(provider_client_impl), 50 provider_client_impl_(provider_client_impl),
51 frame_(nullptr), 51 frame_(nullptr),
52 video_rotation_(video_rotation) { 52 video_rotation_(video_rotation) {
53 } 53 }
54 54
55 VideoLayerImpl::~VideoLayerImpl() { 55 VideoLayerImpl::~VideoLayerImpl() {
56 if (!provider_client_impl_->Stopped()) { 56 if (!provider_client_impl_->Stopped()) {
57 // In impl side painting, we may have a pending and active layer 57 // In impl side painting, we may have a pending and active layer
58 // associated with the video provider at the same time. Both have a ref 58 // associated with the video provider at the same time. Both have a ref
59 // on the VideoFrameProviderClientImpl, but we stop when the first 59 // on the VideoFrameProviderClientImpl, but we stop when the first
60 // LayerImpl (the one on the pending tree) is destroyed since we know 60 // LayerImpl (the one on the pending tree) is destroyed since we know
61 // the main thread is blocked for this commit. 61 // the main thread is blocked for this commit.
62 DCHECK(layer_tree_impl()->proxy()->IsImplThread()); 62 DCHECK(layer_tree_impl()->thread_verifier()->IsImplThread());
63 DCHECK(layer_tree_impl()->proxy()->IsMainThreadBlocked()); 63 DCHECK(layer_tree_impl()->thread_verifier()->IsMainThreadBlocked());
64 provider_client_impl_->Stop(); 64 provider_client_impl_->Stop();
65 } 65 }
66 } 66 }
67 67
68 scoped_ptr<LayerImpl> VideoLayerImpl::CreateLayerImpl( 68 scoped_ptr<LayerImpl> VideoLayerImpl::CreateLayerImpl(
69 LayerTreeImpl* tree_impl) { 69 LayerTreeImpl* tree_impl) {
70 return make_scoped_ptr(new VideoLayerImpl( 70 return make_scoped_ptr(new VideoLayerImpl(
71 tree_impl, id(), provider_client_impl_, video_rotation_)); 71 tree_impl, id(), provider_client_impl_, video_rotation_));
72 } 72 }
73 73
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 void VideoLayerImpl::SetNeedsRedraw() { 401 void VideoLayerImpl::SetNeedsRedraw() {
402 SetUpdateRect(gfx::UnionRects(update_rect(), gfx::Rect(bounds()))); 402 SetUpdateRect(gfx::UnionRects(update_rect(), gfx::Rect(bounds())));
403 layer_tree_impl()->SetNeedsRedraw(); 403 layer_tree_impl()->SetNeedsRedraw();
404 } 404 }
405 405
406 const char* VideoLayerImpl::LayerTypeAsString() const { 406 const char* VideoLayerImpl::LayerTypeAsString() const {
407 return "cc::VideoLayerImpl"; 407 return "cc::VideoLayerImpl";
408 } 408 }
409 409
410 } // namespace cc 410 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698