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

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

Issue 2007103003: Expand WTF::StringView's API to be more like StringPiece. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove bad assert. Created 4 years, 6 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 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 #include "public/platform/WebString.h" 31 #include "public/platform/WebString.h"
32 32
33 #include "wtf/text/AtomicString.h" 33 #include "wtf/text/AtomicString.h"
34 #include "wtf/text/CString.h" 34 #include "wtf/text/CString.h"
35 #include "wtf/text/StringUTF8Adaptor.h" 35 #include "wtf/text/StringUTF8Adaptor.h"
36 #include "wtf/text/StringView.h"
36 #include "wtf/text/WTFString.h" 37 #include "wtf/text/WTFString.h"
37 38
38 namespace blink { 39 namespace blink {
39 40
40 void WebString::reset() 41 void WebString::reset()
41 { 42 {
42 m_private.reset(); 43 m_private.reset();
43 } 44 }
44 45
45 void WebString::assign(const WebString& other) 46 void WebString::assign(const WebString& other)
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 { 127 {
127 assign(s.impl()); 128 assign(s.impl());
128 return *this; 129 return *this;
129 } 130 }
130 131
131 WebString::operator WTF::String() const 132 WebString::operator WTF::String() const
132 { 133 {
133 return m_private.get(); 134 return m_private.get();
134 } 135 }
135 136
137 WebString::operator WTF::StringView() const
138 {
139 return StringView(m_private.get());
140 }
141
136 WebString::WebString(const WTF::AtomicString& s) 142 WebString::WebString(const WTF::AtomicString& s)
137 { 143 {
138 assign(s.getString()); 144 assign(s.getString());
139 } 145 }
140 146
141 WebString& WebString::operator=(const WTF::AtomicString& s) 147 WebString& WebString::operator=(const WTF::AtomicString& s)
142 { 148 {
143 assign(s.getString()); 149 assign(s.getString());
144 return *this; 150 return *this;
145 } 151 }
146 152
147 WebString::operator WTF::AtomicString() const 153 WebString::operator WTF::AtomicString() const
148 { 154 {
149 return WTF::AtomicString(m_private.get()); 155 return WTF::AtomicString(m_private.get());
150 } 156 }
151 157
152 void WebString::assign(WTF::StringImpl* p) 158 void WebString::assign(WTF::StringImpl* p)
153 { 159 {
154 m_private = p; 160 m_private = p;
155 } 161 }
156 162
157 } // namespace blink 163 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698