OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/test/utility/in_process_receiver.h" | 5 #include "media/cast/test/utility/in_process_receiver.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 } | 55 } |
56 | 56 |
57 void InProcessReceiver::Start() { | 57 void InProcessReceiver::Start() { |
58 cast_environment_->PostTask(CastEnvironment::MAIN, | 58 cast_environment_->PostTask(CastEnvironment::MAIN, |
59 FROM_HERE, | 59 FROM_HERE, |
60 base::Bind(&InProcessReceiver::StartOnMainThread, | 60 base::Bind(&InProcessReceiver::StartOnMainThread, |
61 base::Unretained(this))); | 61 base::Unretained(this))); |
62 } | 62 } |
63 | 63 |
64 void InProcessReceiver::Stop() { | 64 void InProcessReceiver::Stop() { |
65 base::WaitableEvent event(false, false); | 65 base::WaitableEvent event(base::WaitableEvent::ResetPolicy::AUTOMATIC, |
| 66 base::WaitableEvent::InitialState::NOT_SIGNALED); |
66 if (cast_environment_->CurrentlyOn(CastEnvironment::MAIN)) { | 67 if (cast_environment_->CurrentlyOn(CastEnvironment::MAIN)) { |
67 StopOnMainThread(&event); | 68 StopOnMainThread(&event); |
68 } else { | 69 } else { |
69 cast_environment_->PostTask(CastEnvironment::MAIN, | 70 cast_environment_->PostTask(CastEnvironment::MAIN, |
70 FROM_HERE, | 71 FROM_HERE, |
71 base::Bind(&InProcessReceiver::StopOnMainThread, | 72 base::Bind(&InProcessReceiver::StopOnMainThread, |
72 base::Unretained(this), | 73 base::Unretained(this), |
73 &event)); | 74 &event)); |
74 event.Wait(); | 75 event.Wait(); |
75 } | 76 } |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 &InProcessReceiver::GotVideoFrame, weak_factory_.GetWeakPtr())); | 144 &InProcessReceiver::GotVideoFrame, weak_factory_.GetWeakPtr())); |
144 } | 145 } |
145 | 146 |
146 void InProcessReceiver::ReceivePacket(std::unique_ptr<Packet> packet) { | 147 void InProcessReceiver::ReceivePacket(std::unique_ptr<Packet> packet) { |
147 // TODO(Hubbe): Make an InsertPacket method instead. | 148 // TODO(Hubbe): Make an InsertPacket method instead. |
148 cast_receiver_->ReceivePacket(std::move(packet)); | 149 cast_receiver_->ReceivePacket(std::move(packet)); |
149 } | 150 } |
150 | 151 |
151 } // namespace cast | 152 } // namespace cast |
152 } // namespace media | 153 } // namespace media |
OLD | NEW |