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

Unified Diff: content/renderer/p2p/socket_dispatcher.h

Issue 10387135: Add deletion observer to P2PSocketDispatcher. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added comments and fixed style nits. Created 8 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
« no previous file with comments | « content/renderer/media/media_stream_impl.cc ('k') | content/renderer/p2p/socket_dispatcher.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/p2p/socket_dispatcher.h
diff --git a/content/renderer/p2p/socket_dispatcher.h b/content/renderer/p2p/socket_dispatcher.h
index 8cebd5190f221f9eb26568fb7e6ac149482da7f3..7c54d6b9035d0c296349580bab70de25ed4cb039 100644
--- a/content/renderer/p2p/socket_dispatcher.h
+++ b/content/renderer/p2p/socket_dispatcher.h
@@ -52,6 +52,18 @@ namespace content {
class P2PHostAddressRequest;
class P2PSocketClient;
+// Callback interface that allows the implementor to be notified before a
+// P2PSocketDispatcher is deleted.
+// P2PSocketDispatcher requires that all NetworkListObservers are
+// unregistered when SocketDispatcherGone is called.
+class P2PSocketDispatcherObserver {
Sergey Ulanov 2012/05/17 18:20:15 Can this be defined inside of P2PSocketDispatcher?
perkj_chrome 2012/05/18 07:54:25 Yes, but last time I did it triggered this long di
Sergey Ulanov 2012/05/21 17:57:19 Well, that's very arguable rule, not everybody agr
+ public:
+ virtual void SocketDispatcherGone() = 0;
Sergey Ulanov 2012/05/17 18:20:15 OnSocketDispatcherDestroyed()
perkj_chrome 2012/05/18 07:54:25 Done.
+
+ protected:
+ ~P2PSocketDispatcherObserver() {}
Sergey Ulanov 2012/05/17 18:20:15 virtual
perkj_chrome 2012/05/18 07:54:25 ok, this is something that comes up from time to t
Sergey Ulanov 2012/05/21 17:57:19 The style guide says that ALL interfaces must have
+};
+
class CONTENT_EXPORT P2PSocketDispatcher : public content::RenderViewObserver {
public:
explicit P2PSocketDispatcher(RenderViewImpl* render_view);
@@ -69,6 +81,9 @@ class CONTENT_EXPORT P2PSocketDispatcher : public content::RenderViewObserver {
void RemoveNetworkListObserver(
webkit_glue::NetworkListObserver* network_list_observer);
+ void AddDeletionObserver(P2PSocketDispatcherObserver* observer);
Sergey Ulanov 2012/05/17 18:20:15 Either the method should be called AddObserver() o
perkj_chrome 2012/05/18 07:54:25 Done.
+ void RemoveDeletionObserver(P2PSocketDispatcherObserver* observer);
+
// RenderViewObserver overrides.
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
@@ -110,6 +125,7 @@ class CONTENT_EXPORT P2PSocketDispatcher : public content::RenderViewObserver {
network_list_observers_;
scoped_refptr<AsyncMessageSender> async_message_sender_;
+ ObserverList<P2PSocketDispatcherObserver> deletion_observers_;
Sergey Ulanov 2012/05/17 18:20:15 nit: add empty line above this one.
perkj_chrome 2012/05/18 07:54:25 Done.
DISALLOW_COPY_AND_ASSIGN(P2PSocketDispatcher);
};
« no previous file with comments | « content/renderer/media/media_stream_impl.cc ('k') | content/renderer/p2p/socket_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698