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

Side by Side Diff: net/url_request/url_request_job.h

Issue 2262653003: Make URLRequest::Read to return net errors or bytes read instead of a bool (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 4 years, 3 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
OLDNEW
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 #ifndef NET_URL_REQUEST_URL_REQUEST_JOB_H_ 5 #ifndef NET_URL_REQUEST_URL_REQUEST_JOB_H_
6 #define NET_URL_REQUEST_URL_REQUEST_JOB_H_ 6 #define NET_URL_REQUEST_URL_REQUEST_JOB_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 // this call, nor is it obliged to fail with "canceled" unless not all data 88 // this call, nor is it obliged to fail with "canceled" unless not all data
89 // was sent as a result. A typical case would be where the job is almost 89 // was sent as a result. A typical case would be where the job is almost
90 // complete and can succeed before the canceled notification can be 90 // complete and can succeed before the canceled notification can be
91 // dispatched (from the message loop). 91 // dispatched (from the message loop).
92 // 92 //
93 // The job should be prepared to receive multiple calls to kill it, but only 93 // The job should be prepared to receive multiple calls to kill it, but only
94 // one notification must be issued. 94 // one notification must be issued.
95 virtual void Kill(); 95 virtual void Kill();
96 96
97 // Called to read post-filtered data from this Job, returning the number of 97 // Called to read post-filtered data from this Job, returning the number of
98 // bytes read, 0 when there is no more data, or -1 if there was an error. 98 // bytes read, 0 when there is no more data, or net error if there was an
99 // This is just the backend for URLRequest::Read, see that function for 99 // error. This is just the backend for URLRequest::Read, see that function for
100 // more info. 100 // more info.
101 bool Read(IOBuffer* buf, int buf_size, int* bytes_read); 101 int Read(IOBuffer* buf, int buf_size);
102 102
103 // Stops further caching of this request, if any. For more info, see 103 // Stops further caching of this request, if any. For more info, see
104 // URLRequest::StopCaching(). 104 // URLRequest::StopCaching().
105 virtual void StopCaching(); 105 virtual void StopCaching();
106 106
107 virtual bool GetFullRequestHeaders(HttpRequestHeaders* headers) const; 107 virtual bool GetFullRequestHeaders(HttpRequestHeaders* headers) const;
108 108
109 // Get the number of bytes received from network. The values returned by this 109 // Get the number of bytes received from network. The values returned by this
110 // will never decrease over the lifetime of the URLRequestJob. 110 // will never decrease over the lifetime of the URLRequestJob.
111 virtual int64_t GetTotalReceivedBytes() const; 111 virtual int64_t GetTotalReceivedBytes() const;
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 int64_t last_notified_total_sent_bytes_; 458 int64_t last_notified_total_sent_bytes_;
459 459
460 base::WeakPtrFactory<URLRequestJob> weak_factory_; 460 base::WeakPtrFactory<URLRequestJob> weak_factory_;
461 461
462 DISALLOW_COPY_AND_ASSIGN(URLRequestJob); 462 DISALLOW_COPY_AND_ASSIGN(URLRequestJob);
463 }; 463 };
464 464
465 } // namespace net 465 } // namespace net
466 466
467 #endif // NET_URL_REQUEST_URL_REQUEST_JOB_H_ 467 #endif // NET_URL_REQUEST_URL_REQUEST_JOB_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698