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

Side by Side Diff: Source/modules/serviceworkers/Body.h

Issue 562413003: Request construction spec changes to use the 'used' flag. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed method name & step number fixes Created 6 years, 3 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 Body_h 5 #ifndef Body_h
6 #define Body_h 6 #define Body_h
7 7
8 #include "bindings/core/v8/ScriptPromise.h" 8 #include "bindings/core/v8/ScriptPromise.h"
9 #include "bindings/core/v8/ScriptPromiseResolver.h" 9 #include "bindings/core/v8/ScriptPromiseResolver.h"
10 #include "bindings/core/v8/ScriptWrappable.h" 10 #include "bindings/core/v8/ScriptWrappable.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 ScriptPromise text(ScriptState*); 43 ScriptPromise text(ScriptState*);
44 44
45 bool bodyUsed() const; 45 bool bodyUsed() const;
46 46
47 // ActiveDOMObject override. 47 // ActiveDOMObject override.
48 virtual void stop() OVERRIDE; 48 virtual void stop() OVERRIDE;
49 virtual bool hasPendingActivity() const OVERRIDE; 49 virtual bool hasPendingActivity() const OVERRIDE;
50 50
51 virtual void trace(Visitor*) { } 51 virtual void trace(Visitor*) { }
52 52
53 protected:
54 // Sets the bodyUsed flag to true. This signifies that the contents of the
55 // body have been consumed and cannot be accessed again.
56 void setBodyUsed();
57
53 private: 58 private:
54 ScriptPromise readAsync(ScriptState*, ResponseType); 59 ScriptPromise readAsync(ScriptState*, ResponseType);
55 void resolveJSON(); 60 void resolveJSON();
56 61
57 // FileReaderLoaderClient functions. 62 // FileReaderLoaderClient functions.
58 virtual void didStartLoading() OVERRIDE; 63 virtual void didStartLoading() OVERRIDE;
59 virtual void didReceiveData() OVERRIDE; 64 virtual void didReceiveData() OVERRIDE;
60 virtual void didFinishLoading() OVERRIDE; 65 virtual void didFinishLoading() OVERRIDE;
61 virtual void didFail(FileError::ErrorCode) OVERRIDE; 66 virtual void didFail(FileError::ErrorCode) OVERRIDE;
62 67
63 virtual PassRefPtr<BlobDataHandle> blobDataHandle() = 0; 68 virtual PassRefPtr<BlobDataHandle> blobDataHandle() = 0;
64 69
65 OwnPtr<FileReaderLoader> m_loader; 70 OwnPtr<FileReaderLoader> m_loader;
66 bool m_bodyUsed; 71 bool m_bodyUsed;
67 ResponseType m_responseType; 72 ResponseType m_responseType;
68 RefPtr<ScriptPromiseResolver> m_resolver; 73 RefPtr<ScriptPromiseResolver> m_resolver;
69 }; 74 };
70 75
71 } // namespace blink 76 } // namespace blink
72 77
73 #endif // Body_h 78 #endif // Body_h
OLDNEW
« no previous file with comments | « LayoutTests/http/tests/serviceworker/resources/request-worker.js ('k') | Source/modules/serviceworkers/Body.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698