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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 const GURL& new_url, | 43 const GURL& new_url, |
44 ResourceResponse* response, | 44 ResourceResponse* response, |
45 bool* defer) OVERRIDE; | 45 bool* defer) OVERRIDE; |
46 virtual bool OnResponseStarted(int request_id, | 46 virtual bool OnResponseStarted(int request_id, |
47 ResourceResponse* response, | 47 ResourceResponse* response, |
48 bool* defer) OVERRIDE; | 48 bool* defer) OVERRIDE; |
49 virtual bool OnWillStart(int request_id, | 49 virtual bool OnWillStart(int request_id, |
50 const GURL& url, | 50 const GURL& url, |
51 bool* defer) OVERRIDE; | 51 bool* defer) OVERRIDE; |
52 virtual bool OnWillRead(int request_id, | 52 virtual bool OnWillRead(int request_id, |
53 scoped_refptr<net::IOBuffer>* buf, | 53 net::IOBuffer** buf, |
54 int* buf_size, | 54 int* buf_size, |
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 private: | 65 private: |
66 // IPC message handlers: | 66 // IPC message handlers: |
67 void OnFollowRedirect(int request_id, | 67 void OnFollowRedirect(int request_id, |
68 bool has_new_first_party_for_cookies, | 68 bool has_new_first_party_for_cookies, |
69 const GURL& new_first_party_for_cookies); | 69 const GURL& new_first_party_for_cookies); |
70 void OnDataReceivedACK(int request_id); | 70 void OnDataReceivedACK(int request_id); |
71 | 71 |
72 bool EnsureResourceBufferIsInitialized(); | 72 bool EnsureResourceBufferIsInitialized(); |
73 void ResumeIfDeferred(); | 73 void ResumeIfDeferred(); |
74 | 74 |
75 scoped_refptr<ResourceBuffer> buffer_; | 75 scoped_refptr<ResourceBuffer> buffer_; |
| 76 net::URLRequest* request_; |
76 ResourceDispatcherHostImpl* rdh_; | 77 ResourceDispatcherHostImpl* rdh_; |
77 | 78 |
78 // Number of messages we've sent to the renderer that we haven't gotten an | 79 // Number of messages we've sent to the renderer that we haven't gotten an |
79 // ACK for. This allows us to avoid having too many messages in flight. | 80 // ACK for. This allows us to avoid having too many messages in flight. |
80 int pending_data_count_; | 81 int pending_data_count_; |
81 | 82 |
82 int allocation_size_; | 83 int allocation_size_; |
83 | 84 |
84 bool did_defer_; | 85 bool did_defer_; |
85 | 86 |
86 bool has_checked_for_sufficient_resources_; | 87 bool has_checked_for_sufficient_resources_; |
87 bool sent_received_response_msg_; | 88 bool sent_received_response_msg_; |
88 bool sent_first_data_msg_; | 89 bool sent_first_data_msg_; |
89 | 90 |
90 DISALLOW_COPY_AND_ASSIGN(AsyncResourceHandler); | 91 DISALLOW_COPY_AND_ASSIGN(AsyncResourceHandler); |
91 }; | 92 }; |
92 | 93 |
93 } // namespace content | 94 } // namespace content |
94 | 95 |
95 #endif // CONTENT_BROWSER_LOADER_ASYNC_RESOURCE_HANDLER_H_ | 96 #endif // CONTENT_BROWSER_LOADER_ASYNC_RESOURCE_HANDLER_H_ |
OLD | NEW |