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/ScriptPromise.h" | 9 #include "bindings/core/v8/ScriptPromise.h" |
10 #include "bindings/core/v8/ScriptPromiseResolver.h" | 10 #include "bindings/core/v8/ScriptPromiseResolver.h" |
11 #include "bindings/core/v8/ScriptState.h" | 11 #include "bindings/core/v8/ScriptState.h" |
12 #include "bindings/core/v8/ScriptValue.h" | 12 #include "bindings/core/v8/ScriptValue.h" |
13 #include "bindings/core/v8/V8ArrayBuffer.h" | 13 #include "bindings/core/v8/V8ArrayBuffer.h" |
14 #include "bindings/core/v8/V8Binding.h" | 14 #include "bindings/core/v8/V8Binding.h" |
15 #include "bindings/core/v8/V8IteratorResultValue.h" | 15 #include "bindings/core/v8/V8IteratorResultValue.h" |
16 #include "core/dom/DOMArrayBuffer.h" | 16 #include "core/dom/DOMArrayBuffer.h" |
17 #include "core/dom/DOMArrayBufferView.h" | 17 #include "core/dom/DOMArrayBufferView.h" |
18 #include "core/dom/DOMException.h" | 18 #include "core/dom/DOMException.h" |
19 #include "core/streams/ReadableStream.h" | 19 #include "core/streams/ReadableStream.h" |
20 #include "wtf/Deque.h" | 20 #include "wtf/Deque.h" |
21 #include "wtf/RefPtr.h" | 21 #include "wtf/RefPtr.h" |
22 #include "wtf/text/WTFString.h" | 22 #include "wtf/text/WTFString.h" |
23 #include <utility> | 23 #include <utility> |
24 | 24 |
25 namespace blink { | 25 namespace blink { |
26 | 26 |
27 // We define the default ChunkTypeTraits for frequently used types. | 27 // We define the default ChunkTypeTraits for frequently used types. |
28 template<typename ChunkType> | 28 template<typename ChunkType> |
29 class ReadableStreamChunkTypeTraits { }; | 29 class ReadableStreamChunkTypeTraits { |
| 30 STATIC_ONLY(ReadableStreamChunkTypeTraits); |
| 31 }; |
30 | 32 |
31 template<> | 33 template<> |
32 class ReadableStreamChunkTypeTraits<String> { | 34 class ReadableStreamChunkTypeTraits<String> { |
33 public: | 35 public: |
34 typedef String HoldType; | 36 typedef String HoldType; |
35 typedef const String& PassType; | 37 typedef const String& PassType; |
36 | 38 |
37 static size_t size(const String& chunk) { return chunk.length(); } | 39 static size_t size(const String& chunk) { return chunk.length(); } |
38 static ScriptValue toScriptValue(ScriptState* scriptState, const HoldType& v
alue) | 40 static ScriptValue toScriptValue(ScriptState* scriptState, const HoldType& v
alue) |
39 { | 41 { |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 ASSERT(queue.isEmpty()); | 218 ASSERT(queue.isEmpty()); |
217 | 219 |
218 queue.swap(m_queue); | 220 queue.swap(m_queue); |
219 m_totalQueueSize = 0; | 221 m_totalQueueSize = 0; |
220 readInternalPostAction(); | 222 readInternalPostAction(); |
221 } | 223 } |
222 | 224 |
223 } // namespace blink | 225 } // namespace blink |
224 | 226 |
225 #endif // ReadableStreamImpl_h | 227 #endif // ReadableStreamImpl_h |
OLD | NEW |