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

Side by Side Diff: third_party/WebKit/Source/modules/fetch/BodyStreamBuffer.cpp

Issue 2567913002: Rename ActiveDOMObject to SuspendableObject (Closed)
Patch Set: Created 4 years 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 #include "modules/fetch/BodyStreamBuffer.h" 5 #include "modules/fetch/BodyStreamBuffer.h"
6 6
7 #include "bindings/core/v8/ScriptState.h" 7 #include "bindings/core/v8/ScriptState.h"
8 #include "bindings/core/v8/V8HiddenValue.h" 8 #include "bindings/core/v8/V8HiddenValue.h"
9 #include "bindings/core/v8/V8ThrowException.h" 9 #include "bindings/core/v8/V8ThrowException.h"
10 #include "core/dom/DOMArrayBuffer.h" 10 #include "core/dom/DOMArrayBuffer.h"
11 #include "core/dom/DOMTypedArray.h" 11 #include "core/dom/DOMTypedArray.h"
12 #include "core/dom/ExceptionCode.h" 12 #include "core/dom/ExceptionCode.h"
13 #include "core/streams/ReadableStreamController.h" 13 #include "core/streams/ReadableStreamController.h"
14 #include "core/streams/ReadableStreamOperations.h" 14 #include "core/streams/ReadableStreamOperations.h"
15 #include "modules/fetch/Body.h" 15 #include "modules/fetch/Body.h"
16 #include "modules/fetch/ReadableStreamBytesConsumer.h" 16 #include "modules/fetch/ReadableStreamBytesConsumer.h"
17 #include "platform/blob/BlobData.h" 17 #include "platform/blob/BlobData.h"
18 #include "platform/network/EncodedFormData.h" 18 #include "platform/network/EncodedFormData.h"
19 #include <memory> 19 #include <memory>
20 20
21 namespace blink { 21 namespace blink {
22 22
23 class BodyStreamBuffer::LoaderClient final 23 class BodyStreamBuffer::LoaderClient final
24 : public GarbageCollectedFinalized<LoaderClient>, 24 : public GarbageCollectedFinalized<LoaderClient>,
25 public ActiveDOMObject, 25 public SuspendableObject,
26 public FetchDataLoader::Client { 26 public FetchDataLoader::Client {
27 WTF_MAKE_NONCOPYABLE(LoaderClient); 27 WTF_MAKE_NONCOPYABLE(LoaderClient);
28 USING_GARBAGE_COLLECTED_MIXIN(LoaderClient); 28 USING_GARBAGE_COLLECTED_MIXIN(LoaderClient);
29 29
30 public: 30 public:
31 LoaderClient(ExecutionContext* executionContext, 31 LoaderClient(ExecutionContext* executionContext,
32 BodyStreamBuffer* buffer, 32 BodyStreamBuffer* buffer,
33 FetchDataLoader::Client* client) 33 FetchDataLoader::Client* client)
34 : ActiveDOMObject(executionContext), m_buffer(buffer), m_client(client) { 34 : SuspendableObject(executionContext),
35 m_buffer(buffer),
36 m_client(client) {
35 suspendIfNeeded(); 37 suspendIfNeeded();
36 } 38 }
37 39
38 void didFetchDataLoadedBlobHandle( 40 void didFetchDataLoadedBlobHandle(
39 PassRefPtr<BlobDataHandle> blobDataHandle) override { 41 PassRefPtr<BlobDataHandle> blobDataHandle) override {
40 m_buffer->endLoading(); 42 m_buffer->endLoading();
41 m_client->didFetchDataLoadedBlobHandle(std::move(blobDataHandle)); 43 m_client->didFetchDataLoadedBlobHandle(std::move(blobDataHandle));
42 } 44 }
43 45
44 void didFetchDataLoadedArrayBuffer(DOMArrayBuffer* arrayBuffer) override { 46 void didFetchDataLoadedArrayBuffer(DOMArrayBuffer* arrayBuffer) override {
(...skipping 12 matching lines...) Expand all
57 } 59 }
58 60
59 void didFetchDataLoadFailed() override { 61 void didFetchDataLoadFailed() override {
60 m_buffer->endLoading(); 62 m_buffer->endLoading();
61 m_client->didFetchDataLoadFailed(); 63 m_client->didFetchDataLoadFailed();
62 } 64 }
63 65
64 DEFINE_INLINE_TRACE() { 66 DEFINE_INLINE_TRACE() {
65 visitor->trace(m_buffer); 67 visitor->trace(m_buffer);
66 visitor->trace(m_client); 68 visitor->trace(m_client);
67 ActiveDOMObject::trace(visitor); 69 SuspendableObject::trace(visitor);
68 FetchDataLoader::Client::trace(visitor); 70 FetchDataLoader::Client::trace(visitor);
69 } 71 }
70 72
71 private: 73 private:
72 void contextDestroyed() override { m_buffer->stopLoading(); } 74 void contextDestroyed() override { m_buffer->stopLoading(); }
73 75
74 Member<BodyStreamBuffer> m_buffer; 76 Member<BodyStreamBuffer> m_buffer;
75 Member<FetchDataLoader::Client> m_client; 77 Member<FetchDataLoader::Client> m_client;
76 }; 78 };
77 79
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 } 386 }
385 if (isErrored) 387 if (isErrored)
386 return BytesConsumer::createErrored(BytesConsumer::Error("error")); 388 return BytesConsumer::createErrored(BytesConsumer::Error("error"));
387 389
388 DCHECK(consumer); 390 DCHECK(consumer);
389 consumer->clearClient(); 391 consumer->clearClient();
390 return consumer; 392 return consumer;
391 } 393 }
392 394
393 } // namespace blink 395 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698