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

Side by Side Diff: services/media/factory_service/rule_set.cc

Issue 1822333002: Motown: wholesale clang-format (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: dalesat Created 4 years, 9 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
OLDNEW
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 "services/media/factory_service/rule_set.h" 7 #include "services/media/factory_service/rule_set.h"
8 8
9 namespace mojo { 9 namespace mojo {
10 namespace media { 10 namespace media {
11 11
12 RuleSet::RuleSet() {} 12 RuleSet::RuleSet() {}
13 13
14 RuleSet::~RuleSet() {} 14 RuleSet::~RuleSet() {}
15 15
16 Event RuleSet::AddRule(const Condition& condition) { 16 Event RuleSet::AddRule(const Condition& condition) {
17 Event event = Event::Create(); 17 Event event = Event::Create();
18 18
19 if (condition()) { 19 if (condition()) {
20 event.Occur(); 20 event.Occur();
21 } else { 21 } else {
22 CheckRules(); // To purge occurred/cancelled events. 22 CheckRules(); // To purge occurred/cancelled events.
23 rules_.push_back(Rule(condition, event)); 23 rules_.push_back(Rule(condition, event));
24 } 24 }
25 25
26 return event; 26 return event;
27 } 27 }
28 28
29 void RuleSet::CheckRules() { 29 void RuleSet::CheckRules() {
30 Event to_occur; 30 Event to_occur;
31 std::unique_ptr<std::list<Event>> more_to_occur; 31 std::unique_ptr<std::list<Event>> more_to_occur;
32 32
(...skipping 26 matching lines...) Expand all
59 59
60 if (more_to_occur) { 60 if (more_to_occur) {
61 for (const Event& event : *more_to_occur) { 61 for (const Event& event : *more_to_occur) {
62 event.Occur(); 62 event.Occur();
63 } 63 }
64 } 64 }
65 } 65 }
66 66
67 } // namespace media 67 } // namespace media
68 } // namespace mojo 68 } // namespace mojo
OLDNEW
« no previous file with comments | « services/media/factory_service/media_source_impl.cc ('k') | services/media/factory_service/watched.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698