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

Side by Side Diff: chrome/renderer/extensions/object_backed_native_handler.cc

Issue 74783006: Remove deprecated v8::External::New calls (chromium side) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « chrome/renderer/extensions/module_system.cc ('k') | gin/modules/module_registry.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // TODO(dcarney): Remove this when UnsafePersistent is removed. 5 // TODO(dcarney): Remove this when UnsafePersistent is removed.
6 #define V8_ALLOW_ACCESS_TO_RAW_HANDLE_CONSTRUCTOR 6 #define V8_ALLOW_ACCESS_TO_RAW_HANDLE_CONSTRUCTOR
7 7
8 #include "chrome/renderer/extensions/object_backed_native_handler.h" 8 #include "chrome/renderer/extensions/object_backed_native_handler.h"
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 57
58 void ObjectBackedNativeHandler::RouteFunction( 58 void ObjectBackedNativeHandler::RouteFunction(
59 const std::string& name, 59 const std::string& name,
60 const HandlerFunction& handler_function) { 60 const HandlerFunction& handler_function) {
61 v8::Isolate* isolate = v8::Isolate::GetCurrent(); 61 v8::Isolate* isolate = v8::Isolate::GetCurrent();
62 v8::HandleScope handle_scope(isolate); 62 v8::HandleScope handle_scope(isolate);
63 v8::Context::Scope context_scope(context_->v8_context()); 63 v8::Context::Scope context_scope(context_->v8_context());
64 64
65 v8::Persistent<v8::Object> data(isolate, v8::Object::New()); 65 v8::Persistent<v8::Object> data(isolate, v8::Object::New());
66 v8::Local<v8::Object> local_data = v8::Local<v8::Object>::New(isolate, data); 66 v8::Local<v8::Object> local_data = v8::Local<v8::Object>::New(isolate, data);
67 local_data->Set(v8::String::New(kHandlerFunction), 67 local_data->Set(
68 v8::External::New(new HandlerFunction(handler_function))); 68 v8::String::New(kHandlerFunction),
69 v8::External::New(isolate, new HandlerFunction(handler_function)));
69 v8::Handle<v8::FunctionTemplate> function_template = 70 v8::Handle<v8::FunctionTemplate> function_template =
70 v8::FunctionTemplate::New(Router, local_data); 71 v8::FunctionTemplate::New(Router, local_data);
71 object_template_.NewHandle(isolate)->Set(name.c_str(), function_template); 72 object_template_.NewHandle(isolate)->Set(name.c_str(), function_template);
72 router_data_.push_back(UnsafePersistent<v8::Object>(&data)); 73 router_data_.push_back(UnsafePersistent<v8::Object>(&data));
73 } 74 }
74 75
75 void ObjectBackedNativeHandler::Invalidate() { 76 void ObjectBackedNativeHandler::Invalidate() {
76 if (!is_valid()) 77 if (!is_valid())
77 return; 78 return;
78 v8::Isolate* isolate = v8::Isolate::GetCurrent(); 79 v8::Isolate* isolate = v8::Isolate::GetCurrent();
(...skipping 10 matching lines...) Expand all
89 handler_function_value.As<v8::External>()->Value()); 90 handler_function_value.As<v8::External>()->Value());
90 data->Delete(v8::String::New(kHandlerFunction)); 91 data->Delete(v8::String::New(kHandlerFunction));
91 it->dispose(); 92 it->dispose();
92 } 93 }
93 object_template_.reset(); 94 object_template_.reset();
94 context_ = NULL; 95 context_ = NULL;
95 NativeHandler::Invalidate(); 96 NativeHandler::Invalidate();
96 } 97 }
97 98
98 } // namespace extensions 99 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/renderer/extensions/module_system.cc ('k') | gin/modules/module_registry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698