OLD | NEW |
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_RUNNER_DELEGATE_H_ | 5 #ifndef GIN_MODULES_MODULE_RUNNER_DELEGATE_H_ |
6 #define GIN_MODULES_MODULE_RUNNER_DELEGATE_H_ | 6 #define GIN_MODULES_MODULE_RUNNER_DELEGATE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 const std::vector<base::FilePath>& search_paths); | 25 const std::vector<base::FilePath>& search_paths); |
26 virtual ~ModuleRunnerDelegate(); | 26 virtual ~ModuleRunnerDelegate(); |
27 | 27 |
28 // Lets you register a built-in module. Built-in modules are instantiated by | 28 // Lets you register a built-in module. Built-in modules are instantiated by |
29 // creating a new instance of a v8::ObjectTemplate rather than by executing | 29 // creating a new instance of a v8::ObjectTemplate rather than by executing |
30 // code. This function takes a ModuleTemplateGetter rather than a | 30 // code. This function takes a ModuleTemplateGetter rather than a |
31 // v8::ObjectTemplate directly so that embedders can create object templates | 31 // v8::ObjectTemplate directly so that embedders can create object templates |
32 // lazily. | 32 // lazily. |
33 void AddBuiltinModule(const std::string& id, ModuleTemplateGetter templ); | 33 void AddBuiltinModule(const std::string& id, ModuleTemplateGetter templ); |
34 | 34 |
| 35 protected: |
| 36 void AttemptToLoadMoreModules(Runner* runner); |
| 37 |
35 private: | 38 private: |
36 typedef std::map<std::string, ModuleTemplateGetter> BuiltinModuleMap; | 39 typedef std::map<std::string, ModuleTemplateGetter> BuiltinModuleMap; |
37 | 40 |
38 // From RunnerDelegate: | 41 // From RunnerDelegate: |
39 virtual v8::Handle<v8::ObjectTemplate> GetGlobalTemplate( | 42 virtual v8::Handle<v8::ObjectTemplate> GetGlobalTemplate( |
40 Runner* runner) OVERRIDE; | 43 Runner* runner) OVERRIDE; |
41 virtual void DidCreateContext(Runner* runner) OVERRIDE; | 44 virtual void DidCreateContext(Runner* runner) OVERRIDE; |
42 virtual void DidRunScript(Runner* runner) OVERRIDE; | 45 virtual void DidRunScript(Runner* runner) OVERRIDE; |
43 | 46 |
44 BuiltinModuleMap builtin_modules_; | 47 BuiltinModuleMap builtin_modules_; |
45 FileModuleProvider module_provider_; | 48 FileModuleProvider module_provider_; |
46 | 49 |
47 DISALLOW_COPY_AND_ASSIGN(ModuleRunnerDelegate); | 50 DISALLOW_COPY_AND_ASSIGN(ModuleRunnerDelegate); |
48 }; | 51 }; |
49 | 52 |
50 } // namespace gin | 53 } // namespace gin |
51 | 54 |
52 #endif // GIN_MODULES_MODULE_RUNNER_DELEGATE_H_ | 55 #endif // GIN_MODULES_MODULE_RUNNER_DELEGATE_H_ |
OLD | NEW |