Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(474)

Side by Side Diff: content/browser/renderer_host/async_resource_handler.cc

Issue 9580002: Add ResourceRequestInfo. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
11 #include "base/hash_tables.h" 11 #include "base/hash_tables.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/shared_memory.h" 13 #include "base/shared_memory.h"
14 #include "content/browser/debugger/devtools_netlog_observer.h" 14 #include "content/browser/debugger/devtools_netlog_observer.h"
15 #include "content/browser/host_zoom_map_impl.h" 15 #include "content/browser/host_zoom_map_impl.h"
16 #include "content/browser/renderer_host/resource_dispatcher_host.h" 16 #include "content/browser/renderer_host/resource_dispatcher_host.h"
17 #include "content/browser/renderer_host/resource_dispatcher_host_request_info.h"
18 #include "content/browser/renderer_host/resource_message_filter.h" 17 #include "content/browser/renderer_host/resource_message_filter.h"
18 #include "content/browser/renderer_host/resource_request_info_impl.h"
19 #include "content/browser/resource_context_impl.h" 19 #include "content/browser/resource_context_impl.h"
20 #include "content/common/resource_messages.h" 20 #include "content/common/resource_messages.h"
21 #include "content/common/view_messages.h" 21 #include "content/common/view_messages.h"
22 #include "content/public/browser/global_request_id.h" 22 #include "content/public/browser/global_request_id.h"
23 #include "content/public/browser/resource_dispatcher_host_delegate.h" 23 #include "content/public/browser/resource_dispatcher_host_delegate.h"
24 #include "content/public/common/resource_response.h" 24 #include "content/public/common/resource_response.h"
25 #include "net/base/io_buffer.h" 25 #include "net/base/io_buffer.h"
26 #include "net/base/load_flags.h" 26 #include "net/base/load_flags.h"
27 #include "net/base/net_log.h" 27 #include "net/base/net_log.h"
28 #include "webkit/glue/resource_loader_bridge.h" 28 #include "webkit/glue/resource_loader_bridge.h"
29 29
30 using base::TimeTicks; 30 using base::TimeTicks;
31 using content::GlobalRequestID; 31 using content::GlobalRequestID;
32 using content::HostZoomMap; 32 using content::HostZoomMap;
33 using content::ResourceRequestInfoImpl;
33 34
34 namespace { 35 namespace {
35 36
36 // When reading, we don't know if we are going to get EOF (0 bytes read), so 37 // When reading, we don't know if we are going to get EOF (0 bytes read), so
37 // we typically have a buffer that we allocated but did not use. We keep 38 // we typically have a buffer that we allocated but did not use. We keep
38 // this buffer around for the next read as a small optimization. 39 // this buffer around for the next read as a small optimization.
39 SharedIOBuffer* g_spare_read_buffer = NULL; 40 SharedIOBuffer* g_spare_read_buffer = NULL;
40 41
41 // The initial size of the shared memory buffer. (32 kilobytes). 42 // The initial size of the shared memory buffer. (32 kilobytes).
42 const int kInitialReadBufSize = 32768; 43 const int kInitialReadBufSize = 32768;
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 132
132 if (rdh_->delegate()) 133 if (rdh_->delegate())
133 rdh_->delegate()->OnResponseStarted(request, response, filter_); 134 rdh_->delegate()->OnResponseStarted(request, response, filter_);
134 135
135 DevToolsNetLogObserver::PopulateResponseInfo(request, response); 136 DevToolsNetLogObserver::PopulateResponseInfo(request, response);
136 137
137 content::ResourceContext* resource_context = filter_->resource_context(); 138 content::ResourceContext* resource_context = filter_->resource_context();
138 content::HostZoomMap* host_zoom_map = 139 content::HostZoomMap* host_zoom_map =
139 content::GetHostZoomMapForResourceContext(resource_context); 140 content::GetHostZoomMapForResourceContext(resource_context);
140 141
141 ResourceDispatcherHostRequestInfo* info = rdh_->InfoForRequest(request); 142 ResourceRequestInfoImpl* info = rdh_->InfoForRequest(request);
142 if (info->resource_type() == ResourceType::MAIN_FRAME && host_zoom_map) { 143 if (info->GetResourceType() == ResourceType::MAIN_FRAME && host_zoom_map) {
143 GURL request_url(request->url()); 144 GURL request_url(request->url());
144 filter_->Send(new ViewMsg_SetZoomLevelForLoadingURL( 145 filter_->Send(new ViewMsg_SetZoomLevelForLoadingURL(
145 info->route_id(), 146 info->GetRouteID(),
146 request_url, host_zoom_map->GetZoomLevel(net::GetHostOrSpecFromURL( 147 request_url, host_zoom_map->GetZoomLevel(net::GetHostOrSpecFromURL(
147 request_url)))); 148 request_url))));
148 } 149 }
149 150
150 response->request_start = request->creation_time(); 151 response->request_start = request->creation_time();
151 response->response_start = TimeTicks::Now(); 152 response->response_start = TimeTicks::Now();
152 filter_->Send(new ResourceMsg_ReceivedResponse( 153 filter_->Send(new ResourceMsg_ReceivedResponse(
153 routing_id_, request_id, *response)); 154 routing_id_, request_id, *response));
154 155
155 if (request->response_info().metadata) { 156 if (request->response_info().metadata) {
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 279
279 // static 280 // static
280 void AsyncResourceHandler::GlobalCleanup() { 281 void AsyncResourceHandler::GlobalCleanup() {
281 if (g_spare_read_buffer) { 282 if (g_spare_read_buffer) {
282 // Avoid the CHECK in SharedIOBuffer::~SharedIOBuffer(). 283 // Avoid the CHECK in SharedIOBuffer::~SharedIOBuffer().
283 SharedIOBuffer* tmp = g_spare_read_buffer; 284 SharedIOBuffer* tmp = g_spare_read_buffer;
284 g_spare_read_buffer = NULL; 285 g_spare_read_buffer = NULL;
285 tmp->Release(); 286 tmp->Release();
286 } 287 }
287 } 288 }
OLDNEW
« no previous file with comments | « content/browser/download/download_resource_handler.cc ('k') | content/browser/renderer_host/buffered_resource_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698