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

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

Issue 2644053002: [Mojo-Loading] Split too large data chunk in renderer (Closed)
Patch Set: fix Created 3 years, 11 months 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 | « no previous file | 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 void OnComplete(const ResourceRequestCompletionStatus& status); 44 void OnComplete(const ResourceRequestCompletionStatus& status);
45 45
46 // Cancels watching the handle and dispatches an error to the 46 // Cancels watching the handle and dispatches an error to the
47 // ResourceDispatcher. This function does nothing if the reading is already 47 // ResourceDispatcher. This function does nothing if the reading is already
48 // cancelled or done. 48 // cancelled or done.
49 void Cancel(); 49 void Cancel();
50 50
51 void SetDefersLoading(); 51 void SetDefersLoading();
52 void UnsetDefersLoading(); 52 void UnsetDefersLoading();
53 53
54 // The maximal number of bytes consumed in a task. When there are more bytes
55 // in the data pipe, they will be consumed in following tasks. Setting a too
56 // small number will generate ton of tasks but setting a too large number will
57 // lead to thread janks. Also, some clients cannot handle too large chunks
58 // (512k for example).
59 static constexpr uint32_t kMaxNumConsumedBytesInTask = 64 * 1024;
60
54 private: 61 private:
55 friend class base::RefCounted<URLResponseBodyConsumer>; 62 friend class base::RefCounted<URLResponseBodyConsumer>;
56 ~URLResponseBodyConsumer(); 63 ~URLResponseBodyConsumer();
57 64
58 class ReceivedData; 65 class ReceivedData;
59 void Reclaim(uint32_t size); 66 void Reclaim(uint32_t size);
60 67
61 void OnReadable(MojoResult unused); 68 void OnReadable(MojoResult unused);
62 void NotifyCompletionIfAppropriate(); 69 void NotifyCompletionIfAppropriate();
63 70
64 const int request_id_; 71 const int request_id_;
65 ResourceDispatcher* resource_dispatcher_; 72 ResourceDispatcher* resource_dispatcher_;
66 mojo::ScopedDataPipeConsumerHandle handle_; 73 mojo::ScopedDataPipeConsumerHandle handle_;
67 mojo::Watcher handle_watcher_; 74 mojo::Watcher handle_watcher_;
68 ResourceRequestCompletionStatus completion_status_; 75 ResourceRequestCompletionStatus completion_status_;
69 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 76 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
70 77
71 bool has_received_completion_ = false; 78 bool has_received_completion_ = false;
72 bool has_been_cancelled_ = false; 79 bool has_been_cancelled_ = false;
73 bool has_seen_end_of_data_; 80 bool has_seen_end_of_data_;
74 bool is_deferred_ = false; 81 bool is_deferred_ = false;
75 bool is_in_on_readable_ = false; 82 bool is_in_on_readable_ = false;
76 83
77 DISALLOW_COPY_AND_ASSIGN(URLResponseBodyConsumer); 84 DISALLOW_COPY_AND_ASSIGN(URLResponseBodyConsumer);
78 }; 85 };
79 86
80 } // namespace content 87 } // namespace content
81 88
82 #endif // CONTENT_CHILD_URL_RESPONSE_BODY_CONSUMER_H_ 89 #endif // CONTENT_CHILD_URL_RESPONSE_BODY_CONSUMER_H_
OLDNEW
« no previous file with comments | « no previous file | content/child/url_response_body_consumer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698