OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "content/browser/renderer_host/media/video_capture_gpu_jpeg_decoder.h" | 5 #include "content/browser/renderer_host/media/video_capture_gpu_jpeg_decoder.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 base::AutoLock lock(lock_); | 192 base::AutoLock lock(lock_); |
193 decode_done_closure_.Reset(); | 193 decode_done_closure_.Reset(); |
194 decoder_status_ = FAILED; | 194 decoder_status_ = FAILED; |
195 } | 195 } |
196 | 196 |
197 // static | 197 // static |
198 void VideoCaptureGpuJpegDecoder::EstablishGpuChannelOnUIThread( | 198 void VideoCaptureGpuJpegDecoder::EstablishGpuChannelOnUIThread( |
199 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 199 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
200 base::WeakPtr<VideoCaptureGpuJpegDecoder> weak_this) { | 200 base::WeakPtr<VideoCaptureGpuJpegDecoder> weak_this) { |
201 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 201 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
202 DCHECK(BrowserGpuChannelHostFactory::instance()); | 202 |
| 203 // If the factory is unavailable, this means we are shutting down. |
| 204 if (!BrowserGpuChannelHostFactory::instance()) { |
| 205 GpuChannelEstablishedOnUIThread(task_runner, weak_this, nullptr); |
| 206 return; |
| 207 } |
203 | 208 |
204 BrowserGpuChannelHostFactory::instance()->EstablishGpuChannel( | 209 BrowserGpuChannelHostFactory::instance()->EstablishGpuChannel( |
205 base::Bind(&VideoCaptureGpuJpegDecoder::GpuChannelEstablishedOnUIThread, | 210 base::Bind(&VideoCaptureGpuJpegDecoder::GpuChannelEstablishedOnUIThread, |
206 task_runner, weak_this)); | 211 task_runner, weak_this)); |
207 } | 212 } |
208 | 213 |
209 // static | 214 // static |
210 void VideoCaptureGpuJpegDecoder::GpuChannelEstablishedOnUIThread( | 215 void VideoCaptureGpuJpegDecoder::GpuChannelEstablishedOnUIThread( |
211 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 216 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
212 base::WeakPtr<VideoCaptureGpuJpegDecoder> weak_this, | 217 base::WeakPtr<VideoCaptureGpuJpegDecoder> weak_this, |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 lock_.AssertAcquired(); | 255 lock_.AssertAcquired(); |
251 return !decode_done_closure_.is_null(); | 256 return !decode_done_closure_.is_null(); |
252 } | 257 } |
253 | 258 |
254 void VideoCaptureGpuJpegDecoder::RecordInitDecodeUMA_Locked() { | 259 void VideoCaptureGpuJpegDecoder::RecordInitDecodeUMA_Locked() { |
255 UMA_HISTOGRAM_BOOLEAN("Media.VideoCaptureGpuJpegDecoder.InitDecodeSuccess", | 260 UMA_HISTOGRAM_BOOLEAN("Media.VideoCaptureGpuJpegDecoder.InitDecodeSuccess", |
256 decoder_status_ == INIT_PASSED); | 261 decoder_status_ == INIT_PASSED); |
257 } | 262 } |
258 | 263 |
259 } // namespace content | 264 } // namespace content |
OLD | NEW |