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

Side by Side Diff: webkit/browser/fileapi/file_system_usage_cache.cc

Issue 16907002: Update Android to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 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
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 "webkit/browser/fileapi/file_system_usage_cache.h" 5 #include "webkit/browser/fileapi/file_system_usage_cache.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 bool FileSystemUsageCache::FlushFile(const base::FilePath& file_path) { 282 bool FileSystemUsageCache::FlushFile(const base::FilePath& file_path) {
283 TRACE_EVENT0("FileSystem", "UsageCache::FlushFile"); 283 TRACE_EVENT0("FileSystem", "UsageCache::FlushFile");
284 DCHECK(CalledOnValidThread()); 284 DCHECK(CalledOnValidThread());
285 base::PlatformFile file = base::kInvalidPlatformFileValue; 285 base::PlatformFile file = base::kInvalidPlatformFileValue;
286 return GetPlatformFile(file_path, &file) && base::FlushPlatformFile(file); 286 return GetPlatformFile(file_path, &file) && base::FlushPlatformFile(file);
287 } 287 }
288 288
289 void FileSystemUsageCache::ScheduleCloseTimer() { 289 void FileSystemUsageCache::ScheduleCloseTimer() {
290 DCHECK(CalledOnValidThread()); 290 DCHECK(CalledOnValidThread());
291 if (!timer_) 291 if (!timer_)
292 timer_.reset(new TimedTaskHelper(task_runner_)); 292 timer_.reset(new TimedTaskHelper(task_runner_.get()));
293 293
294 if (timer_->IsRunning()) { 294 if (timer_->IsRunning()) {
295 timer_->Reset(); 295 timer_->Reset();
296 return; 296 return;
297 } 297 }
298 298
299 timer_->Start(FROM_HERE, 299 timer_->Start(FROM_HERE,
300 base::TimeDelta::FromSeconds(kCloseDelaySeconds), 300 base::TimeDelta::FromSeconds(kCloseDelaySeconds),
301 base::Bind(&FileSystemUsageCache::CloseCacheFiles, 301 base::Bind(&FileSystemUsageCache::CloseCacheFiles,
302 weak_factory_.GetWeakPtr())); 302 weak_factory_.GetWeakPtr()));
303 } 303 }
304 304
305 bool FileSystemUsageCache::CalledOnValidThread() { 305 bool FileSystemUsageCache::CalledOnValidThread() {
306 return !task_runner_.get() || task_runner_->RunsTasksOnCurrentThread(); 306 return !task_runner_.get() || task_runner_->RunsTasksOnCurrentThread();
307 } 307 }
308 308
309 bool FileSystemUsageCache::HasCacheFileHandle(const base::FilePath& file_path) { 309 bool FileSystemUsageCache::HasCacheFileHandle(const base::FilePath& file_path) {
310 DCHECK(CalledOnValidThread()); 310 DCHECK(CalledOnValidThread());
311 DCHECK_LE(cache_files_.size(), kMaxHandleCacheSize); 311 DCHECK_LE(cache_files_.size(), kMaxHandleCacheSize);
312 return ContainsKey(cache_files_, file_path); 312 return ContainsKey(cache_files_, file_path);
313 } 313 }
314 314
315 } // namespace fileapi 315 } // namespace fileapi
OLDNEW
« no previous file with comments | « net/ssl/openssl_client_key_store_unittest.cc ('k') | webkit/browser/fileapi/sandbox_file_stream_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698