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

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

Issue 16150002: Implement special origin database handling for Isolated Apps (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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
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/browser/fileapi/obfuscated_file_util.h" 5 #include "webkit/browser/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
11 #include "base/file_util.h" 11 #include "base/file_util.h"
12 #include "base/format_macros.h" 12 #include "base/format_macros.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/message_loop.h" 14 #include "base/message_loop.h"
15 #include "base/stl_util.h" 15 #include "base/stl_util.h"
16 #include "base/stringprintf.h" 16 #include "base/stringprintf.h"
17 #include "base/strings/string_number_conversions.h" 17 #include "base/strings/string_number_conversions.h"
18 #include "base/strings/sys_string_conversions.h" 18 #include "base/strings/sys_string_conversions.h"
19 #include "base/utf_string_conversions.h" 19 #include "base/utf_string_conversions.h"
20 #include "googleurl/src/gurl.h" 20 #include "googleurl/src/gurl.h"
21 #include "webkit/base/origin_url_conversions.h" 21 #include "webkit/base/origin_url_conversions.h"
22 #include "webkit/browser/fileapi/file_observers.h" 22 #include "webkit/browser/fileapi/file_observers.h"
23 #include "webkit/browser/fileapi/file_system_context.h" 23 #include "webkit/browser/fileapi/file_system_context.h"
24 #include "webkit/browser/fileapi/file_system_operation_context.h" 24 #include "webkit/browser/fileapi/file_system_operation_context.h"
25 #include "webkit/browser/fileapi/file_system_url.h" 25 #include "webkit/browser/fileapi/file_system_url.h"
26 #include "webkit/browser/fileapi/native_file_util.h" 26 #include "webkit/browser/fileapi/native_file_util.h"
27 #include "webkit/browser/fileapi/sandbox_isolated_origin_database.h"
27 #include "webkit/browser/fileapi/sandbox_mount_point_provider.h" 28 #include "webkit/browser/fileapi/sandbox_mount_point_provider.h"
29 #include "webkit/browser/fileapi/sandbox_origin_database.h"
28 #include "webkit/browser/fileapi/syncable/syncable_file_system_util.h" 30 #include "webkit/browser/fileapi/syncable/syncable_file_system_util.h"
29 #include "webkit/common/fileapi/file_system_util.h" 31 #include "webkit/common/fileapi/file_system_util.h"
30 #include "webkit/quota/quota_manager.h" 32 #include "webkit/quota/quota_manager.h"
31 33
32 // Example of various paths: 34 // Example of various paths:
33 // void ObfuscatedFileUtil::DoSomething(const FileSystemURL& url) { 35 // void ObfuscatedFileUtil::DoSomething(const FileSystemURL& url) {
34 // base::FilePath virtual_path = url.path(); 36 // base::FilePath virtual_path = url.path();
35 // base::FilePath local_path = GetLocalFilePath(url); 37 // base::FilePath local_path = GetLocalFilePath(url);
36 // 38 //
37 // NativeFileUtil::DoSomething(local_path); 39 // NativeFileUtil::DoSomething(local_path);
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 205
204 FileId current_file_id_; 206 FileId current_file_id_;
205 base::PlatformFileInfo current_platform_file_info_; 207 base::PlatformFileInfo current_platform_file_info_;
206 }; 208 };
207 209
208 class ObfuscatedOriginEnumerator 210 class ObfuscatedOriginEnumerator
209 : public ObfuscatedFileUtil::AbstractOriginEnumerator { 211 : public ObfuscatedFileUtil::AbstractOriginEnumerator {
210 public: 212 public:
211 typedef SandboxOriginDatabase::OriginRecord OriginRecord; 213 typedef SandboxOriginDatabase::OriginRecord OriginRecord;
212 ObfuscatedOriginEnumerator( 214 ObfuscatedOriginEnumerator(
213 SandboxOriginDatabase* origin_database, 215 SandboxOriginDatabaseInterface* origin_database,
214 const base::FilePath& base_file_path) 216 const base::FilePath& base_file_path)
215 : base_file_path_(base_file_path) { 217 : base_file_path_(base_file_path) {
216 if (origin_database) 218 if (origin_database)
217 origin_database->ListAllOrigins(&origins_); 219 origin_database->ListAllOrigins(&origins_);
218 } 220 }
219 221
220 virtual ~ObfuscatedOriginEnumerator() {} 222 virtual ~ObfuscatedOriginEnumerator() {}
221 223
222 // Returns the next origin. Returns empty if there are no more origins. 224 // Returns the next origin. Returns empty if there are no more origins.
223 virtual GURL Next() OVERRIDE { 225 virtual GURL Next() OVERRIDE {
224 OriginRecord record; 226 OriginRecord record;
225 if (!origins_.empty()) { 227 if (!origins_.empty()) {
226 record = origins_.back(); 228 record = origins_.back();
227 origins_.pop_back(); 229 origins_.pop_back();
228 } 230 }
229 current_ = record; 231 current_ = record;
230 return webkit_base::GetOriginURLFromIdentifier(UTF8ToUTF16(record.origin)); 232 return webkit_base::GetOriginURLFromIdentifier(UTF8ToUTF16(record.origin));
231 } 233 }
232 234
233 // Returns the current origin's information. 235 // Returns the current origin's information.
234 virtual bool HasFileSystemType(FileSystemType type) const OVERRIDE { 236 virtual bool HasFileSystemType(FileSystemType type) const OVERRIDE {
235 if (current_.path.empty()) 237 if (current_.path.empty())
236 return false; 238 return false;
237 base::FilePath::StringType type_string = 239 base::FilePath::StringType type_string =
238 ObfuscatedFileUtil::GetDirectoryNameForType(type); 240 ObfuscatedFileUtil::GetDirectoryNameForType(type);
239 if (type_string.empty()) { 241 if (type_string.empty()) {
240 NOTREACHED(); 242 NOTREACHED();
241 return false; 243 return false;
242 } 244 }
243 base::FilePath path = base_file_path_.Append(current_.path).Append(type_stri ng); 245 base::FilePath path =
246 base_file_path_.Append(current_.path).Append(type_string);
244 return file_util::DirectoryExists(path); 247 return file_util::DirectoryExists(path);
245 } 248 }
246 249
247 private: 250 private:
248 std::vector<OriginRecord> origins_; 251 std::vector<OriginRecord> origins_;
249 OriginRecord current_; 252 OriginRecord current_;
250 base::FilePath base_file_path_; 253 base::FilePath base_file_path_;
251 }; 254 };
252 255
253 ObfuscatedFileUtil::ObfuscatedFileUtil( 256 ObfuscatedFileUtil::ObfuscatedFileUtil(
257 quota::SpecialStoragePolicy* special_storage_policy,
254 const base::FilePath& file_system_directory) 258 const base::FilePath& file_system_directory)
255 : file_system_directory_(file_system_directory) { 259 : special_storage_policy_(special_storage_policy),
260 file_system_directory_(file_system_directory) {
256 } 261 }
257 262
258 ObfuscatedFileUtil::~ObfuscatedFileUtil() { 263 ObfuscatedFileUtil::~ObfuscatedFileUtil() {
259 DropDatabases(); 264 DropDatabases();
260 } 265 }
261 266
262 PlatformFileError ObfuscatedFileUtil::CreateOrOpen( 267 PlatformFileError ObfuscatedFileUtil::CreateOrOpen(
263 FileSystemOperationContext* context, 268 FileSystemOperationContext* context,
264 const FileSystemURL& url, int file_flags, 269 const FileSystemURL& url, int file_flags,
265 PlatformFile* file_handle, bool* created) { 270 PlatformFile* file_handle, bool* created) {
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after
874 } 879 }
875 880
876 if (error_code) 881 if (error_code)
877 *error_code = error; 882 *error_code = error;
878 return path; 883 return path;
879 } 884 }
880 885
881 bool ObfuscatedFileUtil::DeleteDirectoryForOriginAndType( 886 bool ObfuscatedFileUtil::DeleteDirectoryForOriginAndType(
882 const GURL& origin, FileSystemType type) { 887 const GURL& origin, FileSystemType type) {
883 base::PlatformFileError error = base::PLATFORM_FILE_OK; 888 base::PlatformFileError error = base::PLATFORM_FILE_OK;
884 base::FilePath origin_type_path = GetDirectoryForOriginAndType(origin, type, f alse, 889 base::FilePath origin_type_path = GetDirectoryForOriginAndType(
885 &error); 890 origin, type, false, &error);
886 if (origin_type_path.empty()) 891 if (origin_type_path.empty())
887 return true; 892 return true;
888 893
889 if (error != base::PLATFORM_FILE_ERROR_NOT_FOUND) { 894 if (error != base::PLATFORM_FILE_ERROR_NOT_FOUND) {
890 // TODO(dmikurube): Consider the return value of DestroyDirectoryDatabase. 895 // TODO(dmikurube): Consider the return value of DestroyDirectoryDatabase.
891 // We ignore its error now since 1) it doesn't matter the final result, and 896 // We ignore its error now since 1) it doesn't matter the final result, and
892 // 2) it always returns false in Windows because of LevelDB's 897 // 2) it always returns false in Windows because of LevelDB's
893 // implementation. 898 // implementation.
894 // Information about failure would be useful for debugging. 899 // Information about failure would be useful for debugging.
895 DestroyDirectoryDatabase(origin, type); 900 DestroyDirectoryDatabase(origin, type);
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
968 UTF16ToUTF8(webkit_base::GetOriginIdentifierFromURL(origin)) + 973 UTF16ToUTF8(webkit_base::GetOriginIdentifierFromURL(origin)) +
969 type_string; 974 type_string;
970 DirectoryMap::iterator iter = directories_.find(key); 975 DirectoryMap::iterator iter = directories_.find(key);
971 if (iter != directories_.end()) { 976 if (iter != directories_.end()) {
972 SandboxDirectoryDatabase* database = iter->second; 977 SandboxDirectoryDatabase* database = iter->second;
973 directories_.erase(iter); 978 directories_.erase(iter);
974 delete database; 979 delete database;
975 } 980 }
976 981
977 PlatformFileError error = base::PLATFORM_FILE_OK; 982 PlatformFileError error = base::PLATFORM_FILE_OK;
978 base::FilePath path = GetDirectoryForOriginAndType(origin, type, false, &error ); 983 base::FilePath path = GetDirectoryForOriginAndType(
984 origin, type, false, &error);
979 if (path.empty() || error == base::PLATFORM_FILE_ERROR_NOT_FOUND) 985 if (path.empty() || error == base::PLATFORM_FILE_ERROR_NOT_FOUND)
980 return true; 986 return true;
981 return SandboxDirectoryDatabase::DestroyDatabase(path); 987 return SandboxDirectoryDatabase::DestroyDatabase(path);
982 } 988 }
983 989
984 // static 990 // static
985 int64 ObfuscatedFileUtil::ComputeFilePathCost(const base::FilePath& path) { 991 int64 ObfuscatedFileUtil::ComputeFilePathCost(const base::FilePath& path) {
986 return UsageForPath(VirtualPath::BaseName(path).value().size()); 992 return UsageForPath(VirtualPath::BaseName(path).value().size());
987 } 993 }
988 994
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
1041 const base::FilePath& src_file_path, 1047 const base::FilePath& src_file_path,
1042 const GURL& dest_origin, 1048 const GURL& dest_origin,
1043 FileSystemType dest_type, 1049 FileSystemType dest_type,
1044 FileInfo* dest_file_info, int file_flags, PlatformFile* handle) { 1050 FileInfo* dest_file_info, int file_flags, PlatformFile* handle) {
1045 if (handle) 1051 if (handle)
1046 *handle = base::kInvalidPlatformFileValue; 1052 *handle = base::kInvalidPlatformFileValue;
1047 SandboxDirectoryDatabase* db = GetDirectoryDatabase( 1053 SandboxDirectoryDatabase* db = GetDirectoryDatabase(
1048 dest_origin, dest_type, true); 1054 dest_origin, dest_type, true);
1049 1055
1050 PlatformFileError error = base::PLATFORM_FILE_OK; 1056 PlatformFileError error = base::PLATFORM_FILE_OK;
1051 base::FilePath root = GetDirectoryForOriginAndType(dest_origin, dest_type, fal se, 1057 base::FilePath root = GetDirectoryForOriginAndType(
1052 &error); 1058 dest_origin, dest_type, false, &error);
1053 if (error != base::PLATFORM_FILE_OK) 1059 if (error != base::PLATFORM_FILE_OK)
1054 return error; 1060 return error;
1055 1061
1056 base::FilePath dest_local_path; 1062 base::FilePath dest_local_path;
1057 error = GenerateNewLocalPath(db, context, dest_origin, dest_type, 1063 error = GenerateNewLocalPath(db, context, dest_origin, dest_type,
1058 &dest_local_path); 1064 &dest_local_path);
1059 if (error != base::PLATFORM_FILE_OK) 1065 if (error != base::PLATFORM_FILE_OK)
1060 return error; 1066 return error;
1061 1067
1062 bool created = false; 1068 bool created = false;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1113 return base::PLATFORM_FILE_ERROR_FAILED; 1119 return base::PLATFORM_FILE_ERROR_FAILED;
1114 } 1120 }
1115 TouchDirectory(db, dest_file_info->parent_id); 1121 TouchDirectory(db, dest_file_info->parent_id);
1116 1122
1117 return base::PLATFORM_FILE_OK; 1123 return base::PLATFORM_FILE_OK;
1118 } 1124 }
1119 1125
1120 base::FilePath ObfuscatedFileUtil::DataPathToLocalPath( 1126 base::FilePath ObfuscatedFileUtil::DataPathToLocalPath(
1121 const GURL& origin, FileSystemType type, const base::FilePath& data_path) { 1127 const GURL& origin, FileSystemType type, const base::FilePath& data_path) {
1122 PlatformFileError error = base::PLATFORM_FILE_OK; 1128 PlatformFileError error = base::PLATFORM_FILE_OK;
1123 base::FilePath root = GetDirectoryForOriginAndType(origin, type, false, &error ); 1129 base::FilePath root = GetDirectoryForOriginAndType(
1130 origin, type, false, &error);
1124 if (error != base::PLATFORM_FILE_OK) 1131 if (error != base::PLATFORM_FILE_OK)
1125 return base::FilePath(); 1132 return base::FilePath();
1126 return root.Append(data_path); 1133 return root.Append(data_path);
1127 } 1134 }
1128 1135
1129 // TODO(ericu): How to do the whole validation-without-creation thing? 1136 // TODO(ericu): How to do the whole validation-without-creation thing?
1130 // We may not have quota even to create the database. 1137 // We may not have quota even to create the database.
1131 // Ah, in that case don't even get here? 1138 // Ah, in that case don't even get here?
1132 // Still doesn't answer the quota issue, though. 1139 // Still doesn't answer the quota issue, though.
1133 SandboxDirectoryDatabase* ObfuscatedFileUtil::GetDirectoryDatabase( 1140 SandboxDirectoryDatabase* ObfuscatedFileUtil::GetDirectoryDatabase(
1134 const GURL& origin, FileSystemType type, bool create) { 1141 const GURL& origin, FileSystemType type, bool create) {
1135 std::string type_string = GetFileSystemTypeString(type); 1142 std::string type_string = GetFileSystemTypeString(type);
1136 if (type_string.empty()) { 1143 if (type_string.empty()) {
1137 LOG(WARNING) << "Unknown filesystem type requested:" << type; 1144 LOG(WARNING) << "Unknown filesystem type requested:" << type;
1138 return NULL; 1145 return NULL;
1139 } 1146 }
1140 std::string key = 1147 std::string key =
1141 UTF16ToUTF8(webkit_base::GetOriginIdentifierFromURL(origin)) + 1148 UTF16ToUTF8(webkit_base::GetOriginIdentifierFromURL(origin)) +
1142 type_string; 1149 type_string;
1143 DirectoryMap::iterator iter = directories_.find(key); 1150 DirectoryMap::iterator iter = directories_.find(key);
1144 if (iter != directories_.end()) { 1151 if (iter != directories_.end()) {
1145 MarkUsed(); 1152 MarkUsed();
1146 return iter->second; 1153 return iter->second;
1147 } 1154 }
1148 1155
1149 PlatformFileError error = base::PLATFORM_FILE_OK; 1156 PlatformFileError error = base::PLATFORM_FILE_OK;
1150 base::FilePath path = GetDirectoryForOriginAndType(origin, type, create, &erro r); 1157 base::FilePath path = GetDirectoryForOriginAndType(
1158 origin, type, create, &error);
1151 if (error != base::PLATFORM_FILE_OK) { 1159 if (error != base::PLATFORM_FILE_OK) {
1152 LOG(WARNING) << "Failed to get origin+type directory: " << path.value(); 1160 LOG(WARNING) << "Failed to get origin+type directory: " << path.value();
1153 return NULL; 1161 return NULL;
1154 } 1162 }
1155 MarkUsed(); 1163 MarkUsed();
1156 SandboxDirectoryDatabase* database = new SandboxDirectoryDatabase(path); 1164 SandboxDirectoryDatabase* database = new SandboxDirectoryDatabase(path);
1157 directories_[key] = database; 1165 directories_[key] = database;
1158 return database; 1166 return database;
1159 } 1167 }
1160 1168
1161 base::FilePath ObfuscatedFileUtil::GetDirectoryForOrigin( 1169 base::FilePath ObfuscatedFileUtil::GetDirectoryForOrigin(
1162 const GURL& origin, bool create, base::PlatformFileError* error_code) { 1170 const GURL& origin, bool create, base::PlatformFileError* error_code) {
1171 if (special_storage_policy_ &&
1172 special_storage_policy_->HasIsolatedStorage(origin)) {
1173 CHECK(isolated_origin_.is_empty() || isolated_origin_ == origin)
1174 << "multiple origins for an isolated site: "
1175 << isolated_origin_.spec() << " vs " << origin.spec();
1176 isolated_origin_ = origin;
1177 }
1178
1163 if (!InitOriginDatabase(create)) { 1179 if (!InitOriginDatabase(create)) {
1164 if (error_code) { 1180 if (error_code) {
1165 *error_code = create ? 1181 *error_code = create ?
1166 base::PLATFORM_FILE_ERROR_FAILED : 1182 base::PLATFORM_FILE_ERROR_FAILED :
1167 base::PLATFORM_FILE_ERROR_NOT_FOUND; 1183 base::PLATFORM_FILE_ERROR_NOT_FOUND;
1168 } 1184 }
1169 return base::FilePath(); 1185 return base::FilePath();
1170 } 1186 }
1171 base::FilePath directory_name; 1187 base::FilePath directory_name;
1172 std::string id = UTF16ToUTF8(webkit_base::GetOriginIdentifierFromURL(origin)); 1188 std::string id = UTF16ToUTF8(webkit_base::GetOriginIdentifierFromURL(origin));
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1227 } 1243 }
1228 1244
1229 void ObfuscatedFileUtil::DropDatabases() { 1245 void ObfuscatedFileUtil::DropDatabases() {
1230 origin_database_.reset(); 1246 origin_database_.reset();
1231 STLDeleteContainerPairSecondPointers( 1247 STLDeleteContainerPairSecondPointers(
1232 directories_.begin(), directories_.end()); 1248 directories_.begin(), directories_.end());
1233 directories_.clear(); 1249 directories_.clear();
1234 } 1250 }
1235 1251
1236 bool ObfuscatedFileUtil::InitOriginDatabase(bool create) { 1252 bool ObfuscatedFileUtil::InitOriginDatabase(bool create) {
1237 if (!origin_database_) { 1253 if (origin_database_)
1238 if (!create && !file_util::DirectoryExists(file_system_directory_)) 1254 return true;
1239 return false; 1255
1240 if (!file_util::CreateDirectory(file_system_directory_)) { 1256 if (!create && !file_util::DirectoryExists(file_system_directory_))
1241 LOG(WARNING) << "Failed to create FileSystem directory: " << 1257 return false;
1242 file_system_directory_.value(); 1258 if (!file_util::CreateDirectory(file_system_directory_)) {
1243 return false; 1259 LOG(WARNING) << "Failed to create FileSystem directory: " <<
1244 } 1260 file_system_directory_.value();
1261 return false;
1262 }
1263
1264 if (!isolated_origin_.is_empty()) {
1265 DCHECK(special_storage_policy_->HasIsolatedStorage(isolated_origin_));
1245 origin_database_.reset( 1266 origin_database_.reset(
1246 new SandboxOriginDatabase(file_system_directory_)); 1267 new SandboxIsolatedOriginDatabase(
1268 UTF16ToUTF8(webkit_base::GetOriginIdentifierFromURL(
1269 isolated_origin_)),
1270 file_system_directory_));
1271 return true;
1247 } 1272 }
1273
1274 origin_database_.reset(
1275 new SandboxOriginDatabase(file_system_directory_));
1248 return true; 1276 return true;
1249 } 1277 }
1250 1278
1251 PlatformFileError ObfuscatedFileUtil::GenerateNewLocalPath( 1279 PlatformFileError ObfuscatedFileUtil::GenerateNewLocalPath(
1252 SandboxDirectoryDatabase* db, 1280 SandboxDirectoryDatabase* db,
1253 FileSystemOperationContext* context, 1281 FileSystemOperationContext* context,
1254 const GURL& origin, 1282 const GURL& origin,
1255 FileSystemType type, 1283 FileSystemType type,
1256 base::FilePath* local_path) { 1284 base::FilePath* local_path) {
1257 DCHECK(local_path); 1285 DCHECK(local_path);
1258 int64 number; 1286 int64 number;
1259 if (!db || !db->GetNextInteger(&number)) 1287 if (!db || !db->GetNextInteger(&number))
1260 return base::PLATFORM_FILE_ERROR_FAILED; 1288 return base::PLATFORM_FILE_ERROR_FAILED;
1261 1289
1262 PlatformFileError error = base::PLATFORM_FILE_OK; 1290 PlatformFileError error = base::PLATFORM_FILE_OK;
1263 base::FilePath new_local_path = GetDirectoryForOriginAndType(origin, type, 1291 base::FilePath new_local_path = GetDirectoryForOriginAndType(
1264 false, &error); 1292 origin, type, false, &error);
1265 if (error != base::PLATFORM_FILE_OK) 1293 if (error != base::PLATFORM_FILE_OK)
1266 return base::PLATFORM_FILE_ERROR_FAILED; 1294 return base::PLATFORM_FILE_ERROR_FAILED;
1267 1295
1268 // We use the third- and fourth-to-last digits as the directory. 1296 // We use the third- and fourth-to-last digits as the directory.
1269 int64 directory_number = number % 10000 / 100; 1297 int64 directory_number = number % 10000 / 100;
1270 new_local_path = new_local_path.AppendASCII( 1298 new_local_path = new_local_path.AppendASCII(
1271 base::StringPrintf("%02" PRId64, directory_number)); 1299 base::StringPrintf("%02" PRId64, directory_number));
1272 1300
1273 error = NativeFileUtil::CreateDirectory( 1301 error = NativeFileUtil::CreateDirectory(
1274 new_local_path, false /* exclusive */, false /* recursive */); 1302 new_local_path, false /* exclusive */, false /* recursive */);
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
1356 // If truncating we need to update the usage. 1384 // If truncating we need to update the usage.
1357 if (error == base::PLATFORM_FILE_OK && delta) { 1385 if (error == base::PLATFORM_FILE_OK && delta) {
1358 UpdateUsage(context, url, delta); 1386 UpdateUsage(context, url, delta);
1359 context->change_observers()->Notify( 1387 context->change_observers()->Notify(
1360 &FileChangeObserver::OnModifyFile, MakeTuple(url)); 1388 &FileChangeObserver::OnModifyFile, MakeTuple(url));
1361 } 1389 }
1362 return error; 1390 return error;
1363 } 1391 }
1364 1392
1365 } // namespace fileapi 1393 } // namespace fileapi
OLDNEW
« no previous file with comments | « webkit/browser/fileapi/obfuscated_file_util.h ('k') | webkit/browser/fileapi/sandbox_isolated_origin_database.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698