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

Unified Diff: chrome/renderer/extensions/object_backed_native_handler.cc

Issue 11571014: Lazy load chrome.* APIs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: apitest.js Created 7 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: chrome/renderer/extensions/object_backed_native_handler.cc
diff --git a/chrome/renderer/extensions/native_handler.cc b/chrome/renderer/extensions/object_backed_native_handler.cc
similarity index 79%
rename from chrome/renderer/extensions/native_handler.cc
rename to chrome/renderer/extensions/object_backed_native_handler.cc
index 3c41ea53928bfe7fc71747dce604c0413e5b2822..30597abcaeaa965787303e7bb43786f2ec05314d 100644
--- a/chrome/renderer/extensions/native_handler.cc
+++ b/chrome/renderer/extensions/object_backed_native_handler.cc
@@ -2,32 +2,33 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/renderer/extensions/native_handler.h"
+#include "chrome/renderer/extensions/object_backed_native_handler.h"
-#include "base/memory/linked_ptr.h"
#include "base/logging.h"
+#include "base/memory/linked_ptr.h"
#include "chrome/renderer/extensions/module_system.h"
#include "v8/include/v8.h"
namespace extensions {
-NativeHandler::NativeHandler(v8::Isolate* isolate)
+ObjectBackedNativeHandler::ObjectBackedNativeHandler(v8::Isolate* isolate)
: isolate_(isolate),
object_template_(
v8::Persistent<v8::ObjectTemplate>::New(isolate,
v8::ObjectTemplate::New())) {
}
-NativeHandler::~NativeHandler() {
+ObjectBackedNativeHandler::~ObjectBackedNativeHandler() {
object_template_.Dispose(isolate_);
}
-v8::Handle<v8::Object> NativeHandler::NewInstance() {
+v8::Handle<v8::Object> ObjectBackedNativeHandler::NewInstance() {
return object_template_->NewInstance();
}
// static
-v8::Handle<v8::Value> NativeHandler::Router(const v8::Arguments& args) {
+v8::Handle<v8::Value> ObjectBackedNativeHandler::Router(
+ const v8::Arguments& args) {
// It is possible for JS code to execute after ModuleSystem has been deleted
// in which case the native handlers will also have been deleted, making
// HandlerFunction below point to freed memory.
@@ -40,7 +41,7 @@ v8::Handle<v8::Value> NativeHandler::Router(const v8::Arguments& args) {
return handler_function->Run(args);
}
-void NativeHandler::RouteFunction(const std::string& name,
+void ObjectBackedNativeHandler::RouteFunction(const std::string& name,
const HandlerFunction& handler_function) {
linked_ptr<HandlerFunction> function(new HandlerFunction(handler_function));
// TODO(koz): Investigate using v8's MakeWeak() function instead of holding
@@ -52,7 +53,7 @@ void NativeHandler::RouteFunction(const std::string& name,
object_template_->Set(name.c_str(), function_template);
}
-void NativeHandler::RouteStaticFunction(const std::string& name,
+void ObjectBackedNativeHandler::RouteStaticFunction(const std::string& name,
const HandlerFunc handler_func) {
v8::Handle<v8::FunctionTemplate> function_template =
v8::FunctionTemplate::New(handler_func, v8::External::New(this));

Powered by Google App Engine
This is Rietveld 408576698