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

Unified Diff: Source/modules/serviceworkers/Body.h

Issue 786893004: [ServiceWorker] Use BodyStreamBuffer as the body data of the Response object. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/modules/serviceworkers/Body.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/serviceworkers/Body.h
diff --git a/Source/modules/serviceworkers/Body.h b/Source/modules/serviceworkers/Body.h
index dbaa20a7f5ece170a43562a3587dc4ea33919b61..096c45d6037b011c221b299df8f57dae25dbd261 100644
--- a/Source/modules/serviceworkers/Body.h
+++ b/Source/modules/serviceworkers/Body.h
@@ -18,6 +18,7 @@
namespace blink {
+class BodyStreamBuffer;
class ScriptState;
class Body
@@ -50,6 +51,8 @@ public:
void setBodyUsed();
bool bodyUsed() const;
+ bool streamAccessed() const;
+
// ActiveDOMObject override.
virtual void stop() override;
virtual bool hasPendingActivity() const override;
@@ -62,9 +65,12 @@ protected:
private:
class ReadableStreamSource;
+ class BlobHandleReceiver;
+
void pullSource();
void readAllFromStream(ScriptState*);
ScriptPromise readAsync(ScriptState*, ResponseType);
+ void readAsyncFromBlob(PassRefPtr<BlobDataHandle>);
void resolveJSON(const String&);
// FileReaderLoaderClient functions.
@@ -73,7 +79,15 @@ private:
virtual void didFinishLoading() override;
virtual void didFail(FileError::ErrorCode) override;
- virtual PassRefPtr<BlobDataHandle> blobDataHandle() = 0;
+ void didBlobHandleReceiveError(PassRefPtrWillBeRawPtr<DOMException>);
+
+ // We use BlobDataHandle or BodyStreamBuffer as data container of the Body.
+ // BodyStreamBuffer is used only when the Response object is created by
+ // fetch() API.
+ // FIXME: We should seek a cleaner way to handle the data.
+ virtual PassRefPtr<BlobDataHandle> blobDataHandle() const = 0;
+ virtual BodyStreamBuffer* buffer() const = 0;
+ virtual String contentTypeForBuffer() const = 0;
void didFinishLoadingViaStream(DOMArrayBuffer*);
« no previous file with comments | « no previous file | Source/modules/serviceworkers/Body.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698