| OLD | NEW |
| 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 20 matching lines...) Expand all Loading... |
| 31 Invalidate(); | 31 Invalidate(); |
| 32 } | 32 } |
| 33 | 33 |
| 34 v8::Handle<v8::Object> ObjectBackedNativeHandler::NewInstance() { | 34 v8::Handle<v8::Object> ObjectBackedNativeHandler::NewInstance() { |
| 35 return object_template_->NewInstance(); | 35 return object_template_->NewInstance(); |
| 36 } | 36 } |
| 37 | 37 |
| 38 // static | 38 // static |
| 39 void ObjectBackedNativeHandler::Router( | 39 void ObjectBackedNativeHandler::Router( |
| 40 const v8::FunctionCallbackInfo<v8::Value>& args) { | 40 const v8::FunctionCallbackInfo<v8::Value>& args) { |
| 41 v8::HandleScope handle_scope; | 41 v8::HandleScope handle_scope(args.GetIsolate()); |
| 42 v8::Handle<v8::Object> data = args.Data().As<v8::Object>(); | 42 v8::Handle<v8::Object> data = args.Data().As<v8::Object>(); |
| 43 | 43 |
| 44 v8::Handle<v8::Value> handler_function_value = | 44 v8::Handle<v8::Value> handler_function_value = |
| 45 data->Get(v8::String::New(kHandlerFunction)); | 45 data->Get(v8::String::New(kHandlerFunction)); |
| 46 // See comment in header file for why we do this. | 46 // See comment in header file for why we do this. |
| 47 if (handler_function_value.IsEmpty() || | 47 if (handler_function_value.IsEmpty() || |
| 48 handler_function_value->IsUndefined()) { | 48 handler_function_value->IsUndefined()) { |
| 49 console::Error(v8::Context::GetCalling(), | 49 console::Error(v8::Context::GetCalling(), |
| 50 "Extension view no longer exists"); | 50 "Extension view no longer exists"); |
| 51 return; | 51 return; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 handler_function_value.As<v8::External>()->Value()); | 89 handler_function_value.As<v8::External>()->Value()); |
| 90 data->Delete(v8::String::New(kHandlerFunction)); | 90 data->Delete(v8::String::New(kHandlerFunction)); |
| 91 it->dispose(); | 91 it->dispose(); |
| 92 } | 92 } |
| 93 object_template_.reset(); | 93 object_template_.reset(); |
| 94 context_ = NULL; | 94 context_ = NULL; |
| 95 NativeHandler::Invalidate(); | 95 NativeHandler::Invalidate(); |
| 96 } | 96 } |
| 97 | 97 |
| 98 } // namespace extensions | 98 } // namespace extensions |
| OLD | NEW |