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

Unified Diff: extensions/renderer/module_system.cc

Issue 649003003: Add a mojoPrivate API that exposes mojo to component apps/extensions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@serial-service
Patch Set: Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: extensions/renderer/module_system.cc
diff --git a/extensions/renderer/module_system.cc b/extensions/renderer/module_system.cc
index 5a180b458583040c3ee433656abb7b1df74f3f89..78d485c3ccaf95b440563bd55fe1f0cbf60de0a5 100644
--- a/extensions/renderer/module_system.cc
+++ b/extensions/renderer/module_system.cc
@@ -657,17 +657,20 @@ v8::Handle<v8::Value> ModuleSystem::LoadModule(const std::string& module_name) {
void ModuleSystem::OnDidAddPendingModule(
const std::string& id,
const std::vector<std::string>& dependencies) {
- if (!source_map_->Contains(id))
- return;
+ bool module_system_managed = source_map_->Contains(id);
gin::ModuleRegistry* registry =
gin::ModuleRegistry::From(context_->v8_context());
DCHECK(registry);
- for (std::vector<std::string>::const_iterator it = dependencies.begin();
- it != dependencies.end();
- ++it) {
- if (registry->available_modules().count(*it) == 0)
- LoadModule(*it);
+ for (const auto& dependency : dependencies) {
+ // If a dependency is not available, and either the module or this
+ // dependency is managed by ModuleSystem, attempt to load it. Other
+ // gin::ModuleRegistry users (WebUI and users of the mojoPrivate API) are
+ // responsible for loading their module dependencies when required.
+ if (registry->available_modules().count(dependency) == 0 &&
+ (module_system_managed || source_map_->Contains(dependency))) {
+ LoadModule(dependency);
+ }
}
registry->AttemptToLoadMoreModules(GetIsolate());
}

Powered by Google App Engine
This is Rietveld 408576698