| 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 base::Bind(&VideoCaptureGpuJpegDecoder::GpuChannelEstablishedOnUIThread, | 202 base::Bind(&VideoCaptureGpuJpegDecoder::GpuChannelEstablishedOnUIThread, |
| 203 task_runner, weak_this)); | 203 task_runner, weak_this)); |
| 204 } | 204 } |
| 205 | 205 |
| 206 // static | 206 // static |
| 207 void VideoCaptureGpuJpegDecoder::GpuChannelEstablishedOnUIThread( | 207 void VideoCaptureGpuJpegDecoder::GpuChannelEstablishedOnUIThread( |
| 208 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 208 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
| 209 base::WeakPtr<VideoCaptureGpuJpegDecoder> weak_this) { | 209 base::WeakPtr<VideoCaptureGpuJpegDecoder> weak_this) { |
| 210 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 210 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 211 | 211 |
| 212 scoped_refptr<GpuChannelHost> gpu_channel_host( | 212 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host( |
| 213 BrowserGpuChannelHostFactory::instance()->GetGpuChannel()); | 213 BrowserGpuChannelHostFactory::instance()->GetGpuChannel()); |
| 214 task_runner->PostTask( | 214 task_runner->PostTask( |
| 215 FROM_HERE, base::Bind(&VideoCaptureGpuJpegDecoder::FinishInitialization, | 215 FROM_HERE, base::Bind(&VideoCaptureGpuJpegDecoder::FinishInitialization, |
| 216 weak_this, std::move(gpu_channel_host))); | 216 weak_this, std::move(gpu_channel_host))); |
| 217 } | 217 } |
| 218 | 218 |
| 219 void VideoCaptureGpuJpegDecoder::FinishInitialization( | 219 void VideoCaptureGpuJpegDecoder::FinishInitialization( |
| 220 scoped_refptr<GpuChannelHost> gpu_channel_host) { | 220 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host) { |
| 221 TRACE_EVENT0("gpu", "VideoCaptureGpuJpegDecoder::FinishInitialization"); | 221 TRACE_EVENT0("gpu", "VideoCaptureGpuJpegDecoder::FinishInitialization"); |
| 222 DCHECK(CalledOnValidThread()); | 222 DCHECK(CalledOnValidThread()); |
| 223 base::AutoLock lock(lock_); | 223 base::AutoLock lock(lock_); |
| 224 if (!gpu_channel_host) { | 224 if (!gpu_channel_host) { |
| 225 LOG(ERROR) << "Failed to establish GPU channel for JPEG decoder"; | 225 LOG(ERROR) << "Failed to establish GPU channel for JPEG decoder"; |
| 226 } else if (gpu_channel_host->gpu_info().jpeg_decode_accelerator_supported) { | 226 } else if (gpu_channel_host->gpu_info().jpeg_decode_accelerator_supported) { |
| 227 gpu_channel_host_ = std::move(gpu_channel_host); | 227 gpu_channel_host_ = std::move(gpu_channel_host); |
| 228 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner = | 228 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner = |
| 229 BrowserGpuChannelHostFactory::instance()->GetIOThreadTaskRunner(); | 229 BrowserGpuChannelHostFactory::instance()->GetIOThreadTaskRunner(); |
| 230 | 230 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 248 lock_.AssertAcquired(); | 248 lock_.AssertAcquired(); |
| 249 return !decode_done_closure_.is_null(); | 249 return !decode_done_closure_.is_null(); |
| 250 } | 250 } |
| 251 | 251 |
| 252 void VideoCaptureGpuJpegDecoder::RecordInitDecodeUMA_Locked() { | 252 void VideoCaptureGpuJpegDecoder::RecordInitDecodeUMA_Locked() { |
| 253 UMA_HISTOGRAM_BOOLEAN("Media.VideoCaptureGpuJpegDecoder.InitDecodeSuccess", | 253 UMA_HISTOGRAM_BOOLEAN("Media.VideoCaptureGpuJpegDecoder.InitDecodeSuccess", |
| 254 decoder_status_ == INIT_PASSED); | 254 decoder_status_ == INIT_PASSED); |
| 255 } | 255 } |
| 256 | 256 |
| 257 } // namespace content | 257 } // namespace content |
| OLD | NEW |