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/stl_util.h" | |
11 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
12 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
13 #include "base/trace_event/trace_event.h" | 12 #include "base/trace_event/trace_event.h" |
14 #include "content/public/renderer/render_frame.h" | 13 #include "content/public/renderer/render_frame.h" |
15 #include "content/public/renderer/render_view.h" | 14 #include "content/public/renderer/render_view.h" |
16 #include "extensions/common/extension.h" | 15 #include "extensions/common/extension.h" |
17 #include "extensions/common/extensions_client.h" | 16 #include "extensions/common/extensions_client.h" |
18 #include "extensions/renderer/console.h" | 17 #include "extensions/renderer/console.h" |
19 #include "extensions/renderer/safe_builtins.h" | 18 #include "extensions/renderer/safe_builtins.h" |
20 #include "extensions/renderer/script_context.h" | 19 #include "extensions/renderer/script_context.h" |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 v8::EscapableHandleScope handle_scope(GetIsolate()); | 265 v8::EscapableHandleScope handle_scope(GetIsolate()); |
267 v8::Local<v8::Value> no_args; | 266 v8::Local<v8::Value> no_args; |
268 return handle_scope.Escape( | 267 return handle_scope.Escape( |
269 CallModuleMethod(module_name, method_name, 0, &no_args)); | 268 CallModuleMethod(module_name, method_name, 0, &no_args)); |
270 } | 269 } |
271 | 270 |
272 v8::Local<v8::Value> ModuleSystem::CallModuleMethod( | 271 v8::Local<v8::Value> ModuleSystem::CallModuleMethod( |
273 const std::string& module_name, | 272 const std::string& module_name, |
274 const std::string& method_name, | 273 const std::string& method_name, |
275 std::vector<v8::Local<v8::Value>>* args) { | 274 std::vector<v8::Local<v8::Value>>* args) { |
276 return CallModuleMethod( | 275 return CallModuleMethod(module_name, method_name, args->size(), args->data()); |
277 module_name, method_name, args->size(), vector_as_array(args)); | |
278 } | 276 } |
279 | 277 |
280 v8::Local<v8::Value> ModuleSystem::CallModuleMethod( | 278 v8::Local<v8::Value> ModuleSystem::CallModuleMethod( |
281 const std::string& module_name, | 279 const std::string& module_name, |
282 const std::string& method_name, | 280 const std::string& method_name, |
283 int argc, | 281 int argc, |
284 v8::Local<v8::Value> argv[]) { | 282 v8::Local<v8::Value> argv[]) { |
285 TRACE_EVENT2("v8", | 283 TRACE_EVENT2("v8", |
286 "v8.callModuleMethod", | 284 "v8.callModuleMethod", |
287 "module_name", | 285 "module_name", |
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
746 | 744 |
747 void ModuleSystem::ClobberExistingNativeHandler(const std::string& name) { | 745 void ModuleSystem::ClobberExistingNativeHandler(const std::string& name) { |
748 NativeHandlerMap::iterator existing_handler = native_handler_map_.find(name); | 746 NativeHandlerMap::iterator existing_handler = native_handler_map_.find(name); |
749 if (existing_handler != native_handler_map_.end()) { | 747 if (existing_handler != native_handler_map_.end()) { |
750 clobbered_native_handlers_.push_back(existing_handler->second); | 748 clobbered_native_handlers_.push_back(existing_handler->second); |
751 native_handler_map_.erase(existing_handler); | 749 native_handler_map_.erase(existing_handler); |
752 } | 750 } |
753 } | 751 } |
754 | 752 |
755 } // namespace extensions | 753 } // namespace extensions |
OLD | NEW |