| 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/extension_cache_impl.h" | 5 #include "chrome/browser/extensions/updater/extension_cache_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 | 25 |
| 26 namespace extensions { | 26 namespace extensions { |
| 27 | 27 |
| 28 ExtensionCacheImpl::ExtensionCacheImpl( | 28 ExtensionCacheImpl::ExtensionCacheImpl( |
| 29 std::unique_ptr<ExtensionCacheDelegate> delegate) | 29 std::unique_ptr<ExtensionCacheDelegate> delegate) |
| 30 : cache_(new LocalExtensionCache( | 30 : cache_(new LocalExtensionCache( |
| 31 delegate->GetCacheDir(), | 31 delegate->GetCacheDir(), |
| 32 delegate->GetMaximumCacheSize(), | 32 delegate->GetMaximumCacheSize(), |
| 33 delegate->GetMaximumCacheAge(), | 33 delegate->GetMaximumCacheAge(), |
| 34 base::CreateSequencedTaskRunnerWithTraits( | 34 base::CreateSequencedTaskRunnerWithTraits( |
| 35 base::TaskTraits() | 35 {base::MayBlock(), base::TaskPriority::BACKGROUND, |
| 36 .MayBlock() | 36 base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN}))), |
| 37 .WithPriority(base::TaskPriority::BACKGROUND) | |
| 38 .WithShutdownBehavior( | |
| 39 base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN)))), | |
| 40 weak_ptr_factory_(this) { | 37 weak_ptr_factory_(this) { |
| 41 notification_registrar_.Add( | 38 notification_registrar_.Add( |
| 42 this, extensions::NOTIFICATION_EXTENSION_INSTALL_ERROR, | 39 this, extensions::NOTIFICATION_EXTENSION_INSTALL_ERROR, |
| 43 content::NotificationService::AllBrowserContextsAndSources()); | 40 content::NotificationService::AllBrowserContextsAndSources()); |
| 44 cache_->Init(true, base::Bind(&ExtensionCacheImpl::OnCacheInitialized, | 41 cache_->Init(true, base::Bind(&ExtensionCacheImpl::OnCacheInitialized, |
| 45 weak_ptr_factory_.GetWeakPtr())); | 42 weak_ptr_factory_.GetWeakPtr())); |
| 46 } | 43 } |
| 47 | 44 |
| 48 ExtensionCacheImpl::~ExtensionCacheImpl() { | 45 ExtensionCacheImpl::~ExtensionCacheImpl() { |
| 49 } | 46 } |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 // We deliberately keep the file with incorrect hash sum, so that it | 133 // We deliberately keep the file with incorrect hash sum, so that it |
| 137 // will not be re-downloaded each time. | 134 // will not be re-downloaded each time. |
| 138 break; | 135 break; |
| 139 default: | 136 default: |
| 140 cache_->RemoveExtension(id, hash); | 137 cache_->RemoveExtension(id, hash); |
| 141 break; | 138 break; |
| 142 } | 139 } |
| 143 } | 140 } |
| 144 | 141 |
| 145 } // namespace extensions | 142 } // namespace extensions |
| OLD | NEW |