OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/renderer_host/async_resource_handler.h" | 5 #include "chrome/browser/renderer_host/async_resource_handler.h" |
6 | 6 |
7 #include "base/hash_tables.h" | 7 #include "base/hash_tables.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/process.h" | 9 #include "base/process.h" |
10 #include "base/shared_memory.h" | 10 #include "base/shared_memory.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 return receiver_->Send(new ViewMsg_Resource_UploadProgress(routing_id_, | 95 return receiver_->Send(new ViewMsg_Resource_UploadProgress(routing_id_, |
96 request_id, | 96 request_id, |
97 position, size)); | 97 position, size)); |
98 } | 98 } |
99 | 99 |
100 bool AsyncResourceHandler::OnRequestRedirected(int request_id, | 100 bool AsyncResourceHandler::OnRequestRedirected(int request_id, |
101 const GURL& new_url, | 101 const GURL& new_url, |
102 ResourceResponse* response, | 102 ResourceResponse* response, |
103 bool* defer) { | 103 bool* defer) { |
104 *defer = true; | 104 *defer = true; |
105 URLRequest* request = rdh_->GetURLRequest( | 105 net::URLRequest* request = rdh_->GetURLRequest( |
106 GlobalRequestID(process_id_, request_id)); | 106 GlobalRequestID(process_id_, request_id)); |
107 LoadTimingObserver::PopulateTimingInfo(request, response); | 107 LoadTimingObserver::PopulateTimingInfo(request, response); |
108 DevToolsNetLogObserver::PopulateResponseInfo(request, response); | 108 DevToolsNetLogObserver::PopulateResponseInfo(request, response); |
109 return receiver_->Send(new ViewMsg_Resource_ReceivedRedirect( | 109 return receiver_->Send(new ViewMsg_Resource_ReceivedRedirect( |
110 routing_id_, request_id, new_url, response->response_head)); | 110 routing_id_, request_id, new_url, response->response_head)); |
111 } | 111 } |
112 | 112 |
113 bool AsyncResourceHandler::OnResponseStarted(int request_id, | 113 bool AsyncResourceHandler::OnResponseStarted(int request_id, |
114 ResourceResponse* response) { | 114 ResourceResponse* response) { |
115 // For changes to the main frame, inform the renderer of the new URL's | 115 // For changes to the main frame, inform the renderer of the new URL's |
116 // per-host settings before the request actually commits. This way the | 116 // per-host settings before the request actually commits. This way the |
117 // renderer will be able to set these precisely at the time the | 117 // renderer will be able to set these precisely at the time the |
118 // request commits, avoiding the possibility of e.g. zooming the old content | 118 // request commits, avoiding the possibility of e.g. zooming the old content |
119 // or of having to layout the new content twice. | 119 // or of having to layout the new content twice. |
120 URLRequest* request = rdh_->GetURLRequest( | 120 net::URLRequest* request = rdh_->GetURLRequest( |
121 GlobalRequestID(process_id_, request_id)); | 121 GlobalRequestID(process_id_, request_id)); |
122 | 122 |
123 LoadTimingObserver::PopulateTimingInfo(request, response); | 123 LoadTimingObserver::PopulateTimingInfo(request, response); |
124 DevToolsNetLogObserver::PopulateResponseInfo(request, response); | 124 DevToolsNetLogObserver::PopulateResponseInfo(request, response); |
125 | 125 |
126 ResourceDispatcherHostRequestInfo* info = rdh_->InfoForRequest(request); | 126 ResourceDispatcherHostRequestInfo* info = rdh_->InfoForRequest(request); |
127 if (info->resource_type() == ResourceType::MAIN_FRAME) { | 127 if (info->resource_type() == ResourceType::MAIN_FRAME) { |
128 GURL request_url(request->url()); | 128 GURL request_url(request->url()); |
129 ChromeURLRequestContext* context = | 129 ChromeURLRequestContext* context = |
130 static_cast<ChromeURLRequestContext*>(request->context()); | 130 static_cast<ChromeURLRequestContext*>(request->context()); |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 | 255 |
256 // static | 256 // static |
257 void AsyncResourceHandler::GlobalCleanup() { | 257 void AsyncResourceHandler::GlobalCleanup() { |
258 if (g_spare_read_buffer) { | 258 if (g_spare_read_buffer) { |
259 // Avoid the CHECK in SharedIOBuffer::~SharedIOBuffer(). | 259 // Avoid the CHECK in SharedIOBuffer::~SharedIOBuffer(). |
260 SharedIOBuffer* tmp = g_spare_read_buffer; | 260 SharedIOBuffer* tmp = g_spare_read_buffer; |
261 g_spare_read_buffer = NULL; | 261 g_spare_read_buffer = NULL; |
262 tmp->Release(); | 262 tmp->Release(); |
263 } | 263 } |
264 } | 264 } |
OLD | NEW |