OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "extensions/renderer/module_system.h" | 5 #include "extensions/renderer/module_system.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 return handle_scope.Escape(exports); | 223 return handle_scope.Escape(exports); |
224 | 224 |
225 exports = LoadModule(*v8::String::Utf8Value(module_name)); | 225 exports = LoadModule(*v8::String::Utf8Value(module_name)); |
226 modules->Set(module_name, exports); | 226 modules->Set(module_name, exports); |
227 return handle_scope.Escape(exports); | 227 return handle_scope.Escape(exports); |
228 } | 228 } |
229 | 229 |
230 v8::Local<v8::Value> ModuleSystem::CallModuleMethod( | 230 v8::Local<v8::Value> ModuleSystem::CallModuleMethod( |
231 const std::string& module_name, | 231 const std::string& module_name, |
232 const std::string& method_name) { | 232 const std::string& method_name) { |
233 v8::HandleScope handle_scope(GetIsolate()); | 233 v8::EscapableHandleScope handle_scope(GetIsolate()); |
234 v8::Handle<v8::Value> no_args; | 234 v8::Handle<v8::Value> no_args; |
235 return CallModuleMethod(module_name, method_name, 0, &no_args); | 235 return handle_scope.Escape( |
| 236 CallModuleMethod(module_name, method_name, 0, &no_args)); |
236 } | 237 } |
237 | 238 |
238 v8::Local<v8::Value> ModuleSystem::CallModuleMethod( | 239 v8::Local<v8::Value> ModuleSystem::CallModuleMethod( |
239 const std::string& module_name, | 240 const std::string& module_name, |
240 const std::string& method_name, | 241 const std::string& method_name, |
241 std::vector<v8::Handle<v8::Value> >* args) { | 242 std::vector<v8::Handle<v8::Value> >* args) { |
242 return CallModuleMethod( | 243 return CallModuleMethod( |
243 module_name, method_name, args->size(), vector_as_array(args)); | 244 module_name, method_name, args->size(), vector_as_array(args)); |
244 } | 245 } |
245 | 246 |
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
659 v8::Handle<v8::Value> value) { | 660 v8::Handle<v8::Value> value) { |
660 if (!is_valid()) | 661 if (!is_valid()) |
661 return; | 662 return; |
662 v8::HandleScope handle_scope(GetIsolate()); | 663 v8::HandleScope handle_scope(GetIsolate()); |
663 v8::Handle<v8::Promise::Resolver> resolver_local( | 664 v8::Handle<v8::Promise::Resolver> resolver_local( |
664 v8::Local<v8::Promise::Resolver>::New(GetIsolate(), *resolver)); | 665 v8::Local<v8::Promise::Resolver>::New(GetIsolate(), *resolver)); |
665 resolver_local->Resolve(value); | 666 resolver_local->Resolve(value); |
666 } | 667 } |
667 | 668 |
668 } // namespace extensions | 669 } // namespace extensions |
OLD | NEW |