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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 const GURL& new_url, | 105 const GURL& new_url, |
106 content::ResourceResponse* response, | 106 content::ResourceResponse* response, |
107 bool* defer) { | 107 bool* defer) { |
108 *defer = true; | 108 *defer = true; |
109 net::URLRequest* request = rdh_->GetURLRequest( | 109 net::URLRequest* request = rdh_->GetURLRequest( |
110 GlobalRequestID(filter_->child_id(), request_id)); | 110 GlobalRequestID(filter_->child_id(), request_id)); |
111 if (rdh_->delegate()) | 111 if (rdh_->delegate()) |
112 rdh_->delegate()->OnRequestRedirected(request, response); | 112 rdh_->delegate()->OnRequestRedirected(request, response); |
113 | 113 |
114 DevToolsNetLogObserver::PopulateResponseInfo(request, response); | 114 DevToolsNetLogObserver::PopulateResponseInfo(request, response); |
115 response->request_start = request->creation_time(); | 115 response->data.request_start = request->creation_time(); |
116 response->response_start = TimeTicks::Now(); | 116 response->data.response_start = TimeTicks::Now(); |
117 return filter_->Send(new ResourceMsg_ReceivedRedirect( | 117 return filter_->Send(new ResourceMsg_ReceivedRedirect( |
118 routing_id_, request_id, new_url, *response)); | 118 routing_id_, request_id, new_url, response->data)); |
119 } | 119 } |
120 | 120 |
121 bool AsyncResourceHandler::OnResponseStarted( | 121 bool AsyncResourceHandler::OnResponseStarted( |
122 int request_id, | 122 int request_id, |
123 content::ResourceResponse* response) { | 123 content::ResourceResponse* response) { |
124 // For changes to the main frame, inform the renderer of the new URL's | 124 // For changes to the main frame, inform the renderer of the new URL's |
125 // per-host settings before the request actually commits. This way the | 125 // per-host settings before the request actually commits. This way the |
126 // renderer will be able to set these precisely at the time the | 126 // renderer will be able to set these precisely at the time the |
127 // request commits, avoiding the possibility of e.g. zooming the old content | 127 // request commits, avoiding the possibility of e.g. zooming the old content |
128 // or of having to layout the new content twice. | 128 // or of having to layout the new content twice. |
(...skipping 11 matching lines...) Expand all Loading... |
140 | 140 |
141 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); | 141 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); |
142 if (info->GetResourceType() == ResourceType::MAIN_FRAME && host_zoom_map) { | 142 if (info->GetResourceType() == ResourceType::MAIN_FRAME && host_zoom_map) { |
143 GURL request_url(request->url()); | 143 GURL request_url(request->url()); |
144 filter_->Send(new ViewMsg_SetZoomLevelForLoadingURL( | 144 filter_->Send(new ViewMsg_SetZoomLevelForLoadingURL( |
145 info->GetRouteID(), | 145 info->GetRouteID(), |
146 request_url, host_zoom_map->GetZoomLevel(net::GetHostOrSpecFromURL( | 146 request_url, host_zoom_map->GetZoomLevel(net::GetHostOrSpecFromURL( |
147 request_url)))); | 147 request_url)))); |
148 } | 148 } |
149 | 149 |
150 response->request_start = request->creation_time(); | 150 response->data.request_start = request->creation_time(); |
151 response->response_start = TimeTicks::Now(); | 151 response->data.response_start = TimeTicks::Now(); |
152 filter_->Send(new ResourceMsg_ReceivedResponse( | 152 filter_->Send(new ResourceMsg_ReceivedResponse( |
153 routing_id_, request_id, *response)); | 153 routing_id_, request_id, response->data)); |
154 | 154 |
155 if (request->response_info().metadata) { | 155 if (request->response_info().metadata) { |
156 std::vector<char> copy(request->response_info().metadata->data(), | 156 std::vector<char> copy(request->response_info().metadata->data(), |
157 request->response_info().metadata->data() + | 157 request->response_info().metadata->data() + |
158 request->response_info().metadata->size()); | 158 request->response_info().metadata->size()); |
159 filter_->Send(new ResourceMsg_ReceivedCachedMetadata( | 159 filter_->Send(new ResourceMsg_ReceivedCachedMetadata( |
160 routing_id_, request_id, copy)); | 160 routing_id_, request_id, copy)); |
161 } | 161 } |
162 | 162 |
163 return true; | 163 return true; |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 void AsyncResourceHandler::GlobalCleanup() { | 280 void AsyncResourceHandler::GlobalCleanup() { |
281 if (g_spare_read_buffer) { | 281 if (g_spare_read_buffer) { |
282 // Avoid the CHECK in SharedIOBuffer::~SharedIOBuffer(). | 282 // Avoid the CHECK in SharedIOBuffer::~SharedIOBuffer(). |
283 SharedIOBuffer* tmp = g_spare_read_buffer; | 283 SharedIOBuffer* tmp = g_spare_read_buffer; |
284 g_spare_read_buffer = NULL; | 284 g_spare_read_buffer = NULL; |
285 tmp->Release(); | 285 tmp->Release(); |
286 } | 286 } |
287 } | 287 } |
288 | 288 |
289 } // namespace content | 289 } // namespace content |
OLD | NEW |