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); | |
42 | 41 |
43 static void GlobalCleanup(); | 42 static void GlobalCleanup(); |
44 | 43 |
45 private: | 44 private: |
46 ~AsyncResourceHandler(); | 45 ~AsyncResourceHandler(); |
47 | 46 |
48 scoped_refptr<SharedIOBuffer> read_buffer_; | 47 scoped_refptr<SharedIOBuffer> read_buffer_; |
49 ResourceDispatcherHost::Receiver* receiver_; | 48 ResourceDispatcherHost::Receiver* receiver_; |
50 int process_id_; | 49 int process_id_; |
51 int routing_id_; | 50 int routing_id_; |
52 base::ProcessHandle process_handle_; | 51 base::ProcessHandle process_handle_; |
53 ResourceDispatcherHost* rdh_; | 52 ResourceDispatcherHost* rdh_; |
54 | 53 |
55 // |next_buffer_size_| is the size of the buffer to be allocated on the next | 54 // |next_buffer_size_| is the size of the buffer to be allocated on the next |
56 // OnWillRead() call. We exponentially grow the size of the buffer allocated | 55 // OnWillRead() call. We exponentially grow the size of the buffer allocated |
57 // when our owner fills our buffers. On the first OnWillRead() call, we | 56 // when our owner fills our buffers. On the first OnWillRead() call, we |
58 // allocate a buffer of 32k and double it in OnReadCompleted() if the buffer | 57 // allocate a buffer of 32k and double it in OnReadCompleted() if the buffer |
59 // was filled, up to a maximum size of 512k. | 58 // was filled, up to a maximum size of 512k. |
60 int next_buffer_size_; | 59 int next_buffer_size_; |
61 | 60 |
62 DISALLOW_COPY_AND_ASSIGN(AsyncResourceHandler); | 61 DISALLOW_COPY_AND_ASSIGN(AsyncResourceHandler); |
63 }; | 62 }; |
64 | 63 |
65 #endif // CHROME_BROWSER_RENDERER_HOST_ASYNC_RESOURCE_HANDLER_H_ | 64 #endif // CHROME_BROWSER_RENDERER_HOST_ASYNC_RESOURCE_HANDLER_H_ |
OLD | NEW |