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 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_GARBAGE_COLLECTOR_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_GARBAGE_COLLECTOR_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_GARBAGE_COLLECTOR_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_GARBAGE_COLLECTOR_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 private: | 53 private: |
54 // Cleans up the extension install directory. It can end up with garbage in it | 54 // Cleans up the extension install directory. It can end up with garbage in it |
55 // if extensions can't initially be removed when they are uninstalled (eg if a | 55 // if extensions can't initially be removed when they are uninstalled (eg if a |
56 // file is in use). | 56 // file is in use). |
57 // Obsolete version directories are removed, as are directories that aren't | 57 // Obsolete version directories are removed, as are directories that aren't |
58 // found in the ExtensionPrefs. | 58 // found in the ExtensionPrefs. |
59 // The "Temp" directory that is used during extension installation will get | 59 // The "Temp" directory that is used during extension installation will get |
60 // removed iff there are no pending installations. | 60 // removed iff there are no pending installations. |
61 void GarbageCollectExtensions(); | 61 void GarbageCollectExtensions(); |
62 | 62 |
63 // Garbage collects apps/extensions isolated storage, if it is not currently | 63 // Garbage collects apps/extensions isolated storage if it is uninstalled. |
64 // active (i.e. is not in ExtensionRegistry::ENABLED). There is an exception | 64 // There is an exception for ephemeral apps because they can outlive their |
65 // for ephemeral apps, because they can outlive their cache lifetimes. | 65 // cache lifetimes. |
66 void GarbageCollectIsolatedStorageIfNeeded(); | 66 void GarbageCollectIsolatedStorageIfNeeded(); |
67 | 67 |
68 // The BrowserContext associated with the GarbageCollector. | 68 // The BrowserContext associated with the GarbageCollector. |
69 content::BrowserContext* context_; | 69 content::BrowserContext* context_; |
70 | 70 |
71 #if defined(OS_CHROMEOS) | 71 #if defined(OS_CHROMEOS) |
72 // TODO(rkc): HACK alert - this is only in place to allow the | 72 // TODO(rkc): HACK alert - this is only in place to allow the |
73 // kiosk_mode_screensaver to prevent its extension from getting garbage | 73 // kiosk_mode_screensaver to prevent its extension from getting garbage |
74 // collected. Remove this once KioskModeScreensaver is removed. | 74 // collected. Remove this once KioskModeScreensaver is removed. |
75 // See crbug.com/280363 | 75 // See crbug.com/280363 |
76 bool disable_garbage_collection_; | 76 bool disable_garbage_collection_; |
77 #endif | 77 #endif |
78 | 78 |
79 // The number of currently ongoing CRX installations. This is used to prevent | 79 // The number of currently ongoing CRX installations. This is used to prevent |
80 // garbage collection from running while a CRX is being installed. | 80 // garbage collection from running while a CRX is being installed. |
81 int crx_installs_in_progress_; | 81 int crx_installs_in_progress_; |
82 | 82 |
83 // Generate weak pointers for safely posting to the file thread for garbage | 83 // Generate weak pointers for safely posting to the file thread for garbage |
84 // collection. | 84 // collection. |
85 base::WeakPtrFactory<ExtensionGarbageCollector> weak_factory_; | 85 base::WeakPtrFactory<ExtensionGarbageCollector> weak_factory_; |
86 | 86 |
87 DISALLOW_COPY_AND_ASSIGN(ExtensionGarbageCollector); | 87 DISALLOW_COPY_AND_ASSIGN(ExtensionGarbageCollector); |
88 }; | 88 }; |
89 | 89 |
90 } // namespace extensions | 90 } // namespace extensions |
91 | 91 |
92 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_GARBAGE_COLLECTOR_H_ | 92 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_GARBAGE_COLLECTOR_H_ |
OLD | NEW |