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

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

Issue 1192763002: extensions: Use V8 Maybe APIs in NativeHandler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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/utils_native_handler.cc ('k') | extensions/renderer/v8_helpers.h » ('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/v8_context_native_handler.h" 5 #include "extensions/renderer/v8_context_native_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "extensions/common/features/feature.h" 8 #include "extensions/common/features/feature.h"
9 #include "extensions/renderer/dispatcher.h" 9 #include "extensions/renderer/dispatcher.h"
10 #include "extensions/renderer/script_context.h" 10 #include "extensions/renderer/script_context.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 ScriptContext* context = 54 ScriptContext* context =
55 dispatcher_->script_context_set().GetByV8Context(v8_context); 55 dispatcher_->script_context_set().GetByV8Context(v8_context);
56 args.GetReturnValue().Set(context->module_system()->NewInstance()); 56 args.GetReturnValue().Set(context->module_system()->NewInstance());
57 } 57 }
58 58
59 void V8ContextNativeHandler::RunWithNativesEnabledModuleSystem( 59 void V8ContextNativeHandler::RunWithNativesEnabledModuleSystem(
60 const v8::FunctionCallbackInfo<v8::Value>& args) { 60 const v8::FunctionCallbackInfo<v8::Value>& args) {
61 CHECK_EQ(args.Length(), 1); 61 CHECK_EQ(args.Length(), 1);
62 CHECK(args[0]->IsFunction()); 62 CHECK(args[0]->IsFunction());
63 v8::Local<v8::Value> call_with_args[] = { 63 v8::Local<v8::Value> call_with_args[] = {
64 context()->module_system()->NewInstance()}; 64 context()->module_system()->NewInstance()};
65 ModuleSystem::NativesEnabledScope natives_enabled(context()->module_system()); 65 ModuleSystem::NativesEnabledScope natives_enabled(context()->module_system());
66 context()->CallFunction(v8::Local<v8::Function>::Cast(args[0]), 1, 66 context()->CallFunction(v8::Local<v8::Function>::Cast(args[0]), 1,
67 call_with_args); 67 call_with_args);
68 } 68 }
69 69
70 } // namespace extensions 70 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/renderer/utils_native_handler.cc ('k') | extensions/renderer/v8_helpers.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698