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