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

Side by Side Diff: chrome/browser/chromeos/gdata/gdata_file_system.cc

Issue 10169041: gdata: Reduce use of GetWeakPtrForCurrentThread() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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 | Annotate | Revision Log
« 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/chromeos/gdata/gdata_file_system.h" 5 #include "chrome/browser/chromeos/gdata/gdata_file_system.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <sys/stat.h> 8 #include <sys/stat.h>
9 9
10 #include <set> 10 #include <set>
(...skipping 1119 matching lines...) Expand 10 before | Expand all | Expand 10 after
1130 } 1130 }
1131 1131
1132 std::string* resource_id = new std::string; 1132 std::string* resource_id = new std::string;
1133 PostBlockingPoolSequencedTaskAndReply( 1133 PostBlockingPoolSequencedTaskAndReply(
1134 kGDataFileSystemToken, 1134 kGDataFileSystemToken,
1135 FROM_HERE, 1135 FROM_HERE,
1136 base::Bind(&GDataFileSystem::GetDocumentResourceIdOnIOThreadPool, 1136 base::Bind(&GDataFileSystem::GetDocumentResourceIdOnIOThreadPool,
1137 local_file_path, 1137 local_file_path,
1138 resource_id), 1138 resource_id),
1139 base::Bind(&GDataFileSystem::TransferFileForResourceId, 1139 base::Bind(&GDataFileSystem::TransferFileForResourceId,
1140 GetWeakPtrForCurrentThread(), 1140 ui_weak_ptr_,
1141 local_file_path, 1141 local_file_path,
1142 remote_dest_file_path, 1142 remote_dest_file_path,
1143 callback, 1143 callback,
1144 base::Owned(resource_id))); 1144 base::Owned(resource_id)));
1145 } 1145 }
1146 1146
1147 void GDataFileSystem::TransferFileForResourceId( 1147 void GDataFileSystem::TransferFileForResourceId(
1148 const FilePath& local_file_path, 1148 const FilePath& local_file_path,
1149 const FilePath& remote_dest_file_path, 1149 const FilePath& remote_dest_file_path,
1150 const FileOperationCallback& callback, 1150 const FileOperationCallback& callback,
(...skipping 29 matching lines...) Expand all
1180 UploadFileInfo* upload_file_info = new UploadFileInfo; 1180 UploadFileInfo* upload_file_info = new UploadFileInfo;
1181 PostBlockingPoolSequencedTaskAndReply( 1181 PostBlockingPoolSequencedTaskAndReply(
1182 kGDataFileSystemToken, 1182 kGDataFileSystemToken,
1183 FROM_HERE, 1183 FROM_HERE,
1184 base::Bind(&CreateUploadFileInfoOnIOThreadPool, 1184 base::Bind(&CreateUploadFileInfoOnIOThreadPool,
1185 local_file_path, 1185 local_file_path,
1186 remote_dest_file_path, 1186 remote_dest_file_path,
1187 error, 1187 error,
1188 upload_file_info), 1188 upload_file_info),
1189 base::Bind(&GDataFileSystem::StartFileUploadOnUIThread, 1189 base::Bind(&GDataFileSystem::StartFileUploadOnUIThread,
1190 GetWeakPtrForCurrentThread(), 1190 ui_weak_ptr_,
1191 callback, 1191 callback,
1192 error, 1192 error,
1193 upload_file_info)); 1193 upload_file_info));
1194 } 1194 }
1195 1195
1196 // static 1196 // static
1197 void GDataFileSystem::GetDocumentResourceIdOnIOThreadPool( 1197 void GDataFileSystem::GetDocumentResourceIdOnIOThreadPool(
1198 const FilePath& local_file_path, 1198 const FilePath& local_file_path,
1199 std::string* resource_id) { 1199 std::string* resource_id) {
1200 DCHECK(resource_id); 1200 DCHECK(resource_id);
(...skipping 28 matching lines...) Expand all
1229 1229
1230 if (*error != base::PLATFORM_FILE_OK) { 1230 if (*error != base::PLATFORM_FILE_OK) {
1231 if (!callback.is_null()) 1231 if (!callback.is_null())
1232 callback.Run(*error); 1232 callback.Run(*error);
1233 1233
1234 return; 1234 return;
1235 } 1235 }
1236 1236
1237 upload_file_info->completion_callback = 1237 upload_file_info->completion_callback =
1238 base::Bind(&GDataFileSystem::OnTransferCompleted, 1238 base::Bind(&GDataFileSystem::OnTransferCompleted,
1239 GetWeakPtrForCurrentThread(), 1239 ui_weak_ptr_,
1240 callback); 1240 callback);
1241 1241
1242 service->uploader()->UploadFile(scoped_ptr<UploadFileInfo>(upload_file_info)); 1242 service->uploader()->UploadFile(scoped_ptr<UploadFileInfo>(upload_file_info));
1243 } 1243 }
1244 1244
1245 void GDataFileSystem::OnTransferCompleted( 1245 void GDataFileSystem::OnTransferCompleted(
1246 const FileOperationCallback& callback, 1246 const FileOperationCallback& callback,
1247 base::PlatformFileError error, 1247 base::PlatformFileError error,
1248 UploadFileInfo* upload_file_info) { 1248 UploadFileInfo* upload_file_info) {
1249 DCHECK(upload_file_info); 1249 DCHECK(upload_file_info);
(...skipping 3117 matching lines...) Expand 10 before | Expand all | Expand 10 after
4367 pref_registrar_->Init(profile_->GetPrefs()); 4367 pref_registrar_->Init(profile_->GetPrefs());
4368 pref_registrar_->Add(prefs::kDisableGDataHostedFiles, this); 4368 pref_registrar_->Add(prefs::kDisableGDataHostedFiles, this);
4369 } 4369 }
4370 4370
4371 void SetFreeDiskSpaceGetterForTesting(FreeDiskSpaceGetterInterface* getter) { 4371 void SetFreeDiskSpaceGetterForTesting(FreeDiskSpaceGetterInterface* getter) {
4372 delete global_free_disk_getter_for_testing; // Safe to delete NULL; 4372 delete global_free_disk_getter_for_testing; // Safe to delete NULL;
4373 global_free_disk_getter_for_testing = getter; 4373 global_free_disk_getter_for_testing = getter;
4374 } 4374 }
4375 4375
4376 } // namespace gdata 4376 } // namespace gdata
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