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

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

Issue 2893233002: Network traffic annotation added to URLLoaderImpl. (Closed)
Patch Set: Changed ParamTraits to StructTraits. Created 3 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/loader/navigation_url_loader_network_service.h" 5 #include "content/browser/loader/navigation_url_loader_network_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/trace_event/trace_event.h" 10 #include "base/trace_event/trace_event.h"
(...skipping 17 matching lines...) Expand all
28 #include "content/public/browser/browser_context.h" 28 #include "content/public/browser/browser_context.h"
29 #include "content/public/browser/browser_thread.h" 29 #include "content/public/browser/browser_thread.h"
30 #include "content/public/browser/global_request_id.h" 30 #include "content/public/browser/global_request_id.h"
31 #include "content/public/browser/navigation_data.h" 31 #include "content/public/browser/navigation_data.h"
32 #include "content/public/browser/navigation_ui_data.h" 32 #include "content/public/browser/navigation_ui_data.h"
33 #include "content/public/browser/ssl_status.h" 33 #include "content/public/browser/ssl_status.h"
34 #include "content/public/browser/stream_handle.h" 34 #include "content/public/browser/stream_handle.h"
35 #include "content/public/common/referrer.h" 35 #include "content/public/common/referrer.h"
36 #include "content/public/common/url_constants.h" 36 #include "content/public/common/url_constants.h"
37 #include "net/base/load_flags.h" 37 #include "net/base/load_flags.h"
38 #include "net/traffic_annotation/network_traffic_annotation.h"
38 #include "net/url_request/url_request_context.h" 39 #include "net/url_request/url_request_context.h"
39 40
40 namespace content { 41 namespace content {
41 42
42 namespace { 43 namespace {
43 44
44 // Request ID for browser initiated requests. We start at -2 on the same lines 45 // Request ID for browser initiated requests. We start at -2 on the same lines
45 // as ResourceDispatcherHostImpl. 46 // as ResourceDispatcherHostImpl.
46 int g_next_request_id = -2; 47 int g_next_request_id = -2;
47 48
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 } 99 }
99 100
100 // Requests to WebUI scheme won't get redirected to/from other schemes 101 // Requests to WebUI scheme won't get redirected to/from other schemes
101 // or be intercepted, so we just let it go here. 102 // or be intercepted, so we just let it go here.
102 if (factory_for_webui.is_valid()) { 103 if (factory_for_webui.is_valid()) {
103 mojom::URLLoaderFactoryPtr factory_ptr; 104 mojom::URLLoaderFactoryPtr factory_ptr;
104 factory_ptr.Bind(std::move(factory_for_webui)); 105 factory_ptr.Bind(std::move(factory_for_webui));
105 factory_ptr->CreateLoaderAndStart( 106 factory_ptr->CreateLoaderAndStart(
106 std::move(url_loader_request), 0 /* routing_id? */, 107 std::move(url_loader_request), 0 /* routing_id? */,
107 0 /* request_id? */, mojom::kURLLoadOptionSendSSLInfo, 108 0 /* request_id? */, mojom::kURLLoadOptionSendSSLInfo,
108 *resource_request_, std::move(url_loader_client_ptr)); 109 *resource_request_, std::move(url_loader_client_ptr),
110 net::MutableNetworkTrafficAnnotationTag(NO_TRAFFIC_ANNOTATION_YET));
109 return; 111 return;
110 } 112 }
111 113
112 DCHECK(handlers_.empty()); 114 DCHECK(handlers_.empty());
113 if (service_worker_navigation_handle_core) { 115 if (service_worker_navigation_handle_core) {
114 RequestContextFrameType frame_type = 116 RequestContextFrameType frame_type =
115 request_info->is_main_frame ? REQUEST_CONTEXT_FRAME_TYPE_TOP_LEVEL 117 request_info->is_main_frame ? REQUEST_CONTEXT_FRAME_TYPE_TOP_LEVEL
116 : REQUEST_CONTEXT_FRAME_TYPE_NESTED; 118 : REQUEST_CONTEXT_FRAME_TYPE_NESTED;
117 119
118 storage::BlobStorageContext* blob_storage_context = GetBlobStorageContext( 120 storage::BlobStorageContext* blob_storage_context = GetBlobStorageContext(
(...skipping 26 matching lines...) Expand all
145 MaybeStartLoader(nullptr); 147 MaybeStartLoader(nullptr);
146 } 148 }
147 149
148 void MaybeStartLoader(mojom::URLLoaderFactory* factory) { 150 void MaybeStartLoader(mojom::URLLoaderFactory* factory) {
149 DCHECK(url_loader_client_ptr_.is_bound()); 151 DCHECK(url_loader_client_ptr_.is_bound());
150 152
151 if (factory) { 153 if (factory) {
152 factory->CreateLoaderAndStart( 154 factory->CreateLoaderAndStart(
153 std::move(url_loader_request_), 0 /* routing_id? */, 155 std::move(url_loader_request_), 0 /* routing_id? */,
154 0 /* request_id? */, mojom::kURLLoadOptionSendSSLInfo, 156 0 /* request_id? */, mojom::kURLLoadOptionSendSSLInfo,
155 *resource_request_, std::move(url_loader_client_ptr_)); 157 *resource_request_, std::move(url_loader_client_ptr_),
158 net::MutableNetworkTrafficAnnotationTag(NO_TRAFFIC_ANNOTATION_YET));
156 return; 159 return;
157 } 160 }
158 161
159 if (handler_index_ < handlers_.size()) { 162 if (handler_index_ < handlers_.size()) {
160 handlers_[handler_index_++]->MaybeCreateLoaderFactory( 163 handlers_[handler_index_++]->MaybeCreateLoaderFactory(
161 *resource_request_, resource_context_, 164 *resource_request_, resource_context_,
162 base::BindOnce(&URLLoaderRequestController::MaybeStartLoader, 165 base::BindOnce(&URLLoaderRequestController::MaybeStartLoader,
163 base::Unretained(this))); 166 base::Unretained(this)));
164 return; 167 return;
165 } 168 }
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 TRACE_EVENT_ASYNC_END2("navigation", "Navigation timeToResponseStarted", 354 TRACE_EVENT_ASYNC_END2("navigation", "Navigation timeToResponseStarted",
352 this, "&NavigationURLLoaderNetworkService", this, 355 this, "&NavigationURLLoaderNetworkService", this,
353 "success", false); 356 "success", false);
354 357
355 delegate_->OnRequestFailed(completion_status.exists_in_cache, 358 delegate_->OnRequestFailed(completion_status.exists_in_cache,
356 completion_status.error_code); 359 completion_status.error_code);
357 } 360 }
358 } 361 }
359 362
360 } // namespace content 363 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698