| 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 |
| 11 #include <utility> | 11 #include <utility> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
| 17 #include "base/single_thread_task_runner.h" | 17 #include "base/single_thread_task_runner.h" |
| 18 #include "content/common/content_export.h" | 18 #include "content/common/content_export.h" |
| 19 #include "content/common/url_loader.mojom.h" | 19 #include "content/common/url_loader.mojom.h" |
| 20 #include "mojo/public/cpp/system/data_pipe.h" | 20 #include "mojo/public/cpp/system/data_pipe.h" |
| 21 #include "mojo/public/cpp/system/simple_watcher.h" | 21 #include "mojo/public/cpp/system/watcher.h" |
| 22 | 22 |
| 23 namespace content { | 23 namespace content { |
| 24 | 24 |
| 25 class ResourceDispatcher; | 25 class ResourceDispatcher; |
| 26 struct ResourceRequestCompletionStatus; | 26 struct ResourceRequestCompletionStatus; |
| 27 | 27 |
| 28 // This class pulls data from a data pipe and dispatches it to the | 28 // This class pulls data from a data pipe and dispatches it to the |
| 29 // ResourceDispatcher. This class is used only for mojo-enabled requests. | 29 // ResourceDispatcher. This class is used only for mojo-enabled requests. |
| 30 class CONTENT_EXPORT URLResponseBodyConsumer final | 30 class CONTENT_EXPORT URLResponseBodyConsumer final |
| 31 : public base::RefCounted<URLResponseBodyConsumer>, | 31 : public base::RefCounted<URLResponseBodyConsumer>, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 | 64 |
| 65 class ReceivedData; | 65 class ReceivedData; |
| 66 void Reclaim(uint32_t size); | 66 void Reclaim(uint32_t size); |
| 67 | 67 |
| 68 void OnReadable(MojoResult unused); | 68 void OnReadable(MojoResult unused); |
| 69 void NotifyCompletionIfAppropriate(); | 69 void NotifyCompletionIfAppropriate(); |
| 70 | 70 |
| 71 const int request_id_; | 71 const int request_id_; |
| 72 ResourceDispatcher* resource_dispatcher_; | 72 ResourceDispatcher* resource_dispatcher_; |
| 73 mojo::ScopedDataPipeConsumerHandle handle_; | 73 mojo::ScopedDataPipeConsumerHandle handle_; |
| 74 mojo::SimpleWatcher handle_watcher_; | 74 mojo::Watcher handle_watcher_; |
| 75 ResourceRequestCompletionStatus completion_status_; | 75 ResourceRequestCompletionStatus completion_status_; |
| 76 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 76 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 77 | 77 |
| 78 bool has_received_completion_ = false; | 78 bool has_received_completion_ = false; |
| 79 bool has_been_cancelled_ = false; | 79 bool has_been_cancelled_ = false; |
| 80 bool has_seen_end_of_data_; | 80 bool has_seen_end_of_data_; |
| 81 bool is_deferred_ = false; | 81 bool is_deferred_ = false; |
| 82 bool is_in_on_readable_ = false; | 82 bool is_in_on_readable_ = false; |
| 83 | 83 |
| 84 DISALLOW_COPY_AND_ASSIGN(URLResponseBodyConsumer); | 84 DISALLOW_COPY_AND_ASSIGN(URLResponseBodyConsumer); |
| 85 }; | 85 }; |
| 86 | 86 |
| 87 } // namespace content | 87 } // namespace content |
| 88 | 88 |
| 89 #endif // CONTENT_CHILD_URL_RESPONSE_BODY_CONSUMER_H_ | 89 #endif // CONTENT_CHILD_URL_RESPONSE_BODY_CONSUMER_H_ |
| OLD | NEW |