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

Side by Side Diff: Source/core/platform/chromium/support/WebString.cpp

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
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 16 matching lines...) Expand all
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 "config.h" 31 #include "config.h"
32 #include "public/platform/WebString.h" 32 #include "public/platform/WebString.h"
33 33
34 #include "public/platform/WebCString.h" 34 #include "public/platform/WebCString.h"
35 #include "wtf/text/AtomicString.h" 35 #include "wtf/text/AtomicString.h"
36 #include "wtf/text/CString.h" 36 #include "wtf/text/CString.h"
37 #include "wtf/text/StringUTF8Adaptor.h"
37 #include "wtf/text/WTFString.h" 38 #include "wtf/text/WTFString.h"
38 39
39 namespace WebKit { 40 namespace WebKit {
40 41
41 void WebString::reset() 42 void WebString::reset()
42 { 43 {
43 m_private.reset(); 44 m_private.reset();
44 } 45 }
45 46
46 void WebString::assign(const WebString& other) 47 void WebString::assign(const WebString& other)
(...skipping 30 matching lines...) Expand all
77 const WebUChar* WebString::data16() const 78 const WebUChar* WebString::data16() const
78 { 79 {
79 return !m_private.isNull() && !is8Bit() ? m_private->characters16() : 0; 80 return !m_private.isNull() && !is8Bit() ? m_private->characters16() : 0;
80 } 81 }
81 82
82 WebCString WebString::utf8() const 83 WebCString WebString::utf8() const
83 { 84 {
84 return WTF::String(m_private.get()).utf8(); 85 return WTF::String(m_private.get()).utf8();
85 } 86 }
86 87
88 std::string WebString::toUTF8String() const
89 {
90 StringUTF8Adaptor utf8(m_private.get());
91 return std::string(utf8.data(), utf8.length());
92 }
93
87 WebString WebString::fromUTF8(const char* data, size_t length) 94 WebString WebString::fromUTF8(const char* data, size_t length)
88 { 95 {
89 return WTF::String::fromUTF8(data, length); 96 return WTF::String::fromUTF8(data, length);
90 } 97 }
91 98
92 WebString WebString::fromUTF8(const char* data) 99 WebString WebString::fromUTF8(const char* data)
93 { 100 {
94 return WTF::String::fromUTF8(data); 101 return WTF::String::fromUTF8(data);
95 } 102 }
96 103
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 { 137 {
131 return WTF::AtomicString(m_private.get()); 138 return WTF::AtomicString(m_private.get());
132 } 139 }
133 140
134 void WebString::assign(WTF::StringImpl* p) 141 void WebString::assign(WTF::StringImpl* p)
135 { 142 {
136 m_private = p; 143 m_private = p;
137 } 144 }
138 145
139 } // namespace WebKit 146 } // namespace WebKit
OLDNEW
« no previous file with comments | « no previous file | Source/core/platform/chromium/support/WebURL.cpp » ('j') | public/platform/WebString.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698