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

Side by Side Diff: headless/lib/browser/domain_cc.template

Issue 2427883003: Remove usage of FOR_EACH_OBSERVER macro in headless domain_cc.template (Closed)
Patch Set: braces Created 4 years, 2 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // This file is generated 1 // This file is generated
2 2
3 // Copyright 2016 The Chromium Authors. All rights reserved. 3 // Copyright 2016 The Chromium Authors. All rights reserved.
4 // Use of this source code is governed by a BSD-style license that can be 4 // Use of this source code is governed by a BSD-style license that can be
5 // found in the LICENSE file. 5 // found in the LICENSE file.
6 6
7 #include "headless/public/domains/{{domain.domain | camelcase_to_hacker_style}}. h" 7 #include "headless/public/domains/{{domain.domain | camelcase_to_hacker_style}}. h"
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 10
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 } 95 }
96 {% endfor %} 96 {% endfor %}
97 {% if "events" in domain %} 97 {% if "events" in domain %}
98 {% for event in domain.events %} 98 {% for event in domain.events %}
99 99
100 {# Generate dispatchers which call registered observers for an event. #} 100 {# Generate dispatchers which call registered observers for an event. #}
101 void Domain::Dispatch{{event.name | to_title_case}}Event(const base::Value& para ms) { 101 void Domain::Dispatch{{event.name | to_title_case}}Event(const base::Value& para ms) {
102 ErrorReporter errors; 102 ErrorReporter errors;
103 std::unique_ptr<{{event.name | to_title_case}}Params> parsed_params({{event.na me | to_title_case}}Params::Parse(params, &errors)); 103 std::unique_ptr<{{event.name | to_title_case}}Params> parsed_params({{event.na me | to_title_case}}Params::Parse(params, &errors));
104 DCHECK(!errors.HasErrors()); 104 DCHECK(!errors.HasErrors());
105 FOR_EACH_OBSERVER(ExperimentalObserver, observers_, On{{event.name | to_title_ case}}(*parsed_params)); 105 for (ExperimentalObserver& observer : observers_) {
106 observer.On{{event.name | to_title_case}}(*parsed_params);
107 }
106 } 108 }
107 {% endfor %} 109 {% endfor %}
108 {% endif %} 110 {% endif %}
109 111
110 Domain::Domain(internal::MessageDispatcher* dispatcher) 112 Domain::Domain(internal::MessageDispatcher* dispatcher)
111 : dispatcher_(dispatcher) { 113 : dispatcher_(dispatcher) {
112 {% if "events" in domain %} 114 {% if "events" in domain %}
113 {# Register all events in this domain. #} 115 {# Register all events in this domain. #}
114 {% for event in domain.events %} 116 {% for event in domain.events %}
115 dispatcher_->RegisterEventHandler( 117 dispatcher_->RegisterEventHandler(
(...skipping 17 matching lines...) Expand all
133 } 135 }
134 136
135 void ExperimentalDomain::RemoveObserver(ExperimentalObserver* observer) { 137 void ExperimentalDomain::RemoveObserver(ExperimentalObserver* observer) {
136 observers_.RemoveObserver(observer); 138 observers_.RemoveObserver(observer);
137 } 139 }
138 {% endif %} 140 {% endif %}
139 141
140 } // namespace {{domain.domain | camelcase_to_hacker_style}} 142 } // namespace {{domain.domain | camelcase_to_hacker_style}}
141 143
142 } // namespace headless 144 } // namespace headless
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698