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

Side by Side Diff: extensions/renderer/module_system.cc

Issue 399363002: Add support for writing unit tests for Mojo-backed apps/extensions APIs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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
« no previous file with comments | « extensions/renderer/dispatcher.cc ('k') | extensions/renderer/module_system_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « extensions/renderer/dispatcher.cc ('k') | extensions/renderer/module_system_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698