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

Unified Diff: third_party/WebKit/Source/platform/v8_inspector/public/V8ToProtocolValue.cpp

Issue 1738073002: DevTools: introduce protocol::Value, baseline for hierarchical data in remote debugging protocol. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/v8_inspector/public/V8ToProtocolValue.cpp
diff --git a/third_party/WebKit/Source/platform/JSONValuesForV8.cpp b/third_party/WebKit/Source/platform/v8_inspector/public/V8ToProtocolValue.cpp
similarity index 75%
copy from third_party/WebKit/Source/platform/JSONValuesForV8.cpp
copy to third_party/WebKit/Source/platform/v8_inspector/public/V8ToProtocolValue.cpp
index 94ded635e57939761eefbcd53aca5b311aef680e..8c4a92152c865f7d88945a6a33b9de89cf409c0e 100644
--- a/third_party/WebKit/Source/platform/JSONValuesForV8.cpp
+++ b/third_party/WebKit/Source/platform/v8_inspector/public/V8ToProtocolValue.cpp
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "platform/JSONValuesForV8.h"
+#include "platform/v8_inspector/public/V8ToProtocolValue.h"
namespace blink {
@@ -15,7 +15,7 @@ static String coreString(v8::Local<v8::String> v8String)
return result;
}
-PassRefPtr<JSONValue> toJSONValue(v8::Local<v8::Context> context, v8::Local<v8::Value> value, int maxDepth)
+PassRefPtr<protocol::Value> toProtocolValue(v8::Local<v8::Context> context, v8::Local<v8::Value> value, int maxDepth)
{
if (value.IsEmpty()) {
ASSERT_NOT_REACHED();
@@ -27,22 +27,22 @@ PassRefPtr<JSONValue> toJSONValue(v8::Local<v8::Context> context, v8::Local<v8::
maxDepth--;
if (value->IsNull() || value->IsUndefined())
- return JSONValue::null();
+ return protocol::Value::null();
if (value->IsBoolean())
- return JSONBasicValue::create(value.As<v8::Boolean>()->Value());
+ return protocol::FundamentalValue::create(value.As<v8::Boolean>()->Value());
if (value->IsNumber())
- return JSONBasicValue::create(value.As<v8::Number>()->Value());
+ return protocol::FundamentalValue::create(value.As<v8::Number>()->Value());
if (value->IsString())
- return JSONString::create(coreString(value.As<v8::String>()));
+ return protocol::StringValue::create(coreString(value.As<v8::String>()));
if (value->IsArray()) {
v8::Local<v8::Array> array = value.As<v8::Array>();
- RefPtr<JSONArray> inspectorArray = JSONArray::create();
+ RefPtr<protocol::ListValue> inspectorArray = protocol::ListValue::create();
uint32_t length = array->Length();
for (uint32_t i = 0; i < length; i++) {
v8::Local<v8::Value> value;
if (!array->Get(context, i).ToLocal(&value))
return nullptr;
- RefPtr<JSONValue> element = toJSONValue(context, value, maxDepth);
+ RefPtr<protocol::Value> element = toProtocolValue(context, value, maxDepth);
if (!element)
return nullptr;
inspectorArray->pushValue(element);
@@ -50,7 +50,7 @@ PassRefPtr<JSONValue> toJSONValue(v8::Local<v8::Context> context, v8::Local<v8::
return inspectorArray;
}
if (value->IsObject()) {
- RefPtr<JSONObject> jsonObject = JSONObject::create();
+ RefPtr<protocol::DictionaryValue> jsonObject = protocol::DictionaryValue::create();
v8::Local<v8::Object> object = v8::Local<v8::Object>::Cast(value);
v8::Local<v8::Array> propertyNames;
if (!object->GetPropertyNames(context).ToLocal(&propertyNames))
@@ -72,7 +72,7 @@ PassRefPtr<JSONValue> toJSONValue(v8::Local<v8::Context> context, v8::Local<v8::
v8::Local<v8::Value> property;
if (!object->Get(context, name).ToLocal(&property))
return nullptr;
- RefPtr<JSONValue> propertyValue = toJSONValue(context, property, maxDepth);
+ RefPtr<protocol::Value> propertyValue = toProtocolValue(context, property, maxDepth);
if (!propertyValue)
return nullptr;
jsonObject->setValue(coreString(propertyName), propertyValue);

Powered by Google App Engine
This is Rietveld 408576698