OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 |
11 #include "chrome/browser/renderer_host/resource_handler.h" | 11 #include "chrome/browser/renderer_host/resource_handler.h" |
(...skipping 14 matching lines...) Expand all Loading... |
26 // ResourceHandler implementation: | 26 // ResourceHandler implementation: |
27 virtual bool OnUploadProgress(int request_id, uint64 position, uint64 size); | 27 virtual bool OnUploadProgress(int request_id, uint64 position, uint64 size); |
28 virtual bool OnRequestRedirected(int request_id, const GURL& new_url, | 28 virtual bool OnRequestRedirected(int request_id, const GURL& new_url, |
29 ResourceResponse* response, bool* defer); | 29 ResourceResponse* response, bool* defer); |
30 virtual bool OnResponseStarted(int request_id, ResourceResponse* response); | 30 virtual bool OnResponseStarted(int request_id, ResourceResponse* response); |
31 virtual bool OnWillStart(int request_id, const GURL& url, bool* defer); | 31 virtual bool OnWillStart(int request_id, const GURL& url, bool* defer); |
32 virtual bool OnWillRead(int request_id, net::IOBuffer** buf, int* buf_size, | 32 virtual bool OnWillRead(int request_id, net::IOBuffer** buf, int* buf_size, |
33 int min_size); | 33 int min_size); |
34 virtual bool OnReadCompleted(int request_id, int* bytes_read); | 34 virtual bool OnReadCompleted(int request_id, int* bytes_read); |
35 virtual bool OnResponseCompleted(int request_id, | 35 virtual bool OnResponseCompleted(int request_id, |
36 const URLRequestStatus& status, | 36 const net::URLRequestStatus& status, |
37 const std::string& security_info); | 37 const std::string& security_info); |
38 virtual void OnRequestClosed(); | 38 virtual void OnRequestClosed(); |
39 virtual void OnDataDownloaded(int request_id, int bytes_downloaded); | 39 virtual void OnDataDownloaded(int request_id, int bytes_downloaded); |
40 | 40 |
41 static void GlobalCleanup(); | 41 static void GlobalCleanup(); |
42 | 42 |
43 private: | 43 private: |
44 virtual ~AsyncResourceHandler(); | 44 virtual ~AsyncResourceHandler(); |
45 | 45 |
46 scoped_refptr<SharedIOBuffer> read_buffer_; | 46 scoped_refptr<SharedIOBuffer> read_buffer_; |
47 ResourceMessageFilter* filter_; | 47 ResourceMessageFilter* filter_; |
48 int routing_id_; | 48 int routing_id_; |
49 ResourceDispatcherHost* rdh_; | 49 ResourceDispatcherHost* rdh_; |
50 | 50 |
51 // |next_buffer_size_| is the size of the buffer to be allocated on the next | 51 // |next_buffer_size_| is the size of the buffer to be allocated on the next |
52 // OnWillRead() call. We exponentially grow the size of the buffer allocated | 52 // OnWillRead() call. We exponentially grow the size of the buffer allocated |
53 // when our owner fills our buffers. On the first OnWillRead() call, we | 53 // when our owner fills our buffers. On the first OnWillRead() call, we |
54 // allocate a buffer of 32k and double it in OnReadCompleted() if the buffer | 54 // allocate a buffer of 32k and double it in OnReadCompleted() if the buffer |
55 // was filled, up to a maximum size of 512k. | 55 // was filled, up to a maximum size of 512k. |
56 int next_buffer_size_; | 56 int next_buffer_size_; |
57 | 57 |
58 DISALLOW_COPY_AND_ASSIGN(AsyncResourceHandler); | 58 DISALLOW_COPY_AND_ASSIGN(AsyncResourceHandler); |
59 }; | 59 }; |
60 | 60 |
61 #endif // CHROME_BROWSER_RENDERER_HOST_ASYNC_RESOURCE_HANDLER_H_ | 61 #endif // CHROME_BROWSER_RENDERER_HOST_ASYNC_RESOURCE_HANDLER_H_ |
OLD | NEW |