| Index: Source/bindings/dart/DartScriptValue.cpp
|
| diff --git a/Source/bindings/dart/DartScriptValue.cpp b/Source/bindings/dart/DartScriptValue.cpp
|
| index 8ca68007886ca34e69c277861bfcb166b8bae37d..bca059d7345416065a5523be437197f9a0587126 100644
|
| --- a/Source/bindings/dart/DartScriptValue.cpp
|
| +++ b/Source/bindings/dart/DartScriptValue.cpp
|
| @@ -1,5 +1,5 @@
|
| /*
|
| - * Copyright (C) 2012 Google Inc. All rights reserved.
|
| + * Copyright (C) 2014 Google Inc. All rights reserved.
|
| *
|
| * Redistribution and use in source and binary forms, with or without
|
| * modification, are permitted provided that the following conditions are
|
| @@ -27,26 +27,54 @@
|
| * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| */
|
| +
|
| #include "config.h"
|
| #include "bindings/dart/DartScriptValue.h"
|
|
|
| -#include "bindings/dart/DartDOMData.h"
|
| #include "bindings/dart/DartUtilities.h"
|
| +#include "bindings/dart/V8Converter.h"
|
| +#include "platform/JSONValues.h"
|
|
|
| namespace WebCore {
|
|
|
| -DartScriptValue::DartScriptValue(Dart_Handle value)
|
| +DartScriptValue::~DartScriptValue()
|
| {
|
| - m_value = Dart_NewPersistentHandle(value);
|
| }
|
|
|
| -DartScriptValue::~DartScriptValue()
|
| +// FIXMEDART: Renamed toString in M36.
|
| +bool DartScriptValue::getString(String& result) const
|
| {
|
| - if (!isIsolateAlive())
|
| - return;
|
| + if (hasNoValue())
|
| + return false;
|
| +
|
| + Dart_Handle exception = 0;
|
| + DartStringAdapter string = DartUtilities::dartToString(m_value, exception);
|
| + if (exception)
|
| + return false;
|
| + result = string;
|
| + return true;
|
| +}
|
|
|
| - DartIsolateScope scope(isolate());
|
| - Dart_DeletePersistentHandle(m_value);
|
| +// FIXMEDART: Removed in M36.
|
| +String DartScriptValue::toString() const
|
| +{
|
| + String result;
|
| + if (!getString(result))
|
| + return String();
|
| + return result;
|
| }
|
|
|
| +// FIXMEDART: Implement without conversion to v8.
|
| +PassRefPtr<JSONValue> DartScriptValue::toJSONValue(ScriptState* scriptState) const
|
| +{
|
| + Dart_Handle exception = 0;
|
| + v8::Handle<v8::Value> v8Value = V8Converter::toV8(m_value, exception);
|
| + if (exception) {
|
| + ASSERT_NOT_REACHED();
|
| + return nullptr;
|
| + }
|
| + ScriptValue v8ScriptValue(v8Value, scriptState->isolate());
|
| + return v8ScriptValue.toJSONValue(scriptState);
|
| }
|
| +
|
| +} // namespace WebCore
|
|
|