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 "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" |
(...skipping 23 matching lines...) Expand all Loading... | |
34 new VideoLayerImpl(tree_impl, id, video_rotation)); | 34 new VideoLayerImpl(tree_impl, id, video_rotation)); |
35 layer->SetProviderClientImpl(VideoFrameProviderClientImpl::Create(provider)); | 35 layer->SetProviderClientImpl(VideoFrameProviderClientImpl::Create(provider)); |
36 DCHECK(tree_impl->proxy()->IsImplThread()); | 36 DCHECK(tree_impl->proxy()->IsImplThread()); |
37 DCHECK(tree_impl->proxy()->IsMainThreadBlocked()); | 37 DCHECK(tree_impl->proxy()->IsMainThreadBlocked()); |
38 return layer.Pass(); | 38 return layer.Pass(); |
39 } | 39 } |
40 | 40 |
41 VideoLayerImpl::VideoLayerImpl(LayerTreeImpl* tree_impl, | 41 VideoLayerImpl::VideoLayerImpl(LayerTreeImpl* tree_impl, |
42 int id, | 42 int id, |
43 media::VideoRotation video_rotation) | 43 media::VideoRotation video_rotation) |
44 : LayerImpl(tree_impl, id), frame_(NULL), video_rotation_(video_rotation) { | 44 : LayerImpl(tree_impl, id), frame_(nullptr), video_rotation_(video_rotation) { |
reveman
2014/10/09 15:08:01
needs re-format
| |
45 } | 45 } |
46 | 46 |
47 VideoLayerImpl::~VideoLayerImpl() { | 47 VideoLayerImpl::~VideoLayerImpl() { |
48 if (!provider_client_impl_->Stopped()) { | 48 if (!provider_client_impl_->Stopped()) { |
49 // In impl side painting, we may have a pending and active layer | 49 // In impl side painting, we may have a pending and active layer |
50 // associated with the video provider at the same time. Both have a ref | 50 // associated with the video provider at the same time. Both have a ref |
51 // on the VideoFrameProviderClientImpl, but we stop when the first | 51 // on the VideoFrameProviderClientImpl, but we stop when the first |
52 // LayerImpl (the one on the pending tree) is destroyed since we know | 52 // LayerImpl (the one on the pending tree) is destroyed since we know |
53 // the main thread is blocked for this commit. | 53 // the main thread is blocked for this commit. |
54 DCHECK(layer_tree_impl()->proxy()->IsImplThread()); | 54 DCHECK(layer_tree_impl()->proxy()->IsImplThread()); |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
344 | 344 |
345 software_resources_.clear(); | 345 software_resources_.clear(); |
346 software_release_callback_.Reset(); | 346 software_release_callback_.Reset(); |
347 } else { | 347 } else { |
348 for (size_t i = 0; i < frame_resources_.size(); ++i) | 348 for (size_t i = 0; i < frame_resources_.size(); ++i) |
349 resource_provider->DeleteResource(frame_resources_[i]); | 349 resource_provider->DeleteResource(frame_resources_[i]); |
350 frame_resources_.clear(); | 350 frame_resources_.clear(); |
351 } | 351 } |
352 | 352 |
353 provider_client_impl_->PutCurrentFrame(frame_); | 353 provider_client_impl_->PutCurrentFrame(frame_); |
354 frame_ = NULL; | 354 frame_ = nullptr; |
355 | 355 |
356 provider_client_impl_->ReleaseLock(); | 356 provider_client_impl_->ReleaseLock(); |
357 } | 357 } |
358 | 358 |
359 void VideoLayerImpl::ReleaseResources() { | 359 void VideoLayerImpl::ReleaseResources() { |
360 updater_ = nullptr; | 360 updater_ = nullptr; |
361 } | 361 } |
362 | 362 |
363 void VideoLayerImpl::SetNeedsRedraw() { | 363 void VideoLayerImpl::SetNeedsRedraw() { |
364 SetUpdateRect(gfx::UnionRects(update_rect(), gfx::RectF(bounds()))); | 364 SetUpdateRect(gfx::UnionRects(update_rect(), gfx::RectF(bounds()))); |
365 layer_tree_impl()->SetNeedsRedraw(); | 365 layer_tree_impl()->SetNeedsRedraw(); |
366 } | 366 } |
367 | 367 |
368 void VideoLayerImpl::SetProviderClientImpl( | 368 void VideoLayerImpl::SetProviderClientImpl( |
369 scoped_refptr<VideoFrameProviderClientImpl> provider_client_impl) { | 369 scoped_refptr<VideoFrameProviderClientImpl> provider_client_impl) { |
370 provider_client_impl_ = provider_client_impl; | 370 provider_client_impl_ = provider_client_impl; |
371 } | 371 } |
372 | 372 |
373 const char* VideoLayerImpl::LayerTypeAsString() const { | 373 const char* VideoLayerImpl::LayerTypeAsString() const { |
374 return "cc::VideoLayerImpl"; | 374 return "cc::VideoLayerImpl"; |
375 } | 375 } |
376 | 376 |
377 } // namespace cc | 377 } // namespace cc |
OLD | NEW |