Chromium Code Reviews| 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 "net/base/net_util.h" | 5 #include "net/base/net_util.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <iterator> | 8 #include <iterator> |
| 9 #include <map> | 9 #include <map> |
| 10 | 10 |
| (...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 489 LangToExemplarSetMap& map = LangToExemplarSet::GetInstance()->map; | 489 LangToExemplarSetMap& map = LangToExemplarSet::GetInstance()->map; |
| 490 map.insert(std::make_pair(lang, lang_set)); | 490 map.insert(std::make_pair(lang, lang_set)); |
| 491 } | 491 } |
| 492 | 492 |
| 493 static base::Lock lang_set_lock; | 493 static base::Lock lang_set_lock; |
| 494 | 494 |
| 495 // Returns true if all the characters in component_characters are used by | 495 // Returns true if all the characters in component_characters are used by |
| 496 // the language |lang|. | 496 // the language |lang|. |
| 497 bool IsComponentCoveredByLang(const icu::UnicodeSet& component_characters, | 497 bool IsComponentCoveredByLang(const icu::UnicodeSet& component_characters, |
| 498 const std::string& lang) { | 498 const std::string& lang) { |
| 499 static const icu::UnicodeSet kASCIILetters(0x61, 0x7a); // [a-z] | 499 CR_DEFINE_STATIC_LOCAL( |
| 500 const icu::UnicodeSet, kASCIILetters, (0x61, 0x7a)); // [a-z] | |
|
Mark Mentovai
2011/11/06 14:09:02
('a', 'z') works?
Nico
2011/11/06 17:30:38
D'oh!ne.
| |
| 500 icu::UnicodeSet* lang_set; | 501 icu::UnicodeSet* lang_set; |
| 501 // We're called from both the UI thread and the history thread. | 502 // We're called from both the UI thread and the history thread. |
| 502 { | 503 { |
| 503 base::AutoLock lock(lang_set_lock); | 504 base::AutoLock lock(lang_set_lock); |
| 504 if (!GetExemplarSetForLang(lang, &lang_set)) { | 505 if (!GetExemplarSetForLang(lang, &lang_set)) { |
| 505 UErrorCode status = U_ZERO_ERROR; | 506 UErrorCode status = U_ZERO_ERROR; |
| 506 ULocaleData* uld = ulocdata_open(lang.c_str(), &status); | 507 ULocaleData* uld = ulocdata_open(lang.c_str(), &status); |
| 507 // TODO(jungshik) Turn this check on when the ICU data file is | 508 // TODO(jungshik) Turn this check on when the ICU data file is |
| 508 // rebuilt with the minimal subset of locale data for languages | 509 // rebuilt with the minimal subset of locale data for languages |
| 509 // to which Chrome is not localized but which we offer in the list | 510 // to which Chrome is not localized but which we offer in the list |
| (...skipping 1941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2451 | 2452 |
| 2452 NetworkInterface::NetworkInterface(const std::string& name, | 2453 NetworkInterface::NetworkInterface(const std::string& name, |
| 2453 const IPAddressNumber& address) | 2454 const IPAddressNumber& address) |
| 2454 : name(name), address(address) { | 2455 : name(name), address(address) { |
| 2455 } | 2456 } |
| 2456 | 2457 |
| 2457 NetworkInterface::~NetworkInterface() { | 2458 NetworkInterface::~NetworkInterface() { |
| 2458 } | 2459 } |
| 2459 | 2460 |
| 2460 } // namespace net | 2461 } // namespace net |
| OLD | NEW |