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_RENDERER_HOST_ASYNC_RESOURCE_HANDLER_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_ASYNC_RESOURCE_HANDLER_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_ASYNC_RESOURCE_HANDLER_H_ | 6 #define CONTENT_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 "content/browser/renderer_host/resource_handler.h" | 11 #include "content/browser/renderer_host/resource_handler.h" |
12 #include "googleurl/src/gurl.h" | 12 #include "googleurl/src/gurl.h" |
13 | 13 |
14 class HostZoomMap; | |
15 class ResourceDispatcherHost; | 14 class ResourceDispatcherHost; |
16 class ResourceMessageFilter; | 15 class ResourceMessageFilter; |
17 class SharedIOBuffer; | 16 class SharedIOBuffer; |
18 | 17 |
19 // Used to complete an asynchronous resource request in response to resource | 18 // Used to complete an asynchronous resource request in response to resource |
20 // load events from the resource dispatcher host. | 19 // load events from the resource dispatcher host. |
21 class AsyncResourceHandler : public ResourceHandler { | 20 class AsyncResourceHandler : public ResourceHandler { |
22 public: | 21 public: |
23 AsyncResourceHandler(ResourceMessageFilter* filter, | 22 AsyncResourceHandler(ResourceMessageFilter* filter, |
24 int routing_id, | 23 int routing_id, |
(...skipping 27 matching lines...) Expand all Loading... |
52 int bytes_downloaded) OVERRIDE; | 51 int bytes_downloaded) OVERRIDE; |
53 | 52 |
54 static void GlobalCleanup(); | 53 static void GlobalCleanup(); |
55 | 54 |
56 private: | 55 private: |
57 virtual ~AsyncResourceHandler(); | 56 virtual ~AsyncResourceHandler(); |
58 | 57 |
59 scoped_refptr<SharedIOBuffer> read_buffer_; | 58 scoped_refptr<SharedIOBuffer> read_buffer_; |
60 scoped_refptr<ResourceMessageFilter> filter_; | 59 scoped_refptr<ResourceMessageFilter> filter_; |
61 int routing_id_; | 60 int routing_id_; |
62 HostZoomMap* host_zoom_map_; | |
63 ResourceDispatcherHost* rdh_; | 61 ResourceDispatcherHost* rdh_; |
64 | 62 |
65 // |next_buffer_size_| is the size of the buffer to be allocated on the next | 63 // |next_buffer_size_| is the size of the buffer to be allocated on the next |
66 // OnWillRead() call. We exponentially grow the size of the buffer allocated | 64 // OnWillRead() call. We exponentially grow the size of the buffer allocated |
67 // when our owner fills our buffers. On the first OnWillRead() call, we | 65 // when our owner fills our buffers. On the first OnWillRead() call, we |
68 // allocate a buffer of 32k and double it in OnReadCompleted() if the buffer | 66 // allocate a buffer of 32k and double it in OnReadCompleted() if the buffer |
69 // was filled, up to a maximum size of 512k. | 67 // was filled, up to a maximum size of 512k. |
70 int next_buffer_size_; | 68 int next_buffer_size_; |
71 | 69 |
72 // TODO(battre): Remove url. This is only for debugging | 70 // TODO(battre): Remove url. This is only for debugging |
73 // http://crbug.com/107692. | 71 // http://crbug.com/107692. |
74 GURL url_; | 72 GURL url_; |
75 | 73 |
76 DISALLOW_COPY_AND_ASSIGN(AsyncResourceHandler); | 74 DISALLOW_COPY_AND_ASSIGN(AsyncResourceHandler); |
77 }; | 75 }; |
78 | 76 |
79 #endif // CONTENT_BROWSER_RENDERER_HOST_ASYNC_RESOURCE_HANDLER_H_ | 77 #endif // CONTENT_BROWSER_RENDERER_HOST_ASYNC_RESOURCE_HANDLER_H_ |
OLD | NEW |