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 "media/cast/sender/fake_video_encode_accelerator_factory.h" | 5 #include "media/cast/sender/fake_video_encode_accelerator_factory.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
8 | 10 |
9 namespace media { | 11 namespace media { |
10 namespace cast { | 12 namespace cast { |
11 | 13 |
12 FakeVideoEncodeAcceleratorFactory::FakeVideoEncodeAcceleratorFactory( | 14 FakeVideoEncodeAcceleratorFactory::FakeVideoEncodeAcceleratorFactory( |
13 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) | 15 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) |
14 : task_runner_(task_runner), | 16 : task_runner_(task_runner), |
15 will_init_succeed_(true), | 17 will_init_succeed_(true), |
16 auto_respond_(false), | 18 auto_respond_(false), |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 CHECK(next_response_shm_->CreateAndMapAnonymous(size)); | 61 CHECK(next_response_shm_->CreateAndMapAnonymous(size)); |
60 shm_response_callback_ = callback; | 62 shm_response_callback_ = callback; |
61 if (auto_respond_) | 63 if (auto_respond_) |
62 RespondWithSharedMemory(); | 64 RespondWithSharedMemory(); |
63 } | 65 } |
64 | 66 |
65 void FakeVideoEncodeAcceleratorFactory::RespondWithVideoEncodeAccelerator() { | 67 void FakeVideoEncodeAcceleratorFactory::RespondWithVideoEncodeAccelerator() { |
66 DCHECK(next_response_vea_.get()); | 68 DCHECK(next_response_vea_.get()); |
67 last_response_vea_ = next_response_vea_.get(); | 69 last_response_vea_ = next_response_vea_.get(); |
68 ++vea_response_count_; | 70 ++vea_response_count_; |
69 base::ResetAndReturn(&vea_response_callback_).Run( | 71 base::ResetAndReturn(&vea_response_callback_) |
70 task_runner_, next_response_vea_.Pass()); | 72 .Run(task_runner_, std::move(next_response_vea_)); |
71 } | 73 } |
72 | 74 |
73 void FakeVideoEncodeAcceleratorFactory::RespondWithSharedMemory() { | 75 void FakeVideoEncodeAcceleratorFactory::RespondWithSharedMemory() { |
74 DCHECK(next_response_shm_.get()); | 76 DCHECK(next_response_shm_.get()); |
75 last_response_shm_ = next_response_shm_.get(); | 77 last_response_shm_ = next_response_shm_.get(); |
76 ++shm_response_count_; | 78 ++shm_response_count_; |
77 base::ResetAndReturn(&shm_response_callback_).Run(next_response_shm_.Pass()); | 79 base::ResetAndReturn(&shm_response_callback_) |
| 80 .Run(std::move(next_response_shm_)); |
78 } | 81 } |
79 | 82 |
80 } // namespace cast | 83 } // namespace cast |
81 } // namespace media | 84 } // namespace media |
OLD | NEW |