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

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

Issue 1161053002: Revert of gin: Use V8 Maybe APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@maybe-gin-converter
Patch Set: Created 5 years, 6 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 | « gin/modules/console.cc ('k') | gin/modules/module_registry.cc » ('j') | 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 #ifndef GIN_MODULES_MODULE_REGISTRY_H_ 5 #ifndef GIN_MODULES_MODULE_REGISTRY_H_
6 #define GIN_MODULES_MODULE_REGISTRY_H_ 6 #define GIN_MODULES_MODULE_REGISTRY_H_
7 7
8 #include <list> 8 #include <list>
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 29 matching lines...) Expand all
40 40
41 virtual ~ModuleRegistry(); 41 virtual ~ModuleRegistry();
42 42
43 static ModuleRegistry* From(v8::Local<v8::Context> context); 43 static ModuleRegistry* From(v8::Local<v8::Context> context);
44 44
45 static void RegisterGlobals(v8::Isolate* isolate, 45 static void RegisterGlobals(v8::Isolate* isolate,
46 v8::Local<v8::ObjectTemplate> templ); 46 v8::Local<v8::ObjectTemplate> templ);
47 47
48 // Installs the necessary functions needed for modules. 48 // Installs the necessary functions needed for modules.
49 // WARNING: this may execute script in the page. 49 // WARNING: this may execute script in the page.
50 static bool InstallGlobals(v8::Isolate* isolate, v8::Local<v8::Object> obj); 50 static void InstallGlobals(v8::Isolate* isolate, v8::Local<v8::Object> obj);
51 51
52 void AddObserver(ModuleRegistryObserver* observer); 52 void AddObserver(ModuleRegistryObserver* observer);
53 void RemoveObserver(ModuleRegistryObserver* observer); 53 void RemoveObserver(ModuleRegistryObserver* observer);
54 54
55 // The caller must have already entered our context. 55 // The caller must have already entered our context.
56 void AddBuiltinModule(v8::Isolate* isolate, const std::string& id, 56 void AddBuiltinModule(v8::Isolate* isolate, const std::string& id,
57 v8::Local<v8::Value> module); 57 v8::Local<v8::Value> module);
58 58
59 // The caller must have already entered our context. 59 // The caller must have already entered our context.
60 void AddPendingModule(v8::Isolate* isolate, 60 void AddPendingModule(v8::Isolate* isolate,
(...skipping 13 matching lines...) Expand all
74 const std::set<std::string>& unsatisfied_dependencies() const { 74 const std::set<std::string>& unsatisfied_dependencies() const {
75 return unsatisfied_dependencies_; 75 return unsatisfied_dependencies_;
76 } 76 }
77 77
78 private: 78 private:
79 typedef ScopedVector<PendingModule> PendingModuleVector; 79 typedef ScopedVector<PendingModule> PendingModuleVector;
80 typedef std::multimap<std::string, LoadModuleCallback> LoadModuleCallbackMap; 80 typedef std::multimap<std::string, LoadModuleCallback> LoadModuleCallbackMap;
81 81
82 explicit ModuleRegistry(v8::Isolate* isolate); 82 explicit ModuleRegistry(v8::Isolate* isolate);
83 83
84 bool Load(v8::Isolate* isolate, scoped_ptr<PendingModule> pending); 84 void Load(v8::Isolate* isolate, scoped_ptr<PendingModule> pending);
85 bool RegisterModule(v8::Isolate* isolate, 85 void RegisterModule(v8::Isolate* isolate,
86 const std::string& id, 86 const std::string& id,
87 v8::Local<v8::Value> module); 87 v8::Local<v8::Value> module);
88 88
89 bool CheckDependencies(PendingModule* pending); 89 bool CheckDependencies(PendingModule* pending);
90 bool AttemptToLoad(v8::Isolate* isolate, scoped_ptr<PendingModule> pending); 90 bool AttemptToLoad(v8::Isolate* isolate, scoped_ptr<PendingModule> pending);
91 91
92 v8::Local<v8::Value> GetModule(v8::Isolate* isolate, const std::string& id); 92 v8::Local<v8::Value> GetModule(v8::Isolate* isolate, const std::string& id);
93 93
94 std::set<std::string> available_modules_; 94 std::set<std::string> available_modules_;
95 std::set<std::string> unsatisfied_dependencies_; 95 std::set<std::string> unsatisfied_dependencies_;
96 96
97 LoadModuleCallbackMap waiting_callbacks_; 97 LoadModuleCallbackMap waiting_callbacks_;
98 98
99 PendingModuleVector pending_modules_; 99 PendingModuleVector pending_modules_;
100 v8::Persistent<v8::Object> modules_; 100 v8::Persistent<v8::Object> modules_;
101 101
102 ObserverList<ModuleRegistryObserver> observer_list_; 102 ObserverList<ModuleRegistryObserver> observer_list_;
103 103
104 DISALLOW_COPY_AND_ASSIGN(ModuleRegistry); 104 DISALLOW_COPY_AND_ASSIGN(ModuleRegistry);
105 }; 105 };
106 106
107 } // namespace gin 107 } // namespace gin
108 108
109 #endif // GIN_MODULES_MODULE_REGISTRY_H_ 109 #endif // GIN_MODULES_MODULE_REGISTRY_H_
OLDNEW
« no previous file with comments | « gin/modules/console.cc ('k') | gin/modules/module_registry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698