| 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 <memory> | 10 #include <memory> |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 15 #include "content/browser/loader/resource_handler.h" | 15 #include "content/browser/loader/resource_handler.h" |
| 16 #include "content/browser/loader/resource_message_delegate.h" | 16 #include "content/browser/loader/resource_message_delegate.h" |
| 17 #include "content/common/content_export.h" | 17 #include "content/common/content_export.h" |
| 18 #include "net/base/io_buffer.h" | 18 #include "net/base/io_buffer.h" |
| 19 #include "url/gurl.h" | 19 #include "url/gurl.h" |
| 20 | 20 |
| 21 namespace net { | 21 namespace net { |
| 22 class URLRequest; | 22 class URLRequest; |
| 23 class UploadProgress; |
| 23 } | 24 } |
| 24 | 25 |
| 25 namespace content { | 26 namespace content { |
| 26 class ResourceBuffer; | 27 class ResourceBuffer; |
| 27 class ResourceDispatcherHostImpl; | 28 class ResourceDispatcherHostImpl; |
| 28 class UploadProgressTracker; | 29 class UploadProgressTracker; |
| 29 | 30 |
| 30 // Used to complete an asynchronous resource request in response to resource | 31 // Used to complete an asynchronous resource request in response to resource |
| 31 // load events from the resource dispatcher host. | 32 // load events from the resource dispatcher host. |
| 32 class CONTENT_EXPORT AsyncResourceHandler : public ResourceHandler, | 33 class CONTENT_EXPORT AsyncResourceHandler : public ResourceHandler, |
| (...skipping 27 matching lines...) Expand all Loading... |
| 60 void OnDataReceivedACK(int request_id); | 61 void OnDataReceivedACK(int request_id); |
| 61 void OnUploadProgressACK(int request_id); | 62 void OnUploadProgressACK(int request_id); |
| 62 | 63 |
| 63 bool EnsureResourceBufferIsInitialized(); | 64 bool EnsureResourceBufferIsInitialized(); |
| 64 void ResumeIfDeferred(); | 65 void ResumeIfDeferred(); |
| 65 void OnDefer(); | 66 void OnDefer(); |
| 66 bool CheckForSufficientResource(); | 67 bool CheckForSufficientResource(); |
| 67 int CalculateEncodedDataLengthToReport(); | 68 int CalculateEncodedDataLengthToReport(); |
| 68 int CalculateEncodedBodyLengthToReport(); | 69 int CalculateEncodedBodyLengthToReport(); |
| 69 void RecordHistogram(); | 70 void RecordHistogram(); |
| 70 void SendUploadProgress(int64_t current_position, int64_t total_size); | 71 void SendUploadProgress(const net::UploadProgress& progress); |
| 71 | 72 |
| 72 scoped_refptr<ResourceBuffer> buffer_; | 73 scoped_refptr<ResourceBuffer> buffer_; |
| 73 ResourceDispatcherHostImpl* rdh_; | 74 ResourceDispatcherHostImpl* rdh_; |
| 74 | 75 |
| 75 // Number of messages we've sent to the renderer that we haven't gotten an | 76 // Number of messages we've sent to the renderer that we haven't gotten an |
| 76 // ACK for. This allows us to avoid having too many messages in flight. | 77 // ACK for. This allows us to avoid having too many messages in flight. |
| 77 int pending_data_count_; | 78 int pending_data_count_; |
| 78 | 79 |
| 79 int allocation_size_; | 80 int allocation_size_; |
| 80 | 81 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 92 std::unique_ptr<UploadProgressTracker> upload_progress_tracker_; | 93 std::unique_ptr<UploadProgressTracker> upload_progress_tracker_; |
| 93 | 94 |
| 94 int64_t reported_transfer_size_; | 95 int64_t reported_transfer_size_; |
| 95 | 96 |
| 96 DISALLOW_COPY_AND_ASSIGN(AsyncResourceHandler); | 97 DISALLOW_COPY_AND_ASSIGN(AsyncResourceHandler); |
| 97 }; | 98 }; |
| 98 | 99 |
| 99 } // namespace content | 100 } // namespace content |
| 100 | 101 |
| 101 #endif // CONTENT_BROWSER_LOADER_ASYNC_RESOURCE_HANDLER_H_ | 102 #endif // CONTENT_BROWSER_LOADER_ASYNC_RESOURCE_HANDLER_H_ |
| OLD | NEW |