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

Side by Side Diff: google_apis/gaia/oauth2_api_call_flow.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
« no previous file with comments | « google_apis/gaia/oauth2_access_token_fetcher_impl.cc ('k') | sync/internal_api/http_bridge.cc » ('j') | 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 "google_apis/gaia/oauth2_api_call_flow.h" 5 #include "google_apis/gaia/oauth2_api_call_flow.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/profiler/scoped_profile.h"
11 #include "base/strings/stringprintf.h" 12 #include "base/strings/stringprintf.h"
12 #include "google_apis/gaia/gaia_urls.h" 13 #include "google_apis/gaia/gaia_urls.h"
13 #include "google_apis/gaia/oauth2_access_token_fetcher_impl.h" 14 #include "google_apis/gaia/oauth2_access_token_fetcher_impl.h"
14 #include "net/base/escape.h" 15 #include "net/base/escape.h"
15 #include "net/base/load_flags.h" 16 #include "net/base/load_flags.h"
16 #include "net/http/http_status_code.h" 17 #include "net/http/http_status_code.h"
17 #include "net/url_request/url_fetcher.h" 18 #include "net/url_request/url_fetcher.h"
18 #include "net/url_request/url_request_context_getter.h" 19 #include "net/url_request/url_request_context_getter.h"
19 #include "net/url_request/url_request_status.h" 20 #include "net/url_request/url_request_status.h"
20 21
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 131
131 std::string OAuth2ApiCallFlow::CreateApiCallBodyContentType() { 132 std::string OAuth2ApiCallFlow::CreateApiCallBodyContentType() {
132 return "application/x-www-form-urlencoded"; 133 return "application/x-www-form-urlencoded";
133 } 134 }
134 135
135 OAuth2AccessTokenFetcher* OAuth2ApiCallFlow::CreateAccessTokenFetcher() { 136 OAuth2AccessTokenFetcher* OAuth2ApiCallFlow::CreateAccessTokenFetcher() {
136 return new OAuth2AccessTokenFetcherImpl(this, context_, refresh_token_); 137 return new OAuth2AccessTokenFetcherImpl(this, context_, refresh_token_);
137 } 138 }
138 139
139 void OAuth2ApiCallFlow::OnURLFetchComplete(const net::URLFetcher* source) { 140 void OAuth2ApiCallFlow::OnURLFetchComplete(const net::URLFetcher* source) {
141 // TODO(vadimt): Remove ScopedProfile below once crbug.com/422577 is fixed.
142 tracked_objects::ScopedProfile tracking_profile(
143 FROM_HERE_WITH_EXPLICIT_FUNCTION(
144 "422577 OAuth2ApiCallFlow::OnURLFetchComplete"));
145
140 CHECK(source); 146 CHECK(source);
141 CHECK_EQ(API_CALL_STARTED, state_); 147 CHECK_EQ(API_CALL_STARTED, state_);
142 EndApiCall(source); 148 EndApiCall(source);
143 } 149 }
144 150
145 void OAuth2ApiCallFlow::OnGetTokenSuccess(const std::string& access_token, 151 void OAuth2ApiCallFlow::OnGetTokenSuccess(const std::string& access_token,
146 const base::Time& expiration_time) { 152 const base::Time& expiration_time) {
147 access_token_ = access_token; 153 access_token_ = access_token;
148 EndMintAccessToken(NULL); 154 EndMintAccessToken(NULL);
149 } 155 }
(...skipping 20 matching lines...) Expand all
170 // especially at startup and after sign-in on ChromeOS. Retrying once should 176 // especially at startup and after sign-in on ChromeOS. Retrying once should
171 // be enough in those cases; let the fetcher retry up to 3 times just in case. 177 // be enough in those cases; let the fetcher retry up to 3 times just in case.
172 // http://crbug.com/163710 178 // http://crbug.com/163710
173 result->SetAutomaticallyRetryOnNetworkChanges(3); 179 result->SetAutomaticallyRetryOnNetworkChanges(3);
174 180
175 if (!empty_body) 181 if (!empty_body)
176 result->SetUploadData(CreateApiCallBodyContentType(), body); 182 result->SetUploadData(CreateApiCallBodyContentType(), body);
177 183
178 return result; 184 return result;
179 } 185 }
OLDNEW
« no previous file with comments | « google_apis/gaia/oauth2_access_token_fetcher_impl.cc ('k') | sync/internal_api/http_bridge.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698