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

Side by Side Diff: chrome/browser/chromeos/extensions/install_limiter.cc

Issue 2858073002: Use constexpr TaskTraits constructor in chrome. (Closed)
Patch Set: Created 3 years, 7 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/extensions/install_limiter.h" 5 #include "chrome/browser/chromeos/extensions/install_limiter.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 62
63 void InstallLimiter::Add(const scoped_refptr<CrxInstaller>& installer, 63 void InstallLimiter::Add(const scoped_refptr<CrxInstaller>& installer,
64 const base::FilePath& path) { 64 const base::FilePath& path) {
65 // No deferred installs when disabled for test. 65 // No deferred installs when disabled for test.
66 if (disabled_for_test_) { 66 if (disabled_for_test_) {
67 installer->InstallCrx(path); 67 installer->InstallCrx(path);
68 return; 68 return;
69 } 69 }
70 70
71 base::PostTaskWithTraitsAndReplyWithResult( 71 base::PostTaskWithTraitsAndReplyWithResult(
72 FROM_HERE, base::TaskTraits().MayBlock(), base::Bind(&GetFileSize, path), 72 FROM_HERE, {base::MayBlock()}, base::Bind(&GetFileSize, path),
73 base::Bind(&InstallLimiter::AddWithSize, AsWeakPtr(), installer, path)); 73 base::Bind(&InstallLimiter::AddWithSize, AsWeakPtr(), installer, path));
74 } 74 }
75 75
76 void InstallLimiter::AddWithSize(const scoped_refptr<CrxInstaller>& installer, 76 void InstallLimiter::AddWithSize(const scoped_refptr<CrxInstaller>& installer,
77 const base::FilePath& path, 77 const base::FilePath& path,
78 int64_t size) { 78 int64_t size) {
79 const int64_t kBigAppSizeThreshold = 1048576; // 1MB 79 const int64_t kBigAppSizeThreshold = 1048576; // 1MB
80 80
81 if (size <= kBigAppSizeThreshold) { 81 if (size <= kBigAppSizeThreshold) {
82 RunInstall(installer, path); 82 RunInstall(installer, path);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 126
127 registrar_.Remove(this, extensions::NOTIFICATION_CRX_INSTALLER_DONE, source); 127 registrar_.Remove(this, extensions::NOTIFICATION_CRX_INSTALLER_DONE, source);
128 128
129 const scoped_refptr<CrxInstaller> installer = 129 const scoped_refptr<CrxInstaller> installer =
130 content::Source<extensions::CrxInstaller>(source).ptr(); 130 content::Source<extensions::CrxInstaller>(source).ptr();
131 running_installers_.erase(installer); 131 running_installers_.erase(installer);
132 CheckAndRunDeferrredInstalls(); 132 CheckAndRunDeferrredInstalls();
133 } 133 }
134 134
135 } // namespace extensions 135 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/extensions/file_manager/private_api_mount.cc ('k') | chrome/browser/chromeos/external_metrics.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698