| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008, 2009, 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2008, 2009, 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 v8::Local<v8::Value> ScriptValue::v8ValueFor(ScriptState* targetScriptState) con
st | 56 v8::Local<v8::Value> ScriptValue::v8ValueFor(ScriptState* targetScriptState) con
st |
| 57 { | 57 { |
| 58 if (isEmpty()) | 58 if (isEmpty()) |
| 59 return v8::Local<v8::Value>(); | 59 return v8::Local<v8::Value>(); |
| 60 v8::Isolate* isolate = targetScriptState->isolate(); | 60 v8::Isolate* isolate = targetScriptState->isolate(); |
| 61 if (&m_scriptState->world() == &targetScriptState->world()) | 61 if (&m_scriptState->world() == &targetScriptState->world()) |
| 62 return m_value->newLocal(isolate); | 62 return m_value->newLocal(isolate); |
| 63 | 63 |
| 64 ASSERT(isolate->InContext()); | 64 ASSERT(isolate->InContext()); |
| 65 v8::Local<v8::Value> value = m_value->newLocal(isolate); | 65 v8::Local<v8::Value> value = m_value->newLocal(isolate); |
| 66 RefPtr<SerializedScriptValue> serialized = SerializedScriptValueFactory::ins
tance().createAndSwallowExceptions(isolate, value); | 66 RefPtr<SerializedScriptValue> serialized = SerializedScriptValue::serializeA
ndSwallowExceptions(isolate, value); |
| 67 return serialized->deserialize(); | 67 return serialized->deserialize(); |
| 68 } | 68 } |
| 69 | 69 |
| 70 bool ScriptValue::toString(String& result) const | 70 bool ScriptValue::toString(String& result) const |
| 71 { | 71 { |
| 72 if (isEmpty()) | 72 if (isEmpty()) |
| 73 return false; | 73 return false; |
| 74 | 74 |
| 75 ScriptState::Scope scope(m_scriptState.get()); | 75 ScriptState::Scope scope(m_scriptState.get()); |
| 76 v8::Local<v8::Value> string = v8Value(); | 76 v8::Local<v8::Value> string = v8Value(); |
| 77 if (string.IsEmpty() || !string->IsString()) | 77 if (string.IsEmpty() || !string->IsString()) |
| 78 return false; | 78 return false; |
| 79 result = toCoreString(v8::Local<v8::String>::Cast(string)); | 79 result = toCoreString(v8::Local<v8::String>::Cast(string)); |
| 80 return true; | 80 return true; |
| 81 } | 81 } |
| 82 | 82 |
| 83 ScriptValue ScriptValue::createNull(ScriptState* scriptState) | 83 ScriptValue ScriptValue::createNull(ScriptState* scriptState) |
| 84 { | 84 { |
| 85 return ScriptValue(scriptState, v8::Null(scriptState->isolate())); | 85 return ScriptValue(scriptState, v8::Null(scriptState->isolate())); |
| 86 } | 86 } |
| 87 | 87 |
| 88 } // namespace blink | 88 } // namespace blink |
| OLD | NEW |