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

Unified Diff: chrome/browser/in_process_webkit/webkit_context.h

Issue 5359005: Moved deleting the indexed db context to the WebKitContext destructor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Includes cleanup. Created 10 years, 1 month 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: chrome/browser/in_process_webkit/webkit_context.h
diff --git a/chrome/browser/in_process_webkit/webkit_context.h b/chrome/browser/in_process_webkit/webkit_context.h
index be20825c02557b460d37fc89eee5823d741c4fd9..82425ef757ddab593c2cf73b1a6aa4935f7840f1 100644
--- a/chrome/browser/in_process_webkit/webkit_context.h
+++ b/chrome/browser/in_process_webkit/webkit_context.h
@@ -9,11 +9,14 @@
#include <vector>
#include "base/file_path.h"
+#include "base/lock.h"
#include "base/ref_counted.h"
#include "base/scoped_ptr.h"
#include "base/time.h"
#include "chrome/browser/in_process_webkit/dom_storage_context.h"
#include "chrome/browser/in_process_webkit/indexed_db_context.h"
+#include "chrome/browser/prefs/pref_change_registrar.h"
+#include "chrome/common/notification_observer.h"
class Profile;
@@ -24,12 +27,15 @@ class Profile;
//
// This class is created on the UI thread and accessed on the UI, IO, and WebKit
// threads.
-class WebKitContext : public base::RefCountedThreadSafe<WebKitContext> {
+class WebKitContext
+ : public NotificationObserver,
jochen (gone - plz use gerrit) 2010/11/27 19:02:27 notification observer is a pure virtual class, ref
pastarmovj 2010/11/27 20:45:15 Done.
+ public base::RefCountedThreadSafe<WebKitContext> {
public:
explicit WebKitContext(Profile* profile);
const FilePath& data_path() const { return data_path_; }
bool is_incognito() const { return is_incognito_; }
+ bool clear_on_exit() const;
DOMStorageContext* dom_storage_context() {
return dom_storage_context_.get();
@@ -60,6 +66,11 @@ class WebKitContext : public base::RefCountedThreadSafe<WebKitContext> {
// called from any thread.
void DeleteSessionStorageNamespace(int64 session_storage_namespace_id);
+ // NotificationObserver implementation.
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details);
+
private:
friend class base::RefCountedThreadSafe<WebKitContext>;
~WebKitContext();
@@ -68,6 +79,14 @@ class WebKitContext : public base::RefCountedThreadSafe<WebKitContext> {
const FilePath data_path_;
const bool is_incognito_;
+ // Used around accesses to the clear_on_exit_ flag to guarantee thread safety.
+ mutable Lock lock_;
+ // When set the destructors of context objects will delete its files.
+ bool clear_on_exit_;
jochen (gone - plz use gerrit) 2010/11/27 19:02:27 I'd name this something like clear_local_state_on_
pastarmovj 2010/11/27 20:45:15 Done. I felt it would have been way too long and c
+
+ Profile* profile_;
jochen (gone - plz use gerrit) 2010/11/27 19:02:27 what do you need to profile for?
pastarmovj 2010/11/27 20:45:15 For the Observer to be able to extract the new pre
+ PrefChangeRegistrar pref_change_registrar_;
+
scoped_ptr<DOMStorageContext> dom_storage_context_;
scoped_ptr<IndexedDBContext> indexed_db_context_;

Powered by Google App Engine
This is Rietveld 408576698