| 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 ReadableStreamImpl_h | 5 #ifndef ReadableStreamImpl_h |
| 6 #define ReadableStreamImpl_h | 6 #define ReadableStreamImpl_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/ExceptionState.h" | 8 #include "bindings/core/v8/ExceptionState.h" |
| 9 #include "bindings/core/v8/ScriptState.h" | 9 #include "bindings/core/v8/ScriptState.h" |
| 10 #include "bindings/core/v8/ScriptValue.h" | 10 #include "bindings/core/v8/ScriptValue.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 // ReadableStream pure virtual methods. | 55 // ReadableStream pure virtual methods. |
| 56 template <typename ChunkTypeTraits> | 56 template <typename ChunkTypeTraits> |
| 57 class ReadableStreamImpl : public ReadableStream { | 57 class ReadableStreamImpl : public ReadableStream { |
| 58 public: | 58 public: |
| 59 ReadableStreamImpl(ExecutionContext* executionContext, UnderlyingSource* sou
rce) | 59 ReadableStreamImpl(ExecutionContext* executionContext, UnderlyingSource* sou
rce) |
| 60 : ReadableStream(executionContext, source) | 60 : ReadableStream(executionContext, source) |
| 61 , m_totalQueueSize(0) { } | 61 , m_totalQueueSize(0) { } |
| 62 virtual ~ReadableStreamImpl() { } | 62 virtual ~ReadableStreamImpl() { } |
| 63 | 63 |
| 64 // ReadableStream methods | 64 // ReadableStream methods |
| 65 virtual ScriptValue read(ScriptState*, ExceptionState&) OVERRIDE; | 65 virtual ScriptValue read(ScriptState*, ExceptionState&) override; |
| 66 | 66 |
| 67 bool enqueue(typename ChunkTypeTraits::PassType); | 67 bool enqueue(typename ChunkTypeTraits::PassType); |
| 68 | 68 |
| 69 virtual void trace(Visitor* visitor) OVERRIDE | 69 virtual void trace(Visitor* visitor) override |
| 70 { | 70 { |
| 71 ReadableStream::trace(visitor); | 71 ReadableStream::trace(visitor); |
| 72 } | 72 } |
| 73 | 73 |
| 74 private: | 74 private: |
| 75 // ReadableStream methods | 75 // ReadableStream methods |
| 76 virtual bool isQueueEmpty() const OVERRIDE { return m_queue.isEmpty(); } | 76 virtual bool isQueueEmpty() const override { return m_queue.isEmpty(); } |
| 77 virtual void clearQueue() OVERRIDE | 77 virtual void clearQueue() override |
| 78 { | 78 { |
| 79 m_queue.clear(); | 79 m_queue.clear(); |
| 80 m_totalQueueSize = 0; | 80 m_totalQueueSize = 0; |
| 81 } | 81 } |
| 82 | 82 |
| 83 Deque<typename ChunkTypeTraits::HoldType> m_queue; | 83 Deque<typename ChunkTypeTraits::HoldType> m_queue; |
| 84 size_t m_totalQueueSize; | 84 size_t m_totalQueueSize; |
| 85 }; | 85 }; |
| 86 | 86 |
| 87 template <typename ChunkTypeTraits> | 87 template <typename ChunkTypeTraits> |
| (...skipping 18 matching lines...) Expand all Loading... |
| 106 typename ChunkTypeTraits::HoldType chunk = m_queue.takeFirst(); | 106 typename ChunkTypeTraits::HoldType chunk = m_queue.takeFirst(); |
| 107 m_totalQueueSize -= ChunkTypeTraits::size(chunk); | 107 m_totalQueueSize -= ChunkTypeTraits::size(chunk); |
| 108 readPostAction(); | 108 readPostAction(); |
| 109 return ChunkTypeTraits::toScriptValue(scriptState, chunk); | 109 return ChunkTypeTraits::toScriptValue(scriptState, chunk); |
| 110 } | 110 } |
| 111 | 111 |
| 112 } // namespace blink | 112 } // namespace blink |
| 113 | 113 |
| 114 #endif // ReadableStreamImpl_h | 114 #endif // ReadableStreamImpl_h |
| 115 | 115 |
| OLD | NEW |