OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 CONTENT_CHILD_URL_RESPONSE_BODY_CONSUMER_H_ | 5 #ifndef CONTENT_CHILD_URL_RESPONSE_BODY_CONSUMER_H_ |
6 #define CONTENT_CHILD_URL_RESPONSE_BODY_CONSUMER_H_ | 6 #define CONTENT_CHILD_URL_RESPONSE_BODY_CONSUMER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 19 matching lines...) Expand all Loading... |
30 class CONTENT_EXPORT URLResponseBodyConsumer final | 30 class CONTENT_EXPORT URLResponseBodyConsumer final |
31 : public base::RefCounted<URLResponseBodyConsumer>, | 31 : public base::RefCounted<URLResponseBodyConsumer>, |
32 public base::SupportsWeakPtr<URLResponseBodyConsumer> { | 32 public base::SupportsWeakPtr<URLResponseBodyConsumer> { |
33 public: | 33 public: |
34 URLResponseBodyConsumer( | 34 URLResponseBodyConsumer( |
35 int request_id, | 35 int request_id, |
36 ResourceDispatcher* resource_dispatcher, | 36 ResourceDispatcher* resource_dispatcher, |
37 mojo::ScopedDataPipeConsumerHandle handle, | 37 mojo::ScopedDataPipeConsumerHandle handle, |
38 scoped_refptr<base::SingleThreadTaskRunner> task_runner); | 38 scoped_refptr<base::SingleThreadTaskRunner> task_runner); |
39 | 39 |
40 // Starts watching the handle. | |
41 void Start(); | |
42 | |
43 // Sets the completion status. The completion status is dispatched to the | 40 // Sets the completion status. The completion status is dispatched to the |
44 // ResourceDispatcher when the both following conditions hold: | 41 // ResourceDispatcher when the both following conditions hold: |
45 // 1) This function has been called and the completion status is set, and | 42 // 1) This function has been called and the completion status is set, and |
46 // 2) All data is read from the handle. | 43 // 2) All data is read from the handle. |
47 void OnComplete(const ResourceRequestCompletionStatus& status); | 44 void OnComplete(const ResourceRequestCompletionStatus& status); |
48 | 45 |
49 // Cancels watching the handle and dispatches an error to the | 46 // Cancels watching the handle and dispatches an error to the |
50 // ResourceDispatcher. This function does nothing if the reading is already | 47 // ResourceDispatcher. This function does nothing if the reading is already |
51 // cancelled or done. | 48 // cancelled or done. |
52 void Cancel(); | 49 void Cancel(); |
(...skipping 23 matching lines...) Expand all Loading... |
76 bool has_seen_end_of_data_; | 73 bool has_seen_end_of_data_; |
77 bool is_deferred_ = false; | 74 bool is_deferred_ = false; |
78 bool is_in_on_readable_ = false; | 75 bool is_in_on_readable_ = false; |
79 | 76 |
80 DISALLOW_COPY_AND_ASSIGN(URLResponseBodyConsumer); | 77 DISALLOW_COPY_AND_ASSIGN(URLResponseBodyConsumer); |
81 }; | 78 }; |
82 | 79 |
83 } // namespace content | 80 } // namespace content |
84 | 81 |
85 #endif // CONTENT_CHILD_URL_RESPONSE_BODY_CONSUMER_H_ | 82 #endif // CONTENT_CHILD_URL_RESPONSE_BODY_CONSUMER_H_ |
OLD | NEW |