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

Unified Diff: content/browser/notifications/platform_notification_context_impl.h

Issue 1024463006: Destroy the notification database when corruption occurs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@n-db-SWContextObserver
Patch Set: another test Created 5 years, 9 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
Index: content/browser/notifications/platform_notification_context_impl.h
diff --git a/content/browser/notifications/platform_notification_context_impl.h b/content/browser/notifications/platform_notification_context_impl.h
index ddbf2a7169130cf33f940a7f44a87733def37b5d..4b5ef8fd338e53d7aa12c53e06cd4dd2a3696604 100644
--- a/content/browser/notifications/platform_notification_context_impl.h
+++ b/content/browser/notifications/platform_notification_context_impl.h
@@ -58,10 +58,13 @@ class CONTENT_EXPORT PlatformNotificationContextImpl
// ServiceWorkerContextObserver implementation.
void OnRegistrationDeleted(int64_t registration_id,
const GURL& pattern) override;
+ void OnStorageWiped() override;
private:
friend class PlatformNotificationContextTest;
+ enum class CorruptionBehavior;
+
~PlatformNotificationContextImpl() override;
void InitializeOnIO();
@@ -78,7 +81,8 @@ class CONTENT_EXPORT PlatformNotificationContextImpl
// database has been opened, |success_closure| will be invoked on the task
// thread, otherwise |failure_closure_| will be invoked on the IO thread.
void OpenDatabase(const base::Closure& success_closure,
- const base::Closure& failure_closure);
+ const base::Closure& failure_closure,
+ CorruptionBehavior corruption_behavior);
// Deletes all notifications associated with |service_worker_registration_id|
// belonging to |origin|. Must be called on the |task_runner_| thread.
@@ -107,6 +111,10 @@ class CONTENT_EXPORT PlatformNotificationContextImpl
const GURL& origin,
const DeleteResultCallback& callback);
+ // Destroys the database regardless of its initialization status. This method
+ // must only be called on the |task_runner_| thread.
+ void DestroyDatabase();
+
// Returns the path in which the database should be initialized. May be empty.
base::FilePath GetDatabasePath() const;

Powered by Google App Engine
This is Rietveld 408576698