| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef BodyStreamBuffer_h | 5 #ifndef BodyStreamBuffer_h |
| 6 #define BodyStreamBuffer_h | 6 #define BodyStreamBuffer_h |
| 7 | 7 |
| 8 #include "core/dom/DOMException.h" | 8 #include "core/dom/DOMException.h" |
| 9 #include "modules/ModulesExport.h" | 9 #include "modules/ModulesExport.h" |
| 10 #include "platform/blob/BlobData.h" | 10 #include "platform/blob/BlobData.h" |
| 11 #include "platform/heap/Heap.h" | 11 #include "platform/heap/Heap.h" |
| 12 #include "public/platform/WebDataConsumerHandle.h" |
| 12 #include "wtf/Deque.h" | 13 #include "wtf/Deque.h" |
| 13 #include "wtf/RefPtr.h" | 14 #include "wtf/RefPtr.h" |
| 14 #include "wtf/text/WTFString.h" | 15 #include "wtf/text/WTFString.h" |
| 15 | 16 |
| 16 namespace blink { | 17 namespace blink { |
| 17 | 18 |
| 18 class DOMArrayBuffer; | 19 class DOMArrayBuffer; |
| 19 | 20 |
| 20 class MODULES_EXPORT BodyStreamBuffer final : public GarbageCollectedFinalized<B
odyStreamBuffer> { | 21 class MODULES_EXPORT BodyStreamBuffer final : public GarbageCollectedFinalized<B
odyStreamBuffer> { |
| 21 public: | 22 public: |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 // This function registers an observer so it fails and returns false when an | 65 // This function registers an observer so it fails and returns false when an |
| 65 // observer was already registered. | 66 // observer was already registered. |
| 66 bool startTee(BodyStreamBuffer* out1, BodyStreamBuffer* out2); | 67 bool startTee(BodyStreamBuffer* out1, BodyStreamBuffer* out2); |
| 67 | 68 |
| 68 // When an observer was registered this function fails and returns false. | 69 // When an observer was registered this function fails and returns false. |
| 69 bool registerObserver(Observer*); | 70 bool registerObserver(Observer*); |
| 70 void unregisterObserver(); | 71 void unregisterObserver(); |
| 71 bool isObserverRegistered() const { return m_observer.get(); } | 72 bool isObserverRegistered() const { return m_observer.get(); } |
| 72 DECLARE_TRACE(); | 73 DECLARE_TRACE(); |
| 73 | 74 |
| 75 // Creates a BodyStreamBuffer from |handle| as the source. |
| 76 // On failure, BodyStreamBuffer::error() is called with a NetworkError |
| 77 // with |failureMessage|. |
| 78 static BodyStreamBuffer* create(PassOwnPtr<WebDataConsumerHandle> /* handle
*/, const String& failureMessage); |
| 79 |
| 74 private: | 80 private: |
| 75 Deque<RefPtr<DOMArrayBuffer>> m_queue; | 81 Deque<RefPtr<DOMArrayBuffer>> m_queue; |
| 76 bool m_isClosed; | 82 bool m_isClosed; |
| 77 Member<DOMException> m_exception; | 83 Member<DOMException> m_exception; |
| 78 Member<Observer> m_observer; | 84 Member<Observer> m_observer; |
| 79 Member<Canceller> m_canceller; | 85 Member<Canceller> m_canceller; |
| 80 }; | 86 }; |
| 81 | 87 |
| 82 } // namespace blink | 88 } // namespace blink |
| 83 | 89 |
| 84 #endif // BodyStreamBuffer_h | 90 #endif // BodyStreamBuffer_h |
| OLD | NEW |