OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CONTENT_PUBLIC_CHILD_REQUEST_PEER_H_ | 5 #ifndef CONTENT_PUBLIC_CHILD_REQUEST_PEER_H_ |
6 #define CONTENT_PUBLIC_CHILD_REQUEST_PEER_H_ | 6 #define CONTENT_PUBLIC_CHILD_REQUEST_PEER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 public: | 46 public: |
47 virtual ~ReceivedData() {} | 47 virtual ~ReceivedData() {} |
48 virtual const char* payload() const = 0; | 48 virtual const char* payload() const = 0; |
49 virtual int length() const = 0; | 49 virtual int length() const = 0; |
50 // The encoded_data_length is the length of the encoded data transferred | 50 // The encoded_data_length is the length of the encoded data transferred |
51 // over the network, including headers. It is only set for responses | 51 // over the network, including headers. It is only set for responses |
52 // originating from the network (ie. not the cache). It will usually be | 52 // originating from the network (ie. not the cache). It will usually be |
53 // different from length(), and may be smaller if the content was | 53 // different from length(), and may be smaller if the content was |
54 // compressed. -1 means this value is unavailable. | 54 // compressed. -1 means this value is unavailable. |
55 virtual int encoded_data_length() const = 0; | 55 virtual int encoded_data_length() const = 0; |
56 // The encoded_body_length is the size of the body as transferred over the | |
57 // network or stored in the disk cache, excluding headers. This will be | |
58 // different from length() if a content encoding was used. | |
59 virtual int encoded_body_length() const = 0; | |
60 }; | 56 }; |
61 | 57 |
62 // A ThreadSafeReceivedData can be deleted on ANY thread. | 58 // A ThreadSafeReceivedData can be deleted on ANY thread. |
63 class CONTENT_EXPORT ThreadSafeReceivedData : public ReceivedData {}; | 59 class CONTENT_EXPORT ThreadSafeReceivedData : public ReceivedData {}; |
64 | 60 |
65 // Called as upload progress is made. | 61 // Called as upload progress is made. |
66 // note: only for requests with upload progress enabled. | 62 // note: only for requests with upload progress enabled. |
67 virtual void OnUploadProgress(uint64_t position, uint64_t size) = 0; | 63 virtual void OnUploadProgress(uint64_t position, uint64_t size) = 0; |
68 | 64 |
69 // Called when a redirect occurs. The implementation may return false to | 65 // Called when a redirect occurs. The implementation may return false to |
(...skipping 23 matching lines...) Expand all Loading... |
93 // Called when metadata generated by the renderer is retrieved from the | 89 // Called when metadata generated by the renderer is retrieved from the |
94 // cache. This method may be called zero or one times. | 90 // cache. This method may be called zero or one times. |
95 virtual void OnReceivedCachedMetadata(const char* data, int len) {} | 91 virtual void OnReceivedCachedMetadata(const char* data, int len) {} |
96 | 92 |
97 // Called when the response is complete. This method signals completion of | 93 // Called when the response is complete. This method signals completion of |
98 // the resource load. | 94 // the resource load. |
99 virtual void OnCompletedRequest(int error_code, | 95 virtual void OnCompletedRequest(int error_code, |
100 bool was_ignored_by_handler, | 96 bool was_ignored_by_handler, |
101 bool stale_copy_in_cache, | 97 bool stale_copy_in_cache, |
102 const base::TimeTicks& completion_time, | 98 const base::TimeTicks& completion_time, |
103 int64_t total_transfer_size) = 0; | 99 int64_t total_transfer_size, |
| 100 int64_t encoded_body_size) = 0; |
104 | 101 |
105 virtual ~RequestPeer() {} | 102 virtual ~RequestPeer() {} |
106 }; | 103 }; |
107 | 104 |
108 } // namespace content | 105 } // namespace content |
109 | 106 |
110 #endif // CONTENT_PUBLIC_CHILD_REQUEST_PEER_H_ | 107 #endif // CONTENT_PUBLIC_CHILD_REQUEST_PEER_H_ |
OLD | NEW |