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 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 Loading... | |
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 setUsed(); | |
horo
2014/09/12 04:55:56
setBodyUsed()
dmurph
2014/09/12 18:40:07
Done.
| |
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 |
OLD | NEW |