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

Side by Side Diff: public/platform/WebString.h

Issue 20135002: Optimize WebURL -> GURL conversions (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove operator< Created 7 years, 5 months 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 | Annotate | Revision Log
« no previous file with comments | « Source/weborigin/KURL.cpp ('k') | public/platform/WebURL.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 15 matching lines...) Expand all
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #ifndef WebString_h 31 #ifndef WebString_h
32 #define WebString_h 32 #define WebString_h
33 33
34 #include "WebCommon.h" 34 #include "WebCommon.h"
35 #include "WebPrivatePtr.h" 35 #include "WebPrivatePtr.h"
36 #include <string>
36 37
37 #if INSIDE_WEBKIT 38 #if INSIDE_WEBKIT
38 #include <wtf/Forward.h> 39 #include <wtf/Forward.h>
39 #else 40 #else
40 #include <base/strings/latin1_string_conversions.h> 41 #include <base/strings/latin1_string_conversions.h>
41 #include <base/strings/nullable_string16.h> 42 #include <base/strings/nullable_string16.h>
42 #include <base/strings/string16.h> 43 #include <base/strings/string16.h>
43 #endif 44 #endif
44 45
45 namespace WTF { 46 namespace WTF {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 83
83 BLINK_COMMON_EXPORT size_t length() const; 84 BLINK_COMMON_EXPORT size_t length() const;
84 85
85 // Caller must check bounds. 86 // Caller must check bounds.
86 BLINK_COMMON_EXPORT WebUChar at(unsigned) const; 87 BLINK_COMMON_EXPORT WebUChar at(unsigned) const;
87 88
88 bool isEmpty() const { return !length(); } 89 bool isEmpty() const { return !length(); }
89 bool isNull() const { return m_private.isNull(); } 90 bool isNull() const { return m_private.isNull(); }
90 91
91 BLINK_COMMON_EXPORT WebCString utf8() const; 92 BLINK_COMMON_EXPORT WebCString utf8() const;
93 BLINK_COMMON_EXPORT std::string toUTF8String() const;
darin (slow to review) 2013/07/24 23:16:51 This is sort of a new thing for us. There's a lot
abarth-chromium 2013/07/24 23:22:43 Yes. I suspect most (all?) the callers of WebStri
92 94
93 BLINK_COMMON_EXPORT static WebString fromUTF8(const char* data, size_t lengt h); 95 BLINK_COMMON_EXPORT static WebString fromUTF8(const char* data, size_t lengt h);
94 BLINK_COMMON_EXPORT static WebString fromUTF8(const char* data); 96 BLINK_COMMON_EXPORT static WebString fromUTF8(const char* data);
95 97
96 template <int N> WebString(const char (&data)[N]) 98 template <int N> WebString(const char (&data)[N])
97 { 99 {
98 assign(fromUTF8(data, N - 1)); 100 assign(fromUTF8(data, N - 1));
99 } 101 }
100 102
101 template <int N> WebString& operator=(const char (&data)[N]) 103 template <int N> WebString& operator=(const char (&data)[N])
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 } 177 }
176 178
177 inline bool operator!=(const WebString& a, const WebString& b) 179 inline bool operator!=(const WebString& a, const WebString& b)
178 { 180 {
179 return !(a == b); 181 return !(a == b);
180 } 182 }
181 183
182 } // namespace WebKit 184 } // namespace WebKit
183 185
184 #endif 186 #endif
OLDNEW
« no previous file with comments | « Source/weborigin/KURL.cpp ('k') | public/platform/WebURL.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698