OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // This is the browser side of the resource dispatcher, it receives requests | 5 // This is the browser side of the resource dispatcher, it receives requests |
6 // from the RenderProcessHosts, and dispatches them to URLRequests. It then | 6 // from the RenderProcessHosts, and dispatches them to URLRequests. It then |
7 // fowards the messages from the URLRequests back to the correct process for | 7 // fowards the messages from the URLRequests back to the correct process for |
8 // handling. | 8 // handling. |
9 // | 9 // |
10 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading | 10 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
103 // OnReadCompleted is called, the buffer may be recycled. Otherwise, it may | 103 // OnReadCompleted is called, the buffer may be recycled. Otherwise, it may |
104 // not be recycled and may potentially outlive the handler. | 104 // not be recycled and may potentially outlive the handler. |
105 // | 105 // |
106 // Unlike other methods, may be called synchronously on Resume, for | 106 // Unlike other methods, may be called synchronously on Resume, for |
107 // performance reasons. | 107 // performance reasons. |
108 // | 108 // |
109 // If the handler returns false, then the request is cancelled. Otherwise, | 109 // If the handler returns false, then the request is cancelled. Otherwise, |
110 // once data is available, OnReadCompleted will be called. | 110 // once data is available, OnReadCompleted will be called. |
111 // TODO(mmenke): Make this method use a ResourceController, and allow it to | 111 // TODO(mmenke): Make this method use a ResourceController, and allow it to |
112 // succeed asynchronously. | 112 // succeed asynchronously. |
113 virtual bool OnWillRead(scoped_refptr<net::IOBuffer>* buf, | 113 virtual void OnWillRead(scoped_refptr<net::IOBuffer>* buf, |
Charlie Harrison
2017/02/16 21:25:04
Please update the comment.
mmenke
2017/03/08 19:16:07
Done.
| |
114 int* buf_size) = 0; | 114 int* buf_size, |
115 std::unique_ptr<ResourceController> controller) = 0; | |
115 | 116 |
116 // Data (*bytes_read bytes) was written into the buffer provided by | 117 // Data (*bytes_read bytes) was written into the buffer provided by |
117 // OnWillRead. The request will not continue until one of |controller|'s | 118 // OnWillRead. The request will not continue until one of |controller|'s |
118 // resume or cancellation methods is invoked. A zero |bytes_read| signals | 119 // resume or cancellation methods is invoked. A zero |bytes_read| signals |
119 // that no further data will be received. | 120 // that no further data will be received. |
120 virtual void OnReadCompleted( | 121 virtual void OnReadCompleted( |
121 int bytes_read, | 122 int bytes_read, |
122 std::unique_ptr<ResourceController> controller) = 0; | 123 std::unique_ptr<ResourceController> controller) = 0; |
123 | 124 |
124 // The response is complete. The final response status is given. The request | 125 // The response is complete. The final response status is given. The request |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
176 net::URLRequest* request_; | 177 net::URLRequest* request_; |
177 Delegate* delegate_; | 178 Delegate* delegate_; |
178 std::unique_ptr<ResourceController> controller_; | 179 std::unique_ptr<ResourceController> controller_; |
179 | 180 |
180 DISALLOW_COPY_AND_ASSIGN(ResourceHandler); | 181 DISALLOW_COPY_AND_ASSIGN(ResourceHandler); |
181 }; | 182 }; |
182 | 183 |
183 } // namespace content | 184 } // namespace content |
184 | 185 |
185 #endif // CONTENT_BROWSER_LOADER_RESOURCE_HANDLER_H_ | 186 #endif // CONTENT_BROWSER_LOADER_RESOURCE_HANDLER_H_ |
OLD | NEW |