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

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

Issue 10834295: gdata: Make callback parameters mandatory for CloseFile functions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 | « chrome/browser/chromeos/gdata/gdata_file_system_interface.h ('k') | 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_proxy.h" 5 #include "chrome/browser/chromeos/gdata/gdata_file_system_proxy.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 // Since those two values don't generally match (last modification time on the 119 // Since those two values don't generally match (last modification time on the
120 // drive server vs. last modification time of the local, downloaded file), so 120 // drive server vs. last modification time of the local, downloaded file), so
121 // we have to opt out from this check. We do this by unsetting last_modified 121 // we have to opt out from this check. We do this by unsetting last_modified
122 // value in the file info passed to the CreateSnapshot caller. 122 // value in the file info passed to the CreateSnapshot caller.
123 base::PlatformFileInfo final_file_info(file_info); 123 base::PlatformFileInfo final_file_info(file_info);
124 final_file_info.last_modified = base::Time(); 124 final_file_info.last_modified = base::Time();
125 125
126 callback.Run(error, final_file_info, local_path, file_ref); 126 callback.Run(error, final_file_info, local_path, file_ref);
127 } 127 }
128 128
129 void OnClose(const FilePath& local_path, GDataFileError error_code) { 129 // Emits debug log when GDataFileSystem::CloseFile() is complete.
130 void EmitDebugLogForCloseFile(const FilePath& local_path,
131 GDataFileError error_code) {
130 DVLOG(1) << "Closed: " << local_path.AsUTF8Unsafe() << ": " << error_code; 132 DVLOG(1) << "Closed: " << local_path.AsUTF8Unsafe() << ": " << error_code;
131 } 133 }
132 134
133 void DoTruncateOnFileThread( 135 void DoTruncateOnFileThread(
134 const FilePath& local_cache_path, 136 const FilePath& local_cache_path,
135 int64 length, 137 int64 length,
136 base::PlatformFileError* result) { 138 base::PlatformFileError* result) {
137 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 139 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
138 140
139 base::PlatformFile file = base::CreatePlatformFile( 141 base::PlatformFile file = base::CreatePlatformFile(
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 base::kInvalidPlatformFileValue, 543 base::kInvalidPlatformFileValue,
542 peer_handle)); 544 peer_handle));
543 } 545 }
544 } 546 }
545 547
546 void GDataFileSystemProxy::NotifyCloseFile(const FileSystemURL& url) { 548 void GDataFileSystemProxy::NotifyCloseFile(const FileSystemURL& url) {
547 FilePath file_path; 549 FilePath file_path;
548 if (!ValidateUrl(url, &file_path)) 550 if (!ValidateUrl(url, &file_path))
549 return; 551 return;
550 552
551 file_system_->CloseFile(file_path, FileOperationCallback()); 553 file_system_->CloseFile(file_path,
554 base::Bind(&EmitDebugLogForCloseFile, file_path));
552 } 555 }
553 556
554 void GDataFileSystemProxy::CreateSnapshotFile( 557 void GDataFileSystemProxy::CreateSnapshotFile(
555 const FileSystemURL& file_url, 558 const FileSystemURL& file_url,
556 const FileSystemOperationInterface::SnapshotFileCallback& callback) { 559 const FileSystemOperationInterface::SnapshotFileCallback& callback) {
557 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 560 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
558 561
559 FilePath file_path; 562 FilePath file_path;
560 if (!ValidateUrl(file_url, &file_path)) { 563 if (!ValidateUrl(file_url, &file_path)) {
561 MessageLoopProxy::current()->PostTask(FROM_HERE, 564 MessageLoopProxy::current()->PostTask(FROM_HERE,
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
725 728
726 callback.Run( 729 callback.Run(
727 util::GDataFileErrorToPlatformError(result), local_path, file_ref); 730 util::GDataFileErrorToPlatformError(result), local_path, file_ref);
728 } 731 }
729 732
730 void GDataFileSystemProxy::CloseWritableSnapshotFile( 733 void GDataFileSystemProxy::CloseWritableSnapshotFile(
731 const FilePath& virtual_path, 734 const FilePath& virtual_path,
732 const FilePath& local_path) { 735 const FilePath& local_path) {
733 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 736 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
734 737
735 file_system_->CloseFile(virtual_path, base::Bind(&OnClose, virtual_path)); 738 file_system_->CloseFile(virtual_path,
739 base::Bind(&EmitDebugLogForCloseFile, virtual_path));
736 } 740 }
737 741
738 } // namespace gdata 742 } // namespace gdata
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/gdata/gdata_file_system_interface.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698