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

Unified Diff: chrome/browser/extensions/extension_function_dispatcher.h

Issue 6990050: Small cleanup to move ExtensionFunctionDispatcher to use WeakPtr instead of Peer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 7 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/extensions/extension_function_dispatcher.h
diff --git a/chrome/browser/extensions/extension_function_dispatcher.h b/chrome/browser/extensions/extension_function_dispatcher.h
index d3b8d1c8fa915303bef592e99ae03b7d6512ce47..a59890e1ba05995d4deb30e268850104994c94c1 100644
--- a/chrome/browser/extensions/extension_function_dispatcher.h
+++ b/chrome/browser/extensions/extension_function_dispatcher.h
@@ -9,7 +9,7 @@
#include <string>
#include <vector>
-#include "base/memory/ref_counted.h"
+#include "base/memory/weak_ptr.h"
#include "googleurl/src/gurl.h"
#include "ui/gfx/native_widget_types.h"
@@ -38,7 +38,8 @@ typedef ExtensionFunction* (*ExtensionFunctionFactory)();
// we can gracefully handle cases like TabContents, where the RVH, extension,
// and URL can all change over the lifetime of the tab. Instead, these items
// are all passed into each request.
-class ExtensionFunctionDispatcher {
+class ExtensionFunctionDispatcher
+ : public base::SupportsWeakPtr<ExtensionFunctionDispatcher> {
public:
class Delegate {
public:
@@ -60,20 +61,6 @@ class ExtensionFunctionDispatcher {
virtual ~Delegate() {}
};
- // The peer object allows us to notify ExtensionFunctions when we are
- // destroyed.
- // TODO: this should use WeakPtr
- struct Peer : public base::RefCounted<Peer> {
- explicit Peer(ExtensionFunctionDispatcher* dispatcher)
- : dispatcher_(dispatcher) {}
- ExtensionFunctionDispatcher* dispatcher_;
-
- private:
- friend class base::RefCounted<Peer>;
-
- ~Peer() {}
- };
-
// Gets a list of all known extension function names.
static void GetAllFunctionNames(std::vector<std::string>* names);
@@ -118,8 +105,6 @@ class ExtensionFunctionDispatcher {
Profile* profile_;
Delegate* delegate_;
-
- scoped_refptr<Peer> peer_;
};
#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_DISPATCHER_H_
« no previous file with comments | « chrome/browser/extensions/extension_function.h ('k') | chrome/browser/extensions/extension_function_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698