| 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/common/gpu/media/gpu_jpeg_decode_accelerator.h" | 5 #include "content/common/gpu/media/gpu_jpeg_decode_accelerator.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/containers/hash_tables.h" | 11 #include "base/containers/hash_tables.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/memory/shared_memory.h" | 13 #include "base/memory/shared_memory.h" |
| 14 #include "base/single_thread_task_runner.h" | 14 #include "base/single_thread_task_runner.h" |
| 15 #include "base/stl_util.h" | 15 #include "base/stl_util.h" |
| 16 #include "base/thread_task_runner_handle.h" | 16 #include "base/thread_task_runner_handle.h" |
| 17 #include "base/trace_event/trace_event.h" | 17 #include "base/trace_event/trace_event.h" |
| 18 #include "build/build_config.h" | 18 #include "build/build_config.h" |
| 19 #include "gpu/ipc/service/gpu_channel.h" | 19 #include "content/common/gpu/gpu_channel.h" |
| 20 #include "ipc/ipc_message_macros.h" | 20 #include "ipc/ipc_message_macros.h" |
| 21 #include "ipc/message_filter.h" | 21 #include "ipc/message_filter.h" |
| 22 #include "media/filters/jpeg_parser.h" | 22 #include "media/filters/jpeg_parser.h" |
| 23 #include "media/gpu/ipc/common/media_messages.h" | 23 #include "media/gpu/ipc/common/media_messages.h" |
| 24 #include "ui/gfx/geometry/size.h" | 24 #include "ui/gfx/geometry/size.h" |
| 25 | 25 |
| 26 #if defined(OS_CHROMEOS) | 26 #if defined(OS_CHROMEOS) |
| 27 #if defined(ARCH_CPU_X86_FAMILY) | 27 #if defined(ARCH_CPU_X86_FAMILY) |
| 28 #include "content/common/gpu/media/vaapi_jpeg_decode_accelerator.h" | 28 #include "content/common/gpu/media/vaapi_jpeg_decode_accelerator.h" |
| 29 #endif | 29 #endif |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 // The sender to which this filter was added. | 285 // The sender to which this filter was added. |
| 286 IPC::Sender* sender_; | 286 IPC::Sender* sender_; |
| 287 | 287 |
| 288 // A map from route id to JpegDecodeAccelerator. | 288 // A map from route id to JpegDecodeAccelerator. |
| 289 // Unless in destructor (maybe on child thread), |client_map_| should | 289 // Unless in destructor (maybe on child thread), |client_map_| should |
| 290 // only be accessed on IO thread. | 290 // only be accessed on IO thread. |
| 291 ClientMap client_map_; | 291 ClientMap client_map_; |
| 292 }; | 292 }; |
| 293 | 293 |
| 294 GpuJpegDecodeAccelerator::GpuJpegDecodeAccelerator( | 294 GpuJpegDecodeAccelerator::GpuJpegDecodeAccelerator( |
| 295 gpu::GpuChannel* channel, | 295 GpuChannel* channel, |
| 296 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner) | 296 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner) |
| 297 : channel_(channel), | 297 : channel_(channel), |
| 298 child_task_runner_(base::ThreadTaskRunnerHandle::Get()), | 298 child_task_runner_(base::ThreadTaskRunnerHandle::Get()), |
| 299 io_task_runner_(io_task_runner), | 299 io_task_runner_(io_task_runner), |
| 300 client_number_(0) { | 300 client_number_(0) { |
| 301 } | 301 } |
| 302 | 302 |
| 303 GpuJpegDecodeAccelerator::~GpuJpegDecodeAccelerator() { | 303 GpuJpegDecodeAccelerator::~GpuJpegDecodeAccelerator() { |
| 304 DCHECK(CalledOnValidThread()); | 304 DCHECK(CalledOnValidThread()); |
| 305 if (filter_) { | 305 if (filter_) { |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 for (const auto& create_jda_function : create_jda_fps) { | 414 for (const auto& create_jda_function : create_jda_fps) { |
| 415 scoped_ptr<media::JpegDecodeAccelerator> accelerator = | 415 scoped_ptr<media::JpegDecodeAccelerator> accelerator = |
| 416 (*create_jda_function)(base::ThreadTaskRunnerHandle::Get()); | 416 (*create_jda_function)(base::ThreadTaskRunnerHandle::Get()); |
| 417 if (accelerator && accelerator->IsSupported()) | 417 if (accelerator && accelerator->IsSupported()) |
| 418 return true; | 418 return true; |
| 419 } | 419 } |
| 420 return false; | 420 return false; |
| 421 } | 421 } |
| 422 | 422 |
| 423 } // namespace content | 423 } // namespace content |
| OLD | NEW |