Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1758)

Side by Side Diff: third_party/WebKit/Source/core/streams/ReadableStreamImpl.h

Issue 1878463002: Move DOMArrayBuffer, DOMArrayBufferViews and DataView to the heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tidy Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
(...skipping 29 matching lines...) Expand all
40 static size_t size(const String& chunk) { return chunk.length(); } 40 static size_t size(const String& chunk) { return chunk.length(); }
41 static ScriptValue toScriptValue(ScriptState* scriptState, const HoldType& v alue) 41 static ScriptValue toScriptValue(ScriptState* scriptState, const HoldType& v alue)
42 { 42 {
43 return ScriptValue(scriptState, v8String(scriptState->isolate(), value)) ; 43 return ScriptValue(scriptState, v8String(scriptState->isolate(), value)) ;
44 } 44 }
45 }; 45 };
46 46
47 template<> 47 template<>
48 class ReadableStreamChunkTypeTraits<DOMArrayBuffer> { 48 class ReadableStreamChunkTypeTraits<DOMArrayBuffer> {
49 public: 49 public:
50 typedef RefPtr<DOMArrayBuffer> HoldType; 50 typedef DOMArrayBuffer* HoldType;
51 typedef PassRefPtr<DOMArrayBuffer> PassType; 51 typedef DOMArrayBuffer* PassType;
52 52
53 static size_t size(const PassType& chunk) { return chunk->byteLength(); } 53 static size_t size(const PassType& chunk) { return chunk->byteLength(); }
54 static ScriptValue toScriptValue(ScriptState* scriptState, const HoldType& v alue) 54 static ScriptValue toScriptValue(ScriptState* scriptState, const HoldType& v alue)
55 { 55 {
56 return ScriptValue(scriptState, toV8(value.get(), scriptState->context() ->Global(), scriptState->isolate())); 56 return ScriptValue(scriptState, toV8(value, scriptState->context()->Glob al(), scriptState->isolate()));
57 } 57 }
58 }; 58 };
59 59
60 template<> 60 template<>
61 class ReadableStreamChunkTypeTraits<DOMArrayBufferView> { 61 class ReadableStreamChunkTypeTraits<DOMArrayBufferView> {
62 public: 62 public:
63 typedef RefPtr<DOMArrayBufferView> HoldType; 63 typedef DOMArrayBufferView* HoldType;
64 typedef PassRefPtr<DOMArrayBufferView> PassType; 64 typedef DOMArrayBufferView* PassType;
65 65
66 static size_t size(const PassType& chunk) { return chunk->byteLength(); } 66 static size_t size(const PassType& chunk) { return chunk->byteLength(); }
67 static ScriptValue toScriptValue(ScriptState* scriptState, const HoldType& v alue) 67 static ScriptValue toScriptValue(ScriptState* scriptState, const HoldType& v alue)
68 { 68 {
69 return ScriptValue(scriptState, toV8(value.get(), scriptState->context() ->Global(), scriptState->isolate())); 69 return ScriptValue(scriptState, toV8(value, scriptState->context()->Glob al(), scriptState->isolate()));
70 } 70 }
71 }; 71 };
72 72
73 // ReadableStreamImpl<ChunkTypeTraits> is a ReadableStream subtype. It has a 73 // ReadableStreamImpl<ChunkTypeTraits> is a ReadableStream subtype. It has a
74 // queue whose type depends on ChunkTypeTraits and it implements queue-related 74 // queue whose type depends on ChunkTypeTraits and it implements queue-related
75 // ReadableStream pure virtual methods. 75 // ReadableStream pure virtual methods.
76 template <typename ChunkTypeTraits> 76 template <typename ChunkTypeTraits>
77 class ReadableStreamImpl : public ReadableStream { 77 class ReadableStreamImpl : public ReadableStream {
78 public: 78 public:
79 class Strategy : public GarbageCollectedFinalized<Strategy> { 79 class Strategy : public GarbageCollectedFinalized<Strategy> {
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 226
227 setIsDisturbed(); 227 setIsDisturbed();
228 queue.swap(m_queue); 228 queue.swap(m_queue);
229 m_totalQueueSize = 0; 229 m_totalQueueSize = 0;
230 readInternalPostAction(); 230 readInternalPostAction();
231 } 231 }
232 232
233 } // namespace blink 233 } // namespace blink
234 234
235 #endif // ReadableStreamImpl_h 235 #endif // ReadableStreamImpl_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698