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

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

Issue 10416003: RefCounted types should not have public destructors (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: One more fix Created 8 years, 6 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"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 bool AsyncResourceHandler::OnRequestRedirected(int request_id, 141 bool AsyncResourceHandler::OnRequestRedirected(int request_id,
142 const GURL& new_url, 142 const GURL& new_url,
143 ResourceResponse* response, 143 ResourceResponse* response,
144 bool* defer) { 144 bool* defer) {
145 *defer = did_defer_ = true; 145 *defer = did_defer_ = true;
146 146
147 if (rdh_->delegate()) 147 if (rdh_->delegate())
148 rdh_->delegate()->OnRequestRedirected(request_, response); 148 rdh_->delegate()->OnRequestRedirected(request_, response);
149 149
150 DevToolsNetLogObserver::PopulateResponseInfo(request_, response); 150 DevToolsNetLogObserver::PopulateResponseInfo(request_, response);
151 response->request_start = request_->creation_time(); 151 response->head.request_start = request_->creation_time();
152 response->response_start = TimeTicks::Now(); 152 response->head.response_start = TimeTicks::Now();
153 return filter_->Send(new ResourceMsg_ReceivedRedirect( 153 return filter_->Send(new ResourceMsg_ReceivedRedirect(
154 routing_id_, request_id, new_url, *response)); 154 routing_id_, request_id, new_url, response->head));
155 } 155 }
156 156
157 bool AsyncResourceHandler::OnResponseStarted(int request_id, 157 bool AsyncResourceHandler::OnResponseStarted(int request_id,
158 ResourceResponse* response, 158 ResourceResponse* response,
159 bool* defer) { 159 bool* defer) {
160 // For changes to the main frame, inform the renderer of the new URL's 160 // For changes to the main frame, inform the renderer of the new URL's
161 // per-host settings before the request actually commits. This way the 161 // per-host settings before the request actually commits. This way the
162 // renderer will be able to set these precisely at the time the 162 // renderer will be able to set these precisely at the time the
163 // request commits, avoiding the possibility of e.g. zooming the old content 163 // request commits, avoiding the possibility of e.g. zooming the old content
164 // or of having to layout the new content twice. 164 // or of having to layout the new content twice.
165 165
166 if (rdh_->delegate()) 166 if (rdh_->delegate())
167 rdh_->delegate()->OnResponseStarted(request_, response, filter_); 167 rdh_->delegate()->OnResponseStarted(request_, response, filter_);
168 168
169 DevToolsNetLogObserver::PopulateResponseInfo(request_, response); 169 DevToolsNetLogObserver::PopulateResponseInfo(request_, response);
170 170
171 ResourceContext* resource_context = filter_->resource_context(); 171 ResourceContext* resource_context = filter_->resource_context();
172 HostZoomMap* host_zoom_map = 172 HostZoomMap* host_zoom_map =
173 GetHostZoomMapForResourceContext(resource_context); 173 GetHostZoomMapForResourceContext(resource_context);
174 174
175 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request_); 175 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request_);
176 if (info->GetResourceType() == ResourceType::MAIN_FRAME && host_zoom_map) { 176 if (info->GetResourceType() == ResourceType::MAIN_FRAME && host_zoom_map) {
177 const GURL& request_url = request_->url(); 177 const GURL& request_url = request_->url();
178 filter_->Send(new ViewMsg_SetZoomLevelForLoadingURL( 178 filter_->Send(new ViewMsg_SetZoomLevelForLoadingURL(
179 info->GetRouteID(), 179 info->GetRouteID(),
180 request_url, host_zoom_map->GetZoomLevel(net::GetHostOrSpecFromURL( 180 request_url, host_zoom_map->GetZoomLevel(net::GetHostOrSpecFromURL(
181 request_url)))); 181 request_url))));
182 } 182 }
183 183
184 response->request_start = request_->creation_time(); 184 response->head.request_start = request_->creation_time();
185 response->response_start = TimeTicks::Now(); 185 response->head.response_start = TimeTicks::Now();
186 filter_->Send(new ResourceMsg_ReceivedResponse( 186 filter_->Send(new ResourceMsg_ReceivedResponse(
187 routing_id_, request_id, *response)); 187 routing_id_, request_id, response->head));
188 188
189 if (request_->response_info().metadata) { 189 if (request_->response_info().metadata) {
190 std::vector<char> copy(request_->response_info().metadata->data(), 190 std::vector<char> copy(request_->response_info().metadata->data(),
191 request_->response_info().metadata->data() + 191 request_->response_info().metadata->data() +
192 request_->response_info().metadata->size()); 192 request_->response_info().metadata->size());
193 filter_->Send(new ResourceMsg_ReceivedCachedMetadata( 193 filter_->Send(new ResourceMsg_ReceivedCachedMetadata(
194 routing_id_, request_id, copy)); 194 routing_id_, request_id, copy));
195 } 195 }
196 196
197 return true; 197 return true;
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 } 330 }
331 331
332 void AsyncResourceHandler::ResumeIfDeferred() { 332 void AsyncResourceHandler::ResumeIfDeferred() {
333 if (did_defer_) { 333 if (did_defer_) {
334 did_defer_ = false; 334 did_defer_ = false;
335 controller()->Resume(); 335 controller()->Resume();
336 } 336 }
337 } 337 }
338 338
339 } // namespace content 339 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/download/download_resource_handler.cc ('k') | content/browser/renderer_host/buffered_resource_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698