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

Unified Diff: third_party/WebKit/public/platform/WebString.h

Issue 1568073002: Reduce string copies in GURL creation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Mac Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/public/platform/WebString.h
diff --git a/third_party/WebKit/public/platform/WebString.h b/third_party/WebKit/public/platform/WebString.h
index 8e4bbcc473ca4f4d985f70d943cf953a5734dfad..8be52218ee7e59a69ebbc69d368f920b596d1eae 100644
--- a/third_party/WebKit/public/platform/WebString.h
+++ b/third_party/WebKit/public/platform/WebString.h
@@ -137,7 +137,7 @@ public:
operator base::string16() const
{
- return base::Latin1OrUTF16ToUTF16(length(), data8(), data16());
+ return base::Latin1OrUTF16ToUTF16(length(), data8OrNull(), data16OrNull());
}
WebString(const base::NullableString16& s)
@@ -163,11 +163,14 @@ public:
}
#endif
-private:
BLINK_COMMON_EXPORT bool is8Bit() const;
- BLINK_COMMON_EXPORT const WebLChar* data8() const;
- BLINK_COMMON_EXPORT const WebUChar* data16() const;
+ // Returns the 8- or 16-bit underlying string buffer. If the buffer is not
+ // the corresponding type, null will be returned.
+ BLINK_COMMON_EXPORT const WebLChar* data8OrNull() const;
esprehn 2016/01/07 23:56:23 Yeah I don't want to expose this. All this patch
+ BLINK_COMMON_EXPORT const WebUChar* data16OrNull() const;
+
+private:
BLINK_COMMON_EXPORT void assign(WTF::StringImpl*);
WebPrivatePtr<WTF::StringImpl> m_private;

Powered by Google App Engine
This is Rietveld 408576698