OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifdef WIN32 | 5 #ifdef WIN32 |
6 #include <windows.h> | 6 #include <windows.h> |
7 #else | 7 #else |
8 #include <pthread.h> | 8 #include <pthread.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 void GURL::InitializeFromCanonicalSpec() { | 130 void GURL::InitializeFromCanonicalSpec() { |
131 if (is_valid_ && SchemeIsFileSystem()) { | 131 if (is_valid_ && SchemeIsFileSystem()) { |
132 inner_url_.reset( | 132 inner_url_.reset( |
133 new GURL(spec_.data(), parsed_.Length(), | 133 new GURL(spec_.data(), parsed_.Length(), |
134 *parsed_.inner_parsed(), true)); | 134 *parsed_.inner_parsed(), true)); |
135 } | 135 } |
136 | 136 |
137 #ifndef NDEBUG | 137 #ifndef NDEBUG |
138 // For testing purposes, check that the parsed canonical URL is identical to | 138 // For testing purposes, check that the parsed canonical URL is identical to |
139 // what we would have produced. Skip checking for invalid URLs have no meaning | 139 // what we would have produced. Skip checking for invalid URLs have no meaning |
140 // and we can't always canonicalize then reproducabely. | 140 // and we can't always canonicalize them reproducibly. |
141 if (is_valid_) { | 141 if (is_valid_) { |
142 url_parse::Component scheme; | 142 url_parse::Component scheme; |
143 if (!url_util::FindAndCompareScheme(spec_.data(), spec_.length(), | 143 if (!url_util::FindAndCompareScheme(spec_.data(), spec_.length(), |
144 "filesystem", &scheme) || | 144 "filesystem", &scheme) || |
145 scheme.begin == parsed_.scheme.begin) { | 145 scheme.begin == parsed_.scheme.begin) { |
146 // We can't do this check on the inner_url of a filesystem URL, as | 146 // We can't do this check on the inner_url of a filesystem URL, as |
147 // canonical_spec actually points to the start of the outer URL, so we'd | 147 // canonical_spec actually points to the start of the outer URL, so we'd |
148 // end up with infinite recursion in this constructor. | 148 // end up with infinite recursion in this constructor. |
149 GURL test_url(spec_); | 149 GURL test_url(spec_); |
150 | 150 |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
509 void GURL::Swap(GURL* other) { | 509 void GURL::Swap(GURL* other) { |
510 spec_.swap(other->spec_); | 510 spec_.swap(other->spec_); |
511 std::swap(is_valid_, other->is_valid_); | 511 std::swap(is_valid_, other->is_valid_); |
512 std::swap(parsed_, other->parsed_); | 512 std::swap(parsed_, other->parsed_); |
513 inner_url_.swap(other->inner_url_); | 513 inner_url_.swap(other->inner_url_); |
514 } | 514 } |
515 | 515 |
516 std::ostream& operator<<(std::ostream& out, const GURL& url) { | 516 std::ostream& operator<<(std::ostream& out, const GURL& url) { |
517 return out << url.possibly_invalid_spec(); | 517 return out << url.possibly_invalid_spec(); |
518 } | 518 } |
OLD | NEW |