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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 DCHECK(BrowserGpuChannelHostFactory::instance()); | 202 DCHECK(BrowserGpuChannelHostFactory::instance()); |
203 | 203 |
204 BrowserGpuChannelHostFactory::instance()->EstablishGpuChannel( | 204 BrowserGpuChannelHostFactory::instance()->EstablishGpuChannel( |
205 base::Bind(&VideoCaptureGpuJpegDecoder::GpuChannelEstablishedOnUIThread, | 205 base::Bind(&VideoCaptureGpuJpegDecoder::GpuChannelEstablishedOnUIThread, |
206 task_runner, weak_this)); | 206 task_runner, weak_this)); |
207 } | 207 } |
208 | 208 |
209 // static | 209 // static |
210 void VideoCaptureGpuJpegDecoder::GpuChannelEstablishedOnUIThread( | 210 void VideoCaptureGpuJpegDecoder::GpuChannelEstablishedOnUIThread( |
211 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 211 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
212 base::WeakPtr<VideoCaptureGpuJpegDecoder> weak_this) { | 212 base::WeakPtr<VideoCaptureGpuJpegDecoder> weak_this, |
| 213 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host) { |
213 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 214 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
214 | 215 |
215 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host( | |
216 BrowserGpuChannelHostFactory::instance()->GetGpuChannel()); | |
217 task_runner->PostTask( | 216 task_runner->PostTask( |
218 FROM_HERE, base::Bind(&VideoCaptureGpuJpegDecoder::FinishInitialization, | 217 FROM_HERE, base::Bind(&VideoCaptureGpuJpegDecoder::FinishInitialization, |
219 weak_this, std::move(gpu_channel_host))); | 218 weak_this, std::move(gpu_channel_host))); |
220 } | 219 } |
221 | 220 |
222 void VideoCaptureGpuJpegDecoder::FinishInitialization( | 221 void VideoCaptureGpuJpegDecoder::FinishInitialization( |
223 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host) { | 222 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host) { |
224 TRACE_EVENT0("gpu", "VideoCaptureGpuJpegDecoder::FinishInitialization"); | 223 TRACE_EVENT0("gpu", "VideoCaptureGpuJpegDecoder::FinishInitialization"); |
225 DCHECK(CalledOnValidThread()); | 224 DCHECK(CalledOnValidThread()); |
226 base::AutoLock lock(lock_); | 225 base::AutoLock lock(lock_); |
(...skipping 24 matching lines...) Expand all Loading... |
251 lock_.AssertAcquired(); | 250 lock_.AssertAcquired(); |
252 return !decode_done_closure_.is_null(); | 251 return !decode_done_closure_.is_null(); |
253 } | 252 } |
254 | 253 |
255 void VideoCaptureGpuJpegDecoder::RecordInitDecodeUMA_Locked() { | 254 void VideoCaptureGpuJpegDecoder::RecordInitDecodeUMA_Locked() { |
256 UMA_HISTOGRAM_BOOLEAN("Media.VideoCaptureGpuJpegDecoder.InitDecodeSuccess", | 255 UMA_HISTOGRAM_BOOLEAN("Media.VideoCaptureGpuJpegDecoder.InitDecodeSuccess", |
257 decoder_status_ == INIT_PASSED); | 256 decoder_status_ == INIT_PASSED); |
258 } | 257 } |
259 | 258 |
260 } // namespace content | 259 } // namespace content |
OLD | NEW |