Chromium Code Reviews| Index: content/browser/appcache/chrome_appcache_service.h |
| diff --git a/content/browser/appcache/chrome_appcache_service.h b/content/browser/appcache/chrome_appcache_service.h |
| index d325b376d443b6f575c1dbd627ad168d8aa72df5..ee1445169926aabc44f71405dca57e674fc502b3 100644 |
| --- a/content/browser/appcache/chrome_appcache_service.h |
| +++ b/content/browser/appcache/chrome_appcache_service.h |
| @@ -7,15 +7,21 @@ |
| #pragma once |
| #include "base/memory/ref_counted.h" |
| +#include "base/synchronization/waitable_event.h" |
| #include "content/browser/browser_thread.h" |
| #include "content/common/notification_observer.h" |
| #include "content/common/notification_registrar.h" |
| +#include "net/base/completion_callback.h" |
| #include "webkit/appcache/appcache_policy.h" |
| #include "webkit/appcache/appcache_service.h" |
| #include "webkit/quota/special_storage_policy.h" |
| class FilePath; |
| +namespace appcache { |
| +class TestableChromeAppCacheService; |
| +} |
| + |
| namespace content { |
| class ResourceContext; |
| } |
| @@ -40,14 +46,21 @@ class ChromeAppCacheService |
| void InitializeOnIOThread( |
| const FilePath& cache_path, // may be empty to use in-memory structures |
| const content::ResourceContext* resource_context, |
| - scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy, |
| - bool clear_local_state_on_exit); |
| + scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy); |
| - void SetClearLocalStateOnExit(bool clear_local_state); |
| + // Safe to call from any thread |
| + base::WaitableEvent* ClearAppCache(net::CompletionCallback* callback); |
|
michaeln
2011/07/14 00:42:34
Given the approach of deleting in the storage dtor
marja(google)
2011/07/14 10:31:59
Done.
michaeln
2011/07/14 22:53:16
But this method is still in the CL?
marja(google)
2011/07/15 11:03:42
Oops, misread which func this comment refers to. N
|
| + // Can only be called when there are no pending operations on the |
| + // ChromeAppCacheService (or the underlying AppCacheStorage), and when it will |
| + // no longer accessed before deleting it. This function will call |
| + // AppCacheDatabase functions in the IO thread; that can only work if there is |
| + // no concurrency. |
| + void SyncClearAppCacheOnIOThread(); |
| private: |
| friend class BrowserThread; |
| friend class DeleteTask<ChromeAppCacheService>; |
| + friend class appcache::TestableChromeAppCacheService; |
| virtual ~ChromeAppCacheService(); |
| @@ -61,10 +74,23 @@ class ChromeAppCacheService |
| const NotificationSource& source, |
| const NotificationDetails& details); |
| + // AppCache clearing helpers and callbacks |
| + void OnGotAppCacheInfo(int rv); |
| + void OnAppCacheDeleted(int rv); |
| + void OnClearedAppCache(); |
| + |
| const content::ResourceContext* resource_context_; |
| NotificationRegistrar registrar_; |
| - bool clear_local_state_on_exit_; |
| FilePath cache_path_; |
| + net::CompletionCallbackImpl<ChromeAppCacheService> |
| + appcache_got_info_callback_; |
| + net::CompletionCallbackImpl<ChromeAppCacheService> |
| + appcache_deleted_callback_; |
| + scoped_refptr<appcache::AppCacheInfoCollection> appcache_info_; |
| + int appcaches_to_be_deleted_count_; |
| + scoped_ptr<base::WaitableEvent> appcaches_cleared_event_; |
| + net::CompletionCallback* appcaches_cleared_callback_; |
| + bool waiting_for_clear_appcaches_; |
| DISALLOW_COPY_AND_ASSIGN(ChromeAppCacheService); |
| }; |