| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/renderer/extensions/chrome_v8_extension.h" | 5 #include "chrome/renderer/extensions/chrome_v8_extension.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
| 9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 | 23 |
| 24 namespace { | 24 namespace { |
| 25 | 25 |
| 26 const char kChromeHidden[] = "chromeHidden"; | 26 const char kChromeHidden[] = "chromeHidden"; |
| 27 | 27 |
| 28 #ifndef NDEBUG | 28 #ifndef NDEBUG |
| 29 const char kValidateCallbacks[] = "validateCallbacks"; | 29 const char kValidateCallbacks[] = "validateCallbacks"; |
| 30 #endif | 30 #endif |
| 31 | 31 |
| 32 typedef std::map<int, std::string> StringMap; | 32 typedef std::map<int, std::string> StringMap; |
| 33 static base::LazyInstance<StringMap> g_string_map(base::LINKER_INITIALIZED); | 33 static base::LazyInstance<StringMap> g_string_map = LINKER_ZERO_INITIALIZED; |
| 34 | 34 |
| 35 static base::LazyInstance<ChromeV8Extension::InstanceSet> g_instances( | 35 static base::LazyInstance<ChromeV8Extension::InstanceSet> g_instances = |
| 36 base::LINKER_INITIALIZED); | 36 LINKER_ZERO_INITIALIZED; |
| 37 | 37 |
| 38 } // namespace | 38 } // namespace |
| 39 | 39 |
| 40 | 40 |
| 41 // static | 41 // static |
| 42 const char* ChromeV8Extension::GetStringResource(int resource_id) { | 42 const char* ChromeV8Extension::GetStringResource(int resource_id) { |
| 43 StringMap* strings = g_string_map.Pointer(); | 43 StringMap* strings = g_string_map.Pointer(); |
| 44 StringMap::iterator it = strings->find(resource_id); | 44 StringMap::iterator it = strings->find(resource_id); |
| 45 if (it == strings->end()) { | 45 if (it == strings->end()) { |
| 46 it = strings->insert(std::make_pair( | 46 it = strings->insert(std::make_pair( |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 if (args.Length() < 1) | 213 if (args.Length() < 1) |
| 214 return v8::Undefined(); | 214 return v8::Undefined(); |
| 215 | 215 |
| 216 std::vector<std::string> components; | 216 std::vector<std::string> components; |
| 217 for (int i = 0; i < args.Length(); ++i) | 217 for (int i = 0; i < args.Length(); ++i) |
| 218 components.push_back(*v8::String::Utf8Value(args[i]->ToString())); | 218 components.push_back(*v8::String::Utf8Value(args[i]->ToString())); |
| 219 | 219 |
| 220 LOG(ERROR) << JoinString(components, ','); | 220 LOG(ERROR) << JoinString(components, ','); |
| 221 return v8::Undefined(); | 221 return v8::Undefined(); |
| 222 } | 222 } |
| OLD | NEW |