Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(906)

Side by Side Diff: media/gpu/ipc/service/gpu_jpeg_decode_accelerator.cc

Issue 2905823002: Add Mojo interfaces for GpuJpegDecodeAccelerator and GpuJpegDecodeAcceleratorHost (Closed)
Patch Set: mojo interface Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "media/gpu/ipc/service/gpu_jpeg_decode_accelerator.h" 5 #include "media/gpu/ipc/service/gpu_jpeg_decode_accelerator.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, 373 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner,
374 std::vector<GpuJpegDecodeAcceleratorFactoryProvider::CreateAcceleratorCB> 374 std::vector<GpuJpegDecodeAcceleratorFactoryProvider::CreateAcceleratorCB>
375 accelerator_factory_functions) 375 accelerator_factory_functions)
376 : accelerator_factory_functions_(accelerator_factory_functions), 376 : accelerator_factory_functions_(accelerator_factory_functions),
377 channel_(channel), 377 channel_(channel),
378 child_task_runner_(base::ThreadTaskRunnerHandle::Get()), 378 child_task_runner_(base::ThreadTaskRunnerHandle::Get()),
379 io_task_runner_(std::move(io_task_runner)), 379 io_task_runner_(std::move(io_task_runner)),
380 client_number_(0) {} 380 client_number_(0) {}
381 381
382 GpuJpegDecodeAccelerator::~GpuJpegDecodeAccelerator() { 382 GpuJpegDecodeAccelerator::~GpuJpegDecodeAccelerator() {
383 DCHECK(CalledOnValidThread()); 383 DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
384 if (filter_) { 384 if (filter_) {
385 channel_->RemoveFilter(filter_.get()); 385 channel_->RemoveFilter(filter_.get());
386 } 386 }
387 } 387 }
388 388
389 void GpuJpegDecodeAccelerator::AddClient(int32_t route_id, 389 void GpuJpegDecodeAccelerator::AddClient(int32_t route_id,
390 base::Callback<void(bool)> response) { 390 base::Callback<void(bool)> response) {
391 DCHECK(CalledOnValidThread()); 391 DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
392 392
393 // When adding non-chromeos platforms, VideoCaptureGpuJpegDecoder::Initialize 393 // When adding non-chromeos platforms, VideoCaptureGpuJpegDecoder::Initialize
394 // needs to be updated. 394 // needs to be updated.
395 395
396 std::unique_ptr<Client> client( 396 std::unique_ptr<Client> client(
397 new Client(AsWeakPtr(), route_id, io_task_runner_)); 397 new Client(AsWeakPtr(), route_id, io_task_runner_));
398 std::unique_ptr<JpegDecodeAccelerator> accelerator; 398 std::unique_ptr<JpegDecodeAccelerator> accelerator;
399 for (const auto& create_jda_function : accelerator_factory_functions_) { 399 for (const auto& create_jda_function : accelerator_factory_functions_) {
400 std::unique_ptr<JpegDecodeAccelerator> tmp_accelerator = 400 std::unique_ptr<JpegDecodeAccelerator> tmp_accelerator =
401 create_jda_function.Run(io_task_runner_); 401 create_jda_function.Run(io_task_runner_);
(...skipping 26 matching lines...) Expand all
428 // here instead of making the code unnecessarily complicated. 428 // here instead of making the code unnecessarily complicated.
429 io_task_runner_->PostTask( 429 io_task_runner_->PostTask(
430 FROM_HERE, base::Bind(&MessageFilter::AddClientOnIOThread, filter_, 430 FROM_HERE, base::Bind(&MessageFilter::AddClientOnIOThread, filter_,
431 route_id, client.release(), response)); 431 route_id, client.release(), response));
432 } 432 }
433 433
434 void GpuJpegDecodeAccelerator::NotifyDecodeStatus( 434 void GpuJpegDecodeAccelerator::NotifyDecodeStatus(
435 int32_t route_id, 435 int32_t route_id,
436 int32_t buffer_id, 436 int32_t buffer_id,
437 JpegDecodeAccelerator::Error error) { 437 JpegDecodeAccelerator::Error error) {
438 DCHECK(CalledOnValidThread()); 438 DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
439 Send(new AcceleratedJpegDecoderHostMsg_DecodeAck(route_id, buffer_id, error)); 439 Send(new AcceleratedJpegDecoderHostMsg_DecodeAck(route_id, buffer_id, error));
440 } 440 }
441 441
442 void GpuJpegDecodeAccelerator::ClientRemoved() { 442 void GpuJpegDecodeAccelerator::ClientRemoved() {
443 DCHECK(CalledOnValidThread()); 443 DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
444 DCHECK_GT(client_number_, 0); 444 DCHECK_GT(client_number_, 0);
445 client_number_--; 445 client_number_--;
446 if (client_number_ == 0) { 446 if (client_number_ == 0) {
447 channel_->RemoveFilter(filter_.get()); 447 channel_->RemoveFilter(filter_.get());
448 filter_ = nullptr; 448 filter_ = nullptr;
449 } 449 }
450 } 450 }
451 451
452 bool GpuJpegDecodeAccelerator::Send(IPC::Message* message) { 452 bool GpuJpegDecodeAccelerator::Send(IPC::Message* message) {
453 DCHECK(CalledOnValidThread()); 453 DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
454 return channel_->Send(message); 454 return channel_->Send(message);
455 } 455 }
456 456
457 void GpuJpegDecodeAccelerator::CreateJpegDecoder(
458 mojom::GpuJpegDecodeAcceleratorClientPtr client,
459 CreateJpegDecoderCallback callback) {}
mcasas 2017/05/26 14:39:59 Until you implement these methods, write NOTIMPLEM
Chandan 2017/05/29 13:02:33 Done.
460
461 void GpuJpegDecodeAccelerator::Decode(mojom::JpegDecodeInfoPtr info) {}
462
463 void GpuJpegDecodeAccelerator::Destroy() {}
464
457 } // namespace media 465 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698