OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/extensions/updater/local_extension_cache.h" | 5 #include "chrome/browser/extensions/updater/local_extension_cache.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/files/file_enumerator.h" | 8 #include "base/files/file_enumerator.h" |
9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "base/sequenced_task_runner.h" | 10 #include "base/sequenced_task_runner.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 LocalExtensionCache::LocalExtensionCache( | 31 LocalExtensionCache::LocalExtensionCache( |
32 const base::FilePath& cache_dir, | 32 const base::FilePath& cache_dir, |
33 uint64 max_cache_size, | 33 uint64 max_cache_size, |
34 const base::TimeDelta& max_cache_age, | 34 const base::TimeDelta& max_cache_age, |
35 const scoped_refptr<base::SequencedTaskRunner>& backend_task_runner) | 35 const scoped_refptr<base::SequencedTaskRunner>& backend_task_runner) |
36 : cache_dir_(cache_dir), | 36 : cache_dir_(cache_dir), |
37 max_cache_size_(max_cache_size), | 37 max_cache_size_(max_cache_size), |
38 min_cache_age_(base::Time::Now() - max_cache_age), | 38 min_cache_age_(base::Time::Now() - max_cache_age), |
39 backend_task_runner_(backend_task_runner), | 39 backend_task_runner_(backend_task_runner), |
40 state_(kUninitialized), | 40 state_(kUninitialized), |
41 weak_ptr_factory_(this), | |
42 cache_status_polling_delay_( | 41 cache_status_polling_delay_( |
43 base::TimeDelta::FromMilliseconds(kCacheStatusPollingDelayMs)) { | 42 base::TimeDelta::FromMilliseconds(kCacheStatusPollingDelayMs)), |
| 43 weak_ptr_factory_(this) { |
44 } | 44 } |
45 | 45 |
46 LocalExtensionCache::~LocalExtensionCache() { | 46 LocalExtensionCache::~LocalExtensionCache() { |
47 if (state_ == kReady) | 47 if (state_ == kReady) |
48 CleanUp(); | 48 CleanUp(); |
49 } | 49 } |
50 | 50 |
51 void LocalExtensionCache::Init(bool wait_for_cache_initialization, | 51 void LocalExtensionCache::Init(bool wait_for_cache_initialization, |
52 const base::Closure& callback) { | 52 const base::Closure& callback) { |
53 DCHECK_EQ(state_, kUninitialized); | 53 DCHECK_EQ(state_, kUninitialized); |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 | 484 |
485 LocalExtensionCache::CacheItemInfo::CacheItemInfo( | 485 LocalExtensionCache::CacheItemInfo::CacheItemInfo( |
486 const std::string& version, | 486 const std::string& version, |
487 const base::Time& last_used, | 487 const base::Time& last_used, |
488 uint64 size, | 488 uint64 size, |
489 const base::FilePath& file_path) | 489 const base::FilePath& file_path) |
490 : version(version), last_used(last_used), size(size), file_path(file_path) { | 490 : version(version), last_used(last_used), size(size), file_path(file_path) { |
491 } | 491 } |
492 | 492 |
493 } // namespace extensions | 493 } // namespace extensions |
OLD | NEW |