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/ActiveScriptWrappable.h" | 8 #include "bindings/core/v8/ActiveScriptWrappable.h" |
9 #include "bindings/core/v8/ScriptPromise.h" | 9 #include "bindings/core/v8/ScriptPromise.h" |
10 #include "bindings/core/v8/ScriptValue.h" | 10 #include "bindings/core/v8/ScriptValue.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 class ScriptState; | 22 class ScriptState; |
23 | 23 |
24 // This class represents Body mix-in defined in the fetch spec | 24 // This class represents Body mix-in defined in the fetch spec |
25 // https://fetch.spec.whatwg.org/#body-mixin. | 25 // https://fetch.spec.whatwg.org/#body-mixin. |
26 // | 26 // |
27 // Note: This class has body stream and its predicate whereas in the current | 27 // Note: This class has body stream and its predicate whereas in the current |
28 // spec only Response has it and Request has a byte stream defined in the | 28 // spec only Response has it and Request has a byte stream defined in the |
29 // Encoding spec. The spec should be fixed shortly to be aligned with this | 29 // Encoding spec. The spec should be fixed shortly to be aligned with this |
30 // implementation. | 30 // implementation. |
31 class MODULES_EXPORT Body | 31 class MODULES_EXPORT Body |
32 : public GarbageCollectedFinalized<Body> | 32 : public GarbageCollected<Body> |
33 , public ScriptWrappable | 33 , public ScriptWrappable |
34 , public ActiveScriptWrappable | 34 , public ActiveScriptWrappable |
35 , public ContextLifecycleObserver { | 35 , public ContextLifecycleObserver { |
36 WTF_MAKE_NONCOPYABLE(Body); | 36 WTF_MAKE_NONCOPYABLE(Body); |
37 DEFINE_WRAPPERTYPEINFO(); | 37 DEFINE_WRAPPERTYPEINFO(); |
38 USING_GARBAGE_COLLECTED_MIXIN(Body); | 38 USING_GARBAGE_COLLECTED_MIXIN(Body); |
39 public: | 39 public: |
40 explicit Body(ExecutionContext*); | 40 explicit Body(ExecutionContext*); |
41 ~Body() override { } | |
42 | 41 |
43 ScriptPromise arrayBuffer(ScriptState*); | 42 ScriptPromise arrayBuffer(ScriptState*); |
44 ScriptPromise blob(ScriptState*); | 43 ScriptPromise blob(ScriptState*); |
45 ScriptPromise formData(ScriptState*); | 44 ScriptPromise formData(ScriptState*); |
46 ScriptPromise json(ScriptState*); | 45 ScriptPromise json(ScriptState*); |
47 ScriptPromise text(ScriptState*); | 46 ScriptPromise text(ScriptState*); |
48 ScriptValue bodyWithUseCounter(ScriptState*); | 47 ScriptValue bodyWithUseCounter(ScriptState*); |
49 virtual BodyStreamBuffer* bodyBuffer() = 0; | 48 virtual BodyStreamBuffer* bodyBuffer() = 0; |
50 virtual const BodyStreamBuffer* bodyBuffer() const = 0; | 49 virtual const BodyStreamBuffer* bodyBuffer() const = 0; |
51 | 50 |
(...skipping 14 matching lines...) Expand all Loading... |
66 // Body consumption algorithms will reject with a TypeError in a number of | 65 // Body consumption algorithms will reject with a TypeError in a number of |
67 // error conditions. This method wraps those up into one call which returns | 66 // error conditions. This method wraps those up into one call which returns |
68 // an empty ScriptPromise if the consumption may proceed, and a | 67 // an empty ScriptPromise if the consumption may proceed, and a |
69 // ScriptPromise rejected with a TypeError if it ought to be blocked. | 68 // ScriptPromise rejected with a TypeError if it ought to be blocked. |
70 ScriptPromise rejectInvalidConsumption(ScriptState*); | 69 ScriptPromise rejectInvalidConsumption(ScriptState*); |
71 }; | 70 }; |
72 | 71 |
73 } // namespace blink | 72 } // namespace blink |
74 | 73 |
75 #endif // Body_h | 74 #endif // Body_h |
OLD | NEW |