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

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: Update perf tests. 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/task_runner_provider.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->task_runner_provider()->IsMainThreadBlocked());
34 DCHECK(tree_impl->proxy()->IsImplThread()); 34 DCHECK(tree_impl->task_runner_provider()->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()->task_runner_provider()->IsImplThread());
63 DCHECK(layer_tree_impl()->proxy()->IsMainThreadBlocked()); 63 DCHECK(layer_tree_impl()->task_runner_provider()->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 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 } 362 }
363 363
364 void VideoLayerImpl::DidDraw(ResourceProvider* resource_provider) { 364 void VideoLayerImpl::DidDraw(ResourceProvider* resource_provider) {
365 LayerImpl::DidDraw(resource_provider); 365 LayerImpl::DidDraw(resource_provider);
366 366
367 DCHECK(frame_.get()); 367 DCHECK(frame_.get());
368 368
369 if (frame_resource_type_ == 369 if (frame_resource_type_ ==
370 VideoFrameExternalResources::SOFTWARE_RESOURCE) { 370 VideoFrameExternalResources::SOFTWARE_RESOURCE) {
371 for (size_t i = 0; i < software_resources_.size(); ++i) { 371 for (size_t i = 0; i < software_resources_.size(); ++i) {
372 software_release_callback_.Run( 372 software_release_callback_.Run(0, false,
373 0, false, layer_tree_impl()->BlockingMainThreadTaskRunner()); 373 layer_tree_impl()
374 ->task_runner_provider()
375 ->blocking_main_thread_task_runner());
374 } 376 }
375 377
376 software_resources_.clear(); 378 software_resources_.clear();
377 software_release_callback_.Reset(); 379 software_release_callback_.Reset();
378 } else { 380 } else {
379 for (size_t i = 0; i < frame_resources_.size(); ++i) 381 for (size_t i = 0; i < frame_resources_.size(); ++i)
380 resource_provider->DeleteResource(frame_resources_[i].id); 382 resource_provider->DeleteResource(frame_resources_[i].id);
381 frame_resources_.clear(); 383 frame_resources_.clear();
382 } 384 }
383 385
(...skipping 17 matching lines...) Expand all
401 void VideoLayerImpl::SetNeedsRedraw() { 403 void VideoLayerImpl::SetNeedsRedraw() {
402 SetUpdateRect(gfx::UnionRects(update_rect(), gfx::Rect(bounds()))); 404 SetUpdateRect(gfx::UnionRects(update_rect(), gfx::Rect(bounds())));
403 layer_tree_impl()->SetNeedsRedraw(); 405 layer_tree_impl()->SetNeedsRedraw();
404 } 406 }
405 407
406 const char* VideoLayerImpl::LayerTypeAsString() const { 408 const char* VideoLayerImpl::LayerTypeAsString() const {
407 return "cc::VideoLayerImpl"; 409 return "cc::VideoLayerImpl";
408 } 410 }
409 411
410 } // namespace cc 412 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/video_frame_provider_client_impl_unittest.cc ('k') | cc/layers/video_layer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698