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

Unified Diff: ipc/ipc_sync_message_filter.h

Issue 2370643004: Port messages sent by WebIDBFactoryImpl to Mojo. (Closed)
Patch Set: Allow cpp_only to be set by the invoker. Created 4 years, 3 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_message_filter.h
diff --git a/ipc/ipc_sync_message_filter.h b/ipc/ipc_sync_message_filter.h
index 3818ab2a9178821fadc9dff6c099a498ae10ac2b..4e3f9b8bf926984dd7cdf8e4d9a2b46b04128701 100644
--- a/ipc/ipc_sync_message_filter.h
+++ b/ipc/ipc_sync_message_filter.h
@@ -17,6 +17,10 @@
#include "ipc/ipc_sync_message.h"
#include "ipc/message_filter.h"
#include "ipc/mojo_event.h"
+#include "mojo/public/cpp/bindings/associated_group.h"
+#include "mojo/public/cpp/bindings/associated_interface_ptr.h"
+#include "mojo/public/cpp/bindings/associated_interface_request.h"
+#include "mojo/public/cpp/bindings/scoped_interface_endpoint_handle.h"
namespace base {
class SingleThreadTaskRunner;
@@ -42,6 +46,20 @@ class IPC_EXPORT SyncMessageFilter : public MessageFilter, public Sender {
void OnChannelClosing() override;
bool OnMessageReceived(const Message& message) override;
+ // Binds an associated interface proxy to an interface in the browser process.
+ // Interfaces acquired through this method are associated with the IPC Channel
+ // and as such retain FIFO with legacy IPC messages.
+ //
+ // NOTE: This must ONLY be called on the Channel's thread, after
+ // OnFilterAdded.
+ template <typename Interface>
+ void GetRemoteAssociatedInterface(
+ mojo::AssociatedInterfacePtr<Interface>* proxy) {
+ mojo::AssociatedInterfaceRequest<Interface> request =
+ mojo::GetProxy(proxy, &channel_associated_group_);
+ GetGenericRemoteAssociatedInterface(Interface::Name_, request.PassHandle());
+ }
+
protected:
explicit SyncMessageFilter(base::WaitableEvent* shutdown_event);
~SyncMessageFilter() override;
@@ -59,6 +77,11 @@ class IPC_EXPORT SyncMessageFilter : public MessageFilter, public Sender {
void OnShutdownEventSignaled(base::WaitableEvent* event);
void OnIOMessageLoopDestroyed();
+ // NOTE: This must ONLY be called on the Channel's thread.
+ void GetGenericRemoteAssociatedInterface(
+ const std::string& interface_name,
+ mojo::ScopedInterfaceEndpointHandle handle);
+
// The channel to which this filter was added.
Channel* channel_;
@@ -89,6 +112,10 @@ class IPC_EXPORT SyncMessageFilter : public MessageFilter, public Sender {
scoped_refptr<IOMessageLoopObserver> io_message_loop_observer_;
+ // The AssociatedGroup for the underlying channel, used to construct new
+ // associated interface endpoints.
+ mojo::AssociatedGroup channel_associated_group_;
+
base::WeakPtrFactory<SyncMessageFilter> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(SyncMessageFilter);

Powered by Google App Engine
This is Rietveld 408576698