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

Side by Side Diff: chrome/browser/chromeos/drive/file_cache.cc

Issue 304183005: drive: Always use last_modified stored in ResourceEntry (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/drive/file_cache_unittest.cc » ('j') | 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 "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
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
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/drive/file_cache_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698