Chromium Code Reviews| 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 <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 55 int min_size) OVERRIDE; | 55 int min_size) OVERRIDE; |
| 56 virtual bool OnReadCompleted(int request_id, | 56 virtual bool OnReadCompleted(int request_id, |
| 57 int bytes_read, | 57 int bytes_read, |
| 58 bool* defer) OVERRIDE; | 58 bool* defer) OVERRIDE; |
| 59 virtual bool OnResponseCompleted(int request_id, | 59 virtual bool OnResponseCompleted(int request_id, |
| 60 const net::URLRequestStatus& status, | 60 const net::URLRequestStatus& status, |
| 61 const std::string& security_info) OVERRIDE; | 61 const std::string& security_info) OVERRIDE; |
| 62 virtual void OnDataDownloaded(int request_id, | 62 virtual void OnDataDownloaded(int request_id, |
| 63 int bytes_downloaded) OVERRIDE; | 63 int bytes_downloaded) OVERRIDE; |
| 64 | 64 |
| 65 // Once detached, no more data is sent to the renderer process. Only | |
| 66 // completion and error notification. This is useful for prefetches where the | |
| 67 // render process does not need the data and the download may persist longer | |
| 68 // than the render process. | |
| 69 void DetachReads(); | |
|
gavinp
2013/10/09 18:05:42
Nit: I vote for inlining this.
| |
| 70 | |
| 65 private: | 71 private: |
| 66 // IPC message handlers: | 72 // IPC message handlers: |
| 67 void OnFollowRedirect(int request_id, | 73 void OnFollowRedirect(int request_id, |
| 68 bool has_new_first_party_for_cookies, | 74 bool has_new_first_party_for_cookies, |
| 69 const GURL& new_first_party_for_cookies); | 75 const GURL& new_first_party_for_cookies); |
| 70 void OnDataReceivedACK(int request_id); | 76 void OnDataReceivedACK(int request_id); |
| 71 | 77 |
| 72 bool EnsureResourceBufferIsInitialized(); | 78 bool EnsureResourceBufferIsInitialized(); |
| 73 void ResumeIfDeferred(); | 79 void ResumeIfDeferred(); |
| 74 | 80 |
| 75 scoped_refptr<ResourceBuffer> buffer_; | 81 scoped_refptr<ResourceBuffer> buffer_; |
| 76 net::URLRequest* request_; | 82 net::URLRequest* request_; |
| 77 ResourceDispatcherHostImpl* rdh_; | 83 ResourceDispatcherHostImpl* rdh_; |
| 78 | 84 |
| 79 // Number of messages we've sent to the renderer that we haven't gotten an | 85 // Number of messages we've sent to the renderer that we haven't gotten an |
| 80 // ACK for. This allows us to avoid having too many messages in flight. | 86 // ACK for. This allows us to avoid having too many messages in flight. |
| 81 int pending_data_count_; | 87 int pending_data_count_; |
| 82 | 88 |
| 83 int allocation_size_; | 89 int allocation_size_; |
| 84 | 90 |
| 85 bool did_defer_; | 91 bool did_defer_; |
| 86 | 92 |
| 87 bool has_checked_for_sufficient_resources_; | 93 bool has_checked_for_sufficient_resources_; |
| 88 bool sent_received_response_msg_; | 94 bool sent_received_response_msg_; |
| 89 bool sent_first_data_msg_; | 95 bool sent_first_data_msg_; |
| 96 bool detached_reads_; | |
|
gavinp
2013/10/09 18:05:42
Naming nit: I like totally unambiguous names for b
| |
| 90 | 97 |
| 91 DISALLOW_COPY_AND_ASSIGN(AsyncResourceHandler); | 98 DISALLOW_COPY_AND_ASSIGN(AsyncResourceHandler); |
| 92 }; | 99 }; |
| 93 | 100 |
| 94 } // namespace content | 101 } // namespace content |
| 95 | 102 |
| 96 #endif // CONTENT_BROWSER_LOADER_ASYNC_RESOURCE_HANDLER_H_ | 103 #endif // CONTENT_BROWSER_LOADER_ASYNC_RESOURCE_HANDLER_H_ |
| OLD | NEW |