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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 // Version 2: Added StringUCharTag for UChar v8 strings. | 62 // Version 2: Added StringUCharTag for UChar v8 strings. |
63 // Version 3: Switched to using uuids as blob data identifiers. | 63 // Version 3: Switched to using uuids as blob data identifiers. |
64 // Version 4: Extended File serialization to be complete. | 64 // Version 4: Extended File serialization to be complete. |
65 // Version 5: Added CryptoKeyTag for Key objects. | 65 // Version 5: Added CryptoKeyTag for Key objects. |
66 // Version 6: Added indexed serialization for File, Blob, and FileList. | 66 // Version 6: Added indexed serialization for File, Blob, and FileList. |
67 // Version 7: Extended File serialization with user visibility. | 67 // Version 7: Extended File serialization with user visibility. |
68 static const uint32_t wireFormatVersion = 7; | 68 static const uint32_t wireFormatVersion = 7; |
69 | 69 |
70 ~SerializedScriptValue(); | 70 ~SerializedScriptValue(); |
71 | 71 |
| 72 // VarInt encoding constants. |
| 73 static const int varIntShift = 7; |
| 74 static const int varIntMask = (1 << varIntShift) - 1; |
| 75 |
72 // If a serialization error occurs (e.g., cyclic input value) this | 76 // If a serialization error occurs (e.g., cyclic input value) this |
73 // function returns an empty representation, schedules a V8 exception to | 77 // function returns an empty representation, schedules a V8 exception to |
74 // be thrown using v8::ThrowException(), and sets |didThrow|. In this case | 78 // be thrown using v8::ThrowException(), and sets |didThrow|. In this case |
75 // the caller must not invoke any V8 operations until control returns to | 79 // the caller must not invoke any V8 operations until control returns to |
76 // V8. When serialization is successful, |didThrow| is false. | 80 // V8. When serialization is successful, |didThrow| is false. |
77 static PassRefPtr<SerializedScriptValue> create(v8::Handle<v8::Value>, Messa
gePortArray*, ArrayBufferArray*, ExceptionState&, v8::Isolate*); | 81 static PassRefPtr<SerializedScriptValue> create(v8::Handle<v8::Value>, Messa
gePortArray*, ArrayBufferArray*, ExceptionState&, v8::Isolate*); |
78 static PassRefPtr<SerializedScriptValue> createFromWire(const String&); | 82 static PassRefPtr<SerializedScriptValue> createFromWire(const String&); |
79 static PassRefPtr<SerializedScriptValue> createFromWireBytes(const Vector<ui
nt8_t>&); | 83 static PassRefPtr<SerializedScriptValue> createFromWireBytes(const Vector<ui
nt8_t>&); |
80 static PassRefPtr<SerializedScriptValue> create(const String&); | 84 static PassRefPtr<SerializedScriptValue> create(const String&); |
81 static PassRefPtr<SerializedScriptValue> create(const String&, v8::Isolate*)
; | 85 static PassRefPtr<SerializedScriptValue> create(const String&, v8::Isolate*)
; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 | 126 |
123 String m_data; | 127 String m_data; |
124 OwnPtr<ArrayBufferContentsArray> m_arrayBufferContentsArray; | 128 OwnPtr<ArrayBufferContentsArray> m_arrayBufferContentsArray; |
125 BlobDataHandleMap m_blobDataHandles; | 129 BlobDataHandleMap m_blobDataHandles; |
126 intptr_t m_externallyAllocatedMemory; | 130 intptr_t m_externallyAllocatedMemory; |
127 }; | 131 }; |
128 | 132 |
129 } // namespace blink | 133 } // namespace blink |
130 | 134 |
131 #endif // SerializedScriptValue_h | 135 #endif // SerializedScriptValue_h |
OLD | NEW |