OLD | NEW |
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/blob/blob_storage_controller.h" | 5 #include "webkit/blob/blob_storage_controller.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "googleurl/src/gurl.h" | 8 #include "googleurl/src/gurl.h" |
9 #include "webkit/blob/blob_data.h" | 9 #include "webkit/blob/blob_data.h" |
10 | 10 |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 new_length, | 208 new_length, |
209 iter->expected_modification_time()); | 209 iter->expected_modification_time()); |
210 } | 210 } |
211 length -= new_length; | 211 length -= new_length; |
212 offset = 0; | 212 offset = 0; |
213 } | 213 } |
214 } | 214 } |
215 | 215 |
216 void BlobStorageController::AppendFileItem( | 216 void BlobStorageController::AppendFileItem( |
217 BlobData* target_blob_data, | 217 BlobData* target_blob_data, |
218 const FilePath& file_path, uint64 offset, uint64 length, | 218 const base::FilePath& file_path, uint64 offset, uint64 length, |
219 const base::Time& expected_modification_time) { | 219 const base::Time& expected_modification_time) { |
220 target_blob_data->AppendFile(file_path, offset, length, | 220 target_blob_data->AppendFile(file_path, offset, length, |
221 expected_modification_time); | 221 expected_modification_time); |
222 | 222 |
223 // It may be a temporary file that should be deleted when no longer needed. | 223 // It may be a temporary file that should be deleted when no longer needed. |
224 scoped_refptr<ShareableFileReference> shareable_file = | 224 scoped_refptr<ShareableFileReference> shareable_file = |
225 ShareableFileReference::Get(file_path); | 225 ShareableFileReference::Get(file_path); |
226 if (shareable_file) | 226 if (shareable_file) |
227 target_blob_data->AttachShareableFileReference(shareable_file); | 227 target_blob_data->AttachShareableFileReference(shareable_file); |
228 } | 228 } |
(...skipping 13 matching lines...) Expand all Loading... |
242 bool BlobStorageController::DecrementBlobDataUsage(BlobData* blob_data) { | 242 bool BlobStorageController::DecrementBlobDataUsage(BlobData* blob_data) { |
243 BlobDataUsageMap::iterator found = blob_data_usage_count_.find(blob_data); | 243 BlobDataUsageMap::iterator found = blob_data_usage_count_.find(blob_data); |
244 DCHECK(found != blob_data_usage_count_.end()); | 244 DCHECK(found != blob_data_usage_count_.end()); |
245 if (--(found->second)) | 245 if (--(found->second)) |
246 return false; // Still in use | 246 return false; // Still in use |
247 blob_data_usage_count_.erase(found); | 247 blob_data_usage_count_.erase(found); |
248 return true; | 248 return true; |
249 } | 249 } |
250 | 250 |
251 } // namespace webkit_blob | 251 } // namespace webkit_blob |
OLD | NEW |