| 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 "chrome/browser/chromeos/drive/file_cache.h" | 5 #include "chrome/browser/chromeos/drive/file_cache.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 } | 277 } |
| 278 | 278 |
| 279 entry.mutable_file_specific_info()->mutable_cache_state()->set_is_dirty(true); | 279 entry.mutable_file_specific_info()->mutable_cache_state()->set_is_dirty(true); |
| 280 entry.mutable_file_specific_info()->mutable_cache_state()->clear_md5(); | 280 entry.mutable_file_specific_info()->mutable_cache_state()->clear_md5(); |
| 281 error = storage_->PutEntry(entry); | 281 error = storage_->PutEntry(entry); |
| 282 if (error != FILE_ERROR_OK) | 282 if (error != FILE_ERROR_OK) |
| 283 return error; | 283 return error; |
| 284 | 284 |
| 285 write_opened_files_[id]++; | 285 write_opened_files_[id]++; |
| 286 file_closer->reset(new base::ScopedClosureRunner( | 286 file_closer->reset(new base::ScopedClosureRunner( |
| 287 base::Bind(&google_apis::RunTaskOnThread, | 287 base::Bind(&google_apis::RunTaskWithTaskRunner, |
| 288 blocking_task_runner_, | 288 blocking_task_runner_, |
| 289 base::Bind(&FileCache::CloseForWrite, | 289 base::Bind(&FileCache::CloseForWrite, |
| 290 weak_ptr_factory_.GetWeakPtr(), | 290 weak_ptr_factory_.GetWeakPtr(), |
| 291 id)))); | 291 id)))); |
| 292 return FILE_ERROR_OK; | 292 return FILE_ERROR_OK; |
| 293 } | 293 } |
| 294 | 294 |
| 295 bool FileCache::IsOpenedForWrite(const std::string& id) { | 295 bool FileCache::IsOpenedForWrite(const std::string& id) { |
| 296 AssertOnSequencedWorkerPool(); | 296 AssertOnSequencedWorkerPool(); |
| 297 return write_opened_files_.count(id); | 297 return write_opened_files_.count(id); |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 604 base::Time::Now().ToInternalValue()); | 604 base::Time::Now().ToInternalValue()); |
| 605 error = storage_->PutEntry(entry); | 605 error = storage_->PutEntry(entry); |
| 606 if (error != FILE_ERROR_OK) { | 606 if (error != FILE_ERROR_OK) { |
| 607 LOG(ERROR) << "Failed to put entry: " << id << ", " | 607 LOG(ERROR) << "Failed to put entry: " << id << ", " |
| 608 << FileErrorToString(error); | 608 << FileErrorToString(error); |
| 609 } | 609 } |
| 610 } | 610 } |
| 611 | 611 |
| 612 } // namespace internal | 612 } // namespace internal |
| 613 } // namespace drive | 613 } // namespace drive |
| OLD | NEW |