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

Unified Diff: chrome/browser/apps/ephemeral_app_service.h

Issue 1415863002: Delete all cached ephemeral apps at startup. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove dud file Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/apps/ephemeral_app_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/apps/ephemeral_app_service.h
diff --git a/chrome/browser/apps/ephemeral_app_service.h b/chrome/browser/apps/ephemeral_app_service.h
index b4c0de44c2ad087c37d951fe7a7370cc5d2d1aa0..d8b1a8965bfad61463dfb49790daf6d54d2da1a9 100644
--- a/chrome/browser/apps/ephemeral_app_service.h
+++ b/chrome/browser/apps/ephemeral_app_service.h
@@ -10,7 +10,6 @@
#include "apps/app_lifetime_monitor.h"
#include "base/memory/weak_ptr.h"
#include "base/scoped_observer.h"
-#include "base/timer/timer.h"
#include "components/keyed_service/core/keyed_service.h"
#include "extensions/browser/extension_registry_observer.h"
@@ -21,7 +20,8 @@ class Extension;
class ExtensionRegistry;
} // namespace extensions
-// Performs the background garbage collection of ephemeral apps.
+// Delete cached ephemeral apps at startup.
+// TODO(benwells): Remove this system. https://crbug.com/517735.
class EphemeralAppService : public KeyedService,
public extensions::ExtensionRegistryObserver,
public apps::AppLifetimeMonitor::Observer {
@@ -36,55 +36,28 @@ class EphemeralAppService : public KeyedService,
// Clears the ephemeral app cache. Removes all idle ephemeral apps.
void ClearCachedApps();
- int ephemeral_app_count() const { return ephemeral_app_count_; }
-
void set_disable_delay_for_test(int delay) {
disable_idle_app_delay_ = delay;
}
- // Constants exposed for testing purposes:
-
- // The number of days of inactivity before an ephemeral app will be removed.
- static const int kAppInactiveThreshold;
- // If the ephemeral app has been launched within this number of days, it will
- // definitely not be garbage collected.
- static const int kAppKeepThreshold;
- // The maximum number of ephemeral apps to keep cached. Excess may be removed.
- static const int kMaxEphemeralAppsCount;
-
private:
- // A map used to order the ephemeral apps by their last launch time.
- typedef std::multimap<base::Time, std::string> LaunchTimeAppMap;
-
// extensions::ExtensionRegistryObserver.
void OnExtensionWillBeInstalled(content::BrowserContext* browser_context,
const extensions::Extension* extension,
bool is_update,
bool from_ephemeral,
const std::string& old_name) override;
- void OnExtensionUninstalled(content::BrowserContext* browser_context,
- const extensions::Extension* extension,
- extensions::UninstallReason reason) override;
// apps::AppLifetimeMonitor::Observer implementation.
void OnAppStop(Profile* profile, const std::string& app_id) override;
void OnChromeTerminating() override;
void Init();
- void InitEphemeralAppCount();
void DisableEphemeralApp(const std::string& app_id);
- void DisableEphemeralAppsOnStartup();
void HandleEphemeralAppPromoted(const extensions::Extension* app);
- // Garbage collect ephemeral apps.
- void TriggerGarbageCollect(const base::TimeDelta& delay);
- void GarbageCollectApps();
- static void GetAppsToRemove(int app_count,
- const LaunchTimeAppMap& app_launch_times,
- std::set<std::string>* remove_app_ids);
-
Profile* profile_;
ScopedObserver<extensions::ExtensionRegistry,
@@ -93,18 +66,12 @@ class EphemeralAppService : public KeyedService,
ScopedObserver<apps::AppLifetimeMonitor, apps::AppLifetimeMonitor::Observer>
app_lifetime_monitor_observer_;
- base::OneShotTimer garbage_collect_apps_timer_;
-
- // The count of cached ephemeral apps.
- int ephemeral_app_count_;
-
// Number of seconds before disabling idle ephemeral apps.
// Overridden in tests.
int disable_idle_app_delay_;
base::WeakPtrFactory<EphemeralAppService> weak_ptr_factory_;
- friend class EphemeralAppServiceTest;
friend class EphemeralAppServiceBrowserTest;
DISALLOW_COPY_AND_ASSIGN(EphemeralAppService);
« no previous file with comments | « no previous file | chrome/browser/apps/ephemeral_app_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698