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

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

Issue 2893233002: Network traffic annotation added to URLLoaderImpl. (Closed)
Patch Set: Mutable network traffic annotation added. 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 } 98 }
98 99
99 // Requests to WebUI scheme won't get redirected to/from other schemes 100 // Requests to WebUI scheme won't get redirected to/from other schemes
100 // or be intercepted, so we just let it go here. 101 // or be intercepted, so we just let it go here.
101 if (factory_for_webui.is_valid()) { 102 if (factory_for_webui.is_valid()) {
102 mojom::URLLoaderFactoryPtr factory_ptr; 103 mojom::URLLoaderFactoryPtr factory_ptr;
103 factory_ptr.Bind(std::move(factory_for_webui)); 104 factory_ptr.Bind(std::move(factory_for_webui));
104 factory_ptr->CreateLoaderAndStart( 105 factory_ptr->CreateLoaderAndStart(
105 std::move(url_loader_request), 0 /* routing_id? */, 106 std::move(url_loader_request), 0 /* routing_id? */,
106 0 /* request_id? */, mojom::kURLLoadOptionSendSSLInfo, 107 0 /* request_id? */, mojom::kURLLoadOptionSendSSLInfo,
107 *resource_request_, std::move(url_loader_client_ptr)); 108 *resource_request_, std::move(url_loader_client_ptr),
109 NO_TRAFFIC_ANNOTATION_YET);
108 return; 110 return;
109 } 111 }
110 112
111 DCHECK(handlers_.empty()); 113 DCHECK(handlers_.empty());
112 if (service_worker_navigation_handle_core) { 114 if (service_worker_navigation_handle_core) {
113 RequestContextFrameType frame_type = 115 RequestContextFrameType frame_type =
114 request_info->is_main_frame ? REQUEST_CONTEXT_FRAME_TYPE_TOP_LEVEL 116 request_info->is_main_frame ? REQUEST_CONTEXT_FRAME_TYPE_TOP_LEVEL
115 : REQUEST_CONTEXT_FRAME_TYPE_NESTED; 117 : REQUEST_CONTEXT_FRAME_TYPE_NESTED;
116 118
117 storage::BlobStorageContext* blob_storage_context = GetBlobStorageContext( 119 storage::BlobStorageContext* blob_storage_context = GetBlobStorageContext(
(...skipping 29 matching lines...) Expand all
147 MaybeStartLoader(nullptr); 149 MaybeStartLoader(nullptr);
148 } 150 }
149 151
150 void MaybeStartLoader(mojom::URLLoaderFactory* factory) { 152 void MaybeStartLoader(mojom::URLLoaderFactory* factory) {
151 DCHECK(url_loader_client_ptr_.is_bound()); 153 DCHECK(url_loader_client_ptr_.is_bound());
152 154
153 if (factory) { 155 if (factory) {
154 factory->CreateLoaderAndStart( 156 factory->CreateLoaderAndStart(
155 std::move(url_loader_request_), 0 /* routing_id? */, 157 std::move(url_loader_request_), 0 /* routing_id? */,
156 0 /* request_id? */, mojom::kURLLoadOptionSendSSLInfo, 158 0 /* request_id? */, mojom::kURLLoadOptionSendSSLInfo,
157 *resource_request_, std::move(url_loader_client_ptr_)); 159 *resource_request_, std::move(url_loader_client_ptr_),
160 NO_TRAFFIC_ANNOTATION_YET);
158 return; 161 return;
159 } 162 }
160 163
161 if (handler_index_ < handlers_.size()) { 164 if (handler_index_ < handlers_.size()) {
162 handlers_[handler_index_++]->MaybeCreateLoaderFactory( 165 handlers_[handler_index_++]->MaybeCreateLoaderFactory(
163 *resource_request_, resource_context_, 166 *resource_request_, resource_context_,
164 base::BindOnce(&URLLoaderRequestController::MaybeStartLoader, 167 base::BindOnce(&URLLoaderRequestController::MaybeStartLoader,
165 base::Unretained(this))); 168 base::Unretained(this)));
166 return; 169 return;
167 } 170 }
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 TRACE_EVENT_ASYNC_END2("navigation", "Navigation timeToResponseStarted", 353 TRACE_EVENT_ASYNC_END2("navigation", "Navigation timeToResponseStarted",
351 this, "&NavigationURLLoaderNetworkService", this, 354 this, "&NavigationURLLoaderNetworkService", this,
352 "success", false); 355 "success", false);
353 356
354 delegate_->OnRequestFailed(completion_status.exists_in_cache, 357 delegate_->OnRequestFailed(completion_status.exists_in_cache,
355 completion_status.error_code); 358 completion_status.error_code);
356 } 359 }
357 } 360 }
358 361
359 } // namespace content 362 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698