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

Side by Side Diff: chrome/browser/net/chrome_network_delegate.cc

Issue 691553004: Record stack trace and coarse reason for referrer failures (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updates Created 6 years, 1 month 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 #include "chrome/browser/net/chrome_network_delegate.h" 5 #include "chrome/browser/net/chrome_network_delegate.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 8
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/base_paths.h" 11 #include "base/base_paths.h"
12 #include "base/debug/alias.h"
12 #include "base/debug/dump_without_crashing.h" 13 #include "base/debug/dump_without_crashing.h"
14 #include "base/debug/stack_trace.h"
13 #include "base/debug/trace_event.h" 15 #include "base/debug/trace_event.h"
14 #include "base/logging.h" 16 #include "base/logging.h"
15 #include "base/metrics/histogram.h" 17 #include "base/metrics/histogram.h"
16 #include "base/metrics/user_metrics.h" 18 #include "base/metrics/user_metrics.h"
17 #include "base/path_service.h" 19 #include "base/path_service.h"
18 #include "base/prefs/pref_member.h" 20 #include "base/prefs/pref_member.h"
19 #include "base/prefs/pref_service.h" 21 #include "base/prefs/pref_service.h"
20 #include "base/strings/string_number_conversions.h" 22 #include "base/strings/string_number_conversions.h"
21 #include "base/time/time.h" 23 #include "base/time/time.h"
22 #include "chrome/browser/browser_process.h" 24 #include "chrome/browser/browser_process.h"
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 void RecordIOThreadToRequestStartOnUIThread( 222 void RecordIOThreadToRequestStartOnUIThread(
221 const base::TimeTicks& request_start) { 223 const base::TimeTicks& request_start) {
222 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 224 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
223 base::TimeDelta request_lag = request_start - 225 base::TimeDelta request_lag = request_start -
224 g_browser_process->io_thread()->creation_time(); 226 g_browser_process->io_thread()->creation_time();
225 UMA_HISTOGRAM_TIMES("Net.IOThreadCreationToHTTPRequestStart", request_lag); 227 UMA_HISTOGRAM_TIMES("Net.IOThreadCreationToHTTPRequestStart", request_lag);
226 } 228 }
227 #endif // defined(OS_ANDROID) 229 #endif // defined(OS_ANDROID)
228 230
229 void ReportInvalidReferrerSend(const GURL& target_url, 231 void ReportInvalidReferrerSend(const GURL& target_url,
230 const GURL& referrer_url) { 232 const GURL& referrer_url,
233 const base::debug::StackTrace& callstack) {
234 // Record information to help debug http://crbug.com/422871
235 base::debug::StackTrace trace = callstack;
236 base::debug::Alias(&trace);
237 enum { INVALID_URL, FILE_URL, DATA_URL, HTTP_URL, OTHER } reason = OTHER;
238 if (!target_url.is_valid())
239 reason = INVALID_URL;
240 else if (target_url.SchemeIsFile())
241 reason = FILE_URL;
242 else if (target_url.SchemeIs(url::kDataScheme))
243 reason = DATA_URL;
244 else if (target_url.SchemeIs(url::kHttpScheme))
245 reason = HTTP_URL;
246 base::debug::Alias(&reason);
231 base::RecordAction( 247 base::RecordAction(
232 base::UserMetricsAction("Net.URLRequest_StartJob_InvalidReferrer")); 248 base::UserMetricsAction("Net.URLRequest_StartJob_InvalidReferrer"));
233 base::debug::DumpWithoutCrashing(); 249 base::debug::DumpWithoutCrashing();
234 NOTREACHED(); 250 NOTREACHED();
235 } 251 }
236 252
237 } // namespace 253 } // namespace
238 254
239 ChromeNetworkDelegate::ChromeNetworkDelegate( 255 ChromeNetworkDelegate::ChromeNetworkDelegate(
240 extensions::EventRouterForwarder* event_router, 256 extensions::EventRouterForwarder* event_router,
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after
785 bool setting_cookie_allowed = cookie_settings_->IsSettingCookieAllowed( 801 bool setting_cookie_allowed = cookie_settings_->IsSettingCookieAllowed(
786 url, first_party_for_cookies); 802 url, first_party_for_cookies);
787 bool privacy_mode = !(reading_cookie_allowed && setting_cookie_allowed); 803 bool privacy_mode = !(reading_cookie_allowed && setting_cookie_allowed);
788 return privacy_mode; 804 return privacy_mode;
789 } 805 }
790 806
791 bool ChromeNetworkDelegate::OnCancelURLRequestWithPolicyViolatingReferrerHeader( 807 bool ChromeNetworkDelegate::OnCancelURLRequestWithPolicyViolatingReferrerHeader(
792 const net::URLRequest& request, 808 const net::URLRequest& request,
793 const GURL& target_url, 809 const GURL& target_url,
794 const GURL& referrer_url) const { 810 const GURL& referrer_url) const {
811 base::debug::StackTrace callstack;
795 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, 812 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
796 base::Bind(&ReportInvalidReferrerSend, target_url, referrer_url)); 813 base::Bind(&ReportInvalidReferrerSend, target_url,
814 referrer_url, callstack));
797 return true; 815 return true;
798 } 816 }
799 817
800 void ChromeNetworkDelegate::AccumulateContentLength( 818 void ChromeNetworkDelegate::AccumulateContentLength(
801 int64 received_content_length, 819 int64 received_content_length,
802 int64 original_content_length, 820 int64 original_content_length,
803 data_reduction_proxy::DataReductionProxyRequestType request_type) { 821 data_reduction_proxy::DataReductionProxyRequestType request_type) {
804 DCHECK_GE(received_content_length, 0); 822 DCHECK_GE(received_content_length, 0);
805 DCHECK_GE(original_content_length, 0); 823 DCHECK_GE(original_content_length, 0);
806 if (data_reduction_proxy_statistics_prefs_) { 824 if (data_reduction_proxy_statistics_prefs_) {
807 StoreAccumulatedContentLength(received_content_length, 825 StoreAccumulatedContentLength(received_content_length,
808 original_content_length, 826 original_content_length,
809 request_type, 827 request_type,
810 reinterpret_cast<Profile*>(profile_), 828 reinterpret_cast<Profile*>(profile_),
811 data_reduction_proxy_statistics_prefs_); 829 data_reduction_proxy_statistics_prefs_);
812 } 830 }
813 received_content_length_ += received_content_length; 831 received_content_length_ += received_content_length;
814 original_content_length_ += original_content_length; 832 original_content_length_ += original_content_length;
815 } 833 }
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