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

Unified Diff: third_party/WebKit/Source/platform/v8_inspector/InjectedScript.cpp

Issue 1728873002: DevTools: simplify JSONValues API, prepare to the OwnPtr migration. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebaselines 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/InjectedScript.cpp
diff --git a/third_party/WebKit/Source/platform/v8_inspector/InjectedScript.cpp b/third_party/WebKit/Source/platform/v8_inspector/InjectedScript.cpp
index 5a287f695778500b959f043c7204208acbabf550..b94a541f442a1f2c5be78d3789daf3256d8a121f 100644
--- a/third_party/WebKit/Source/platform/v8_inspector/InjectedScript.cpp
+++ b/third_party/WebKit/Source/platform/v8_inspector/InjectedScript.cpp
@@ -77,7 +77,7 @@ static PassOwnPtr<protocol::Runtime::ExceptionDetails> toExceptionDetails(PassRe
if (stackTrace && stackTrace->length() > 0) {
OwnPtr<protocol::Array<protocol::Runtime::CallFrame>> frames = protocol::Array<protocol::Runtime::CallFrame>::create();
for (unsigned i = 0; i < stackTrace->length(); ++i) {
- RefPtr<JSONObject> stackFrame = stackTrace->get(i)->asObject();
+ RefPtr<JSONObject> stackFrame = JSONObject::cast(stackTrace->get(i));
int lineNumber = 0;
stackFrame->getNumber("lineNumber", &lineNumber);
int column = 0;
@@ -204,7 +204,7 @@ void InjectedScript::getStepInPositions(ErrorString* errorString, v8::Local<v8::
return;
}
if (resultValue->type() == JSONValue::TypeArray) {
- *positions = Array<protocol::Debugger::Location>::runtimeCast(resultValue->asArray());
+ *positions = Array<protocol::Debugger::Location>::runtimeCast(resultValue.release());
return;
}
}
@@ -260,7 +260,7 @@ void InjectedScript::getFunctionDetails(ErrorString* errorString, const String&
*errorString = "Internal error";
return;
}
- *result = FunctionDetails::runtimeCast(resultValue->asObject());
+ *result = FunctionDetails::runtimeCast(resultValue);
}
void InjectedScript::getGeneratorObjectDetails(ErrorString* errorString, const String& objectId, OwnPtr<GeneratorObjectDetails>* result)
@@ -275,7 +275,7 @@ void InjectedScript::getGeneratorObjectDetails(ErrorString* errorString, const S
*errorString = "Internal error";
return;
}
- *result = GeneratorObjectDetails::runtimeCast(resultValue->asObject());
+ *result = GeneratorObjectDetails::runtimeCast(resultValue);
}
void InjectedScript::getCollectionEntries(ErrorString* errorString, const String& objectId, OwnPtr<Array<CollectionEntry>>* result)
@@ -290,7 +290,7 @@ void InjectedScript::getCollectionEntries(ErrorString* errorString, const String
*errorString = "Internal error";
return;
}
- *result = Array<CollectionEntry>::runtimeCast(resultValue->asArray());
+ *result = Array<CollectionEntry>::runtimeCast(resultValue.release());
}
void InjectedScript::getProperties(ErrorString* errorString, const String& objectId, bool ownProperties, bool accessorPropertiesOnly, bool generatePreview, OwnPtr<Array<PropertyDescriptor>>* properties, Maybe<protocol::Runtime::ExceptionDetails>* exceptionDetails)
@@ -313,7 +313,7 @@ void InjectedScript::getProperties(ErrorString* errorString, const String& objec
*errorString = "Internal error";
return;
}
- *properties = Array<PropertyDescriptor>::runtimeCast(result->asArray());
+ *properties = Array<PropertyDescriptor>::runtimeCast(result.release());
}
void InjectedScript::getInternalProperties(ErrorString* errorString, const String& objectId, Maybe<Array<InternalPropertyDescriptor>>* properties, Maybe<protocol::Runtime::ExceptionDetails>* exceptionDetails)
@@ -330,7 +330,7 @@ void InjectedScript::getInternalProperties(ErrorString* errorString, const Strin
*errorString = "Internal error";
return;
}
- OwnPtr<Array<InternalPropertyDescriptor>> array = Array<InternalPropertyDescriptor>::runtimeCast(result->asArray());
+ OwnPtr<Array<InternalPropertyDescriptor>> array = Array<InternalPropertyDescriptor>::runtimeCast(result.release());
if (array->length() > 0)
*properties = array.release();
}
@@ -340,8 +340,8 @@ void InjectedScript::releaseObject(const String& objectId)
RefPtr<JSONValue> parsedObjectId = parseJSON(objectId);
if (!parsedObjectId)
return;
- RefPtr<JSONObject> object;
- if (!parsedObjectId->asObject(&object))
+ RefPtr<JSONObject> object = JSONObject::cast(parsedObjectId);
+ if (!object)
return;
int boundId = 0;
if (!object->getNumber("id", &boundId))
@@ -379,7 +379,7 @@ PassOwnPtr<Array<CallFrame>> InjectedScript::wrapCallFrames(v8::Local<v8::Object
ASSERT(!hadException);
RefPtr<JSONValue> result = toJSONValue(context(), callFramesValue);
if (result && result->type() == JSONValue::TypeArray)
- return Array<CallFrame>::runtimeCast(result->asArray());
+ return Array<CallFrame>::runtimeCast(result.release());
return Array<CallFrame>::create();
}
@@ -395,8 +395,7 @@ PassOwnPtr<protocol::Runtime::RemoteObject> InjectedScript::wrapObject(v8::Local
v8::Local<v8::Value> r = callFunctionWithEvalEnabled(function, hadException);
if (hadException)
return nullptr;
- RefPtr<JSONObject> rawResult = toJSONValue(context(), r)->asObject();
- return protocol::Runtime::RemoteObject::runtimeCast(rawResult);
+ return protocol::Runtime::RemoteObject::runtimeCast(toJSONValue(context(), r));
}
PassOwnPtr<protocol::Runtime::RemoteObject> InjectedScript::wrapTable(v8::Local<v8::Value> table, v8::Local<v8::Value> columns) const
@@ -413,8 +412,7 @@ PassOwnPtr<protocol::Runtime::RemoteObject> InjectedScript::wrapTable(v8::Local<
v8::Local<v8::Value> r = callFunctionWithEvalEnabled(function, hadException);
if (hadException)
return nullptr;
- RefPtr<JSONObject> rawResult = toJSONValue(context(), r)->asObject();
- return protocol::Runtime::RemoteObject::runtimeCast(rawResult);
+ return protocol::Runtime::RemoteObject::runtimeCast(toJSONValue(context(), r));
}
v8::Local<v8::Value> InjectedScript::findObject(const RemoteObjectId& objectId) const
@@ -513,7 +511,7 @@ void InjectedScript::makeEvalCall(ErrorString* errorString, V8FunctionCall& func
ASSERT(errorString->length());
return;
}
- RefPtr<JSONObject> resultPair = result->asObject();
+ RefPtr<JSONObject> resultPair = JSONObject::cast(result);
if (!resultPair) {
*errorString = "Internal error: result is not an Object";
return;

Powered by Google App Engine
This is Rietveld 408576698