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

Side by Side Diff: src/inspector/string-util.cc

Issue 2523743003: Roll third_party/inspector_protocol to 73028acaa3646789fd2a3bfd0d79eb2d91b696b3 (Closed)
Patch Set: addressed comments Created 4 years 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
« no previous file with comments | « src/inspector/string-util.h ('k') | src/inspector/v8-console-message.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project 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 #include "src/inspector/string-util.h" 5 #include "src/inspector/string-util.h"
6 6
7 #include "src/inspector/protocol/Protocol.h" 7 #include "src/inspector/protocol/Protocol.h"
8 8
9 namespace v8_inspector { 9 namespace v8_inspector {
10 10
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 } else { 86 } else {
87 for (size_t i = 0, j = 0; prefix[j] && i < string.length(); ++i, ++j) { 87 for (size_t i = 0, j = 0; prefix[j] && i < string.length(); ++i, ++j) {
88 if (string.characters16()[i] != prefix[j]) return false; 88 if (string.characters16()[i] != prefix[j]) return false;
89 } 89 }
90 } 90 }
91 return true; 91 return true;
92 } 92 }
93 93
94 namespace protocol { 94 namespace protocol {
95 95
96 std::unique_ptr<protocol::Value> parseJSON(const StringView& string) { 96 std::unique_ptr<protocol::Value> StringUtil::parseJSON(
97 const StringView& string) {
97 if (!string.length()) return nullptr; 98 if (!string.length()) return nullptr;
98 if (string.is8Bit()) { 99 if (string.is8Bit()) {
99 return protocol::parseJSON(string.characters8(), 100 return parseJSONCharacters(string.characters8(),
100 static_cast<int>(string.length())); 101 static_cast<int>(string.length()));
101 } 102 }
102 return protocol::parseJSON(string.characters16(), 103 return parseJSONCharacters(string.characters16(),
103 static_cast<int>(string.length())); 104 static_cast<int>(string.length()));
104 } 105 }
105 106
106 std::unique_ptr<protocol::Value> parseJSON(const String16& string) { 107 std::unique_ptr<protocol::Value> StringUtil::parseJSON(const String16& string) {
107 if (!string.length()) return nullptr; 108 if (!string.length()) return nullptr;
108 return protocol::parseJSON(string.characters16(), 109 return parseJSONCharacters(string.characters16(),
109 static_cast<int>(string.length())); 110 static_cast<int>(string.length()));
110 } 111 }
111 112
112 } // namespace protocol 113 } // namespace protocol
113 114
114 // static 115 // static
115 std::unique_ptr<StringBuffer> StringBuffer::create(const StringView& string) { 116 std::unique_ptr<StringBuffer> StringBuffer::create(const StringView& string) {
116 String16 owner = toString16(string); 117 String16 owner = toString16(string);
117 return StringBufferImpl::adopt(owner); 118 return StringBufferImpl::adopt(owner);
118 } 119 }
119 120
120 // static 121 // static
121 std::unique_ptr<StringBufferImpl> StringBufferImpl::adopt(String16& string) { 122 std::unique_ptr<StringBufferImpl> StringBufferImpl::adopt(String16& string) {
122 return wrapUnique(new StringBufferImpl(string)); 123 return std::unique_ptr<StringBufferImpl>(new StringBufferImpl(string));
123 } 124 }
124 125
125 StringBufferImpl::StringBufferImpl(String16& string) { 126 StringBufferImpl::StringBufferImpl(String16& string) {
126 m_owner.swap(string); 127 m_owner.swap(string);
127 m_string = toStringView(m_owner); 128 m_string = toStringView(m_owner);
128 } 129 }
129 130
130 } // namespace v8_inspector 131 } // namespace v8_inspector
OLDNEW
« no previous file with comments | « src/inspector/string-util.h ('k') | src/inspector/v8-console-message.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698