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

Unified Diff: chrome/browser/ui/autofill/autofill_popup_controller_impl.h

Issue 12217024: Use WeakPtr to simplify AutofillPopupControllerImpl memory management (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix android build Created 7 years, 10 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: chrome/browser/ui/autofill/autofill_popup_controller_impl.h
diff --git a/chrome/browser/ui/autofill/autofill_popup_controller_impl.h b/chrome/browser/ui/autofill/autofill_popup_controller_impl.h
index a5f0c8d5e3e2483ee341abb95ae719bdbe79b02b..a1158bd17bc74fcfbe45ec439f20d10d09556dfd 100644
--- a/chrome/browser/ui/autofill/autofill_popup_controller_impl.h
+++ b/chrome/browser/ui/autofill/autofill_popup_controller_impl.h
@@ -6,6 +6,7 @@
#define CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_POPUP_CONTROLLER_IMPL_H_
#include "base/gtest_prod_util.h"
+#include "base/memory/weak_ptr.h"
#include "base/string16.h"
#include "chrome/browser/ui/autofill/autofill_popup_controller.h"
#include "content/public/browser/keyboard_listener.h"
@@ -33,8 +34,8 @@ class AutofillPopupControllerImpl : public AutofillPopupController,
// Creates a new |AutofillPopupControllerImpl|, or reuses |previous| if
// the construction arguments are the same. |previous| may be invalidated by
// this call.
- static AutofillPopupControllerImpl* GetOrCreate(
- AutofillPopupControllerImpl* previous,
+ static base::WeakPtr<AutofillPopupControllerImpl> GetOrCreate(
+ base::WeakPtr<AutofillPopupControllerImpl> previous,
AutofillPopupDelegate* delegate,
gfx::NativeView container_view,
const gfx::RectF& element_bounds);
@@ -138,6 +139,8 @@ class AutofillPopupControllerImpl : public AutofillPopupController,
int GetDesiredPopupHeight() const;
#endif
+ base::WeakPtr<AutofillPopupControllerImpl> GetWeakPtr();
+
private:
const gfx::Rect RoundedElementBounds() const;
#if !defined(OS_ANDROID)
@@ -208,6 +211,8 @@ class AutofillPopupControllerImpl : public AutofillPopupController,
// True if the delegate should be informed when |this| is destroyed.
bool inform_delegate_of_destruction_;
+
+ base::WeakPtrFactory<AutofillPopupControllerImpl> weak_ptr_factory_;
};
#endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_POPUP_CONTROLLER_IMPL_H_

Powered by Google App Engine
This is Rietveld 408576698