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

Side by Side Diff: components/captive_portal/captive_portal_detector.cc

Issue 648873003: Adding instrumentation to locate the source of jankiness. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 "components/captive_portal/captive_portal_detector.h" 5 #include "components/captive_portal/captive_portal_detector.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/profiler/scoped_profile.h"
8 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
9 #include "net/base/load_flags.h" 10 #include "net/base/load_flags.h"
10 #include "net/http/http_response_headers.h" 11 #include "net/http/http_response_headers.h"
11 #include "net/url_request/url_request_status.h" 12 #include "net/url_request/url_request_status.h"
12 13
13 namespace captive_portal { 14 namespace captive_portal {
14 15
15 const char CaptivePortalDetector::kDefaultURL[] = 16 const char CaptivePortalDetector::kDefaultURL[] =
16 "http://www.gstatic.com/generate_204"; 17 "http://www.gstatic.com/generate_204";
17 18
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 net::LOAD_DO_NOT_SEND_AUTH_DATA); 51 net::LOAD_DO_NOT_SEND_AUTH_DATA);
51 url_fetcher_->Start(); 52 url_fetcher_->Start();
52 } 53 }
53 54
54 void CaptivePortalDetector::Cancel() { 55 void CaptivePortalDetector::Cancel() {
55 url_fetcher_.reset(); 56 url_fetcher_.reset();
56 detection_callback_.Reset(); 57 detection_callback_.Reset();
57 } 58 }
58 59
59 void CaptivePortalDetector::OnURLFetchComplete(const net::URLFetcher* source) { 60 void CaptivePortalDetector::OnURLFetchComplete(const net::URLFetcher* source) {
61 // TODO(vadimt): Remove ScopedProfile below once crbug.com/422577 is fixed.
62 tracked_objects::ScopedProfile tracking_profile(
63 FROM_HERE_WITH_EXPLICIT_FUNCTION(
64 "422577 CaptivePortalDetector::OnURLFetchComplete"));
65
60 DCHECK(CalledOnValidThread()); 66 DCHECK(CalledOnValidThread());
61 DCHECK(FetchingURL()); 67 DCHECK(FetchingURL());
62 DCHECK_EQ(url_fetcher_.get(), source); 68 DCHECK_EQ(url_fetcher_.get(), source);
63 DCHECK(!detection_callback_.is_null()); 69 DCHECK(!detection_callback_.is_null());
64 70
65 Results results; 71 Results results;
66 GetCaptivePortalResultFromResponse(url_fetcher_.get(), &results); 72 GetCaptivePortalResultFromResponse(url_fetcher_.get(), &results);
67 DetectionCallback callback = detection_callback_; 73 DetectionCallback callback = detection_callback_;
68 url_fetcher_.reset(); 74 url_fetcher_.reset();
69 detection_callback_.Reset(); 75 detection_callback_.Reset();
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 return base::Time::Now(); 145 return base::Time::Now();
140 else 146 else
141 return time_for_testing_; 147 return time_for_testing_;
142 } 148 }
143 149
144 bool CaptivePortalDetector::FetchingURL() const { 150 bool CaptivePortalDetector::FetchingURL() const {
145 return url_fetcher_.get() != NULL; 151 return url_fetcher_.get() != NULL;
146 } 152 }
147 153
148 } // namespace captive_portal 154 } // namespace captive_portal
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/protocol_manager.cc ('k') | components/google/core/browser/google_url_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698