OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_RENDERER_MODULE_SYSTEM_H_ | 5 #ifndef CHROME_RENDERER_MODULE_SYSTEM_H_ |
6 #define CHROME_RENDERER_MODULE_SYSTEM_H_ | 6 #define CHROME_RENDERER_MODULE_SYSTEM_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/memory/linked_ptr.h" | 10 #include "base/memory/linked_ptr.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 DISALLOW_COPY_AND_ASSIGN(NativesEnabledScope); | 51 DISALLOW_COPY_AND_ASSIGN(NativesEnabledScope); |
52 }; | 52 }; |
53 | 53 |
54 // |source_map| is a weak pointer. | 54 // |source_map| is a weak pointer. |
55 explicit ModuleSystem(v8::Handle<v8::Context> context, SourceMap* source_map); | 55 explicit ModuleSystem(v8::Handle<v8::Context> context, SourceMap* source_map); |
56 virtual ~ModuleSystem(); | 56 virtual ~ModuleSystem(); |
57 | 57 |
58 // Returns true if the current context has a ModuleSystem installed in it. | 58 // Returns true if the current context has a ModuleSystem installed in it. |
59 static bool IsPresentInCurrentContext(); | 59 static bool IsPresentInCurrentContext(); |
60 | 60 |
| 61 // Dumps the given exception message to LOG(ERROR). |
| 62 static void DumpException(v8::Handle<v8::Message> message); |
| 63 |
61 // Require the specified module. This is the equivalent of calling | 64 // Require the specified module. This is the equivalent of calling |
62 // require('module_name') from the loaded JS files. | 65 // require('module_name') from the loaded JS files. |
63 void Require(const std::string& module_name); | 66 void Require(const std::string& module_name); |
64 v8::Handle<v8::Value> Require(const v8::Arguments& args); | 67 v8::Handle<v8::Value> Require(const v8::Arguments& args); |
65 v8::Handle<v8::Value> RequireForJs(const v8::Arguments& args); | 68 v8::Handle<v8::Value> RequireForJs(const v8::Arguments& args); |
66 v8::Handle<v8::Value> RequireForJsInner(v8::Handle<v8::String> module_name); | 69 v8::Handle<v8::Value> RequireForJsInner(v8::Handle<v8::String> module_name); |
67 | 70 |
68 // Register |native_handler| as a potential target for requireNative(), so | 71 // Register |native_handler| as a potential target for requireNative(), so |
69 // calls to requireNative(|name|) from JS will return a new object created by | 72 // calls to requireNative(|name|) from JS will return a new object created by |
70 // |native_handler|. | 73 // |native_handler|. |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 // When 0, natives are disabled, otherwise indicates how many callers have | 132 // When 0, natives are disabled, otherwise indicates how many callers have |
130 // pinned natives as enabled. | 133 // pinned natives as enabled. |
131 int natives_enabled_; | 134 int natives_enabled_; |
132 | 135 |
133 std::set<std::string> overridden_native_handlers_; | 136 std::set<std::string> overridden_native_handlers_; |
134 | 137 |
135 DISALLOW_COPY_AND_ASSIGN(ModuleSystem); | 138 DISALLOW_COPY_AND_ASSIGN(ModuleSystem); |
136 }; | 139 }; |
137 | 140 |
138 #endif // CHROME_RENDERER_MODULE_SYSTEM_H_ | 141 #endif // CHROME_RENDERER_MODULE_SYSTEM_H_ |
OLD | NEW |