| 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/macros.h" | 10 #include "base/macros.h" |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 } | 132 } |
| 133 | 133 |
| 134 auto maybe = message->GetLineNumber(context_->v8_context()); | 134 auto maybe = message->GetLineNumber(context_->v8_context()); |
| 135 int line_number = maybe.IsJust() ? maybe.FromJust() : 0; | 135 int line_number = maybe.IsJust() ? maybe.FromJust() : 0; |
| 136 return base::StringPrintf("%s:%d: %s", | 136 return base::StringPrintf("%s:%d: %s", |
| 137 resource_name.c_str(), | 137 resource_name.c_str(), |
| 138 line_number, | 138 line_number, |
| 139 error_message.c_str()); | 139 error_message.c_str()); |
| 140 } | 140 } |
| 141 | 141 |
| 142 ModuleSystem::ModuleSystem(ScriptContext* context, SourceMap* source_map) | 142 ModuleSystem::ModuleSystem(ScriptContext* context, const SourceMap* source_map) |
| 143 : ObjectBackedNativeHandler(context), | 143 : ObjectBackedNativeHandler(context), |
| 144 context_(context), | 144 context_(context), |
| 145 source_map_(source_map), | 145 source_map_(source_map), |
| 146 natives_enabled_(0), | 146 natives_enabled_(0), |
| 147 exception_handler_(new DefaultExceptionHandler(context)), | 147 exception_handler_(new DefaultExceptionHandler(context)), |
| 148 weak_factory_(this) { | 148 weak_factory_(this) { |
| 149 RouteFunction( | 149 RouteFunction( |
| 150 "require", | 150 "require", |
| 151 base::Bind(&ModuleSystem::RequireForJs, base::Unretained(this))); | 151 base::Bind(&ModuleSystem::RequireForJs, base::Unretained(this))); |
| 152 RouteFunction( | 152 RouteFunction( |
| (...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 744 | 744 |
| 745 void ModuleSystem::ClobberExistingNativeHandler(const std::string& name) { | 745 void ModuleSystem::ClobberExistingNativeHandler(const std::string& name) { |
| 746 NativeHandlerMap::iterator existing_handler = native_handler_map_.find(name); | 746 NativeHandlerMap::iterator existing_handler = native_handler_map_.find(name); |
| 747 if (existing_handler != native_handler_map_.end()) { | 747 if (existing_handler != native_handler_map_.end()) { |
| 748 clobbered_native_handlers_.push_back(std::move(existing_handler->second)); | 748 clobbered_native_handlers_.push_back(std::move(existing_handler->second)); |
| 749 native_handler_map_.erase(existing_handler); | 749 native_handler_map_.erase(existing_handler); |
| 750 } | 750 } |
| 751 } | 751 } |
| 752 | 752 |
| 753 } // namespace extensions | 753 } // namespace extensions |
| OLD | NEW |