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 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
584 AssertOnSequencedWorkerPool(); | 584 AssertOnSequencedWorkerPool(); |
585 | 585 |
586 std::map<std::string, int>::iterator it = write_opened_files_.find(id); | 586 std::map<std::string, int>::iterator it = write_opened_files_.find(id); |
587 if (it == write_opened_files_.end()) | 587 if (it == write_opened_files_.end()) |
588 return; | 588 return; |
589 | 589 |
590 DCHECK_LT(0, it->second); | 590 DCHECK_LT(0, it->second); |
591 --it->second; | 591 --it->second; |
592 if (it->second == 0) | 592 if (it->second == 0) |
593 write_opened_files_.erase(it); | 593 write_opened_files_.erase(it); |
| 594 |
| 595 // Update last modified date. |
| 596 ResourceEntry entry; |
| 597 FileError error = storage_->GetEntry(id, &entry); |
| 598 if (error != FILE_ERROR_OK) { |
| 599 LOG(ERROR) << "Failed to get entry: " << id << ", " |
| 600 << FileErrorToString(error); |
| 601 return; |
| 602 } |
| 603 entry.mutable_file_info()->set_last_modified( |
| 604 base::Time::Now().ToInternalValue()); |
| 605 error = storage_->PutEntry(entry); |
| 606 if (error != FILE_ERROR_OK) { |
| 607 LOG(ERROR) << "Failed to put entry: " << id << ", " |
| 608 << FileErrorToString(error); |
| 609 } |
594 } | 610 } |
595 | 611 |
596 } // namespace internal | 612 } // namespace internal |
597 } // namespace drive | 613 } // namespace drive |
OLD | NEW |