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 CONTENT_BROWSER_LOADER_ASYNC_RESOURCE_HANDLER_H_ | 5 #ifndef CONTENT_BROWSER_LOADER_ASYNC_RESOURCE_HANDLER_H_ |
6 #define CONTENT_BROWSER_LOADER_ASYNC_RESOURCE_HANDLER_H_ | 6 #define CONTENT_BROWSER_LOADER_ASYNC_RESOURCE_HANDLER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 void OnFollowRedirect(int request_id); | 59 void OnFollowRedirect(int request_id); |
60 void OnDataReceivedACK(int request_id); | 60 void OnDataReceivedACK(int request_id); |
61 void OnUploadProgressACK(int request_id); | 61 void OnUploadProgressACK(int request_id); |
62 | 62 |
63 void ReportUploadProgress(); | 63 void ReportUploadProgress(); |
64 | 64 |
65 bool EnsureResourceBufferIsInitialized(); | 65 bool EnsureResourceBufferIsInitialized(); |
66 void ResumeIfDeferred(); | 66 void ResumeIfDeferred(); |
67 void OnDefer(); | 67 void OnDefer(); |
68 bool CheckForSufficientResource(); | 68 bool CheckForSufficientResource(); |
| 69 int CalculateEncodedDataLengthToReport(); |
69 | 70 |
70 scoped_refptr<ResourceBuffer> buffer_; | 71 scoped_refptr<ResourceBuffer> buffer_; |
71 ResourceDispatcherHostImpl* rdh_; | 72 ResourceDispatcherHostImpl* rdh_; |
72 | 73 |
73 // Number of messages we've sent to the renderer that we haven't gotten an | 74 // Number of messages we've sent to the renderer that we haven't gotten an |
74 // ACK for. This allows us to avoid having too many messages in flight. | 75 // ACK for. This allows us to avoid having too many messages in flight. |
75 int pending_data_count_; | 76 int pending_data_count_; |
76 | 77 |
77 int allocation_size_; | 78 int allocation_size_; |
78 | 79 |
79 bool did_defer_; | 80 bool did_defer_; |
80 | 81 |
81 bool has_checked_for_sufficient_resources_; | 82 bool has_checked_for_sufficient_resources_; |
82 bool sent_received_response_msg_; | 83 bool sent_received_response_msg_; |
83 bool sent_first_data_msg_; | 84 bool sent_first_data_msg_; |
84 | 85 |
85 uint64_t last_upload_position_; | 86 uint64_t last_upload_position_; |
86 bool waiting_for_upload_progress_ack_; | 87 bool waiting_for_upload_progress_ack_; |
87 base::TimeTicks last_upload_ticks_; | 88 base::TimeTicks last_upload_ticks_; |
88 base::RepeatingTimer progress_timer_; | 89 base::RepeatingTimer progress_timer_; |
89 | 90 |
90 int64_t reported_transfer_size_; | 91 int64_t reported_transfer_size_; |
91 | 92 |
92 DISALLOW_COPY_AND_ASSIGN(AsyncResourceHandler); | 93 DISALLOW_COPY_AND_ASSIGN(AsyncResourceHandler); |
93 }; | 94 }; |
94 | 95 |
95 } // namespace content | 96 } // namespace content |
96 | 97 |
97 #endif // CONTENT_BROWSER_LOADER_ASYNC_RESOURCE_HANDLER_H_ | 98 #endif // CONTENT_BROWSER_LOADER_ASYNC_RESOURCE_HANDLER_H_ |
OLD | NEW |