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

Side by Side Diff: content/browser/loader/resource_dispatcher_host_impl.cc

Issue 2843403002: Network traffic annotation added to ResourceDisaptcherHostImpl. (Closed)
Patch Set: Annotation updated. Created 3 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading 5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading
6 6
7 #include "content/browser/loader/resource_dispatcher_host_impl.h" 7 #include "content/browser/loader/resource_dispatcher_host_impl.h"
8 8
9 #include <stddef.h> 9 #include <stddef.h>
10 10
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" 98 #include "net/base/registry_controlled_domains/registry_controlled_domain.h"
99 #include "net/base/upload_data_stream.h" 99 #include "net/base/upload_data_stream.h"
100 #include "net/cert/cert_status_flags.h" 100 #include "net/cert/cert_status_flags.h"
101 #include "net/cookies/cookie_monster.h" 101 #include "net/cookies/cookie_monster.h"
102 #include "net/http/http_request_headers.h" 102 #include "net/http/http_request_headers.h"
103 #include "net/http/http_response_headers.h" 103 #include "net/http/http_response_headers.h"
104 #include "net/http/http_response_info.h" 104 #include "net/http/http_response_info.h"
105 #include "net/log/net_log_with_source.h" 105 #include "net/log/net_log_with_source.h"
106 #include "net/ssl/client_cert_store.h" 106 #include "net/ssl/client_cert_store.h"
107 #include "net/ssl/ssl_cert_request_info.h" 107 #include "net/ssl/ssl_cert_request_info.h"
108 #include "net/traffic_annotation/network_traffic_annotation.h"
108 #include "net/url_request/url_request.h" 109 #include "net/url_request/url_request.h"
109 #include "net/url_request/url_request_context.h" 110 #include "net/url_request/url_request_context.h"
110 #include "net/url_request/url_request_job_factory.h" 111 #include "net/url_request/url_request_job_factory.h"
111 #include "ppapi/features/features.h" 112 #include "ppapi/features/features.h"
112 #include "storage/browser/blob/blob_data_handle.h" 113 #include "storage/browser/blob/blob_data_handle.h"
113 #include "storage/browser/blob/blob_storage_context.h" 114 #include "storage/browser/blob/blob_storage_context.h"
114 #include "storage/browser/blob/blob_url_request_job_factory.h" 115 #include "storage/browser/blob/blob_url_request_job_factory.h"
115 #include "storage/browser/blob/shareable_file_reference.h" 116 #include "storage/browser/blob/shareable_file_reference.h"
116 #include "storage/browser/fileapi/file_permission_policy.h" 117 #include "storage/browser/fileapi/file_permission_policy.h"
117 #include "storage/browser/fileapi/file_system_context.h" 118 #include "storage/browser/fileapi/file_system_context.h"
118 #include "url/third_party/mozilla/url_parse.h" 119 #include "url/third_party/mozilla/url_parse.h"
119 #include "url/url_constants.h" 120 #include "url/url_constants.h"
120 121
121 using base::Time; 122 using base::Time;
122 using base::TimeDelta; 123 using base::TimeDelta;
123 using base::TimeTicks; 124 using base::TimeTicks;
124 using storage::ShareableFileReference; 125 using storage::ShareableFileReference;
125 using SyncLoadResultCallback = 126 using SyncLoadResultCallback =
126 content::ResourceDispatcherHostImpl::SyncLoadResultCallback; 127 content::ResourceDispatcherHostImpl::SyncLoadResultCallback;
127 128
128 // ---------------------------------------------------------------------------- 129 // ----------------------------------------------------------------------------
129 130
131 namespace {
132
133 constexpr net::NetworkTrafficAnnotationTag kTrafficAnnotation =
134 net::DefineNetworkTrafficAnnotation("resource_dispather_host", R"(
135 semantics {
136 sender: "Resource Dispatcher Host"
137 description:
138 "Navigation-initiated request or renderer process initiated "
139 "request, which includes all resources for normal page loads, "
140 "chrome URLs, resources for installed extensions, as well as "
141 "downloads."
142 trigger:
143 "Navigating to a URL or downloading a file. A webpage, "
144 "ServiceWorker, chrome:// page, or extension may also initiate "
145 "requests in the background."
146 data: "Anything the initiator wants to send."
147 destination: OTHER
148 }
149 policy {
150 cookies_allowed: true
151 cookies_store: "user or per-app cookie store"
152 setting: "These requests cannot be disabled."
153 policy_exception_justification:
154 "Not implemented. Without these requests, Chrome will be unable to "
155 "load any webpage."
156 })");
157
158 } // namespace
159
130 namespace content { 160 namespace content {
131 161
132 namespace { 162 namespace {
133 163
134 static ResourceDispatcherHostImpl* g_resource_dispatcher_host; 164 static ResourceDispatcherHostImpl* g_resource_dispatcher_host;
135 165
136 // The interval for calls to ResourceDispatcherHostImpl::UpdateLoadStates 166 // The interval for calls to ResourceDispatcherHostImpl::UpdateLoadStates
137 const int kUpdateLoadStatesIntervalMsec = 250; 167 const int kUpdateLoadStatesIntervalMsec = 250;
138 168
139 // Maximum byte "cost" of all the outstanding requests for a renderer. 169 // Maximum byte "cost" of all the outstanding requests for a renderer.
(...skipping 1060 matching lines...) Expand 10 before | Expand all | Expand 10 after
1200 resource_context)) { 1230 resource_context)) {
1201 AbortRequestBeforeItStarts(requester_info->filter(), sync_result_handler, 1231 AbortRequestBeforeItStarts(requester_info->filter(), sync_result_handler,
1202 request_id, std::move(url_loader_client)); 1232 request_id, std::move(url_loader_client));
1203 return; 1233 return;
1204 } 1234 }
1205 1235
1206 // Construct the request. 1236 // Construct the request.
1207 std::unique_ptr<net::URLRequest> new_request = request_context->CreateRequest( 1237 std::unique_ptr<net::URLRequest> new_request = request_context->CreateRequest(
1208 is_navigation_stream_request ? request_data.resource_body_stream_url 1238 is_navigation_stream_request ? request_data.resource_body_stream_url
1209 : request_data.url, 1239 : request_data.url,
1210 request_data.priority, nullptr); 1240 request_data.priority, nullptr, kTrafficAnnotation);
1211 1241
1212 // Log that this request is a service worker navigation preload request here, 1242 // Log that this request is a service worker navigation preload request here,
1213 // since navigation preload machinery has no access to netlog. 1243 // since navigation preload machinery has no access to netlog.
1214 // TODO(falken): Figure out how mojom::URLLoaderClient can 1244 // TODO(falken): Figure out how mojom::URLLoaderClient can
1215 // access the request's netlog. 1245 // access the request's netlog.
1216 if (requester_info->IsNavigationPreload()) { 1246 if (requester_info->IsNavigationPreload()) {
1217 new_request->net_log().AddEvent( 1247 new_request->net_log().AddEvent(
1218 net::NetLogEventType::SERVICE_WORKER_NAVIGATION_PRELOAD_REQUEST); 1248 net::NetLogEventType::SERVICE_WORKER_NAVIGATION_PRELOAD_REQUEST);
1219 } 1249 }
1220 1250
(...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after
1965 1995
1966 // TODO(davidben): BuildLoadFlagsForRequest includes logic for 1996 // TODO(davidben): BuildLoadFlagsForRequest includes logic for
1967 // CanSendCookiesForOrigin and CanReadRawCookies. Is this needed here? 1997 // CanSendCookiesForOrigin and CanReadRawCookies. Is this needed here?
1968 1998
1969 // Sync loads should have maximum priority and should be the only 1999 // Sync loads should have maximum priority and should be the only
1970 // requests that have the ignore limits flag set. 2000 // requests that have the ignore limits flag set.
1971 DCHECK(!(load_flags & net::LOAD_IGNORE_LIMITS)); 2001 DCHECK(!(load_flags & net::LOAD_IGNORE_LIMITS));
1972 2002
1973 std::unique_ptr<net::URLRequest> new_request; 2003 std::unique_ptr<net::URLRequest> new_request;
1974 new_request = request_context->CreateRequest( 2004 new_request = request_context->CreateRequest(
1975 info.common_params.url, net::HIGHEST, nullptr); 2005 info.common_params.url, net::HIGHEST, nullptr, kTrafficAnnotation);
1976 2006
1977 new_request->set_method(info.common_params.method); 2007 new_request->set_method(info.common_params.method);
1978 new_request->set_first_party_for_cookies( 2008 new_request->set_first_party_for_cookies(
1979 info.first_party_for_cookies); 2009 info.first_party_for_cookies);
1980 new_request->set_initiator(info.begin_params.initiator_origin); 2010 new_request->set_initiator(info.begin_params.initiator_origin);
1981 if (info.is_main_frame) { 2011 if (info.is_main_frame) {
1982 new_request->set_first_party_url_policy( 2012 new_request->set_first_party_url_policy(
1983 net::URLRequest::UPDATE_FIRST_PARTY_URL_ON_REDIRECT); 2013 net::URLRequest::UPDATE_FIRST_PARTY_URL_ON_REDIRECT);
1984 } 2014 }
1985 2015
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after
2615 &throttles); 2645 &throttles);
2616 if (!throttles.empty()) { 2646 if (!throttles.empty()) {
2617 handler.reset(new ThrottlingResourceHandler(std::move(handler), request, 2647 handler.reset(new ThrottlingResourceHandler(std::move(handler), request,
2618 std::move(throttles))); 2648 std::move(throttles)));
2619 } 2649 }
2620 } 2650 }
2621 return handler; 2651 return handler;
2622 } 2652 }
2623 2653
2624 } // namespace content 2654 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698