| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008, 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2008, 2009 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 13 matching lines...) Expand all Loading... |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef ScriptValue_h | 31 #ifndef ScriptValue_h |
| 32 #define ScriptValue_h | 32 #define ScriptValue_h |
| 33 | 33 |
| 34 #include "bindings/v8/BlobInfo.h" |
| 34 #include "bindings/v8/ScriptState.h" | 35 #include "bindings/v8/ScriptState.h" |
| 35 #include "bindings/v8/SharedPersistent.h" | 36 #include "bindings/v8/SharedPersistent.h" |
| 36 #include <v8.h> | 37 #include <v8.h> |
| 37 #include "wtf/PassRefPtr.h" | 38 #include "wtf/PassRefPtr.h" |
| 38 #include "wtf/RefPtr.h" | 39 #include "wtf/RefPtr.h" |
| 39 #include "wtf/Vector.h" | 40 #include "wtf/Vector.h" |
| 40 #include "wtf/text/WTFString.h" | 41 #include "wtf/text/WTFString.h" |
| 41 | 42 |
| 42 #ifndef NDEBUG | 43 #ifndef NDEBUG |
| 43 #include "bindings/v8/V8GCController.h" | 44 #include "bindings/v8/V8GCController.h" |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 return !value.IsEmpty() && value->IsObject(); | 136 return !value.IsEmpty() && value->IsObject(); |
| 136 } | 137 } |
| 137 | 138 |
| 138 bool hasNoValue() const | 139 bool hasNoValue() const |
| 139 { | 140 { |
| 140 return !m_value.get() || m_value->isEmpty(); | 141 return !m_value.get() || m_value->isEmpty(); |
| 141 } | 142 } |
| 142 | 143 |
| 143 PassRefPtr<SerializedScriptValue> serialize(ScriptState*); | 144 PassRefPtr<SerializedScriptValue> serialize(ScriptState*); |
| 144 PassRefPtr<SerializedScriptValue> serialize(ScriptState*, MessagePortArray*,
ArrayBufferArray*, bool&); | 145 PassRefPtr<SerializedScriptValue> serialize(ScriptState*, MessagePortArray*,
ArrayBufferArray*, bool&); |
| 146 PassRefPtr<SerializedScriptValue> serialize(ScriptState*, Vector<BlobInfo>*,
bool&); |
| 145 static ScriptValue deserialize(ScriptState*, SerializedScriptValue*); | 147 static ScriptValue deserialize(ScriptState*, SerializedScriptValue*); |
| 146 | 148 |
| 147 void clear() | 149 void clear() |
| 148 { | 150 { |
| 149 m_value = 0; | 151 m_value = 0; |
| 150 } | 152 } |
| 151 | 153 |
| 152 v8::Handle<v8::Value> v8Value() const | 154 v8::Handle<v8::Value> v8Value() const |
| 153 { | 155 { |
| 154 return m_value.get() ? m_value->newLocal(v8::Isolate::GetCurrent()) : v8
::Handle<v8::Value>(); | 156 return m_value.get() ? m_value->newLocal(v8::Isolate::GetCurrent()) : v8
::Handle<v8::Value>(); |
| 155 } | 157 } |
| 156 | 158 |
| 157 bool getString(ScriptState* scriptState, String& result) const { return getS
tring(result, scriptState->isolate()); } | 159 bool getString(ScriptState* scriptState, String& result) const { return getS
tring(result, scriptState->isolate()); } |
| 158 bool getString(String& result) const { return getString(result, v8::Isolate:
:GetCurrent()); } | 160 bool getString(String& result) const { return getString(result, v8::Isolate:
:GetCurrent()); } |
| 159 bool getString(String& result, v8::Isolate*) const; | 161 bool getString(String& result, v8::Isolate*) const; |
| 160 String toString(ScriptState*) const; | 162 String toString(ScriptState*) const; |
| 161 | 163 |
| 162 PassRefPtr<JSONValue> toJSONValue(ScriptState*) const; | 164 PassRefPtr<JSONValue> toJSONValue(ScriptState*) const; |
| 163 | 165 |
| 164 private: | 166 private: |
| 165 RefPtr<SharedPersistent<v8::Value> > m_value; | 167 RefPtr<SharedPersistent<v8::Value> > m_value; |
| 166 }; | 168 }; |
| 167 | 169 |
| 168 } // namespace WebCore | 170 } // namespace WebCore |
| 169 | 171 |
| 170 #endif // ScriptValue_h | 172 #endif // ScriptValue_h |
| OLD | NEW |