OLD | NEW |
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 #include "platform/v8_inspector/V8StringUtil.h" | 5 #include "platform/v8_inspector/V8StringUtil.h" |
6 | 6 |
7 #include "platform/inspector_protocol/String16.h" | 7 #include "platform/inspector_protocol/String16.h" |
8 #include "platform/v8_inspector/V8InspectorImpl.h" | 8 #include "platform/v8_inspector/V8InspectorImpl.h" |
9 #include "platform/v8_inspector/V8InspectorSessionImpl.h" | 9 #include "platform/v8_inspector/V8InspectorSessionImpl.h" |
10 #include "platform/v8_inspector/V8Regex.h" | 10 #include "platform/v8_inspector/V8Regex.h" |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 return v8::String::NewFromTwoByte(isolate, reinterpret_cast<const uint16_t*>
(string.characters16()), v8::NewStringType::kNormal, string.length()).ToLocalChe
cked(); | 158 return v8::String::NewFromTwoByte(isolate, reinterpret_cast<const uint16_t*>
(string.characters16()), v8::NewStringType::kNormal, string.length()).ToLocalChe
cked(); |
159 } | 159 } |
160 | 160 |
161 v8::Local<v8::String> toV8StringInternalized(v8::Isolate* isolate, const String1
6& string) | 161 v8::Local<v8::String> toV8StringInternalized(v8::Isolate* isolate, const String1
6& string) |
162 { | 162 { |
163 if (string.isEmpty()) | 163 if (string.isEmpty()) |
164 return v8::String::Empty(isolate); | 164 return v8::String::Empty(isolate); |
165 return v8::String::NewFromTwoByte(isolate, reinterpret_cast<const uint16_t*>
(string.characters16()), v8::NewStringType::kInternalized, string.length()).ToLo
calChecked(); | 165 return v8::String::NewFromTwoByte(isolate, reinterpret_cast<const uint16_t*>
(string.characters16()), v8::NewStringType::kInternalized, string.length()).ToLo
calChecked(); |
166 } | 166 } |
167 | 167 |
| 168 v8::Local<v8::String> toV8StringInternalized(v8::Isolate* isolate, const char* s
tr) |
| 169 { |
| 170 return v8::String::NewFromUtf8(isolate, str, v8::NewStringType::kInternalize
d).ToLocalChecked(); |
| 171 } |
| 172 |
168 String16 toProtocolString(v8::Local<v8::String> value) | 173 String16 toProtocolString(v8::Local<v8::String> value) |
169 { | 174 { |
170 if (value.IsEmpty() || value->IsNull() || value->IsUndefined()) | 175 if (value.IsEmpty() || value->IsNull() || value->IsUndefined()) |
171 return String16(); | 176 return String16(); |
172 std::unique_ptr<UChar[]> buffer(new UChar[value->Length()]); | 177 std::unique_ptr<UChar[]> buffer(new UChar[value->Length()]); |
173 value->Write(reinterpret_cast<uint16_t*>(buffer.get()), 0, value->Length()); | 178 value->Write(reinterpret_cast<uint16_t*>(buffer.get()), 0, value->Length()); |
174 return String16(buffer.get(), value->Length()); | 179 return String16(buffer.get(), value->Length()); |
175 } | 180 } |
176 | 181 |
177 String16 toProtocolStringWithTypeCheck(v8::Local<v8::Value> value) | 182 String16 toProtocolStringWithTypeCheck(v8::Local<v8::Value> value) |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 return nullptr; | 274 return nullptr; |
270 jsonObject->setValue(toProtocolString(propertyName), std::move(prope
rtyValue)); | 275 jsonObject->setValue(toProtocolString(propertyName), std::move(prope
rtyValue)); |
271 } | 276 } |
272 return std::move(jsonObject); | 277 return std::move(jsonObject); |
273 } | 278 } |
274 NOTREACHED(); | 279 NOTREACHED(); |
275 return nullptr; | 280 return nullptr; |
276 } | 281 } |
277 | 282 |
278 } // namespace blink | 283 } // namespace blink |
OLD | NEW |