| OLD | NEW |
| 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/module_system.h" | 5 #include "extensions/renderer/module_system.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 } | 94 } |
| 95 Fatal(context_, CreateExceptionString(try_catch) + "{" + stack_trace + "}"); | 95 Fatal(context_, CreateExceptionString(try_catch) + "{" + stack_trace + "}"); |
| 96 } | 96 } |
| 97 }; | 97 }; |
| 98 | 98 |
| 99 // Sets a property on the "exports" object for bindings. Called by JS with | 99 // Sets a property on the "exports" object for bindings. Called by JS with |
| 100 // exports.$set(<key>, <value>). | 100 // exports.$set(<key>, <value>). |
| 101 void SetExportsProperty( | 101 void SetExportsProperty( |
| 102 const v8::FunctionCallbackInfo<v8::Value>& args) { | 102 const v8::FunctionCallbackInfo<v8::Value>& args) { |
| 103 v8::Local<v8::Object> obj = args.This(); | 103 v8::Local<v8::Object> obj = args.This(); |
| 104 DCHECK_EQ(2, args.Length()); | 104 CHECK_EQ(2, args.Length()); |
| 105 DCHECK(args[0]->IsString()); | 105 CHECK(args[0]->IsString()); |
| 106 v8::Maybe<bool> result = | 106 v8::Maybe<bool> result = |
| 107 obj->DefineOwnProperty(args.GetIsolate()->GetCurrentContext(), | 107 obj->DefineOwnProperty(args.GetIsolate()->GetCurrentContext(), |
| 108 args[0]->ToString(), args[1], v8::ReadOnly); | 108 args[0]->ToString(), args[1], v8::ReadOnly); |
| 109 if (!result.FromMaybe(false)) | 109 if (!result.FromMaybe(false)) |
| 110 LOG(ERROR) << "Failed to set private property on the export."; | 110 LOG(ERROR) << "Failed to set private property on the export."; |
| 111 } | 111 } |
| 112 | 112 |
| 113 } // namespace | 113 } // namespace |
| 114 | 114 |
| 115 std::string ModuleSystem::ExceptionHandler::CreateExceptionString( | 115 std::string ModuleSystem::ExceptionHandler::CreateExceptionString( |
| (...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 746 | 746 |
| 747 void ModuleSystem::ClobberExistingNativeHandler(const std::string& name) { | 747 void ModuleSystem::ClobberExistingNativeHandler(const std::string& name) { |
| 748 NativeHandlerMap::iterator existing_handler = native_handler_map_.find(name); | 748 NativeHandlerMap::iterator existing_handler = native_handler_map_.find(name); |
| 749 if (existing_handler != native_handler_map_.end()) { | 749 if (existing_handler != native_handler_map_.end()) { |
| 750 clobbered_native_handlers_.push_back(existing_handler->second); | 750 clobbered_native_handlers_.push_back(existing_handler->second); |
| 751 native_handler_map_.erase(existing_handler); | 751 native_handler_map_.erase(existing_handler); |
| 752 } | 752 } |
| 753 } | 753 } |
| 754 | 754 |
| 755 } // namespace extensions | 755 } // namespace extensions |
| OLD | NEW |