| 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 #include "content/browser/renderer_host/async_resource_handler.h" | 5 #include "content/browser/renderer_host/async_resource_handler.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/debug/alias.h" | 10 #include "base/debug/alias.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #include "content/public/browser/resource_dispatcher_host_delegate.h" | 24 #include "content/public/browser/resource_dispatcher_host_delegate.h" |
| 25 #include "content/public/common/resource_response.h" | 25 #include "content/public/common/resource_response.h" |
| 26 #include "net/base/io_buffer.h" | 26 #include "net/base/io_buffer.h" |
| 27 #include "net/base/load_flags.h" | 27 #include "net/base/load_flags.h" |
| 28 #include "net/base/net_log.h" | 28 #include "net/base/net_log.h" |
| 29 #include "webkit/glue/resource_loader_bridge.h" | 29 #include "webkit/glue/resource_loader_bridge.h" |
| 30 | 30 |
| 31 using base::TimeTicks; | 31 using base::TimeTicks; |
| 32 | 32 |
| 33 namespace content { | 33 namespace content { |
| 34 | |
| 35 namespace { | 34 namespace { |
| 36 | 35 |
| 37 // When reading, we don't know if we are going to get EOF (0 bytes read), so | 36 // When reading, we don't know if we are going to get EOF (0 bytes read), so |
| 38 // we typically have a buffer that we allocated but did not use. We keep | 37 // we typically have a buffer that we allocated but did not use. We keep |
| 39 // this buffer around for the next read as a small optimization. | 38 // this buffer around for the next read as a small optimization. |
| 40 SharedIOBuffer* g_spare_read_buffer = NULL; | 39 SharedIOBuffer* g_spare_read_buffer = NULL; |
| 41 | 40 |
| 42 // The initial size of the shared memory buffer. (32 kilobytes). | 41 // The initial size of the shared memory buffer. (32 kilobytes). |
| 43 const int kInitialReadBufSize = 32768; | 42 const int kInitialReadBufSize = 32768; |
| 44 | 43 |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 | 157 |
| 159 bool AsyncResourceHandler::OnResponseStarted(int request_id, | 158 bool AsyncResourceHandler::OnResponseStarted(int request_id, |
| 160 ResourceResponse* response, | 159 ResourceResponse* response, |
| 161 bool* defer) { | 160 bool* defer) { |
| 162 // For changes to the main frame, inform the renderer of the new URL's | 161 // For changes to the main frame, inform the renderer of the new URL's |
| 163 // per-host settings before the request actually commits. This way the | 162 // per-host settings before the request actually commits. This way the |
| 164 // renderer will be able to set these precisely at the time the | 163 // renderer will be able to set these precisely at the time the |
| 165 // request commits, avoiding the possibility of e.g. zooming the old content | 164 // request commits, avoiding the possibility of e.g. zooming the old content |
| 166 // or of having to layout the new content twice. | 165 // or of having to layout the new content twice. |
| 167 | 166 |
| 168 content::ResourceContext* resource_context = filter_->resource_context(); | 167 ResourceContext* resource_context = filter_->resource_context(); |
| 169 if (rdh_->delegate()) { | 168 if (rdh_->delegate()) { |
| 170 rdh_->delegate()->OnResponseStarted(request_, resource_context, response, | 169 rdh_->delegate()->OnResponseStarted(request_, resource_context, response, |
| 171 filter_); | 170 filter_); |
| 172 } | 171 } |
| 173 | 172 |
| 174 DevToolsNetLogObserver::PopulateResponseInfo(request_, response); | 173 DevToolsNetLogObserver::PopulateResponseInfo(request_, response); |
| 175 | 174 |
| 176 HostZoomMap* host_zoom_map = | 175 HostZoomMap* host_zoom_map = |
| 177 GetHostZoomMapForResourceContext(resource_context); | 176 GetHostZoomMapForResourceContext(resource_context); |
| 178 | 177 |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 } | 351 } |
| 353 | 352 |
| 354 void AsyncResourceHandler::ResumeIfDeferred() { | 353 void AsyncResourceHandler::ResumeIfDeferred() { |
| 355 if (did_defer_) { | 354 if (did_defer_) { |
| 356 did_defer_ = false; | 355 did_defer_ = false; |
| 357 controller()->Resume(); | 356 controller()->Resume(); |
| 358 } | 357 } |
| 359 } | 358 } |
| 360 | 359 |
| 361 } // namespace content | 360 } // namespace content |
| OLD | NEW |