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

Side by Side Diff: third_party/WebKit/Source/platform/exported/WebString.cpp

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 unified diff | Download patch
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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 size_t WebString::length() const 56 size_t WebString::length() const
57 { 57 {
58 return m_private.isNull() ? 0 : m_private->length(); 58 return m_private.isNull() ? 0 : m_private->length();
59 } 59 }
60 60
61 bool WebString::is8Bit() const 61 bool WebString::is8Bit() const
62 { 62 {
63 return m_private->is8Bit(); 63 return m_private->is8Bit();
64 } 64 }
65 65
66 const WebLChar* WebString::data8() const 66 const WebLChar* WebString::data8OrNull() const
67 { 67 {
68 return !m_private.isNull() && is8Bit() ? m_private->characters8() : 0; 68 return !m_private.isNull() && is8Bit() ? m_private->characters8() : 0;
69 } 69 }
70 70
71 const WebUChar* WebString::data16() const 71 const WebUChar* WebString::data16OrNull() const
72 { 72 {
73 return !m_private.isNull() && !is8Bit() ? m_private->characters16() : 0; 73 return !m_private.isNull() && !is8Bit() ? m_private->characters16() : 0;
74 } 74 }
75 75
76 std::string WebString::utf8() const 76 std::string WebString::utf8() const
77 { 77 {
78 StringUTF8Adaptor utf8(m_private.get()); 78 StringUTF8Adaptor utf8(m_private.get());
79 return std::string(utf8.data(), utf8.length()); 79 return std::string(utf8.data(), utf8.length());
80 } 80 }
81 81
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 { 149 {
150 return WTF::AtomicString(m_private.get()); 150 return WTF::AtomicString(m_private.get());
151 } 151 }
152 152
153 void WebString::assign(WTF::StringImpl* p) 153 void WebString::assign(WTF::StringImpl* p)
154 { 154 {
155 m_private = p; 155 m_private = p;
156 } 156 }
157 157
158 } // namespace blink 158 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698