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

Side by Side Diff: src/inspector/StringUtil.cpp

Issue 2292053003: [inspector] Build inspector under v8_enable_inspector build flag. (Closed)
Patch Set: owners Created 4 years, 3 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 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 "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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 if (!string.length()) return nullptr; 100 if (!string.length()) return nullptr;
101 return protocol::parseJSON(string.characters16(), string.length()); 101 return protocol::parseJSON(string.characters16(), string.length());
102 } 102 }
103 103
104 } // namespace protocol 104 } // namespace protocol
105 105
106 std::unique_ptr<protocol::Value> toProtocolValue(v8::Local<v8::Context> context, 106 std::unique_ptr<protocol::Value> toProtocolValue(v8::Local<v8::Context> context,
107 v8::Local<v8::Value> value, 107 v8::Local<v8::Value> value,
108 int maxDepth) { 108 int maxDepth) {
109 if (value.IsEmpty()) { 109 if (value.IsEmpty()) {
110 NOTREACHED(); 110 UNREACHABLE();
111 return nullptr; 111 return nullptr;
112 } 112 }
113 113
114 if (!maxDepth) return nullptr; 114 if (!maxDepth) return nullptr;
115 maxDepth--; 115 maxDepth--;
116 116
117 if (value->IsNull() || value->IsUndefined()) return protocol::Value::null(); 117 if (value->IsNull() || value->IsUndefined()) return protocol::Value::null();
118 if (value->IsBoolean()) 118 if (value->IsBoolean())
119 return protocol::FundamentalValue::create(value.As<v8::Boolean>()->Value()); 119 return protocol::FundamentalValue::create(value.As<v8::Boolean>()->Value());
120 if (value->IsNumber()) { 120 if (value->IsNumber()) {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 v8::Local<v8::Value> property; 165 v8::Local<v8::Value> property;
166 if (!object->Get(context, name).ToLocal(&property)) return nullptr; 166 if (!object->Get(context, name).ToLocal(&property)) return nullptr;
167 std::unique_ptr<protocol::Value> propertyValue = 167 std::unique_ptr<protocol::Value> propertyValue =
168 toProtocolValue(context, property, maxDepth); 168 toProtocolValue(context, property, maxDepth);
169 if (!propertyValue) return nullptr; 169 if (!propertyValue) return nullptr;
170 jsonObject->setValue(toProtocolString(propertyName), 170 jsonObject->setValue(toProtocolString(propertyName),
171 std::move(propertyValue)); 171 std::move(propertyValue));
172 } 172 }
173 return std::move(jsonObject); 173 return std::move(jsonObject);
174 } 174 }
175 NOTREACHED(); 175 UNREACHABLE();
176 return nullptr; 176 return nullptr;
177 } 177 }
178 178
179 // static 179 // static
180 std::unique_ptr<StringBuffer> StringBuffer::create(const StringView& string) { 180 std::unique_ptr<StringBuffer> StringBuffer::create(const StringView& string) {
181 String16 owner = toString16(string); 181 String16 owner = toString16(string);
182 return StringBufferImpl::adopt(owner); 182 return StringBufferImpl::adopt(owner);
183 } 183 }
184 184
185 // static 185 // static
186 std::unique_ptr<StringBufferImpl> StringBufferImpl::adopt(String16& string) { 186 std::unique_ptr<StringBufferImpl> StringBufferImpl::adopt(String16& string) {
187 return wrapUnique(new StringBufferImpl(string)); 187 return wrapUnique(new StringBufferImpl(string));
188 } 188 }
189 189
190 StringBufferImpl::StringBufferImpl(String16& string) { 190 StringBufferImpl::StringBufferImpl(String16& string) {
191 m_owner.swap(string); 191 m_owner.swap(string);
192 m_string = toStringView(m_owner); 192 m_string = toStringView(m_owner);
193 } 193 }
194 194
195 } // namespace v8_inspector 195 } // namespace v8_inspector
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698