OLD | NEW |
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/StringUtil.h" | 5 #include "src/inspector/StringUtil.h" |
6 | 6 |
| 7 #include <limits> |
| 8 |
7 #include "src/inspector/protocol/Protocol.h" | 9 #include "src/inspector/protocol/Protocol.h" |
8 | 10 |
9 #include <limits> | |
10 | |
11 namespace v8_inspector { | 11 namespace v8_inspector { |
12 | 12 |
13 v8::Local<v8::String> toV8String(v8::Isolate* isolate, const String16& string) { | 13 v8::Local<v8::String> toV8String(v8::Isolate* isolate, const String16& string) { |
14 if (string.isEmpty()) return v8::String::Empty(isolate); | 14 if (string.isEmpty()) return v8::String::Empty(isolate); |
15 DCHECK(string.length() < v8::String::kMaxLength); | 15 DCHECK(string.length() < v8::String::kMaxLength); |
16 return v8::String::NewFromTwoByte( | 16 return v8::String::NewFromTwoByte( |
17 isolate, reinterpret_cast<const uint16_t*>(string.characters16()), | 17 isolate, reinterpret_cast<const uint16_t*>(string.characters16()), |
18 v8::NewStringType::kNormal, static_cast<int>(string.length())) | 18 v8::NewStringType::kNormal, static_cast<int>(string.length())) |
19 .ToLocalChecked(); | 19 .ToLocalChecked(); |
20 } | 20 } |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 std::unique_ptr<StringBufferImpl> StringBufferImpl::adopt(String16& string) { | 198 std::unique_ptr<StringBufferImpl> StringBufferImpl::adopt(String16& string) { |
199 return wrapUnique(new StringBufferImpl(string)); | 199 return wrapUnique(new StringBufferImpl(string)); |
200 } | 200 } |
201 | 201 |
202 StringBufferImpl::StringBufferImpl(String16& string) { | 202 StringBufferImpl::StringBufferImpl(String16& string) { |
203 m_owner.swap(string); | 203 m_owner.swap(string); |
204 m_string = toStringView(m_owner); | 204 m_string = toStringView(m_owner); |
205 } | 205 } |
206 | 206 |
207 } // namespace v8_inspector | 207 } // namespace v8_inspector |
OLD | NEW |