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

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

Issue 10416002: Seculative resource prefetching for URLs CL. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Moving to WeakPtrs and RVHD. 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
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/sync_resource_handler.h" 5 #include "content/browser/renderer_host/sync_resource_handler.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "content/browser/debugger/devtools_netlog_observer.h" 8 #include "content/browser/debugger/devtools_netlog_observer.h"
9 #include "content/browser/renderer_host/resource_dispatcher_host_impl.h" 9 #include "content/browser/renderer_host/resource_dispatcher_host_impl.h"
10 #include "content/browser/renderer_host/resource_message_filter.h" 10 #include "content/browser/renderer_host/resource_message_filter.h"
(...skipping 27 matching lines...) Expand all
38 } 38 }
39 39
40 bool SyncResourceHandler::OnRequestRedirected( 40 bool SyncResourceHandler::OnRequestRedirected(
41 int request_id, 41 int request_id,
42 const GURL& new_url, 42 const GURL& new_url,
43 ResourceResponse* response, 43 ResourceResponse* response,
44 bool* defer) { 44 bool* defer) {
45 net::URLRequest* request = rdh_->GetURLRequest( 45 net::URLRequest* request = rdh_->GetURLRequest(
46 GlobalRequestID(filter_->child_id(), request_id)); 46 GlobalRequestID(filter_->child_id(), request_id));
47 if (rdh_->delegate()) 47 if (rdh_->delegate())
48 rdh_->delegate()->OnRequestRedirected(request, response); 48 rdh_->delegate()->OnRequestRedirected(request, filter_->resource_context(),
49 response);
49 50
50 DevToolsNetLogObserver::PopulateResponseInfo(request, response); 51 DevToolsNetLogObserver::PopulateResponseInfo(request, response);
51 // TODO(darin): It would be much better if this could live in WebCore, but 52 // TODO(darin): It would be much better if this could live in WebCore, but
52 // doing so requires API changes at all levels. Similar code exists in 53 // doing so requires API changes at all levels. Similar code exists in
53 // WebCore/platform/network/cf/ResourceHandleCFNet.cpp :-( 54 // WebCore/platform/network/cf/ResourceHandleCFNet.cpp :-(
54 if (new_url.GetOrigin() != result_.final_url.GetOrigin()) { 55 if (new_url.GetOrigin() != result_.final_url.GetOrigin()) {
55 LOG(ERROR) << "Cross origin redirect denied"; 56 LOG(ERROR) << "Cross origin redirect denied";
56 return false; 57 return false;
57 } 58 }
58 result_.final_url = new_url; 59 result_.final_url = new_url;
59 return true; 60 return true;
60 } 61 }
61 62
62 bool SyncResourceHandler::OnResponseStarted( 63 bool SyncResourceHandler::OnResponseStarted(
63 int request_id, 64 int request_id,
64 ResourceResponse* response, 65 ResourceResponse* response,
65 bool* defer) { 66 bool* defer) {
66 net::URLRequest* request = rdh_->GetURLRequest( 67 net::URLRequest* request = rdh_->GetURLRequest(
67 GlobalRequestID(filter_->child_id(), request_id)); 68 GlobalRequestID(filter_->child_id(), request_id));
68 if (rdh_->delegate()) 69 if (rdh_->delegate())
69 rdh_->delegate()->OnResponseStarted(request, response, filter_); 70 rdh_->delegate()->OnResponseStarted(request, filter_->resource_context(),
71 response, filter_);
70 72
71 DevToolsNetLogObserver::PopulateResponseInfo(request, response); 73 DevToolsNetLogObserver::PopulateResponseInfo(request, response);
72 74
73 // We don't care about copying the status here. 75 // We don't care about copying the status here.
74 result_.headers = response->headers; 76 result_.headers = response->headers;
75 result_.mime_type = response->mime_type; 77 result_.mime_type = response->mime_type;
76 result_.charset = response->charset; 78 result_.charset = response->charset;
77 result_.download_file_path = response->download_file_path; 79 result_.download_file_path = response->download_file_path;
78 result_.request_time = response->request_time; 80 result_.request_time = response->request_time;
79 result_.response_time = response->response_time; 81 result_.response_time = response->response_time;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 127
126 void SyncResourceHandler::OnRequestClosed() { 128 void SyncResourceHandler::OnRequestClosed() {
127 if (!result_message_) 129 if (!result_message_)
128 return; 130 return;
129 131
130 result_message_->set_reply_error(); 132 result_message_->set_reply_error();
131 filter_->Send(result_message_); 133 filter_->Send(result_message_);
132 } 134 }
133 135
134 } // namespace content 136 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698