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/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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 // Explicitly acquire and release the provider mutex so it can be held from | 76 // Explicitly acquire and release the provider mutex so it can be held from |
77 // WillDraw to DidDraw. Since the compositor thread is in the middle of | 77 // WillDraw to DidDraw. Since the compositor thread is in the middle of |
78 // drawing, the layer will not be destroyed before DidDraw is called. | 78 // drawing, the layer will not be destroyed before DidDraw is called. |
79 // Therefore, the only thing that will prevent this lock from being released | 79 // Therefore, the only thing that will prevent this lock from being released |
80 // is the GPU process locking it. As the GPU process can't cause the | 80 // is the GPU process locking it. As the GPU process can't cause the |
81 // destruction of the provider (calling StopUsingProvider), holding this | 81 // destruction of the provider (calling StopUsingProvider), holding this |
82 // lock should not cause a deadlock. | 82 // lock should not cause a deadlock. |
83 frame_ = provider_client_impl_->AcquireLockAndCurrentFrame(); | 83 frame_ = provider_client_impl_->AcquireLockAndCurrentFrame(); |
84 | 84 |
85 if (!frame_) { | 85 if (!frame_) { |
| 86 // Drop any resources used by the updater if there is no frame to display. |
| 87 updater_.reset(); |
| 88 |
86 provider_client_impl_->ReleaseLock(); | 89 provider_client_impl_->ReleaseLock(); |
87 return; | 90 return; |
88 } | 91 } |
89 | 92 |
90 if (!updater_) | 93 if (!updater_) |
91 updater_.reset(new VideoResourceUpdater(resource_provider)); | 94 updater_.reset(new VideoResourceUpdater(resource_provider)); |
92 | 95 |
93 VideoFrameExternalResources external_resources; | 96 VideoFrameExternalResources external_resources; |
94 if (frame_->format() == media::VideoFrame::NATIVE_TEXTURE) { | 97 if (frame_->format() == media::VideoFrame::NATIVE_TEXTURE) { |
95 // TODO(danakj): To make this work for ubercomp, push this code out to | 98 // TODO(danakj): To make this work for ubercomp, push this code out to |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 void VideoLayerImpl::SetProviderClientImpl( | 304 void VideoLayerImpl::SetProviderClientImpl( |
302 scoped_refptr<VideoFrameProviderClientImpl> provider_client_impl) { | 305 scoped_refptr<VideoFrameProviderClientImpl> provider_client_impl) { |
303 provider_client_impl_ = provider_client_impl; | 306 provider_client_impl_ = provider_client_impl; |
304 } | 307 } |
305 | 308 |
306 const char* VideoLayerImpl::LayerTypeAsString() const { | 309 const char* VideoLayerImpl::LayerTypeAsString() const { |
307 return "VideoLayer"; | 310 return "VideoLayer"; |
308 } | 311 } |
309 | 312 |
310 } // namespace cc | 313 } // namespace cc |
OLD | NEW |