| 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 #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> |
| 9 |
| 8 #include <string> | 10 #include <string> |
| 9 #include <vector> | 11 #include <vector> |
| 10 | 12 |
| 11 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 14 #include "base/message_loop/message_loop.h" | 16 #include "base/message_loop/message_loop.h" |
| 15 #include "base/power_monitor/power_observer.h" | 17 #include "base/power_monitor/power_observer.h" |
| 16 #include "net/base/host_port_pair.h" | 18 #include "net/base/host_port_pair.h" |
| 17 #include "net/base/load_states.h" | 19 #include "net/base/load_states.h" |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 void SetProxyServer(const HostPortPair& proxy_server); | 348 void SetProxyServer(const HostPortPair& proxy_server); |
| 347 | 349 |
| 348 // The number of bytes read before passing to the filter. This value reflects | 350 // The number of bytes read before passing to the filter. This value reflects |
| 349 // bytes read even when there is no filter. | 351 // bytes read even when there is no filter. |
| 350 int64 prefilter_bytes_read() const { return prefilter_bytes_read_; } | 352 int64 prefilter_bytes_read() const { return prefilter_bytes_read_; } |
| 351 | 353 |
| 352 // The number of bytes read after passing through the filter. This value | 354 // The number of bytes read after passing through the filter. This value |
| 353 // reflects bytes read even when there is no filter. | 355 // reflects bytes read even when there is no filter. |
| 354 int64 postfilter_bytes_read() const { return postfilter_bytes_read_; } | 356 int64 postfilter_bytes_read() const { return postfilter_bytes_read_; } |
| 355 | 357 |
| 358 // Notify the network delegate that more bytes have been received over the |
| 359 // network, if bytes have been received since the previous notification. |
| 360 // TODO(sclittle): Have this method also notify about sent bytes once |
| 361 // URLRequestJob::GetTotalSentBytes has been implemented (crbug.com/518897). |
| 362 void MaybeNotifyNetworkBytes(); |
| 363 |
| 356 // The request that initiated this job. This value MAY BE NULL if the | 364 // The request that initiated this job. This value MAY BE NULL if the |
| 357 // request was released by DetachRequest(). | 365 // request was released by DetachRequest(). |
| 358 URLRequest* request_; | 366 URLRequest* request_; |
| 359 | 367 |
| 360 private: | 368 private: |
| 361 // When data filtering is enabled, this function is used to read data | 369 // When data filtering is enabled, this function is used to read data |
| 362 // for the filter. Returns true if raw data was read. Returns false if | 370 // for the filter. Returns true if raw data was read. Returns false if |
| 363 // an error occurred (or we are waiting for IO to complete). | 371 // an error occurred (or we are waiting for IO to complete). |
| 364 bool ReadRawDataForFilter(int *bytes_read); | 372 bool ReadRawDataForFilter(int *bytes_read); |
| 365 | 373 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 | 435 |
| 428 // Expected content size | 436 // Expected content size |
| 429 int64 expected_content_size_; | 437 int64 expected_content_size_; |
| 430 | 438 |
| 431 // Set when a redirect is deferred. | 439 // Set when a redirect is deferred. |
| 432 RedirectInfo deferred_redirect_info_; | 440 RedirectInfo deferred_redirect_info_; |
| 433 | 441 |
| 434 // The network delegate to use with this request, if any. | 442 // The network delegate to use with this request, if any. |
| 435 NetworkDelegate* network_delegate_; | 443 NetworkDelegate* network_delegate_; |
| 436 | 444 |
| 445 // The value from GetTotalReceivedBytes() the last time |
| 446 // MaybeNotifyNetworkBytes() was called. Used to calculate how bytes have been |
| 447 // newly received since the last notification. |
| 448 int64_t last_notified_total_received_bytes_; |
| 449 |
| 437 base::WeakPtrFactory<URLRequestJob> weak_factory_; | 450 base::WeakPtrFactory<URLRequestJob> weak_factory_; |
| 438 | 451 |
| 439 DISALLOW_COPY_AND_ASSIGN(URLRequestJob); | 452 DISALLOW_COPY_AND_ASSIGN(URLRequestJob); |
| 440 }; | 453 }; |
| 441 | 454 |
| 442 } // namespace net | 455 } // namespace net |
| 443 | 456 |
| 444 #endif // NET_URL_REQUEST_URL_REQUEST_JOB_H_ | 457 #endif // NET_URL_REQUEST_URL_REQUEST_JOB_H_ |
| OLD | NEW |