OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009, 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2009, 2010 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 // case of failure. | 97 // case of failure. |
98 v8::Handle<v8::Value> deserialize(MessagePortArray* = 0); | 98 v8::Handle<v8::Value> deserialize(MessagePortArray* = 0); |
99 v8::Handle<v8::Value> deserialize(v8::Isolate*, MessagePortArray* = 0, const
WebBlobInfoArray* = 0); | 99 v8::Handle<v8::Value> deserialize(v8::Isolate*, MessagePortArray* = 0, const
WebBlobInfoArray* = 0); |
100 | 100 |
101 // Helper function which pulls the values out of a JS sequence and into a Me
ssagePortArray. | 101 // Helper function which pulls the values out of a JS sequence and into a Me
ssagePortArray. |
102 // Also validates the elements per sections 4.1.13 and 4.1.15 of the WebIDL
spec and section 8.3.3 | 102 // Also validates the elements per sections 4.1.13 and 4.1.15 of the WebIDL
spec and section 8.3.3 |
103 // of the HTML5 spec and generates exceptions as appropriate. | 103 // of the HTML5 spec and generates exceptions as appropriate. |
104 // Returns true if the array was filled, or false if the passed value was no
t of an appropriate type. | 104 // Returns true if the array was filled, or false if the passed value was no
t of an appropriate type. |
105 static bool extractTransferables(v8::Local<v8::Value>, int, MessagePortArray
&, ArrayBufferArray&, ExceptionState&, v8::Isolate*); | 105 static bool extractTransferables(v8::Local<v8::Value>, int, MessagePortArray
&, ArrayBufferArray&, ExceptionState&, v8::Isolate*); |
106 | 106 |
107 // Only reflects the truth if the SSV was created by walking a v8 value, not
reliable | |
108 // if the SSV was created createdFromWire(data). | |
109 bool containsBlobs() const { return !m_blobDataHandles.isEmpty(); } | |
110 | |
111 // Informs the V8 about external memory allocated and owned by this object.
Large values should contribute | 107 // Informs the V8 about external memory allocated and owned by this object.
Large values should contribute |
112 // to GC counters to eventually trigger a GC, otherwise flood of postMessage
() can cause OOM. | 108 // to GC counters to eventually trigger a GC, otherwise flood of postMessage
() can cause OOM. |
113 // Ok to invoke multiple times (only adds memory once). | 109 // Ok to invoke multiple times (only adds memory once). |
114 // The memory registration is revoked automatically in destructor. | 110 // The memory registration is revoked automatically in destructor. |
115 void registerMemoryAllocatedWithCurrentScriptContext(); | 111 void registerMemoryAllocatedWithCurrentScriptContext(); |
116 | 112 |
117 private: | 113 private: |
118 enum StringDataMode { | 114 enum StringDataMode { |
119 StringValue, | 115 StringValue, |
120 WireData | 116 WireData |
121 }; | 117 }; |
122 typedef Vector<WTF::ArrayBufferContents, 1> ArrayBufferContentsArray; | 118 typedef Vector<WTF::ArrayBufferContents, 1> ArrayBufferContentsArray; |
123 | 119 |
124 SerializedScriptValue(); | 120 SerializedScriptValue(); |
125 SerializedScriptValue(v8::Handle<v8::Value>, MessagePortArray*, ArrayBufferA
rray*, WebBlobInfoArray*, ExceptionState&, v8::Isolate*); | 121 SerializedScriptValue(v8::Handle<v8::Value>, MessagePortArray*, ArrayBufferA
rray*, WebBlobInfoArray*, ExceptionState&, v8::Isolate*); |
126 explicit SerializedScriptValue(const String& wireData); | 122 explicit SerializedScriptValue(const String& wireData); |
127 | 123 |
128 static PassOwnPtr<ArrayBufferContentsArray> transferArrayBuffers(ArrayBuffer
Array&, ExceptionState&, v8::Isolate*); | 124 static PassOwnPtr<ArrayBufferContentsArray> transferArrayBuffers(ArrayBuffer
Array&, ExceptionState&, v8::Isolate*); |
129 | 125 |
130 String m_data; | 126 String m_data; |
131 OwnPtr<ArrayBufferContentsArray> m_arrayBufferContentsArray; | 127 OwnPtr<ArrayBufferContentsArray> m_arrayBufferContentsArray; |
132 BlobDataHandleMap m_blobDataHandles; | 128 BlobDataHandleMap m_blobDataHandles; |
133 intptr_t m_externallyAllocatedMemory; | 129 intptr_t m_externallyAllocatedMemory; |
134 }; | 130 }; |
135 | 131 |
136 } // namespace WebCore | 132 } // namespace WebCore |
137 | 133 |
138 #endif // SerializedScriptValue_h | 134 #endif // SerializedScriptValue_h |
OLD | NEW |