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

Side by Side Diff: media/cast/logging/log_event_dispatcher.cc

Issue 2023343002: Migrate WaitableEvent to enum-based constructor in media/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@WEvent_enums
Patch Set: 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/blink/webmediaplayer_impl.cc ('k') | media/cast/test/receiver.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 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/logging/log_event_dispatcher.h" 5 #include "media/cast/logging/log_event_dispatcher.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 // CastEnvironment's MAIN thread, block until the unsubscribe task 78 // CastEnvironment's MAIN thread, block until the unsubscribe task
79 // completes. 79 // completes.
80 struct Helper { 80 struct Helper {
81 static void UnsubscribeAndSignal(const scoped_refptr<Impl>& impl, 81 static void UnsubscribeAndSignal(const scoped_refptr<Impl>& impl,
82 RawEventSubscriber* subscriber, 82 RawEventSubscriber* subscriber,
83 base::WaitableEvent* done) { 83 base::WaitableEvent* done) {
84 impl->Unsubscribe(subscriber); 84 impl->Unsubscribe(subscriber);
85 done->Signal(); 85 done->Signal();
86 } 86 }
87 }; 87 };
88 base::WaitableEvent done(true, false); 88 base::WaitableEvent done(base::WaitableEvent::ResetPolicy::MANUAL,
89 base::WaitableEvent::InitialState::NOT_SIGNALED);
89 CHECK(env_->PostTask( 90 CHECK(env_->PostTask(
90 CastEnvironment::MAIN, FROM_HERE, 91 CastEnvironment::MAIN, FROM_HERE,
91 base::Bind(&Helper::UnsubscribeAndSignal, impl_, subscriber, &done))); 92 base::Bind(&Helper::UnsubscribeAndSignal, impl_, subscriber, &done)));
92 done.Wait(); 93 done.Wait();
93 } 94 }
94 } 95 }
95 96
96 LogEventDispatcher::Impl::Impl() {} 97 LogEventDispatcher::Impl::Impl() {}
97 98
98 LogEventDispatcher::Impl::~Impl() { 99 LogEventDispatcher::Impl::~Impl() {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 131
131 void LogEventDispatcher::Impl::Unsubscribe(RawEventSubscriber* subscriber) { 132 void LogEventDispatcher::Impl::Unsubscribe(RawEventSubscriber* subscriber) {
132 const auto it = 133 const auto it =
133 std::find(subscribers_.begin(), subscribers_.end(), subscriber); 134 std::find(subscribers_.begin(), subscribers_.end(), subscriber);
134 DCHECK(it != subscribers_.end()); 135 DCHECK(it != subscribers_.end());
135 subscribers_.erase(it); 136 subscribers_.erase(it);
136 } 137 }
137 138
138 } // namespace cast 139 } // namespace cast
139 } // namespace media 140 } // namespace media
OLDNEW
« no previous file with comments | « media/blink/webmediaplayer_impl.cc ('k') | media/cast/test/receiver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698