| 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/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 const std::string& method_name) { | 287 const std::string& method_name) { |
| 288 v8::EscapableHandleScope handle_scope(GetIsolate()); | 288 v8::EscapableHandleScope handle_scope(GetIsolate()); |
| 289 v8::Local<v8::Value> no_args; | 289 v8::Local<v8::Value> no_args; |
| 290 return handle_scope.Escape( | 290 return handle_scope.Escape( |
| 291 CallModuleMethod(module_name, method_name, 0, &no_args)); | 291 CallModuleMethod(module_name, method_name, 0, &no_args)); |
| 292 } | 292 } |
| 293 | 293 |
| 294 v8::Local<v8::Value> ModuleSystem::CallModuleMethod( | 294 v8::Local<v8::Value> ModuleSystem::CallModuleMethod( |
| 295 const std::string& module_name, | 295 const std::string& module_name, |
| 296 const std::string& method_name, | 296 const std::string& method_name, |
| 297 std::vector<v8::Local<v8::Value>>* args) { | |
| 298 return CallModuleMethod(module_name, method_name, args->size(), args->data()); | |
| 299 } | |
| 300 | |
| 301 v8::Local<v8::Value> ModuleSystem::CallModuleMethod( | |
| 302 const std::string& module_name, | |
| 303 const std::string& method_name, | |
| 304 int argc, | 297 int argc, |
| 305 v8::Local<v8::Value> argv[]) { | 298 v8::Local<v8::Value> argv[]) { |
| 306 TRACE_EVENT2("v8", | 299 TRACE_EVENT2("v8", |
| 307 "v8.callModuleMethod", | 300 "v8.callModuleMethod", |
| 308 "module_name", | 301 "module_name", |
| 309 module_name, | 302 module_name, |
| 310 "method_name", | 303 "method_name", |
| 311 method_name); | 304 method_name); |
| 312 | 305 |
| 313 v8::EscapableHandleScope handle_scope(GetIsolate()); | 306 v8::EscapableHandleScope handle_scope(GetIsolate()); |
| (...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 822 !value->IsFunction()) { | 815 !value->IsFunction()) { |
| 823 Fatal(context_, module_name + "." + method_name + " is not a function"); | 816 Fatal(context_, module_name + "." + method_name + " is not a function"); |
| 824 return function; | 817 return function; |
| 825 } | 818 } |
| 826 | 819 |
| 827 function = v8::Local<v8::Function>::Cast(value); | 820 function = v8::Local<v8::Function>::Cast(value); |
| 828 return function; | 821 return function; |
| 829 } | 822 } |
| 830 | 823 |
| 831 } // namespace extensions | 824 } // namespace extensions |
| OLD | NEW |