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

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

Issue 1547093002: Switch to standard integer types in chrome/browser/chromeos/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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"
11 #include "base/threading/sequenced_worker_pool.h" 11 #include "base/threading/sequenced_worker_pool.h"
12 #include "chrome/browser/chromeos/extensions/install_limiter_factory.h" 12 #include "chrome/browser/chromeos/extensions/install_limiter_factory.h"
13 #include "content/public/browser/browser_thread.h" 13 #include "content/public/browser/browser_thread.h"
14 #include "content/public/browser/notification_details.h" 14 #include "content/public/browser/notification_details.h"
15 #include "content/public/browser/notification_source.h" 15 #include "content/public/browser/notification_source.h"
16 #include "extensions/browser/notification_types.h" 16 #include "extensions/browser/notification_types.h"
17 17
18 using content::BrowserThread; 18 using content::BrowserThread;
19 19
20 namespace { 20 namespace {
21 21
22 int64 GetFileSizeOnBlockingPool(const base::FilePath& file) { 22 int64_t GetFileSizeOnBlockingPool(const base::FilePath& file) {
23 DCHECK(BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); 23 DCHECK(BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread());
24 24
25 // Get file size. In case of error, sets 0 as file size to let the installer 25 // Get file size. In case of error, sets 0 as file size to let the installer
26 // run and fail. 26 // run and fail.
27 int64 size; 27 int64_t size;
28 return base::GetFileSize(file, &size) ? size : 0; 28 return base::GetFileSize(file, &size) ? size : 0;
29 } 29 }
30 30
31 } // namespace 31 } // namespace
32 32
33 namespace extensions { 33 namespace extensions {
34 34
35 //////////////////////////////////////////////////////////////////////////////// 35 ////////////////////////////////////////////////////////////////////////////////
36 // InstallLimiter::DeferredInstall 36 // InstallLimiter::DeferredInstall
37 37
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 return; 70 return;
71 } 71 }
72 72
73 base::PostTaskAndReplyWithResult( 73 base::PostTaskAndReplyWithResult(
74 BrowserThread::GetBlockingPool(), 74 BrowserThread::GetBlockingPool(),
75 FROM_HERE, 75 FROM_HERE,
76 base::Bind(&GetFileSizeOnBlockingPool, path), 76 base::Bind(&GetFileSizeOnBlockingPool, path),
77 base::Bind(&InstallLimiter::AddWithSize, AsWeakPtr(), installer, path)); 77 base::Bind(&InstallLimiter::AddWithSize, AsWeakPtr(), installer, path));
78 } 78 }
79 79
80 void InstallLimiter::AddWithSize( 80 void InstallLimiter::AddWithSize(const scoped_refptr<CrxInstaller>& installer,
81 const scoped_refptr<CrxInstaller>& installer, 81 const base::FilePath& path,
82 const base::FilePath& path, 82 int64_t size) {
83 int64 size) { 83 const int64_t kBigAppSizeThreshold = 1048576; // 1MB
84 const int64 kBigAppSizeThreshold = 1048576; // 1MB
85 84
86 if (size <= kBigAppSizeThreshold) { 85 if (size <= kBigAppSizeThreshold) {
87 RunInstall(installer, path); 86 RunInstall(installer, path);
88 87
89 // Stop wait timer and let install notification drive deferred installs. 88 // Stop wait timer and let install notification drive deferred installs.
90 wait_timer_.Stop(); 89 wait_timer_.Stop();
91 return; 90 return;
92 } 91 }
93 92
94 deferred_installs_.push(DeferredInstall(installer, path)); 93 deferred_installs_.push(DeferredInstall(installer, path));
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 130
132 registrar_.Remove(this, extensions::NOTIFICATION_CRX_INSTALLER_DONE, source); 131 registrar_.Remove(this, extensions::NOTIFICATION_CRX_INSTALLER_DONE, source);
133 132
134 const scoped_refptr<CrxInstaller> installer = 133 const scoped_refptr<CrxInstaller> installer =
135 content::Source<extensions::CrxInstaller>(source).ptr(); 134 content::Source<extensions::CrxInstaller>(source).ptr();
136 running_installers_.erase(installer); 135 running_installers_.erase(installer);
137 CheckAndRunDeferrredInstalls(); 136 CheckAndRunDeferrredInstalls();
138 } 137 }
139 138
140 } // namespace extensions 139 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/extensions/install_limiter.h ('k') | chrome/browser/chromeos/extensions/install_limiter_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698