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

Unified Diff: chrome/browser/profiles/profile_destroyer.h

Issue 10645005: Modify ProfileDestroyer to prevent leaks. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 6 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/profiles/profile_destroyer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/profiles/profile_destroyer.h
===================================================================
--- chrome/browser/profiles/profile_destroyer.h (revision 143384)
+++ chrome/browser/profiles/profile_destroyer.h (working copy)
@@ -9,6 +9,7 @@
#include <vector>
#include "base/memory/ref_counted.h"
+#include "base/timer.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
@@ -24,6 +25,7 @@
public base::RefCounted<ProfileDestroyer> {
public:
static void DestroyProfileWhenAppropriate(Profile* const profile);
+ static void DestroyOffTheRecordProfileNow(Profile* const profile);
private:
friend class base::RefCounted<ProfileDestroyer>;
@@ -37,6 +39,8 @@
virtual void Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) OVERRIDE;
+ // Called by the timer to cancel the pending detruction and do it now.
+ void DestroyProfile();
// Fetch the list of render process hosts that still refer to the profile.
// Return true if we found at least one, false otherwise.
@@ -44,9 +48,20 @@
Profile* const profile,
std::vector<content::RenderProcessHost*> *hosts);
+ // We need access to all pending destroyers so we can cancel them.
+ static std::vector<ProfileDestroyer*>* pending_destroyers_;
+
+ // We register for render process host termination.
content::NotificationRegistrar registrar_;
- Profile* const profile_;
+ // We don't want to wait forever, so we have a cancellation timer.
+ base::Timer timer_;
+
+ // Used to count down the number of render process host left.
+ uint32 num_hosts_;
+
+ Profile* profile_;
+
DISALLOW_COPY_AND_ASSIGN(ProfileDestroyer);
};
« no previous file with comments | « no previous file | chrome/browser/profiles/profile_destroyer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698