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 22 matching lines...) Expand all Loading... | |
33 // These callbacks mirror net::URLRequest::Delegate and the order and | 33 // These callbacks mirror net::URLRequest::Delegate and the order and |
34 // conditions in which they will be called are identical. See url_request.h | 34 // conditions in which they will be called are identical. See url_request.h |
35 // for more information. | 35 // for more information. |
36 class CONTENT_EXPORT RequestPeer { | 36 class CONTENT_EXPORT RequestPeer { |
37 public: | 37 public: |
38 // This class represents data gotten from the Browser process. Each data | 38 // This class represents data gotten from the Browser process. Each data |
39 // consists of |payload|, |length| and |encoded_length|. The payload is | 39 // consists of |payload|, |length| and |encoded_length|. The payload is |
40 // valid only when the data instance is valid. | 40 // valid only when the data instance is valid. |
41 // In order to work with Chrome resource loading IPC, it is desirable to | 41 // In order to work with Chrome resource loading IPC, it is desirable to |
42 // reclaim data in FIFO order in a RequestPeer in terms of performance. | 42 // reclaim data in FIFO order in a RequestPeer in terms of performance. |
43 // |payload|, |length| and |encoded_length| functions are thread-safe, but | 43 // |payload|, |length| and |encoded_length| functions are thread-safe, but |
kinuko
2016/06/28 15:35:07
please update this comment too
Adam Rice
2016/06/29 09:52:15
Done.
| |
44 // the data object itself must be destroyed on the original thread. | 44 // the data object itself must be destroyed on the original thread. |
45 class CONTENT_EXPORT ReceivedData { | 45 class CONTENT_EXPORT ReceivedData { |
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_length is the length of the encoded data transferred | 50 // The encoded_length is the length of the encoded data transferred |
51 // over the network, which could be different from data length (e.g. for | 51 // over the network, which could be different from data length (e.g. for |
52 // gzipped content). | 52 // gzipped content). |
53 virtual int encoded_length() const = 0; | 53 virtual int encoded_length() const = 0; |
54 // The encoded_body_length is the size of the body as transferred over the | |
55 // network or stored in the disk cache. This will be different from the data | |
56 // length if a content encoding was used. | |
57 virtual int encoded_body_length() const = 0; | |
kinuko
2016/06/28 15:35:07
It'd be probably nicer to clearly explain how enco
Adam Rice
2016/06/29 09:52:15
I have tried to make the comments clearer. I also
| |
54 }; | 58 }; |
55 | 59 |
56 // A ThreadSafeReceivedData can be deleted on ANY thread. | 60 // A ThreadSafeReceivedData can be deleted on ANY thread. |
57 class CONTENT_EXPORT ThreadSafeReceivedData : public ReceivedData {}; | 61 class CONTENT_EXPORT ThreadSafeReceivedData : public ReceivedData {}; |
58 | 62 |
59 // Called as upload progress is made. | 63 // Called as upload progress is made. |
60 // note: only for requests with upload progress enabled. | 64 // note: only for requests with upload progress enabled. |
61 virtual void OnUploadProgress(uint64_t position, uint64_t size) = 0; | 65 virtual void OnUploadProgress(uint64_t position, uint64_t size) = 0; |
62 | 66 |
63 // Called when a redirect occurs. The implementation may return false to | 67 // Called when a redirect occurs. The implementation may return false to |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
96 const std::string& security_info, | 100 const std::string& security_info, |
97 const base::TimeTicks& completion_time, | 101 const base::TimeTicks& completion_time, |
98 int64_t total_transfer_size) = 0; | 102 int64_t total_transfer_size) = 0; |
99 | 103 |
100 virtual ~RequestPeer() {} | 104 virtual ~RequestPeer() {} |
101 }; | 105 }; |
102 | 106 |
103 } // namespace content | 107 } // namespace content |
104 | 108 |
105 #endif // CONTENT_PUBLIC_CHILD_REQUEST_PEER_H_ | 109 #endif // CONTENT_PUBLIC_CHILD_REQUEST_PEER_H_ |
OLD | NEW |