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_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> |
11 #include <string> | 11 #include <string> |
12 | 12 |
13 #include "base/callback.h" | 13 #include "base/callback.h" |
14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 16 #include "gin/gin_export.h" |
16 #include "gin/per_context_data.h" | 17 #include "gin/per_context_data.h" |
17 | 18 |
18 namespace gin { | 19 namespace gin { |
19 | 20 |
20 struct PendingModule; | 21 struct PendingModule; |
21 | 22 |
22 // This class implements the Asynchronous Module Definition (AMD) API. | 23 // This class implements the Asynchronous Module Definition (AMD) API. |
23 // https://github.com/amdjs/amdjs-api/wiki/AMD | 24 // https://github.com/amdjs/amdjs-api/wiki/AMD |
24 // | 25 // |
25 // Our implementation isn't complete yet. Missing features: | 26 // Our implementation isn't complete yet. Missing features: |
26 // 1) Built-in support for require, exports, and module. | 27 // 1) Built-in support for require, exports, and module. |
27 // 2) Path resoltuion in module names. | 28 // 2) Path resoltuion in module names. |
28 // | 29 // |
29 // For these reasons, we don't have an "amd" property on the "define" | 30 // For these reasons, we don't have an "amd" property on the "define" |
30 // function. The spec says we should only add that property once our | 31 // function. The spec says we should only add that property once our |
31 // implementation complies with the specification. | 32 // implementation complies with the specification. |
32 // | 33 // |
33 class ModuleRegistry : public ContextSupplement { | 34 class GIN_EXPORT ModuleRegistry : public ContextSupplement { |
34 public: | 35 public: |
35 typedef base::Callback<void (v8::Handle<v8::Value>)> LoadModuleCallback; | 36 typedef base::Callback<void (v8::Handle<v8::Value>)> LoadModuleCallback; |
36 | 37 |
37 virtual ~ModuleRegistry(); | 38 virtual ~ModuleRegistry(); |
38 | 39 |
39 static ModuleRegistry* From(v8::Handle<v8::Context> context); | 40 static ModuleRegistry* From(v8::Handle<v8::Context> context); |
40 | 41 |
41 static void RegisterGlobals(v8::Isolate* isolate, | 42 static void RegisterGlobals(v8::Isolate* isolate, |
42 v8::Handle<v8::ObjectTemplate> templ); | 43 v8::Handle<v8::ObjectTemplate> templ); |
43 | 44 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 | 92 |
92 PendingModuleVector pending_modules_; | 93 PendingModuleVector pending_modules_; |
93 v8::Persistent<v8::Object> modules_; | 94 v8::Persistent<v8::Object> modules_; |
94 | 95 |
95 DISALLOW_COPY_AND_ASSIGN(ModuleRegistry); | 96 DISALLOW_COPY_AND_ASSIGN(ModuleRegistry); |
96 }; | 97 }; |
97 | 98 |
98 } // namespace gin | 99 } // namespace gin |
99 | 100 |
100 #endif // GIN_MODULES_MODULE_REGISTRY_H_ | 101 #endif // GIN_MODULES_MODULE_REGISTRY_H_ |
OLD | NEW |