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

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

Issue 266243004: Clang format slam. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
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 <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 22 matching lines...) Expand all
33 class IOBuffer; 33 class IOBuffer;
34 struct LoadTimingInfo; 34 struct LoadTimingInfo;
35 class NetworkDelegate; 35 class NetworkDelegate;
36 class SSLCertRequestInfo; 36 class SSLCertRequestInfo;
37 class SSLInfo; 37 class SSLInfo;
38 class URLRequest; 38 class URLRequest;
39 class UploadDataStream; 39 class UploadDataStream;
40 class URLRequestStatus; 40 class URLRequestStatus;
41 class X509Certificate; 41 class X509Certificate;
42 42
43 class NET_EXPORT URLRequestJob 43 class NET_EXPORT URLRequestJob : public base::RefCounted<URLRequestJob>,
44 : public base::RefCounted<URLRequestJob>, 44 public base::PowerObserver {
45 public base::PowerObserver {
46 public: 45 public:
47 explicit URLRequestJob(URLRequest* request, 46 explicit URLRequestJob(URLRequest* request,
48 NetworkDelegate* network_delegate); 47 NetworkDelegate* network_delegate);
49 48
50 // Returns the request that owns this job. THIS POINTER MAY BE NULL if the 49 // Returns the request that owns this job. THIS POINTER MAY BE NULL if the
51 // request was destroyed. 50 // request was destroyed.
52 URLRequest* request() const { 51 URLRequest* request() const { return request_; }
53 return request_;
54 }
55 52
56 // Sets the upload data, most requests have no upload data, so this is a NOP. 53 // Sets the upload data, most requests have no upload data, so this is a NOP.
57 // Job types supporting upload data will override this. 54 // Job types supporting upload data will override this.
58 virtual void SetUpload(UploadDataStream* upload_data_stream); 55 virtual void SetUpload(UploadDataStream* upload_data_stream);
59 56
60 // Sets extra request headers for Job types that support request 57 // Sets extra request headers for Job types that support request
61 // headers. Called once before Start() is called. 58 // headers. Called once before Start() is called.
62 virtual void SetExtraRequestHeaders(const HttpRequestHeaders& headers); 59 virtual void SetExtraRequestHeaders(const HttpRequestHeaders& headers);
63 60
64 // Sets the priority of the job. Called once before Start() is 61 // Sets the priority of the job. Called once before Start() is
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 // Called to read raw (pre-filtered) data from this Job. 284 // Called to read raw (pre-filtered) data from this Job.
288 // If returning true, data was read from the job. buf will contain 285 // If returning true, data was read from the job. buf will contain
289 // the data, and bytes_read will receive the number of bytes read. 286 // the data, and bytes_read will receive the number of bytes read.
290 // If returning true, and bytes_read is returned as 0, there is no 287 // If returning true, and bytes_read is returned as 0, there is no
291 // additional data to be read. 288 // additional data to be read.
292 // If returning false, an error occurred or an async IO is now pending. 289 // If returning false, an error occurred or an async IO is now pending.
293 // If async IO is pending, the status of the request will be 290 // If async IO is pending, the status of the request will be
294 // URLRequestStatus::IO_PENDING, and buf must remain available until the 291 // URLRequestStatus::IO_PENDING, and buf must remain available until the
295 // operation is completed. See comments on URLRequest::Read for more 292 // operation is completed. See comments on URLRequest::Read for more
296 // info. 293 // info.
297 virtual bool ReadRawData(IOBuffer* buf, int buf_size, int *bytes_read); 294 virtual bool ReadRawData(IOBuffer* buf, int buf_size, int* bytes_read);
298 295
299 // Called to tell the job that a filter has successfully reached the end of 296 // Called to tell the job that a filter has successfully reached the end of
300 // the stream. 297 // the stream.
301 virtual void DoneReading(); 298 virtual void DoneReading();
302 299
303 // Called to tell the job that the body won't be read because it's a redirect. 300 // Called to tell the job that the body won't be read because it's a redirect.
304 // This is needed so that redirect headers can be cached even though their 301 // This is needed so that redirect headers can be cached even though their
305 // bodies are never read. 302 // bodies are never read.
306 virtual void DoneReadingRedirectResponse(); 303 virtual void DoneReadingRedirectResponse();
307 304
308 // Informs the filter that data has been read into its buffer 305 // Informs the filter that data has been read into its buffer
309 void FilteredDataRead(int bytes_read); 306 void FilteredDataRead(int bytes_read);
310 307
311 // Reads filtered data from the request. Returns true if successful, 308 // Reads filtered data from the request. Returns true if successful,
312 // false otherwise. Note, if there is not enough data received to 309 // false otherwise. Note, if there is not enough data received to
313 // return data, this call can issue a new async IO request under 310 // return data, this call can issue a new async IO request under
314 // the hood. 311 // the hood.
315 bool ReadFilteredData(int *bytes_read); 312 bool ReadFilteredData(int* bytes_read);
316 313
317 // Whether the response is being filtered in this job. 314 // Whether the response is being filtered in this job.
318 // Only valid after NotifyHeadersComplete() has been called. 315 // Only valid after NotifyHeadersComplete() has been called.
319 bool HasFilter() { return filter_ != NULL; } 316 bool HasFilter() { return filter_ != NULL; }
320 317
321 // At or near destruction time, a derived class may request that the filters 318 // At or near destruction time, a derived class may request that the filters
322 // be destroyed so that statistics can be gathered while the derived class is 319 // be destroyed so that statistics can be gathered while the derived class is
323 // still present to assist in calculations. This is used by URLRequestHttpJob 320 // still present to assist in calculations. This is used by URLRequestHttpJob
324 // to get SDCH to emit stats. 321 // to get SDCH to emit stats.
325 void DestroyFilters(); 322 void DestroyFilters();
(...skipping 19 matching lines...) Expand all
345 int64 filter_input_byte_count() const { return filter_input_byte_count_; } 342 int64 filter_input_byte_count() const { return filter_input_byte_count_; }
346 343
347 // The request that initiated this job. This value MAY BE NULL if the 344 // The request that initiated this job. This value MAY BE NULL if the
348 // request was released by DetachRequest(). 345 // request was released by DetachRequest().
349 URLRequest* request_; 346 URLRequest* request_;
350 347
351 private: 348 private:
352 // When data filtering is enabled, this function is used to read data 349 // When data filtering is enabled, this function is used to read data
353 // for the filter. Returns true if raw data was read. Returns false if 350 // for the filter. Returns true if raw data was read. Returns false if
354 // an error occurred (or we are waiting for IO to complete). 351 // an error occurred (or we are waiting for IO to complete).
355 bool ReadRawDataForFilter(int *bytes_read); 352 bool ReadRawDataForFilter(int* bytes_read);
356 353
357 // Invokes ReadRawData and records bytes read if the read completes 354 // Invokes ReadRawData and records bytes read if the read completes
358 // synchronously. 355 // synchronously.
359 bool ReadRawDataHelper(IOBuffer* buf, int buf_size, int* bytes_read); 356 bool ReadRawDataHelper(IOBuffer* buf, int buf_size, int* bytes_read);
360 357
361 // Called in response to a redirect that was not canceled to follow the 358 // Called in response to a redirect that was not canceled to follow the
362 // redirect. The current job will be replaced with a new job loading the 359 // redirect. The current job will be replaced with a new job loading the
363 // given redirect destination. 360 // given redirect destination.
364 void FollowRedirect(const GURL& location, int http_status_code); 361 void FollowRedirect(const GURL& location, int http_status_code);
365 362
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 NetworkDelegate* network_delegate_; 420 NetworkDelegate* network_delegate_;
424 421
425 base::WeakPtrFactory<URLRequestJob> weak_factory_; 422 base::WeakPtrFactory<URLRequestJob> weak_factory_;
426 423
427 DISALLOW_COPY_AND_ASSIGN(URLRequestJob); 424 DISALLOW_COPY_AND_ASSIGN(URLRequestJob);
428 }; 425 };
429 426
430 } // namespace net 427 } // namespace net
431 428
432 #endif // NET_URL_REQUEST_URL_REQUEST_JOB_H_ 429 #endif // NET_URL_REQUEST_URL_REQUEST_JOB_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698