OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 <list> | 5 #include <list> |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "services/media/factory_service/event.h" | 8 #include "services/media/factory_service/event.h" |
9 | 9 |
10 namespace mojo { | 10 namespace mojo { |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 } | 162 } |
163 | 163 |
164 void FirstEventImpl::Init() { | 164 void FirstEventImpl::Init() { |
165 for (Event& precursor : precursors_) { | 165 for (Event& precursor : precursors_) { |
166 if (precursor.occurred()) { | 166 if (precursor.occurred()) { |
167 Finished(); | 167 Finished(); |
168 return; | 168 return; |
169 } | 169 } |
170 } | 170 } |
171 | 171 |
172 std::function<void()> consequence = [this]() { | 172 std::function<void()> consequence = [this]() { Finished(); }; |
173 Finished(); | |
174 }; | |
175 | 173 |
176 for (Event& precursor : precursors_) { | 174 for (Event& precursor : precursors_) { |
177 precursor.When(consequence); | 175 precursor.When(consequence); |
178 } | 176 } |
179 } | 177 } |
180 | 178 |
181 FirstEventImpl::~FirstEventImpl() { | 179 FirstEventImpl::~FirstEventImpl() { |
182 for (Event& precursor : precursors_) { | 180 for (Event& precursor : precursors_) { |
183 precursor.Cancel(); | 181 precursor.Cancel(); |
184 } | 182 } |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 precursors_.back().When(consequence_); | 214 precursors_.back().When(consequence_); |
217 return; | 215 return; |
218 } | 216 } |
219 } | 217 } |
220 | 218 |
221 Occur(); | 219 Occur(); |
222 } | 220 } |
223 | 221 |
224 } // namespace media | 222 } // namespace media |
225 } // namespace mojo | 223 } // namespace mojo |
OLD | NEW |