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

Side by Side Diff: chrome/browser/chromeos/drive/file_system.cc

Issue 23861006: drive: CreateDirectory should only wait for its parent directory's load. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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/drive/file_system.h" 5 #include "chrome/browser/chromeos/drive/file_system.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/message_loop/message_loop_proxy.h" 9 #include "base/message_loop/message_loop_proxy.h"
10 #include "base/platform_file.h" 10 #include "base/platform_file.h"
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 } 448 }
449 449
450 void FileSystem::CreateDirectory( 450 void FileSystem::CreateDirectory(
451 const base::FilePath& directory_path, 451 const base::FilePath& directory_path,
452 bool is_exclusive, 452 bool is_exclusive,
453 bool is_recursive, 453 bool is_recursive,
454 const FileOperationCallback& callback) { 454 const FileOperationCallback& callback) {
455 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 455 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
456 DCHECK(!callback.is_null()); 456 DCHECK(!callback.is_null());
457 457
458 change_list_loader_->LoadIfNeeded( 458 // Ensure its parent directory is loaded to the local metadata.
459 internal::DirectoryFetchInfo(), 459 LoadDirectoryIfNeeded(
460 directory_path.DirName(),
460 base::Bind(&FileSystem::CreateDirectoryAfterLoad, 461 base::Bind(&FileSystem::CreateDirectoryAfterLoad,
461 weak_ptr_factory_.GetWeakPtr(), 462 weak_ptr_factory_.GetWeakPtr(),
462 directory_path, is_exclusive, is_recursive, callback)); 463 directory_path, is_exclusive, is_recursive, callback));
463 } 464 }
464 465
465 void FileSystem::CreateDirectoryAfterLoad( 466 void FileSystem::CreateDirectoryAfterLoad(
466 const base::FilePath& directory_path, 467 const base::FilePath& directory_path,
467 bool is_exclusive, 468 bool is_exclusive,
468 bool is_recursive, 469 bool is_recursive,
469 const FileOperationCallback& callback, 470 const FileOperationCallback& callback,
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after
1085 if (util::IsSpecialResourceId(id)) 1086 if (util::IsSpecialResourceId(id))
1086 return; 1087 return;
1087 1088
1088 util::Log(logging::LOG_INFO, 1089 util::Log(logging::LOG_INFO,
1089 "Thumbnail refresh for %s", directory_path.AsUTF8Unsafe().c_str()); 1090 "Thumbnail refresh for %s", directory_path.AsUTF8Unsafe().c_str());
1090 change_list_loader_->LoadDirectoryFromServer( 1091 change_list_loader_->LoadDirectoryFromServer(
1091 id, base::Bind(&util::EmptyFileOperationCallback)); 1092 id, base::Bind(&util::EmptyFileOperationCallback));
1092 } 1093 }
1093 1094
1094 } // namespace drive 1095 } // namespace drive
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