Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(115)

Side by Side Diff: third_party/WebKit/Source/platform/weborigin/KURL.h

Issue 2463703002: Optimize KURL protocols (Closed)
Patch Set: add dchecks Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2011, 2012 Apple Inc. 2 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2011, 2012 Apple Inc.
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 189
190 const KURL* innerURL() const { return m_innerURL.get(); } 190 const KURL* innerURL() const { return m_innerURL.get(); }
191 191
192 bool isSafeToSendToAnotherThread() const; 192 bool isSafeToSendToAnotherThread() const;
193 193
194 private: 194 private:
195 void init(const KURL& base, 195 void init(const KURL& base,
196 const String& relative, 196 const String& relative,
197 const WTF::TextEncoding* queryEncoding); 197 const WTF::TextEncoding* queryEncoding);
198 198
199 StringView componentStringView(const url::Component&) const;
199 String componentString(const url::Component&) const; 200 String componentString(const url::Component&) const;
200 String stringForInvalidComponent() const; 201 StringView stringViewForInvalidComponent() const;
201 202
202 template <typename CHAR> 203 template <typename CHAR>
203 void replaceComponents(const url::Replacements<CHAR>&); 204 void replaceComponents(const url::Replacements<CHAR>&);
204 205
205 void initInnerURL(); 206 void initInnerURL();
206 void initProtocolIsInHTTPFamily(); 207 void initProtocolMetadata();
207 208
208 bool m_isValid; 209 bool m_isValid;
209 bool m_protocolIsInHTTPFamily; 210 bool m_protocolIsInHTTPFamily;
211
212 // Keep a separate string for the protocol to avoid copious copies for
213 // protocol(). Normally this will be Atomic, except when constructed via
214 // KURL::copy(), which is deep.
215 String m_protocol;
216
210 url::Parsed m_parsed; 217 url::Parsed m_parsed;
211 String m_string; 218 String m_string;
212 std::unique_ptr<KURL> m_innerURL; 219 std::unique_ptr<KURL> m_innerURL;
213 }; 220 };
214 221
215 PLATFORM_EXPORT bool operator==(const KURL&, const KURL&); 222 PLATFORM_EXPORT bool operator==(const KURL&, const KURL&);
216 PLATFORM_EXPORT bool operator==(const KURL&, const String&); 223 PLATFORM_EXPORT bool operator==(const KURL&, const String&);
217 PLATFORM_EXPORT bool operator==(const String&, const KURL&); 224 PLATFORM_EXPORT bool operator==(const String&, const KURL&);
218 PLATFORM_EXPORT bool operator!=(const KURL&, const KURL&); 225 PLATFORM_EXPORT bool operator!=(const KURL&, const KURL&);
219 PLATFORM_EXPORT bool operator!=(const KURL&, const String&); 226 PLATFORM_EXPORT bool operator!=(const KURL&, const String&);
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 288
282 // KURLHash is the default hash for String 289 // KURLHash is the default hash for String
283 template <> 290 template <>
284 struct DefaultHash<blink::KURL> { 291 struct DefaultHash<blink::KURL> {
285 typedef blink::KURLHash Hash; 292 typedef blink::KURLHash Hash;
286 }; 293 };
287 294
288 } // namespace WTF 295 } // namespace WTF
289 296
290 #endif // KURL_h 297 #endif // KURL_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698