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

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

Issue 1768063002: Introduce String::fromUTF8Lenient() and use it for cache_name in CacheStorage API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: incorporated jsbell's comment Created 4 years, 9 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 WebString WebString::fromUTF8(const char* data, size_t length) 82 WebString WebString::fromUTF8(const char* data, size_t length)
83 { 83 {
84 return String::fromUTF8(data, length); 84 return String::fromUTF8(data, length);
85 } 85 }
86 86
87 WebString WebString::fromUTF8(const char* data) 87 WebString WebString::fromUTF8(const char* data)
88 { 88 {
89 return String::fromUTF8(data); 89 return String::fromUTF8(data);
90 } 90 }
91 91
92 WebString WebString::fromUTF8Lenient(const char* data, size_t length)
93 {
94 return String::fromUTF8Lenient(data, length);
95 }
96
92 std::string WebString::latin1() const 97 std::string WebString::latin1() const
93 { 98 {
94 String string(m_private.get()); 99 String string(m_private.get());
95 100
96 if (string.isEmpty()) 101 if (string.isEmpty())
97 return std::string(); 102 return std::string();
98 103
99 if (string.is8Bit()) 104 if (string.is8Bit())
100 return std::string(reinterpret_cast<const char*>(string.characters8()), string.length()); 105 return std::string(reinterpret_cast<const char*>(string.characters8()), string.length());
101 106
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 { 154 {
150 return WTF::AtomicString(m_private.get()); 155 return WTF::AtomicString(m_private.get());
151 } 156 }
152 157
153 void WebString::assign(WTF::StringImpl* p) 158 void WebString::assign(WTF::StringImpl* p)
154 { 159 {
155 m_private = p; 160 m_private = p;
156 } 161 }
157 162
158 } // namespace blink 163 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698