Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(103)

Side by Side Diff: content/child/url_response_body_consumer.h

Issue 2573743002: Handle MOJO_RESULT_BUSY result in URLResponseBodyConsumer (Closed)
Patch Set: fix Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/child/resource_dispatcher.cc ('k') | content/child/url_response_body_consumer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 20 matching lines...) Expand all
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. 40 // Starts watching the handle.
41 void Start(base::SingleThreadTaskRunner* task_runner); 41 void Start();
42 42
43 // Sets the completion status. The completion status is dispatched to the 43 // Sets the completion status. The completion status is dispatched to the
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 private: 54 private:
55 friend class base::RefCounted<URLResponseBodyConsumer>; 55 friend class base::RefCounted<URLResponseBodyConsumer>;
56 ~URLResponseBodyConsumer(); 56 ~URLResponseBodyConsumer();
57 57
58 class ReceivedData; 58 class ReceivedData;
59 void Reclaim(uint32_t size); 59 void Reclaim(uint32_t size);
60 60
61 void OnReadable(MojoResult unused); 61 void OnReadable(MojoResult unused);
62 void NotifyCompletionIfAppropriate(); 62 void NotifyCompletionIfAppropriate();
63 63
64 const int request_id_; 64 const int request_id_;
65 ResourceDispatcher* resource_dispatcher_; 65 ResourceDispatcher* resource_dispatcher_;
66 mojo::ScopedDataPipeConsumerHandle handle_; 66 mojo::ScopedDataPipeConsumerHandle handle_;
67 mojo::Watcher handle_watcher_; 67 mojo::Watcher handle_watcher_;
68 ResourceRequestCompletionStatus completion_status_; 68 ResourceRequestCompletionStatus completion_status_;
69 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
69 70
70 bool has_received_completion_ = false; 71 bool has_received_completion_ = false;
71 bool has_been_cancelled_ = false; 72 bool has_been_cancelled_ = false;
72 bool has_seen_end_of_data_; 73 bool has_seen_end_of_data_;
74 bool is_in_on_readable_ = false;
73 75
74 DISALLOW_COPY_AND_ASSIGN(URLResponseBodyConsumer); 76 DISALLOW_COPY_AND_ASSIGN(URLResponseBodyConsumer);
75 }; 77 };
76 78
77 } // namespace content 79 } // namespace content
78 80
79 #endif // CONTENT_CHILD_URL_RESPONSE_BODY_CONSUMER_H_ 81 #endif // CONTENT_CHILD_URL_RESPONSE_BODY_CONSUMER_H_
OLDNEW
« no previous file with comments | « content/child/resource_dispatcher.cc ('k') | content/child/url_response_body_consumer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698