OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 CHROME_BROWSER_RENDERER_HOST_ASYNC_RESOURCE_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_RENDERER_HOST_ASYNC_RESOURCE_HANDLER_H_ |
6 #define CHROME_BROWSER_RENDERER_HOST_ASYNC_RESOURCE_HANDLER_H_ | 6 #define CHROME_BROWSER_RENDERER_HOST_ASYNC_RESOURCE_HANDLER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 20 matching lines...) Expand all Loading... |
31 ResourceResponse* response, bool* defer); | 31 ResourceResponse* response, bool* defer); |
32 bool OnResponseStarted(int request_id, ResourceResponse* response); | 32 bool OnResponseStarted(int request_id, ResourceResponse* response); |
33 bool OnWillStart(int request_id, const GURL& url, bool* defer); | 33 bool OnWillStart(int request_id, const GURL& url, bool* defer); |
34 bool OnWillRead(int request_id, net::IOBuffer** buf, int* buf_size, | 34 bool OnWillRead(int request_id, net::IOBuffer** buf, int* buf_size, |
35 int min_size); | 35 int min_size); |
36 bool OnReadCompleted(int request_id, int* bytes_read); | 36 bool OnReadCompleted(int request_id, int* bytes_read); |
37 bool OnResponseCompleted(int request_id, | 37 bool OnResponseCompleted(int request_id, |
38 const URLRequestStatus& status, | 38 const URLRequestStatus& status, |
39 const std::string& security_info); | 39 const std::string& security_info); |
40 void OnRequestClosed(); | 40 void OnRequestClosed(); |
| 41 void OnDataDownloaded(int request_id, int bytes_downloaded); |
41 | 42 |
42 static void GlobalCleanup(); | 43 static void GlobalCleanup(); |
43 | 44 |
44 private: | 45 private: |
45 ~AsyncResourceHandler(); | 46 ~AsyncResourceHandler(); |
46 | 47 |
47 scoped_refptr<SharedIOBuffer> read_buffer_; | 48 scoped_refptr<SharedIOBuffer> read_buffer_; |
48 ResourceDispatcherHost::Receiver* receiver_; | 49 ResourceDispatcherHost::Receiver* receiver_; |
49 int process_id_; | 50 int process_id_; |
50 int routing_id_; | 51 int routing_id_; |
51 base::ProcessHandle process_handle_; | 52 base::ProcessHandle process_handle_; |
52 ResourceDispatcherHost* rdh_; | 53 ResourceDispatcherHost* rdh_; |
53 | 54 |
54 // |next_buffer_size_| is the size of the buffer to be allocated on the next | 55 // |next_buffer_size_| is the size of the buffer to be allocated on the next |
55 // OnWillRead() call. We exponentially grow the size of the buffer allocated | 56 // OnWillRead() call. We exponentially grow the size of the buffer allocated |
56 // when our owner fills our buffers. On the first OnWillRead() call, we | 57 // when our owner fills our buffers. On the first OnWillRead() call, we |
57 // allocate a buffer of 32k and double it in OnReadCompleted() if the buffer | 58 // allocate a buffer of 32k and double it in OnReadCompleted() if the buffer |
58 // was filled, up to a maximum size of 512k. | 59 // was filled, up to a maximum size of 512k. |
59 int next_buffer_size_; | 60 int next_buffer_size_; |
60 | 61 |
61 DISALLOW_COPY_AND_ASSIGN(AsyncResourceHandler); | 62 DISALLOW_COPY_AND_ASSIGN(AsyncResourceHandler); |
62 }; | 63 }; |
63 | 64 |
64 #endif // CHROME_BROWSER_RENDERER_HOST_ASYNC_RESOURCE_HANDLER_H_ | 65 #endif // CHROME_BROWSER_RENDERER_HOST_ASYNC_RESOURCE_HANDLER_H_ |
OLD | NEW |