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

Unified Diff: ipc/attachment_broker_privileged.h

Issue 1739203004: Add support for Attachment Brokering of IPC::Channels on multiple threads. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 9 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 | « ipc/attachment_broker_mac_unittest.cc ('k') | ipc/attachment_broker_privileged.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ipc/attachment_broker_privileged.h
diff --git a/ipc/attachment_broker_privileged.h b/ipc/attachment_broker_privileged.h
index 8b855996cda9c43db08581f0e063fcbefb07ddad..1fff37f387bc217b6580c143474b2e8eb7c6aef4 100644
--- a/ipc/attachment_broker_privileged.h
+++ b/ipc/attachment_broker_privileged.h
@@ -5,9 +5,11 @@
#ifndef IPC_ATTACHMENT_BROKER_PRIVILEGED_H_
#define IPC_ATTACHMENT_BROKER_PRIVILEGED_H_
+#include <utility>
#include <vector>
#include "base/macros.h"
+#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "build/build_config.h"
#include "ipc/attachment_broker.h"
@@ -48,17 +50,26 @@ class IPC_EXPORT AttachmentBrokerPrivileged : public IPC::AttachmentBroker {
static void CreateBrokerForSingleProcessTests();
// AttachmentBroker overrides.
- void RegisterCommunicationChannel(Endpoint* endpoint) override;
+ void RegisterCommunicationChannel(
+ Endpoint* endpoint,
+ scoped_refptr<base::SingleThreadTaskRunner> runner) override;
void DeregisterCommunicationChannel(Endpoint* endpoint) override;
bool IsPrivilegedBroker() override;
protected:
+ using EndpointRunnerPair =
+ std::pair<Endpoint*, scoped_refptr<base::SingleThreadTaskRunner>>;
+
// Returns the sender whose peer's process id is |id|.
// Returns nullptr if no sender is found.
// The lock returned by get_lock() must already be acquired before calling
// this method. The return value is only guaranteed to be valid while the lock
// is held.
- Sender* GetSenderWithProcessId(base::ProcessId id);
+ EndpointRunnerPair GetSenderWithProcessId(base::ProcessId id);
+
+ // Sends a message to the endpoint, dispatching onto another thread if
+ // necessary.
+ void SendMessageToEndpoint(EndpointRunnerPair pair, Message* message);
// Errors that can be reported by subclasses.
// These match tools/metrics/histograms.xml.
@@ -105,7 +116,9 @@ class IPC_EXPORT AttachmentBrokerPrivileged : public IPC::AttachmentBroker {
void LogError(UMAError error);
private:
- std::vector<Endpoint*> endpoints_;
+ // A vector of Endpoints, and the SingleThreadTaskRunner that should be used
+ // to invoke Send() on each Endpoint.
+ std::vector<EndpointRunnerPair> endpoints_;
DISALLOW_COPY_AND_ASSIGN(AttachmentBrokerPrivileged);
};
« no previous file with comments | « ipc/attachment_broker_mac_unittest.cc ('k') | ipc/attachment_broker_privileged.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698