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

Side by Side Diff: chrome/browser/sync_file_system/drive_backend_v1/api_util.cc

Issue 63923002: net: Use SequencedTaskRunner for URLFetcherResponseWriter (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add include Created 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/sync_file_system/drive_backend_v1/api_util.h" 5 #include "chrome/browser/sync_file_system/drive_backend_v1/api_util.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <functional> 8 #include <functional>
9 #include <sstream> 9 #include <sstream>
10 #include <string> 10 #include <string>
11 11
12 #include "base/file_util.h" 12 #include "base/file_util.h"
13 #include "base/sequenced_task_runner.h"
13 #include "base/strings/string_util.h" 14 #include "base/strings/string_util.h"
14 #include "base/strings/utf_string_conversions.h" 15 #include "base/strings/utf_string_conversions.h"
15 #include "base/threading/sequenced_worker_pool.h" 16 #include "base/threading/sequenced_worker_pool.h"
16 #include "base/values.h" 17 #include "base/values.h"
17 #include "chrome/browser/drive/drive_api_service.h" 18 #include "chrome/browser/drive/drive_api_service.h"
18 #include "chrome/browser/drive/drive_api_util.h" 19 #include "chrome/browser/drive/drive_api_util.h"
19 #include "chrome/browser/drive/drive_uploader.h" 20 #include "chrome/browser/drive/drive_uploader.h"
20 #include "chrome/browser/drive/gdata_wapi_service.h" 21 #include "chrome/browser/drive/gdata_wapi_service.h"
21 #include "chrome/browser/google_apis/drive_api_parser.h" 22 #include "chrome/browser/google_apis/drive_api_parser.h"
22 #include "chrome/browser/profiles/profile.h" 23 #include "chrome/browser/profiles/profile.h"
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 GURL(google_apis::GDataWapiUrlGenerator:: 165 GURL(google_apis::GDataWapiUrlGenerator::
165 kBaseDownloadUrlForProduction)), 166 kBaseDownloadUrlForProduction)),
166 drive_api_url_generator_( 167 drive_api_url_generator_(
167 GURL(google_apis::DriveApiUrlGenerator::kBaseUrlForProduction), 168 GURL(google_apis::DriveApiUrlGenerator::kBaseUrlForProduction),
168 GURL(google_apis::DriveApiUrlGenerator:: 169 GURL(google_apis::DriveApiUrlGenerator::
169 kBaseDownloadUrlForProduction)), 170 kBaseDownloadUrlForProduction)),
170 upload_next_key_(0), 171 upload_next_key_(0),
171 temp_dir_path_(temp_dir_path) { 172 temp_dir_path_(temp_dir_path) {
172 ProfileOAuth2TokenService* oauth_service = 173 ProfileOAuth2TokenService* oauth_service =
173 ProfileOAuth2TokenServiceFactory::GetForProfile(profile); 174 ProfileOAuth2TokenServiceFactory::GetForProfile(profile);
175 base::SequencedWorkerPool* blocking_pool =
176 content::BrowserThread::GetBlockingPool();
177 scoped_refptr<base::SequencedTaskRunner> task_runner(
178 blocking_pool->GetSequencedTaskRunner(blocking_pool->GetSequenceToken()));
174 if (IsDriveAPIDisabled()) { 179 if (IsDriveAPIDisabled()) {
175 drive_service_.reset(new drive::GDataWapiService( 180 drive_service_.reset(new drive::GDataWapiService(
176 oauth_service, 181 oauth_service,
177 profile->GetRequestContext(), 182 profile->GetRequestContext(),
178 content::BrowserThread::GetBlockingPool(), 183 task_runner.get(),
179 GURL(google_apis::GDataWapiUrlGenerator::kBaseUrlForProduction), 184 GURL(google_apis::GDataWapiUrlGenerator::kBaseUrlForProduction),
180 GURL(google_apis::GDataWapiUrlGenerator::kBaseDownloadUrlForProduction), 185 GURL(google_apis::GDataWapiUrlGenerator::kBaseDownloadUrlForProduction),
181 std::string() /* custom_user_agent */)); 186 std::string() /* custom_user_agent */));
182 } else { 187 } else {
183 drive_service_.reset(new drive::DriveAPIService( 188 drive_service_.reset(new drive::DriveAPIService(
184 oauth_service, 189 oauth_service,
185 profile->GetRequestContext(), 190 profile->GetRequestContext(),
186 content::BrowserThread::GetBlockingPool(), 191 task_runner.get(),
187 GURL(google_apis::DriveApiUrlGenerator::kBaseUrlForProduction), 192 GURL(google_apis::DriveApiUrlGenerator::kBaseUrlForProduction),
188 GURL(google_apis::DriveApiUrlGenerator::kBaseDownloadUrlForProduction), 193 GURL(google_apis::DriveApiUrlGenerator::kBaseDownloadUrlForProduction),
189 GURL(google_apis::GDataWapiUrlGenerator::kBaseUrlForProduction), 194 GURL(google_apis::GDataWapiUrlGenerator::kBaseUrlForProduction),
190 std::string() /* custom_user_agent */)); 195 std::string() /* custom_user_agent */));
191 } 196 }
192 197
193 drive_service_->Initialize(oauth_service->GetPrimaryAccountId()); 198 drive_service_->Initialize(oauth_service->GetPrimaryAccountId());
194 drive_service_->AddObserver(this); 199 drive_service_->AddObserver(this);
195 net::NetworkChangeNotifier::AddConnectionTypeObserver(this); 200 net::NetworkChangeNotifier::AddConnectionTypeObserver(this);
196 201
(...skipping 943 matching lines...) Expand 10 before | Expand all | Expand 10 after
1140 } 1145 }
1141 1146
1142 std::string APIUtil::GetRootResourceId() const { 1147 std::string APIUtil::GetRootResourceId() const {
1143 if (IsDriveAPIDisabled()) 1148 if (IsDriveAPIDisabled())
1144 return drive_service_->GetRootResourceId(); 1149 return drive_service_->GetRootResourceId();
1145 return root_resource_id_; 1150 return root_resource_id_;
1146 } 1151 }
1147 1152
1148 } // namespace drive_backend 1153 } // namespace drive_backend
1149 } // namespace sync_file_system 1154 } // namespace sync_file_system
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698