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

Side by Side Diff: extensions/renderer/object_backed_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, 6 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
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/object_backed_native_handler.h" 5 #include "extensions/renderer/object_backed_native_handler.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/linked_ptr.h" 8 #include "base/memory/linked_ptr.h"
9 #include "extensions/renderer/console.h" 9 #include "extensions/renderer/console.h"
10 #include "extensions/renderer/module_system.h" 10 #include "extensions/renderer/module_system.h"
(...skipping 10 matching lines...) Expand all
21 ObjectBackedNativeHandler::ObjectBackedNativeHandler(ScriptContext* context) 21 ObjectBackedNativeHandler::ObjectBackedNativeHandler(ScriptContext* context)
22 : router_data_(context->isolate()), 22 : router_data_(context->isolate()),
23 context_(context), 23 context_(context),
24 object_template_(context->isolate(), 24 object_template_(context->isolate(),
25 v8::ObjectTemplate::New(context->isolate())) { 25 v8::ObjectTemplate::New(context->isolate())) {
26 } 26 }
27 27
28 ObjectBackedNativeHandler::~ObjectBackedNativeHandler() { 28 ObjectBackedNativeHandler::~ObjectBackedNativeHandler() {
29 } 29 }
30 30
31 v8::Local<v8::Object> ObjectBackedNativeHandler::NewInstance() { 31 v8::MaybeLocal<v8::Object> ObjectBackedNativeHandler::NewInstance() {
32 return v8::Local<v8::ObjectTemplate>::New(GetIsolate(), object_template_) 32 return v8::Local<v8::ObjectTemplate>::New(GetIsolate(), object_template_)
33 ->NewInstance(); 33 ->NewInstance();
34 } 34 }
35 35
36 // static 36 // static
37 void ObjectBackedNativeHandler::Router( 37 void ObjectBackedNativeHandler::Router(
38 const v8::FunctionCallbackInfo<v8::Value>& args) { 38 const v8::FunctionCallbackInfo<v8::Value>& args) {
39 v8::HandleScope handle_scope(args.GetIsolate()); 39 v8::HandleScope handle_scope(args.GetIsolate());
40 v8::Local<v8::Object> data = args.Data().As<v8::Object>(); 40 v8::Local<v8::Object> data = args.Data().As<v8::Object>();
41 41
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 data->Delete(v8::String::NewFromUtf8(isolate, kHandlerFunction)); 90 data->Delete(v8::String::NewFromUtf8(isolate, kHandlerFunction));
91 } 91 }
92 92
93 router_data_.Clear(); 93 router_data_.Clear();
94 object_template_.Reset(); 94 object_template_.Reset();
95 95
96 NativeHandler::Invalidate(); 96 NativeHandler::Invalidate();
97 } 97 }
98 98
99 } // namespace extensions 99 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698