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

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

Issue 408153003: Simplify RunTaskOnThread (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix FileCacheTest Created 6 years, 5 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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
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