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

Side by Side Diff: third_party/WebKit/Source/platform/inspector_protocol/String16STL.h

Issue 2024993003: Add CrossThreadCopier and isolatedCopy() to SourceLocation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef String16STL_h 5 #ifndef String16STL_h
6 #define String16STL_h 6 #define String16STL_h
7 7
8 #include <cstring> 8 #include <cstring>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 16 matching lines...) Expand all
27 String16(const wstring& impl) : m_impl(impl) { } 27 String16(const wstring& impl) : m_impl(impl) { }
28 String16(const UChar* characters) : m_impl(characters) { } 28 String16(const UChar* characters) : m_impl(characters) { }
29 String16(const char* characters) : String16(characters, std::strlen(characte rs)) { } 29 String16(const char* characters) : String16(characters, std::strlen(characte rs)) { }
30 String16(const char* characters, size_t size) 30 String16(const char* characters, size_t size)
31 { 31 {
32 m_impl.resize(size); 32 m_impl.resize(size);
33 for (size_t i = 0; i < size; ++i) 33 for (size_t i = 0; i < size; ++i)
34 m_impl[i] = characters[i]; 34 m_impl[i] = characters[i];
35 } 35 }
36 String16(const UChar* characters, size_t size) : m_impl(characters, size) { } 36 String16(const UChar* characters, size_t size) : m_impl(characters, size) { }
37 String16 isolatedCopy() const { return String16(m_impl); }
37 ~String16() { } 38 ~String16() { }
38 39
39 unsigned sizeInBytes() const { return m_impl.size() * sizeof(UChar); } 40 unsigned sizeInBytes() const { return m_impl.size() * sizeof(UChar); }
40 const UChar* characters16() const { return m_impl.c_str(); } 41 const UChar* characters16() const { return m_impl.c_str(); }
41 std::string utf8() const; 42 std::string utf8() const;
42 static String16 number(int i) { return String16(std::to_string(i).c_str()); } 43 static String16 number(int i) { return String16(std::to_string(i).c_str()); }
43 static String16 fromDouble(double d) { return String16(std::to_string(d).c_s tr()); } 44 static String16 fromDouble(double d) { return String16(std::to_string(d).c_s tr()); }
44 static String16 fromDoubleFixedPrecision(double d, int len) { return String1 6(std::to_string(d).c_str()); } 45 static String16 fromDoubleFixedPrecision(double d, int len) { return String1 6(std::to_string(d).c_str()); }
45 46
46 static double charactersToDouble(const UChar* characters, size_t length, boo l* ok = 0) 47 static double charactersToDouble(const UChar* characters, size_t length, boo l* ok = 0)
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 template<> 228 template<>
228 struct hash<String16> { 229 struct hash<String16> {
229 std::size_t operator()(const String16& k) const 230 std::size_t operator()(const String16& k) const
230 { 231 {
231 return k.hash(); 232 return k.hash();
232 } 233 }
233 }; 234 };
234 } 235 }
235 236
236 #endif // !defined(String16STL_h) 237 #endif // !defined(String16STL_h)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698