Chromium Code Reviews| 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 8f3d05545ac11b82ed4cfcd06fad8e2c47a0b92c..79003b00cb6bc27e44d082286913549e045972f5 100644 |
| --- a/third_party/WebKit/Source/platform/v8_inspector/InjectedScript.cpp |
| +++ b/third_party/WebKit/Source/platform/v8_inspector/InjectedScript.cpp |
| @@ -54,7 +54,7 @@ using blink::protocol::Maybe; |
| namespace blink { |
| -static PassOwnPtr<protocol::Runtime::ExceptionDetails> toExceptionDetails(PassRefPtr<protocol::DictionaryValue> object) |
| +static PassOwnPtr<protocol::Runtime::ExceptionDetails> toExceptionDetails(protocol::DictionaryValue* object) |
| { |
| String text; |
| if (!object->getString("text", &text)) |
| @@ -73,11 +73,11 @@ static PassOwnPtr<protocol::Runtime::ExceptionDetails> toExceptionDetails(PassRe |
| int originScriptId = 0; |
| object->getNumber("scriptId", &originScriptId); |
| - RefPtr<protocol::ListValue> stackTrace = object->getArray("stackTrace"); |
| + protocol::ListValue* stackTrace = object->getArray("stackTrace"); |
| 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<protocol::DictionaryValue> stackFrame = protocol::DictionaryValue::cast(stackTrace->get(i)); |
| + protocol::DictionaryValue* stackFrame = protocol::DictionaryValue::cast(stackTrace->get(i)); |
| int lineNumber = 0; |
| stackFrame->getNumber("lineNumber", &lineNumber); |
| int column = 0; |
| @@ -176,7 +176,7 @@ void InjectedScript::restartFrame(ErrorString* errorString, v8::Local<v8::Object |
| V8FunctionCall function(m_client, context(), v8Value(), "restartFrame"); |
| function.appendArgument(callFrames); |
| function.appendArgument(callFrameId); |
| - RefPtr<protocol::Value> resultValue; |
| + OwnPtr<protocol::Value> resultValue; |
| makeCall(function, &resultValue); |
| if (resultValue) { |
| if (resultValue->type() == protocol::Value::TypeString) { |
| @@ -196,7 +196,7 @@ void InjectedScript::getStepInPositions(ErrorString* errorString, v8::Local<v8:: |
| V8FunctionCall function(m_client, context(), v8Value(), "getStepInPositions"); |
| function.appendArgument(callFrames); |
| function.appendArgument(callFrameId); |
| - RefPtr<protocol::Value> resultValue; |
| + OwnPtr<protocol::Value> resultValue; |
| makeCall(function, &resultValue); |
| if (resultValue) { |
| if (resultValue->type() == protocol::Value::TypeString) { |
| @@ -205,7 +205,7 @@ void InjectedScript::getStepInPositions(ErrorString* errorString, v8::Local<v8:: |
| } |
| if (resultValue->type() == protocol::Value::TypeArray) { |
| protocol::ErrorSupport errors(errorString); |
| - *positions = Array<protocol::Debugger::Location>::parse(resultValue.release(), &errors); |
| + *positions = Array<protocol::Debugger::Location>::parse(resultValue.get(), &errors); |
| return; |
| } |
| } |
| @@ -236,7 +236,7 @@ void InjectedScript::setVariableValue(ErrorString* errorString, |
| function.appendArgument(scopeNumber); |
| function.appendArgument(variableName); |
| function.appendArgument(newValueStr); |
| - RefPtr<protocol::Value> resultValue; |
| + OwnPtr<protocol::Value> resultValue; |
| makeCall(function, &resultValue); |
| if (!resultValue) { |
| *errorString = "Internal error"; |
| @@ -254,10 +254,10 @@ void InjectedScript::getFunctionDetails(ErrorString* errorString, const String& |
| v8::HandleScope handles(m_isolate); |
| V8FunctionCall function(m_client, context(), v8Value(), "getFunctionDetails"); |
| function.appendArgument(functionId); |
| - RefPtr<protocol::Value> resultValue; |
| + OwnPtr<protocol::Value> resultValue; |
| makeCall(function, &resultValue); |
| protocol::ErrorSupport errors(errorString); |
| - *result = FunctionDetails::parse(resultValue, &errors); |
| + *result = FunctionDetails::parse(resultValue.get(), &errors); |
| } |
| void InjectedScript::getGeneratorObjectDetails(ErrorString* errorString, const String& objectId, OwnPtr<GeneratorObjectDetails>* result) |
| @@ -265,10 +265,10 @@ void InjectedScript::getGeneratorObjectDetails(ErrorString* errorString, const S |
| v8::HandleScope handles(m_isolate); |
| V8FunctionCall function(m_client, context(), v8Value(), "getGeneratorObjectDetails"); |
| function.appendArgument(objectId); |
| - RefPtr<protocol::Value> resultValue; |
| + OwnPtr<protocol::Value> resultValue; |
| makeCall(function, &resultValue); |
| protocol::ErrorSupport errors(errorString); |
| - *result = GeneratorObjectDetails::parse(resultValue, &errors); |
| + *result = GeneratorObjectDetails::parse(resultValue.get(), &errors); |
| } |
| void InjectedScript::getCollectionEntries(ErrorString* errorString, const String& objectId, OwnPtr<Array<CollectionEntry>>* result) |
| @@ -276,10 +276,10 @@ void InjectedScript::getCollectionEntries(ErrorString* errorString, const String |
| v8::HandleScope handles(m_isolate); |
| V8FunctionCall function(m_client, context(), v8Value(), "getCollectionEntries"); |
| function.appendArgument(objectId); |
| - RefPtr<protocol::Value> resultValue; |
| + OwnPtr<protocol::Value> resultValue; |
| makeCall(function, &resultValue); |
| protocol::ErrorSupport errors(errorString); |
| - *result = Array<CollectionEntry>::parse(resultValue, &errors); |
| + *result = Array<CollectionEntry>::parse(resultValue.get(), &errors); |
| } |
| void InjectedScript::getProperties(ErrorString* errorString, const String& objectId, bool ownProperties, bool accessorPropertiesOnly, bool generatePreview, OwnPtr<Array<PropertyDescriptor>>* properties, Maybe<protocol::Runtime::ExceptionDetails>* exceptionDetails) |
| @@ -291,7 +291,7 @@ void InjectedScript::getProperties(ErrorString* errorString, const String& objec |
| function.appendArgument(accessorPropertiesOnly); |
| function.appendArgument(generatePreview); |
| - RefPtr<protocol::Value> result; |
| + OwnPtr<protocol::Value> result; |
| makeCallWithExceptionDetails(function, &result, exceptionDetails); |
| if (exceptionDetails->isJust()) { |
| // FIXME: make properties optional |
| @@ -299,7 +299,7 @@ void InjectedScript::getProperties(ErrorString* errorString, const String& objec |
| return; |
| } |
| protocol::ErrorSupport errors(errorString); |
| - *properties = Array<PropertyDescriptor>::parse(result.release(), &errors); |
| + *properties = Array<PropertyDescriptor>::parse(result.get(), &errors); |
| } |
| void InjectedScript::getInternalProperties(ErrorString* errorString, const String& objectId, Maybe<Array<InternalPropertyDescriptor>>* properties, Maybe<protocol::Runtime::ExceptionDetails>* exceptionDetails) |
| @@ -308,22 +308,22 @@ void InjectedScript::getInternalProperties(ErrorString* errorString, const Strin |
| V8FunctionCall function(m_client, context(), v8Value(), "getInternalProperties"); |
| function.appendArgument(objectId); |
| - RefPtr<protocol::Value> result; |
| + OwnPtr<protocol::Value> result; |
| makeCallWithExceptionDetails(function, &result, exceptionDetails); |
| if (exceptionDetails->isJust()) |
| return; |
| protocol::ErrorSupport errors(errorString); |
| - OwnPtr<Array<InternalPropertyDescriptor>> array = Array<InternalPropertyDescriptor>::parse(result.release(), &errors); |
| + OwnPtr<Array<InternalPropertyDescriptor>> array = Array<InternalPropertyDescriptor>::parse(result.get(), &errors); |
| if (!errors.hasErrors() && array->length() > 0) |
| *properties = array.release(); |
| } |
| void InjectedScript::releaseObject(const String& objectId) |
| { |
| - RefPtr<protocol::Value> parsedObjectId = protocol::parseJSON(objectId); |
| + OwnPtr<protocol::Value> parsedObjectId = protocol::parseJSON(objectId); |
| if (!parsedObjectId) |
| return; |
| - RefPtr<protocol::DictionaryValue> object = protocol::DictionaryValue::cast(parsedObjectId); |
| + protocol::DictionaryValue* object = protocol::DictionaryValue::cast(parsedObjectId.get()); |
| if (!object) |
| return; |
| int boundId = 0; |
| @@ -360,10 +360,10 @@ PassOwnPtr<Array<CallFrame>> InjectedScript::wrapCallFrames(v8::Local<v8::Object |
| bool hadException = false; |
| v8::Local<v8::Value> callFramesValue = callFunctionWithEvalEnabled(function, hadException); |
| ASSERT(!hadException); |
| - RefPtr<protocol::Value> result = toProtocolValue(context(), callFramesValue); |
| + OwnPtr<protocol::Value> result = toProtocolValue(context(), callFramesValue); |
| protocol::ErrorSupport errors; |
| if (result && result->type() == protocol::Value::TypeArray) |
| - return Array<CallFrame>::parse(result.release(), &errors); |
| + return Array<CallFrame>::parse(result.get(), &errors); |
| return Array<CallFrame>::create(); |
| } |
| @@ -380,7 +380,7 @@ PassOwnPtr<protocol::Runtime::RemoteObject> InjectedScript::wrapObject(v8::Local |
| if (hadException) |
| return nullptr; |
| protocol::ErrorSupport errors; |
| - return protocol::Runtime::RemoteObject::parse(toProtocolValue(context(), r), &errors); |
| + return protocol::Runtime::RemoteObject::parse(toProtocolValue(context(), r).get(), &errors); |
| } |
| PassOwnPtr<protocol::Runtime::RemoteObject> InjectedScript::wrapTable(v8::Local<v8::Value> table, v8::Local<v8::Value> columns) const |
| @@ -398,7 +398,7 @@ PassOwnPtr<protocol::Runtime::RemoteObject> InjectedScript::wrapTable(v8::Local< |
| if (hadException) |
| return nullptr; |
| protocol::ErrorSupport errors; |
| - return protocol::Runtime::RemoteObject::parse(toProtocolValue(context(), r), &errors); |
| + return protocol::Runtime::RemoteObject::parse(toProtocolValue(context(), r).get(), &errors); |
| } |
| v8::Local<v8::Value> InjectedScript::findObject(const RemoteObjectId& objectId) const |
| @@ -428,7 +428,7 @@ void InjectedScript::setCustomObjectFormatterEnabled(bool enabled) |
| v8::HandleScope handles(m_isolate); |
| V8FunctionCall function(m_client, context(), v8Value(), "setCustomObjectFormatterEnabled"); |
| function.appendArgument(enabled); |
| - RefPtr<protocol::Value> result; |
| + OwnPtr<protocol::Value> result; |
| makeCall(function, &result); |
| } |
| @@ -464,7 +464,7 @@ v8::Local<v8::Value> InjectedScript::callFunctionWithEvalEnabled(V8FunctionCall& |
| return resultValue; |
| } |
| -void InjectedScript::makeCall(V8FunctionCall& function, RefPtr<protocol::Value>* result) |
| +void InjectedScript::makeCall(V8FunctionCall& function, OwnPtr<protocol::Value>* result) |
|
dgozman
2016/03/01 01:45:06
Returning PassOwnPtr<protocol::Value> would be mor
|
| { |
| if (!canAccessInspectedWindow()) { |
| *result = protocol::StringValue::create("Can not access given context."); |
| @@ -486,7 +486,7 @@ void InjectedScript::makeCall(V8FunctionCall& function, RefPtr<protocol::Value>* |
| void InjectedScript::makeEvalCall(ErrorString* errorString, V8FunctionCall& function, OwnPtr<protocol::Runtime::RemoteObject>* objectResult, Maybe<bool>* wasThrown, Maybe<protocol::Runtime::ExceptionDetails>* exceptionDetails) |
| { |
| - RefPtr<protocol::Value> result; |
| + OwnPtr<protocol::Value> result; |
| makeCall(function, &result); |
| if (!result) { |
| *errorString = "Internal error: result value is empty"; |
| @@ -497,28 +497,28 @@ void InjectedScript::makeEvalCall(ErrorString* errorString, V8FunctionCall& func |
| ASSERT(errorString->length()); |
| return; |
| } |
| - RefPtr<protocol::DictionaryValue> resultPair = protocol::DictionaryValue::cast(result); |
| + protocol::DictionaryValue* resultPair = protocol::DictionaryValue::cast(result.get()); |
| if (!resultPair) { |
| *errorString = "Internal error: result is not an Object"; |
| return; |
| } |
| - RefPtr<protocol::DictionaryValue> resultObj = resultPair->getObject("result"); |
| + protocol::DictionaryValue* resultObj = resultPair->getObject("result"); |
| bool wasThrownVal = false; |
| if (!resultObj || !resultPair->getBoolean("wasThrown", &wasThrownVal)) { |
| *errorString = "Internal error: result is not a pair of value and wasThrown flag"; |
| return; |
| } |
| if (wasThrownVal) { |
| - RefPtr<protocol::DictionaryValue> objectExceptionDetails = resultPair->getObject("exceptionDetails"); |
| + protocol::DictionaryValue* objectExceptionDetails = resultPair->getObject("exceptionDetails"); |
| if (objectExceptionDetails) |
| - *exceptionDetails = toExceptionDetails(objectExceptionDetails.release()); |
| + *exceptionDetails = toExceptionDetails(objectExceptionDetails); |
| } |
| protocol::ErrorSupport errors(errorString); |
| *objectResult = protocol::Runtime::RemoteObject::parse(resultObj, &errors); |
| *wasThrown = wasThrownVal; |
| } |
| -void InjectedScript::makeCallWithExceptionDetails(V8FunctionCall& function, RefPtr<protocol::Value>* result, Maybe<protocol::Runtime::ExceptionDetails>* exceptionDetails) |
| +void InjectedScript::makeCallWithExceptionDetails(V8FunctionCall& function, OwnPtr<protocol::Value>* result, Maybe<protocol::Runtime::ExceptionDetails>* exceptionDetails) |
| { |
| v8::HandleScope handles(m_isolate); |
| v8::Context::Scope scope(context()); |