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

Unified Diff: content/browser/mach_broker_mac.h

Issue 1138513003: [Mac] Remove the dedicated MachBroker thread and use a dispatch queue instead. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move-dispatch-source-mach
Patch Set: Created 5 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 | « no previous file | content/browser/mach_broker_mac.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/mach_broker_mac.h
diff --git a/content/browser/mach_broker_mac.h b/content/browser/mach_broker_mac.h
index fb9f3efbf17b4dca105e4d683993ad368a72d4f7..5b4bfb817fbbc8ad90cbe3fc66620fc05c79236a 100644
--- a/content/browser/mach_broker_mac.h
+++ b/content/browser/mach_broker_mac.h
@@ -10,6 +10,9 @@
#include <map>
#include <string>
+#include "base/mac/dispatch_source_mach.h"
+#include "base/mac/scoped_mach_port.h"
+#include "base/memory/scoped_ptr.h"
#include "base/memory/singleton.h"
#include "base/process/process_handle.h"
#include "base/process/process_metrics.h"
@@ -79,12 +82,18 @@ class CONTENT_EXPORT MachBroker : public base::ProcessMetrics::PortProvider,
private:
friend class MachBrokerTest;
- friend class MachListenerThreadDelegate;
friend struct DefaultSingletonTraits<MachBroker>;
MachBroker();
~MachBroker() override;
+ // Performs any initialization work.
+ bool Init();
+
+ // Message handler that is invoked on |dispatch_source_| when an
+ // incoming message needs to be received.
+ void HandleRequest();
+
// Updates the mapping for |pid| to include the given |mach_info|. Does
// nothing if PlaceholderForPid() has not already been called for the given
// |pid|. Callers MUST acquire the lock given by GetLock() before calling
@@ -97,16 +106,23 @@ class CONTENT_EXPORT MachBroker : public base::ProcessMetrics::PortProvider,
// Returns the Mach port name to use when sending or receiving messages.
// Does the Right Thing in the browser and in child processes.
static std::string GetMachPortName();
+
// Callback used to register notifications on the UI thread.
void RegisterNotifications();
- // True if the listener thread has been started.
- bool listener_thread_started_;
+ // Whether or not the class has been initialized.
+ bool initialized_;
// Used to register for notifications received by NotificationObserver.
// Accessed only on the UI thread.
NotificationRegistrar registrar_;
+ // The Mach port on which the server listens.
+ base::mac::ScopedMachReceiveRight server_port_;
+
+ // The dispatch source and queue on which Mach messages will be received.
+ scoped_ptr<base::DispatchSourceMach> dispatch_source_;
+
// Stores mach info for every process in the broker.
typedef std::map<base::ProcessHandle, mach_port_t> MachMap;
MachMap mach_map_;
« no previous file with comments | « no previous file | content/browser/mach_broker_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698