OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 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 1576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1587 return startObjectState(jsObject, next); | 1587 return startObjectState(jsObject, next); |
1588 } else { | 1588 } else { |
1589 return handleError(DataCloneError, "A value could not be cloned.", n
ext); | 1589 return handleError(DataCloneError, "A value could not be cloned.", n
ext); |
1590 } | 1590 } |
1591 } | 1591 } |
1592 return 0; | 1592 return 0; |
1593 } | 1593 } |
1594 | 1594 |
1595 // Interface used by Reader to create objects of composite types. | 1595 // Interface used by Reader to create objects of composite types. |
1596 class CompositeCreator { | 1596 class CompositeCreator { |
| 1597 STACK_ALLOCATED(); |
1597 public: | 1598 public: |
1598 virtual ~CompositeCreator() { } | 1599 virtual ~CompositeCreator() { } |
1599 | 1600 |
1600 virtual bool consumeTopOfStack(v8::Handle<v8::Value>*) = 0; | 1601 virtual bool consumeTopOfStack(v8::Handle<v8::Value>*) = 0; |
1601 virtual uint32_t objectReferenceCount() = 0; | 1602 virtual uint32_t objectReferenceCount() = 0; |
1602 virtual void pushObjectReference(const v8::Handle<v8::Value>&) = 0; | 1603 virtual void pushObjectReference(const v8::Handle<v8::Value>&) = 0; |
1603 virtual bool tryGetObjectFromObjectReference(uint32_t reference, v8::Handle<
v8::Value>*) = 0; | 1604 virtual bool tryGetObjectFromObjectReference(uint32_t reference, v8::Handle<
v8::Value>*) = 0; |
1604 virtual bool tryGetTransferredMessagePort(uint32_t index, v8::Handle<v8::Val
ue>*) = 0; | 1605 virtual bool tryGetTransferredMessagePort(uint32_t index, v8::Handle<v8::Val
ue>*) = 0; |
1605 virtual bool tryGetTransferredArrayBuffer(uint32_t index, v8::Handle<v8::Val
ue>*) = 0; | 1606 virtual bool tryGetTransferredArrayBuffer(uint32_t index, v8::Handle<v8::Val
ue>*) = 0; |
1606 virtual bool newSparseArray(uint32_t length) = 0; | 1607 virtual bool newSparseArray(uint32_t length) = 0; |
(...skipping 1166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2773 if (objectReference >= m_objectPool.size()) | 2774 if (objectReference >= m_objectPool.size()) |
2774 return false; | 2775 return false; |
2775 *object = m_objectPool[objectReference]; | 2776 *object = m_objectPool[objectReference]; |
2776 return true; | 2777 return true; |
2777 } | 2778 } |
2778 | 2779 |
2779 Reader& m_reader; | 2780 Reader& m_reader; |
2780 Vector<v8::Local<v8::Value> > m_stack; | 2781 Vector<v8::Local<v8::Value> > m_stack; |
2781 Vector<v8::Handle<v8::Value> > m_objectPool; | 2782 Vector<v8::Handle<v8::Value> > m_objectPool; |
2782 Vector<uint32_t> m_openCompositeReferenceStack; | 2783 Vector<uint32_t> m_openCompositeReferenceStack; |
2783 MessagePortArray* m_transferredMessagePorts; | 2784 RawPtrWillBeMember<MessagePortArray> m_transferredMessagePorts; |
2784 ArrayBufferContentsArray* m_arrayBufferContents; | 2785 ArrayBufferContentsArray* m_arrayBufferContents; |
2785 Vector<v8::Handle<v8::Object> > m_arrayBuffers; | 2786 Vector<v8::Handle<v8::Object> > m_arrayBuffers; |
2786 uint32_t m_version; | 2787 uint32_t m_version; |
2787 }; | 2788 }; |
2788 | 2789 |
2789 } // namespace | 2790 } // namespace |
2790 | 2791 |
2791 PassRefPtr<SerializedScriptValue> SerializedScriptValue::create(v8::Handle<v8::V
alue> value, MessagePortArray* messagePorts, ArrayBufferArray* arrayBuffers, Exc
eptionState& exceptionState, v8::Isolate* isolate) | 2792 PassRefPtr<SerializedScriptValue> SerializedScriptValue::create(v8::Handle<v8::V
alue> value, MessagePortArray* messagePorts, ArrayBufferArray* arrayBuffers, Exc
eptionState& exceptionState, v8::Isolate* isolate) |
2792 { | 2793 { |
2793 return adoptRef(new SerializedScriptValue(value, messagePorts, arrayBuffers,
0, exceptionState, isolate)); | 2794 return adoptRef(new SerializedScriptValue(value, messagePorts, arrayBuffers,
0, exceptionState, isolate)); |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3055 // If the allocated memory was not registered before, then this class is lik
ely | 3056 // If the allocated memory was not registered before, then this class is lik
ely |
3056 // used in a context other then Worker's onmessage environment and the prese
nce of | 3057 // used in a context other then Worker's onmessage environment and the prese
nce of |
3057 // current v8 context is not guaranteed. Avoid calling v8 then. | 3058 // current v8 context is not guaranteed. Avoid calling v8 then. |
3058 if (m_externallyAllocatedMemory) { | 3059 if (m_externallyAllocatedMemory) { |
3059 ASSERT(v8::Isolate::GetCurrent()); | 3060 ASSERT(v8::Isolate::GetCurrent()); |
3060 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(-m_exte
rnallyAllocatedMemory); | 3061 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(-m_exte
rnallyAllocatedMemory); |
3061 } | 3062 } |
3062 } | 3063 } |
3063 | 3064 |
3064 } // namespace WebCore | 3065 } // namespace WebCore |
OLD | NEW |