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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 static PassRefPtr<SerializedScriptValue> nullValue(); | 84 static PassRefPtr<SerializedScriptValue> nullValue(); |
85 | 85 |
86 String toWireString() const { return m_data; } | 86 String toWireString() const { return m_data; } |
87 void toWireBytes(Vector<char>&) const; | 87 void toWireBytes(Vector<char>&) const; |
88 | 88 |
89 // Deserializes the value (in the current context). Returns a null value in | 89 // Deserializes the value (in the current context). Returns a null value in |
90 // case of failure. | 90 // case of failure. |
91 v8::Handle<v8::Value> deserialize(MessagePortArray* = 0); | 91 v8::Handle<v8::Value> deserialize(MessagePortArray* = 0); |
92 v8::Handle<v8::Value> deserialize(v8::Isolate*, MessagePortArray* = 0); | 92 v8::Handle<v8::Value> deserialize(v8::Isolate*, MessagePortArray* = 0); |
93 | 93 |
| 94 // Helper function which pulls the values out of a JS sequence and into a Me
ssagePortArray. |
| 95 // Also validates the elements per sections 4.1.13 and 4.1.15 of the WebIDL
spec and section 8.3.3 |
| 96 // of the HTML5 spec and generates exceptions as appropriate. |
| 97 // Returns true if the array was filled, or false if the passed value was no
t of an appropriate type. |
| 98 static bool extractTransferables(v8::Local<v8::Value>, int, MessagePortArray
&, ArrayBufferArray&, ExceptionState&, v8::Isolate*); |
| 99 |
94 // Only reflects the truth if the SSV was created by walking a v8 value, not
reliable | 100 // Only reflects the truth if the SSV was created by walking a v8 value, not
reliable |
95 // if the SSV was created createdFromWire(data). | 101 // if the SSV was created createdFromWire(data). |
96 bool containsBlobs() const { return !m_blobDataHandles.isEmpty(); } | 102 bool containsBlobs() const { return !m_blobDataHandles.isEmpty(); } |
97 | 103 |
98 // Informs the V8 about external memory allocated and owned by this object.
Large values should contribute | 104 // Informs the V8 about external memory allocated and owned by this object.
Large values should contribute |
99 // to GC counters to eventually trigger a GC, otherwise flood of postMessage
() can cause OOM. | 105 // to GC counters to eventually trigger a GC, otherwise flood of postMessage
() can cause OOM. |
100 // Ok to invoke multiple times (only adds memory once). | 106 // Ok to invoke multiple times (only adds memory once). |
101 // The memory registration is revoked automatically in destructor. | 107 // The memory registration is revoked automatically in destructor. |
102 void registerMemoryAllocatedWithCurrentScriptContext(); | 108 void registerMemoryAllocatedWithCurrentScriptContext(); |
103 | 109 |
(...skipping 12 matching lines...) Expand all Loading... |
116 | 122 |
117 String m_data; | 123 String m_data; |
118 OwnPtr<ArrayBufferContentsArray> m_arrayBufferContentsArray; | 124 OwnPtr<ArrayBufferContentsArray> m_arrayBufferContentsArray; |
119 BlobDataHandleMap m_blobDataHandles; | 125 BlobDataHandleMap m_blobDataHandles; |
120 intptr_t m_externallyAllocatedMemory; | 126 intptr_t m_externallyAllocatedMemory; |
121 }; | 127 }; |
122 | 128 |
123 } // namespace WebCore | 129 } // namespace WebCore |
124 | 130 |
125 #endif // SerializedScriptValue_h | 131 #endif // SerializedScriptValue_h |
OLD | NEW |