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 #ifndef NDEBUG | 130 #ifndef NDEBUG |
131 // For testing purposes, check that the parsed canonical URL is identical to | 131 // For testing purposes, check that the parsed canonical URL is identical to |
132 // what we would have produced. Skip checking for invalid URLs have no meaning | 132 // what we would have produced. Skip checking for invalid URLs have no meaning |
133 // and we can't always canonicalize then reproducabely. | 133 // and we can't always canonicalize then reproducabely. |
134 if (is_valid_) { | 134 if (is_valid_) { |
135 url::Component scheme; | 135 url::Component scheme; |
136 // We can't do this check on the inner_url of a filesystem URL, as | 136 // We can't do this check on the inner_url of a filesystem URL, as |
137 // canonical_spec actually points to the start of the outer URL, so we'd | 137 // canonical_spec actually points to the start of the outer URL, so we'd |
138 // end up with infinite recursion in this constructor. | 138 // end up with infinite recursion in this constructor. |
139 if (!url::FindAndCompareScheme(spec_.data(), spec_.length(), | 139 if (!url::FindAndCompareScheme(spec_.data(), spec_.length(), |
140 "filesystem", &scheme) || | 140 url::kFileSystemScheme, &scheme) || |
141 scheme.begin == parsed_.scheme.begin) { | 141 scheme.begin == parsed_.scheme.begin) { |
142 // We need to retain trailing whitespace on path URLs, as the |parsed_| | 142 // We need to retain trailing whitespace on path URLs, as the |parsed_| |
143 // spec we originally received may legitimately contain trailing white- | 143 // spec we originally received may legitimately contain trailing white- |
144 // space on the path or components e.g. if the #ref has been | 144 // space on the path or components e.g. if the #ref has been |
145 // removed from a "foo:hello #ref" URL (see http://crbug.com/291747). | 145 // removed from a "foo:hello #ref" URL (see http://crbug.com/291747). |
146 GURL test_url(spec_, RETAIN_TRAILING_PATH_WHITEPACE); | 146 GURL test_url(spec_, RETAIN_TRAILING_PATH_WHITEPACE); |
147 | 147 |
148 DCHECK(test_url.is_valid_ == is_valid_); | 148 DCHECK(test_url.is_valid_ == is_valid_); |
149 DCHECK(test_url.spec_ == spec_); | 149 DCHECK(test_url.spec_ == spec_); |
150 | 150 |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 void GURL::Swap(GURL* other) { | 522 void GURL::Swap(GURL* other) { |
523 spec_.swap(other->spec_); | 523 spec_.swap(other->spec_); |
524 std::swap(is_valid_, other->is_valid_); | 524 std::swap(is_valid_, other->is_valid_); |
525 std::swap(parsed_, other->parsed_); | 525 std::swap(parsed_, other->parsed_); |
526 inner_url_.swap(other->inner_url_); | 526 inner_url_.swap(other->inner_url_); |
527 } | 527 } |
528 | 528 |
529 std::ostream& operator<<(std::ostream& out, const GURL& url) { | 529 std::ostream& operator<<(std::ostream& out, const GURL& url) { |
530 return out << url.possibly_invalid_spec(); | 530 return out << url.possibly_invalid_spec(); |
531 } | 531 } |
OLD | NEW |