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/logging.h" | 7 #include "base/logging.h" |
8 #include "cc/base/math_util.h" | 8 #include "cc/base/math_util.h" |
9 #include "cc/layers/quad_sink.h" | 9 #include "cc/layers/quad_sink.h" |
10 #include "cc/layers/video_frame_provider_client_impl.h" | 10 #include "cc/layers/video_frame_provider_client_impl.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 | 79 |
80 void VideoLayerImpl::DidBecomeActive() { | 80 void VideoLayerImpl::DidBecomeActive() { |
81 provider_client_impl_->set_active_video_layer(this); | 81 provider_client_impl_->set_active_video_layer(this); |
82 } | 82 } |
83 | 83 |
84 void VideoLayerImpl::WillDraw(ResourceProvider* resource_provider) { | 84 void VideoLayerImpl::WillDraw(ResourceProvider* resource_provider) { |
85 LayerImpl::WillDraw(resource_provider); | 85 LayerImpl::WillDraw(resource_provider); |
86 | 86 |
87 | 87 |
88 // Explicitly acquire and release the provider mutex so it can be held from | 88 // Explicitly acquire and release the provider mutex so it can be held from |
89 // willDraw to didDraw. Since the compositor thread is in the middle of | 89 // WillDraw to DidDraw. Since the compositor thread is in the middle of |
90 // drawing, the layer will not be destroyed before didDraw is called. | 90 // drawing, the layer will not be destroyed before DidDraw is called. |
91 // Therefore, the only thing that will prevent this lock from being released | 91 // Therefore, the only thing that will prevent this lock from being released |
92 // is the GPU process locking it. As the GPU process can't cause the | 92 // is the GPU process locking it. As the GPU process can't cause the |
93 // destruction of the provider (calling stopUsingProvider), holding this | 93 // destruction of the provider (calling StopUsingProvider), holding this |
94 // lock should not cause a deadlock. | 94 // lock should not cause a deadlock. |
95 frame_ = provider_client_impl_->AcquireLockAndCurrentFrame(); | 95 frame_ = provider_client_impl_->AcquireLockAndCurrentFrame(); |
96 | 96 |
97 WillDrawInternal(resource_provider); | 97 WillDrawInternal(resource_provider); |
98 FreeUnusedFramePlanes(resource_provider); | 98 FreeUnusedFramePlanes(resource_provider); |
99 | 99 |
100 if (!frame_) | 100 if (!frame_) |
101 provider_client_impl_->ReleaseLock(); | 101 provider_client_impl_->ReleaseLock(); |
102 } | 102 } |
103 | 103 |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 void VideoLayerImpl::SetProviderClientImpl( | 470 void VideoLayerImpl::SetProviderClientImpl( |
471 scoped_refptr<VideoFrameProviderClientImpl> provider_client_impl) { | 471 scoped_refptr<VideoFrameProviderClientImpl> provider_client_impl) { |
472 provider_client_impl_ = provider_client_impl; | 472 provider_client_impl_ = provider_client_impl; |
473 } | 473 } |
474 | 474 |
475 const char* VideoLayerImpl::LayerTypeAsString() const { | 475 const char* VideoLayerImpl::LayerTypeAsString() const { |
476 return "VideoLayer"; | 476 return "VideoLayer"; |
477 } | 477 } |
478 | 478 |
479 } // namespace cc | 479 } // namespace cc |
OLD | NEW |