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

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

Issue 1535363003: Switch to standard integer types in net/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: stddef Created 5 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 | « net/url_request/url_fetcher.h ('k') | net/url_request/url_fetcher_core.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 (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_FETCHER_CORE_H_ 5 #ifndef NET_URL_REQUEST_URL_FETCHER_CORE_H_
6 #define NET_URL_REQUEST_URL_FETCHER_CORE_H_ 6 #define NET_URL_REQUEST_URL_FETCHER_CORE_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <set> 10 #include <set>
11 #include <string> 11 #include <string>
12 12
13 #include "base/basictypes.h"
14 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
15 #include "base/debug/stack_trace.h" 14 #include "base/debug/stack_trace.h"
16 #include "base/files/file_path.h" 15 #include "base/files/file_path.h"
17 #include "base/lazy_instance.h" 16 #include "base/lazy_instance.h"
17 #include "base/macros.h"
18 #include "base/memory/ref_counted.h" 18 #include "base/memory/ref_counted.h"
19 #include "base/memory/scoped_ptr.h" 19 #include "base/memory/scoped_ptr.h"
20 #include "base/timer/timer.h" 20 #include "base/timer/timer.h"
21 #include "net/base/host_port_pair.h" 21 #include "net/base/host_port_pair.h"
22 #include "net/http/http_request_headers.h" 22 #include "net/http/http_request_headers.h"
23 #include "net/url_request/url_fetcher.h" 23 #include "net/url_request/url_fetcher.h"
24 #include "net/url_request/url_request.h" 24 #include "net/url_request/url_request.h"
25 #include "net/url_request/url_request_context_getter_observer.h" 25 #include "net/url_request/url_request_context_getter_observer.h"
26 #include "net/url_request/url_request_status.h" 26 #include "net/url_request/url_request_status.h"
27 #include "url/gurl.h" 27 #include "url/gurl.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 void Stop(); 61 void Stop();
62 62
63 // URLFetcher-like functions. 63 // URLFetcher-like functions.
64 64
65 // For POST requests, set |content_type| to the MIME type of the 65 // For POST requests, set |content_type| to the MIME type of the
66 // content and set |content| to the data to upload. 66 // content and set |content| to the data to upload.
67 void SetUploadData(const std::string& upload_content_type, 67 void SetUploadData(const std::string& upload_content_type,
68 const std::string& upload_content); 68 const std::string& upload_content);
69 void SetUploadFilePath(const std::string& upload_content_type, 69 void SetUploadFilePath(const std::string& upload_content_type,
70 const base::FilePath& file_path, 70 const base::FilePath& file_path,
71 uint64 range_offset, 71 uint64_t range_offset,
72 uint64 range_length, 72 uint64_t range_length,
73 scoped_refptr<base::TaskRunner> file_task_runner); 73 scoped_refptr<base::TaskRunner> file_task_runner);
74 void SetUploadStreamFactory( 74 void SetUploadStreamFactory(
75 const std::string& upload_content_type, 75 const std::string& upload_content_type,
76 const URLFetcher::CreateUploadStreamCallback& callback); 76 const URLFetcher::CreateUploadStreamCallback& callback);
77 void SetChunkedUpload(const std::string& upload_content_type); 77 void SetChunkedUpload(const std::string& upload_content_type);
78 // Adds a block of data to be uploaded in a POST body. This can only be 78 // Adds a block of data to be uploaded in a POST body. This can only be
79 // called after Start(). 79 // called after Start().
80 void AppendChunkToUpload(const std::string& data, bool is_last_chunk); 80 void AppendChunkToUpload(const std::string& data, bool is_last_chunk);
81 // |flags| are flags to apply to the load operation--these should be 81 // |flags| are flags to apply to the load operation--these should be
82 // one or more of the LOAD_* flags defined in net/base/load_flags.h. 82 // one or more of the LOAD_* flags defined in net/base/load_flags.h.
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 int WriteBuffer(scoped_refptr<DrainableIOBuffer> data); 208 int WriteBuffer(scoped_refptr<DrainableIOBuffer> data);
209 209
210 // Used to implement WriteBuffer(). 210 // Used to implement WriteBuffer().
211 void DidWriteBuffer(scoped_refptr<DrainableIOBuffer> data, int result); 211 void DidWriteBuffer(scoped_refptr<DrainableIOBuffer> data, int result);
212 212
213 // Read response bytes from the request. 213 // Read response bytes from the request.
214 void ReadResponse(); 214 void ReadResponse();
215 215
216 // Notify Delegate about the progress of upload/download. 216 // Notify Delegate about the progress of upload/download.
217 void InformDelegateUploadProgress(); 217 void InformDelegateUploadProgress();
218 void InformDelegateUploadProgressInDelegateThread(int64 current, int64 total); 218 void InformDelegateUploadProgressInDelegateThread(int64_t current,
219 int64_t total);
219 void InformDelegateDownloadProgress(); 220 void InformDelegateDownloadProgress();
220 void InformDelegateDownloadProgressInDelegateThread(int64 current, 221 void InformDelegateDownloadProgressInDelegateThread(int64_t current,
221 int64 total); 222 int64_t total);
222 223
223 // Check if any upload data is set or not. 224 // Check if any upload data is set or not.
224 void AssertHasNoUploadData() const; 225 void AssertHasNoUploadData() const;
225 226
226 URLFetcher* fetcher_; // Corresponding fetcher object 227 URLFetcher* fetcher_; // Corresponding fetcher object
227 GURL original_url_; // The URL we were asked to fetch 228 GURL original_url_; // The URL we were asked to fetch
228 GURL url_; // The URL we eventually wound up at 229 GURL url_; // The URL we eventually wound up at
229 URLFetcher::RequestType request_type_; // What type of request is this? 230 URLFetcher::RequestType request_type_; // What type of request is this?
230 URLRequestStatus status_; // Status of the request 231 URLRequestStatus status_; // Status of the request
231 URLFetcherDelegate* delegate_; // Object to notify on completion 232 URLFetcherDelegate* delegate_; // Object to notify on completion
(...skipping 19 matching lines...) Expand all
251 scoped_refptr<HttpResponseHeaders> response_headers_; 252 scoped_refptr<HttpResponseHeaders> response_headers_;
252 bool was_fetched_via_proxy_; 253 bool was_fetched_via_proxy_;
253 bool was_cached_; 254 bool was_cached_;
254 int64_t received_response_content_length_; 255 int64_t received_response_content_length_;
255 int64_t total_received_bytes_; 256 int64_t total_received_bytes_;
256 HostPortPair socket_address_; 257 HostPortPair socket_address_;
257 258
258 bool upload_content_set_; // SetUploadData has been called 259 bool upload_content_set_; // SetUploadData has been called
259 std::string upload_content_; // HTTP POST payload 260 std::string upload_content_; // HTTP POST payload
260 base::FilePath upload_file_path_; // Path to file containing POST payload 261 base::FilePath upload_file_path_; // Path to file containing POST payload
261 uint64 upload_range_offset_; // Offset from the beginning of the file 262 uint64_t upload_range_offset_; // Offset from the beginning of the file
262 // to be uploaded. 263 // to be uploaded.
263 uint64 upload_range_length_; // The length of the part of file to be 264 uint64_t upload_range_length_; // The length of the part of file to be
264 // uploaded. 265 // uploaded.
265 URLFetcher::CreateUploadStreamCallback 266 URLFetcher::CreateUploadStreamCallback
266 upload_stream_factory_; // Callback to create HTTP POST payload. 267 upload_stream_factory_; // Callback to create HTTP POST payload.
267 std::string upload_content_type_; // MIME type of POST payload 268 std::string upload_content_type_; // MIME type of POST payload
268 std::string referrer_; // HTTP Referer header value and policy 269 std::string referrer_; // HTTP Referer header value and policy
269 URLRequest::ReferrerPolicy referrer_policy_; 270 URLRequest::ReferrerPolicy referrer_policy_;
270 bool is_chunked_upload_; // True if using chunked transfer encoding 271 bool is_chunked_upload_; // True if using chunked transfer encoding
271 272
272 // Used to determine how long to wait before making a request or doing a 273 // Used to determine how long to wait before making a request or doing a
273 // retry. 274 // retry.
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 // The number of retries that have been attempted due to ERR_NETWORK_CHANGED. 322 // The number of retries that have been attempted due to ERR_NETWORK_CHANGED.
322 int num_retries_on_network_changes_; 323 int num_retries_on_network_changes_;
323 // Maximum retries allowed when the request fails with ERR_NETWORK_CHANGED. 324 // Maximum retries allowed when the request fails with ERR_NETWORK_CHANGED.
324 // 0 by default. 325 // 0 by default.
325 int max_retries_on_network_changes_; 326 int max_retries_on_network_changes_;
326 327
327 // Timer to poll the progress of uploading for POST and PUT requests. 328 // Timer to poll the progress of uploading for POST and PUT requests.
328 // When crbug.com/119629 is fixed, scoped_ptr is not necessary here. 329 // When crbug.com/119629 is fixed, scoped_ptr is not necessary here.
329 scoped_ptr<base::RepeatingTimer> upload_progress_checker_timer_; 330 scoped_ptr<base::RepeatingTimer> upload_progress_checker_timer_;
330 // Number of bytes sent so far. 331 // Number of bytes sent so far.
331 int64 current_upload_bytes_; 332 int64_t current_upload_bytes_;
332 // Number of bytes received so far. 333 // Number of bytes received so far.
333 int64 current_response_bytes_; 334 int64_t current_response_bytes_;
334 // Total expected bytes to receive (-1 if it cannot be determined). 335 // Total expected bytes to receive (-1 if it cannot be determined).
335 int64 total_response_bytes_; 336 int64_t total_response_bytes_;
336 337
337 // TODO(willchan): Get rid of this after debugging crbug.com/90971. 338 // TODO(willchan): Get rid of this after debugging crbug.com/90971.
338 base::debug::StackTrace stack_trace_; 339 base::debug::StackTrace stack_trace_;
339 340
340 static base::LazyInstance<Registry> g_registry; 341 static base::LazyInstance<Registry> g_registry;
341 342
342 DISALLOW_COPY_AND_ASSIGN(URLFetcherCore); 343 DISALLOW_COPY_AND_ASSIGN(URLFetcherCore);
343 }; 344 };
344 345
345 } // namespace net 346 } // namespace net
346 347
347 #endif // NET_URL_REQUEST_URL_FETCHER_CORE_H_ 348 #endif // NET_URL_REQUEST_URL_FETCHER_CORE_H_
OLDNEW
« no previous file with comments | « net/url_request/url_fetcher.h ('k') | net/url_request/url_fetcher_core.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698