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