| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 // ResourceDispatcher when the both following conditions hold: | 44 // ResourceDispatcher when the both following conditions hold: |
| 45 // 1) This function has been called and the completion status is set, and | 45 // 1) This function has been called and the completion status is set, and |
| 46 // 2) All data is read from the handle. | 46 // 2) All data is read from the handle. |
| 47 void OnComplete(const ResourceRequestCompletionStatus& status); | 47 void OnComplete(const ResourceRequestCompletionStatus& status); |
| 48 | 48 |
| 49 // Cancels watching the handle and dispatches an error to the | 49 // Cancels watching the handle and dispatches an error to the |
| 50 // ResourceDispatcher. This function does nothing if the reading is already | 50 // ResourceDispatcher. This function does nothing if the reading is already |
| 51 // cancelled or done. | 51 // cancelled or done. |
| 52 void Cancel(); | 52 void Cancel(); |
| 53 | 53 |
| 54 void SetDefersLoading(); |
| 55 void UnsetDefersLoading(); |
| 56 |
| 54 private: | 57 private: |
| 55 friend class base::RefCounted<URLResponseBodyConsumer>; | 58 friend class base::RefCounted<URLResponseBodyConsumer>; |
| 56 ~URLResponseBodyConsumer(); | 59 ~URLResponseBodyConsumer(); |
| 57 | 60 |
| 58 class ReceivedData; | 61 class ReceivedData; |
| 59 void Reclaim(uint32_t size); | 62 void Reclaim(uint32_t size); |
| 60 | 63 |
| 61 void OnReadable(MojoResult unused); | 64 void OnReadable(MojoResult unused); |
| 62 void NotifyCompletionIfAppropriate(); | 65 void NotifyCompletionIfAppropriate(); |
| 63 | 66 |
| 64 const int request_id_; | 67 const int request_id_; |
| 65 ResourceDispatcher* resource_dispatcher_; | 68 ResourceDispatcher* resource_dispatcher_; |
| 66 mojo::ScopedDataPipeConsumerHandle handle_; | 69 mojo::ScopedDataPipeConsumerHandle handle_; |
| 67 mojo::Watcher handle_watcher_; | 70 mojo::Watcher handle_watcher_; |
| 68 ResourceRequestCompletionStatus completion_status_; | 71 ResourceRequestCompletionStatus completion_status_; |
| 69 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 72 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 70 | 73 |
| 71 bool has_received_completion_ = false; | 74 bool has_received_completion_ = false; |
| 72 bool has_been_cancelled_ = false; | 75 bool has_been_cancelled_ = false; |
| 73 bool has_seen_end_of_data_; | 76 bool has_seen_end_of_data_; |
| 77 bool is_deferred_ = false; |
| 74 bool is_in_on_readable_ = false; | 78 bool is_in_on_readable_ = false; |
| 75 | 79 |
| 76 DISALLOW_COPY_AND_ASSIGN(URLResponseBodyConsumer); | 80 DISALLOW_COPY_AND_ASSIGN(URLResponseBodyConsumer); |
| 77 }; | 81 }; |
| 78 | 82 |
| 79 } // namespace content | 83 } // namespace content |
| 80 | 84 |
| 81 #endif // CONTENT_CHILD_URL_RESPONSE_BODY_CONSUMER_H_ | 85 #endif // CONTENT_CHILD_URL_RESPONSE_BODY_CONSUMER_H_ |
| OLD | NEW |