OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "extensions/renderer/string_source_map.h" | |
6 | |
7 #include "gin/converter.h" | |
8 | |
9 namespace extensions { | |
10 | |
11 StringSourceMap::StringSourceMap() {} | |
12 StringSourceMap::~StringSourceMap() {} | |
13 | |
14 v8::Local<v8::String> StringSourceMap::GetSource( | |
15 v8::Isolate* isolate, | |
16 const std::string& name) const { | |
17 const auto& iter = sources_.find(name); | |
18 if (iter == sources_.end()) | |
19 return v8::Local<v8::String>(); | |
20 return gin::StringToV8(isolate, iter->second); | |
21 } | |
22 | |
23 bool StringSourceMap::Contains(const std::string& name) const { | |
24 return sources_.find(name) != sources_.end(); | |
25 } | |
26 | |
27 void StringSourceMap::RegisterModule(const std::string& name, | |
28 const std::string& source) { | |
29 CHECK_EQ(0u, sources_.count(name)) << "Module " << name << " not found"; | |
jbroman
2016/12/16 19:00:50
Isn't the opposite the problem, that the module _w
Devlin
2016/12/16 20:31:17
Copy-paste code strikes again! It was this way in
| |
30 sources_[name] = source; | |
31 } | |
32 | |
33 } // namespace extensions | |
OLD | NEW |