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

Unified Diff: ipc/ipc_sync_channel.h

Issue 6711024: Example of how to interpose yourself in a message stream. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 8 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: ipc/ipc_sync_channel.h
===================================================================
--- ipc/ipc_sync_channel.h (revision 83074)
+++ ipc/ipc_sync_channel.h (working copy)
@@ -90,6 +90,21 @@
// of some particular channels to not re-enter in such cases.
void SetRestrictDispatchToSameChannel(bool value);
+ // Interface for a filter to be imposed on outgoing messages which can
+ // re-write the message. Used mainly for testing.
+ class OutgoingMessageFilter {
+ public:
+ virtual ~OutgoingMessageFilter() = 0;
+
+ // Returns a re-written message, freeing the original, or simply the
+ // original unchanged if no rewrite indicated.
+ virtual Message *Rewrite(Message *message) = 0;
+ };
+
+ void set_outgoing_message_filter(OutgoingMessageFilter *filter) {
+ outgoing_message_filter_ = filter;
+ }
+
protected:
class ReceivedSyncMsgQueue;
friend class ReceivedSyncMsgQueue;
@@ -168,6 +183,7 @@
base::WaitableEvent* shutdown_event_;
base::WaitableEventWatcher shutdown_watcher_;
bool restrict_dispatch_;
+
jam 2011/04/27 21:58:07 nit
};
private:
@@ -188,6 +204,7 @@
static void WaitForReplyWithNestedMessageLoop(SyncContext* context);
bool sync_messages_with_no_timeout_allowed_;
+ OutgoingMessageFilter *outgoing_message_filter_;
// Used to signal events between the IPC and listener threads.
base::WaitableEventWatcher dispatch_watcher_;

Powered by Google App Engine
This is Rietveld 408576698