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

Side by Side Diff: media/cast/test/utility/in_process_receiver.cc

Issue 2024723002: DO NOT COMMIT (will be split in sub-components) - clang-tidy WaitableEvent refactor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@WEvent_enums
Patch Set: fix presubmits Created 4 years, 6 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
« no previous file with comments | « media/cast/test/receiver.cc ('k') | media/cast/test/utility/udp_proxy.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « media/cast/test/receiver.cc ('k') | media/cast/test/utility/udp_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698