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

Side by Side Diff: chrome/renderer/extensions/module_system.h

Issue 12853007: Don't throw exceptions when v8 objects/contexts are missing, and catch (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: disable test #2 Created 7 years, 9 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 | Annotate | Revision Log
OLDNEW
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_EXTENSIONS_MODULE_SYSTEM_H_ 5 #ifndef CHROME_RENDERER_EXTENSIONS_MODULE_SYSTEM_H_
6 #define CHROME_RENDERER_EXTENSIONS_MODULE_SYSTEM_H_ 6 #define CHROME_RENDERER_EXTENSIONS_MODULE_SYSTEM_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/memory/linked_ptr.h" 9 #include "base/memory/linked_ptr.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 const std::string&); 161 const std::string&);
162 // Base implementation of a LazyFieldGetter which uses |require_fn| to require 162 // Base implementation of a LazyFieldGetter which uses |require_fn| to require
163 // modules. 163 // modules.
164 static v8::Handle<v8::Value> LazyFieldGetterInner( 164 static v8::Handle<v8::Value> LazyFieldGetterInner(
165 v8::Local<v8::String> property, 165 v8::Local<v8::String> property,
166 const v8::AccessorInfo& info, 166 const v8::AccessorInfo& info,
167 RequireFunction require_function); 167 RequireFunction require_function);
168 168
169 // Return the named source file stored in the source map. 169 // Return the named source file stored in the source map.
170 // |args[0]| - the name of a source file in source_map_. 170 // |args[0]| - the name of a source file in source_map_.
171 v8::Handle<v8::Value> GetSource(v8::Handle<v8::String> source_name); 171 v8::Handle<v8::Value> GetSource(const std::string& module_name);
172 172
173 // Return an object that contains the native methods defined by the named 173 // Return an object that contains the native methods defined by the named
174 // NativeHandler. 174 // NativeHandler.
175 // |args[0]| - the name of a native handler object. 175 // |args[0]| - the name of a native handler object.
176 v8::Handle<v8::Value> RequireNativeFromString(const std::string& native_name); 176 v8::Handle<v8::Value> RequireNativeFromString(const std::string& native_name);
177 v8::Handle<v8::Value> RequireNative(const v8::Arguments& args); 177 v8::Handle<v8::Value> RequireNative(const v8::Arguments& args);
178 178
179 // Wraps |source| in a (function(require, requireNative, exports) {...}). 179 // Wraps |source| in a (function(require, requireNative, exports) {...}).
180 v8::Handle<v8::String> WrapSource(v8::Handle<v8::String> source); 180 v8::Handle<v8::String> WrapSource(v8::Handle<v8::String> source);
181 181
182 // Throws an exception in the calling JS context.
183 v8::Handle<v8::Value> ThrowException(const std::string& message);
184
185 // A map from module names to the JS source for that module. GetSource() 182 // A map from module names to the JS source for that module. GetSource()
186 // performs a lookup on this map. 183 // performs a lookup on this map.
187 SourceMap* source_map_; 184 SourceMap* source_map_;
188 185
189 // A map from native handler names to native handlers. 186 // A map from native handler names to native handlers.
190 NativeHandlerMap native_handler_map_; 187 NativeHandlerMap native_handler_map_;
191 188
192 // When 0, natives are disabled, otherwise indicates how many callers have 189 // When 0, natives are disabled, otherwise indicates how many callers have
193 // pinned natives as enabled. 190 // pinned natives as enabled.
194 int natives_enabled_; 191 int natives_enabled_;
195 192
196 // Called when an exception is thrown but not caught in JS. 193 // Called when an exception is thrown but not caught in JS.
197 scoped_ptr<ExceptionHandler> exception_handler_; 194 scoped_ptr<ExceptionHandler> exception_handler_;
198 195
199 std::set<std::string> overridden_native_handlers_; 196 std::set<std::string> overridden_native_handlers_;
200 197
201 DISALLOW_COPY_AND_ASSIGN(ModuleSystem); 198 DISALLOW_COPY_AND_ASSIGN(ModuleSystem);
202 }; 199 };
203 200
204 } // extensions 201 } // extensions
205 202
206 #endif // CHROME_RENDERER_EXTENSIONS_MODULE_SYSTEM_H_ 203 #endif // CHROME_RENDERER_EXTENSIONS_MODULE_SYSTEM_H_
OLDNEW
« no previous file with comments | « chrome/renderer/extensions/miscellaneous_bindings.cc ('k') | chrome/renderer/extensions/module_system.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698