diff options
author | tony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-10 21:08:39 +0000 |
---|---|---|
committer | tony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-10 21:08:39 +0000 |
commit | 8a16266e66a38bc1bfc6b00893c2a7c8cf8c55ee (patch) | |
tree | 5c07a9d5091a56c6d5a1a2b98ec10d19ae3c20e9 /net | |
parent | f8dce00e633d5ffde45e008fb8f51d5a76942f6b (diff) | |
download | chromium_src-8a16266e66a38bc1bfc6b00893c2a7c8cf8c55ee.zip chromium_src-8a16266e66a38bc1bfc6b00893c2a7c8cf8c55ee.tar.gz chromium_src-8a16266e66a38bc1bfc6b00893c2a7c8cf8c55ee.tar.bz2 |
Move StringPiece into the base namespace. It is colliding
with the StringPiece class in icu4.2, which is a problem
when trying to use the system version of icu.
Review URL: http://codereview.chromium.org/193072
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25920 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r-- | net/base/net_module.cc | 4 | ||||
-rw-r--r-- | net/base/net_module.h | 4 | ||||
-rw-r--r-- | net/base/net_util.cc | 3 | ||||
-rw-r--r-- | net/base/registry_controlled_domain.cc | 10 | ||||
-rw-r--r-- | net/base/registry_controlled_domain.h | 13 | ||||
-rw-r--r-- | net/http/http_chunked_decoder.cc | 12 | ||||
-rw-r--r-- | net/http/http_util.cc | 4 | ||||
-rw-r--r-- | net/url_request/url_request_unittest.cc | 2 |
8 files changed, 28 insertions, 24 deletions
diff --git a/net/base/net_module.cc b/net/base/net_module.cc index de9a586..d7f1918 100644 --- a/net/base/net_module.cc +++ b/net/base/net_module.cc @@ -14,8 +14,8 @@ void NetModule::SetResourceProvider(ResourceProvider func) { } // static -StringPiece NetModule::GetResource(int key) { - return resource_provider ? resource_provider(key) : StringPiece(); +base::StringPiece NetModule::GetResource(int key) { + return resource_provider ? resource_provider(key) : base::StringPiece(); } } // namespace net diff --git a/net/base/net_module.h b/net/base/net_module.h index 06404d0..6df4bfe 100644 --- a/net/base/net_module.h +++ b/net/base/net_module.h @@ -19,7 +19,7 @@ namespace net { // class NetModule { public: - typedef StringPiece (*ResourceProvider)(int key); + typedef base::StringPiece (*ResourceProvider)(int key); // Set the function to call when the net module needs resources static void SetResourceProvider(ResourceProvider func); @@ -27,7 +27,7 @@ class NetModule { // Call the resource provider (if one exists) to get the specified resource. // Returns an empty string if the resource does not exist or if there is no // resource provider. - static StringPiece GetResource(int key); + static base::StringPiece GetResource(int key); private: DISALLOW_IMPLICIT_CONSTRUCTORS(NetModule); diff --git a/net/base/net_util.cc b/net/base/net_util.cc index 13e99a5..5f6b548 100644 --- a/net/base/net_util.cc +++ b/net/base/net_util.cc @@ -918,7 +918,8 @@ std::string CanonicalizeHost(const std::wstring& host, } std::string GetDirectoryListingHeader(const string16& title) { - static const StringPiece header(NetModule::GetResource(IDR_DIR_HEADER_HTML)); + static const base::StringPiece header( + NetModule::GetResource(IDR_DIR_HEADER_HTML)); // This can be null in unit tests. DLOG_IF(WARNING, header.empty()) << "Missing resource: directory listing header"; diff --git a/net/base/registry_controlled_domain.cc b/net/base/registry_controlled_domain.cc index 2bcfba5..40dea62 100644 --- a/net/base/registry_controlled_domain.cc +++ b/net/base/registry_controlled_domain.cc @@ -276,21 +276,23 @@ void RegistryControlledDomainService::Init() { ParseDomainData(kDomainData); } -void RegistryControlledDomainService::ParseDomainData(const StringPiece& data) { +void RegistryControlledDomainService::ParseDomainData( + const base::StringPiece& data) { domain_set_.clear(); size_t line_end = 0; size_t line_start = 0; while (line_start < data.size()) { line_end = data.find('\n', line_start); - if (line_end == StringPiece::npos) + if (line_end == base::StringPiece::npos) line_end = data.size(); - AddRule(StringPiece(data.data() + line_start, line_end - line_start)); + AddRule(base::StringPiece(data.data() + line_start, line_end - line_start)); line_start = line_end + 1; } } -void RegistryControlledDomainService::AddRule(const StringPiece& rule_str) { +void RegistryControlledDomainService::AddRule( + const base::StringPiece& rule_str) { DomainEntry rule(rule_str.data(), rule_str.size()); // Valid rules may be either wild or exceptions, but not both. diff --git a/net/base/registry_controlled_domain.h b/net/base/registry_controlled_domain.h index 2c6edb7..1897e8b5 100644 --- a/net/base/registry_controlled_domain.h +++ b/net/base/registry_controlled_domain.h @@ -227,7 +227,7 @@ class RegistryControlledDomainService { // consider the attributes when doing comparisons, so as far as any data // structures our concerned (ex our set), two DomainEntry's are equal as long // as their StringPiece (the domain) is equal. This is the behavior we want. - class DomainEntry : public StringPiece { + class DomainEntry : public base::StringPiece { public: struct DomainEntryAttributes { DomainEntryAttributes() : exception(false), wildcard(false) { } @@ -242,8 +242,9 @@ class RegistryControlledDomainService { bool wildcard; }; - DomainEntry() : StringPiece() { } - DomainEntry(const char* ptr, size_type size) : StringPiece(ptr, size) { } + DomainEntry() : base::StringPiece() { } + DomainEntry(const char* ptr, size_type size) + : base::StringPiece(ptr, size) { } ~DomainEntry() { } // We override StringPiece's operator < to make it more efficent, since we @@ -252,7 +253,7 @@ class RegistryControlledDomainService { bool operator<(const DomainEntry& other) const { // If we are the same size, call up to StringPiece's real less than. if (size() == other.size()) - return *static_cast<const StringPiece*>(this) < other; + return *static_cast<const base::StringPiece*>(this) < other; // Consider ourselves less if we are smaller return size() < other.size(); } @@ -269,7 +270,7 @@ class RegistryControlledDomainService { // were populated from an embedded resource, we will reference the embedded // resource directly. If we were populated through UseDomainData, then our // StringPiece will reference our local copy in copied_domain_data_. - void ParseDomainData(const StringPiece& data); + void ParseDomainData(const base::StringPiece& data); // Returns the singleton instance, after attempting to initialize it. // NOTE that if the effective-TLD data resource can't be found, the instance @@ -277,7 +278,7 @@ class RegistryControlledDomainService { static RegistryControlledDomainService* GetInstance(); // Adds one rule, assumed to be valid, to the domain_set_. - void AddRule(const StringPiece& rule_str); + void AddRule(const base::StringPiece& rule_str); // Internal workings of the static public methods. See above. static std::string GetDomainAndRegistryImpl(const std::string& host); diff --git a/net/http/http_chunked_decoder.cc b/net/http/http_chunked_decoder.cc index 71f7554..25b789f 100644 --- a/net/http/http_chunked_decoder.cc +++ b/net/http/http_chunked_decoder.cc @@ -93,8 +93,8 @@ int HttpChunkedDecoder::ScanForChunkRemaining(const char* buf, int buf_len) { int bytes_consumed = 0; - size_t index_of_lf = StringPiece(buf, buf_len).find('\n'); - if (index_of_lf != StringPiece::npos) { + size_t index_of_lf = base::StringPiece(buf, buf_len).find('\n'); + if (index_of_lf != base::StringPiece::npos) { buf_len = static_cast<int>(index_of_lf); if (buf_len && buf[buf_len - 1] == '\r') // Eliminate a preceding CR. buf_len--; @@ -121,8 +121,8 @@ int HttpChunkedDecoder::ScanForChunkRemaining(const char* buf, int buf_len) { chunk_terminator_remaining_ = false; } else if (buf_len) { // Ignore any chunk-extensions. - size_t index_of_semicolon = StringPiece(buf, buf_len).find(';'); - if (index_of_semicolon != StringPiece::npos) + size_t index_of_semicolon = base::StringPiece(buf, buf_len).find(';'); + if (index_of_semicolon != base::StringPiece::npos) buf_len = static_cast<int>(index_of_semicolon); if (!ParseChunkSize(buf, buf_len, &chunk_remaining_)) { @@ -181,8 +181,8 @@ bool HttpChunkedDecoder::ParseChunkSize(const char* start, int len, int* out) { // Be more restrictive than HexStringToInt; // don't allow inputs with leading "-", "+", "0x", "0X" - if (StringPiece(start, len).find_first_not_of("0123456789abcdefABCDEF")!= - StringPiece::npos) + if (base::StringPiece(start, len).find_first_not_of("0123456789abcdefABCDEF") + != base::StringPiece::npos) return false; int parsed_number; diff --git a/net/http/http_util.cc b/net/http/http_util.cc index 4381117..41aa554 100644 --- a/net/http/http_util.cc +++ b/net/http/http_util.cc @@ -500,8 +500,8 @@ static bool IsLineSegmentContinuable(const char* begin, const char* end) { // Helper used by AssembleRawHeaders, to find the end of the status line. static const char* FindStatusLineEnd(const char* begin, const char* end) { - size_t i = StringPiece(begin, end - begin).find_first_of("\r\n"); - if (i == StringPiece::npos) + size_t i = base::StringPiece(begin, end - begin).find_first_of("\r\n"); + if (i == base::StringPiece::npos) return end; return begin + i; } diff --git a/net/url_request/url_request_unittest.cc b/net/url_request/url_request_unittest.cc index 2f2f2e1..d82e085 100644 --- a/net/url_request/url_request_unittest.cc +++ b/net/url_request/url_request_unittest.cc @@ -78,7 +78,7 @@ class TestURLRequest : public URLRequest { } }; -StringPiece TestNetResourceProvider(int key) { +base::StringPiece TestNetResourceProvider(int key) { return "header"; } |