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

Side by Side Diff: webkit/fileapi/obfuscated_file_util.cc

Issue 14075016: Change some snapshot- or temporary-file related changes to use ScopedFile (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 7 years, 7 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 | « webkit/fileapi/obfuscated_file_util.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 "webkit/fileapi/obfuscated_file_util.h" 5 #include "webkit/fileapi/obfuscated_file_util.h"
6 6
7 #include <queue> 7 #include <queue>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 839 matching lines...) Expand 10 before | Expand all | Expand 10 after
850 return base::PLATFORM_FILE_ERROR_NOT_EMPTY; 850 return base::PLATFORM_FILE_ERROR_NOT_EMPTY;
851 int64 growth = -UsageForPath(file_info.name.size()); 851 int64 growth = -UsageForPath(file_info.name.size());
852 AllocateQuota(context, growth); 852 AllocateQuota(context, growth);
853 UpdateUsage(context, url, growth); 853 UpdateUsage(context, url, growth);
854 TouchDirectory(db, file_info.parent_id); 854 TouchDirectory(db, file_info.parent_id);
855 context->change_observers()->Notify( 855 context->change_observers()->Notify(
856 &FileChangeObserver::OnRemoveDirectory, MakeTuple(url)); 856 &FileChangeObserver::OnRemoveDirectory, MakeTuple(url));
857 return base::PLATFORM_FILE_OK; 857 return base::PLATFORM_FILE_OK;
858 } 858 }
859 859
860 base::PlatformFileError ObfuscatedFileUtil::CreateSnapshotFile( 860 webkit_blob::ScopedFile ObfuscatedFileUtil::CreateSnapshotFile(
861 FileSystemOperationContext* context, 861 FileSystemOperationContext* context,
862 const FileSystemURL& url, 862 const FileSystemURL& url,
863 base::PlatformFileError* error,
863 base::PlatformFileInfo* file_info, 864 base::PlatformFileInfo* file_info,
864 base::FilePath* platform_path, 865 base::FilePath* platform_path) {
865 SnapshotFilePolicy* policy) {
866 DCHECK(policy);
867 // We're just returning the local file information. 866 // We're just returning the local file information.
868 *policy = kSnapshotFileLocal; 867 *error = GetFileInfo(context, url, file_info, platform_path);
869 base::PlatformFileError error = GetFileInfo( 868 if (*error == base::PLATFORM_FILE_OK && file_info->is_directory) {
870 context, url, file_info, platform_path);
871 if (error == base::PLATFORM_FILE_OK && file_info->is_directory) {
872 *file_info = base::PlatformFileInfo(); 869 *file_info = base::PlatformFileInfo();
873 return base::PLATFORM_FILE_ERROR_NOT_A_FILE; 870 *error = base::PLATFORM_FILE_ERROR_NOT_A_FILE;
874 } 871 }
875 return error; 872 return webkit_blob::ScopedFile();
876 } 873 }
877 874
878 scoped_ptr<FileSystemFileUtil::AbstractFileEnumerator> 875 scoped_ptr<FileSystemFileUtil::AbstractFileEnumerator>
879 ObfuscatedFileUtil::CreateFileEnumerator( 876 ObfuscatedFileUtil::CreateFileEnumerator(
880 FileSystemOperationContext* context, 877 FileSystemOperationContext* context,
881 const FileSystemURL& root_url, 878 const FileSystemURL& root_url,
882 bool recursive) { 879 bool recursive) {
883 FileSystemDirectoryDatabase* db = GetDirectoryDatabase( 880 FileSystemDirectoryDatabase* db = GetDirectoryDatabase(
884 root_url.origin(), root_url.type(), false); 881 root_url.origin(), root_url.type(), false);
885 if (!db) { 882 if (!db) {
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
1334 new_local_path, false /* exclusive */, false /* recursive */); 1331 new_local_path, false /* exclusive */, false /* recursive */);
1335 if (error != base::PLATFORM_FILE_OK) 1332 if (error != base::PLATFORM_FILE_OK)
1336 return error; 1333 return error;
1337 1334
1338 *local_path = 1335 *local_path =
1339 new_local_path.AppendASCII(base::StringPrintf("%08" PRId64, number)); 1336 new_local_path.AppendASCII(base::StringPrintf("%08" PRId64, number));
1340 return base::PLATFORM_FILE_OK; 1337 return base::PLATFORM_FILE_OK;
1341 } 1338 }
1342 1339
1343 } // namespace fileapi 1340 } // namespace fileapi
OLDNEW
« no previous file with comments | « webkit/fileapi/obfuscated_file_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698