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

Unified Diff: chrome/browser/chromeos/extensions/install_limiter.cc

Issue 56833003: Use base::PostTaskAndReplyWithResults() in more places. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase, fix clang error Created 7 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/extensions/install_limiter.cc
diff --git a/chrome/browser/chromeos/extensions/install_limiter.cc b/chrome/browser/chromeos/extensions/install_limiter.cc
index 2798af077532fa345c23d55ef6fd113a0771c296..3b7b3fe2349728928064b2b5a472b8e46b25a59b 100644
--- a/chrome/browser/chromeos/extensions/install_limiter.cc
+++ b/chrome/browser/chromeos/extensions/install_limiter.cc
@@ -19,14 +19,13 @@ using content::BrowserThread;
namespace {
-// Gets the file size of |file| and stores it in |size| on the blocking pool.
-void GetFileSizeOnBlockingPool(const base::FilePath& file, int64* size) {
+int64 GetFileSizeOnBlockingPool(const base::FilePath& file) {
DCHECK(BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread());
// Get file size. In case of error, sets 0 as file size to let the installer
// run and fail.
- if (!file_util::GetFileSize(file, size))
- *size = 0;
+ int64 size;
+ return file_util::GetFileSize(file, &size) ? size : 0;
}
} // namespace
@@ -71,21 +70,20 @@ void InstallLimiter::Add(const scoped_refptr<CrxInstaller>& installer,
return;
}
- int64* size = new int64(0); // Owned by reply callback below.
- BrowserThread::PostBlockingPoolTaskAndReply(
+ base::PostTaskAndReplyWithResult(
+ BrowserThread::GetBlockingPool(),
FROM_HERE,
- base::Bind(&GetFileSizeOnBlockingPool, path, size),
- base::Bind(&InstallLimiter::AddWithSize, AsWeakPtr(),
- installer, path, base::Owned(size)));
+ base::Bind(&GetFileSizeOnBlockingPool, path),
+ base::Bind(&InstallLimiter::AddWithSize, AsWeakPtr(), installer, path));
}
void InstallLimiter::AddWithSize(
const scoped_refptr<CrxInstaller>& installer,
const base::FilePath& path,
- int64* size) {
+ int64 size) {
const int64 kBigAppSizeThreshold = 1048576; // 1MB
- if (*size <= kBigAppSizeThreshold) {
+ if (size <= kBigAppSizeThreshold) {
RunInstall(installer, path);
// Stop wait timer and let install notification drive deferred installs.
« no previous file with comments | « chrome/browser/chromeos/extensions/install_limiter.h ('k') | chrome/browser/extensions/extension_protocols.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698