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

Side by Side Diff: gin/modules/module_registry.cc

Issue 2417423002: Remove usage of FOR_EACH_OBSERVER macro in gin (Closed)
Patch Set: 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 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "gin/modules/module_registry.h" 5 #include "gin/modules/module_registry.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 v8::Local<Value> module) { 156 v8::Local<Value> module) {
157 DCHECK(!id.empty()); 157 DCHECK(!id.empty());
158 RegisterModule(isolate, id, module); 158 RegisterModule(isolate, id, module);
159 } 159 }
160 160
161 void ModuleRegistry::AddPendingModule(Isolate* isolate, 161 void ModuleRegistry::AddPendingModule(Isolate* isolate,
162 std::unique_ptr<PendingModule> pending) { 162 std::unique_ptr<PendingModule> pending) {
163 const std::string pending_id = pending->id; 163 const std::string pending_id = pending->id;
164 const std::vector<std::string> pending_dependencies = pending->dependencies; 164 const std::vector<std::string> pending_dependencies = pending->dependencies;
165 AttemptToLoad(isolate, std::move(pending)); 165 AttemptToLoad(isolate, std::move(pending));
166 FOR_EACH_OBSERVER(ModuleRegistryObserver, observer_list_, 166 for (auto& observer : observer_list_)
167 OnDidAddPendingModule(pending_id, pending_dependencies)); 167 observer.OnDidAddPendingModule(pending_id, pending_dependencies);
168 } 168 }
169 169
170 void ModuleRegistry::LoadModule(Isolate* isolate, 170 void ModuleRegistry::LoadModule(Isolate* isolate,
171 const std::string& id, 171 const std::string& id,
172 LoadModuleCallback callback) { 172 LoadModuleCallback callback) {
173 if (available_modules_.find(id) != available_modules_.end()) { 173 if (available_modules_.find(id) != available_modules_.end()) {
174 // Should we call the callback asynchronously? 174 // Should we call the callback asynchronously?
175 callback.Run(GetModule(isolate, id)); 175 callback.Run(GetModule(isolate, id));
176 return; 176 return;
177 } 177 }
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 for (size_t i = 0; i < pending_modules.size(); ++i) { 280 for (size_t i = 0; i < pending_modules.size(); ++i) {
281 std::unique_ptr<PendingModule> pending(pending_modules[i]); 281 std::unique_ptr<PendingModule> pending(pending_modules[i]);
282 pending_modules[i] = NULL; 282 pending_modules[i] = NULL;
283 if (AttemptToLoad(isolate, std::move(pending))) 283 if (AttemptToLoad(isolate, std::move(pending)))
284 keep_trying = true; 284 keep_trying = true;
285 } 285 }
286 } 286 }
287 } 287 }
288 288
289 } // namespace gin 289 } // namespace gin
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