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

Unified Diff: chrome/browser/child_process_launcher.cc

Issue 466088: Revert 34146 - A place to store the pid>mach_port_t mapping.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years 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 | chrome/browser/mach_broker_mac.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/child_process_launcher.cc
===================================================================
--- chrome/browser/child_process_launcher.cc (revision 34146)
+++ chrome/browser/child_process_launcher.cc (working copy)
@@ -27,99 +27,6 @@
#include "base/global_descriptors_posix.h"
#endif
-#if defined(OS_MACOSX)
-#include "ipc/ipc_switches.h"
-#include "chrome/browser/mach_broker_mac.h"
-#include "chrome/common/mach_ipc_mac.h"
-#endif
-
-#if defined(OS_MACOSX)
-class MachTask : public Task {
- public:
- MachTask(std::string channel_name, mach_port_t* task, mach_port_t* host)
- : task_(task), host_(host) {
- // TODO(thakis): Move some place central
- const std::string kMachChannelPrefix = "com.Google.Chrome";
- std::string channel = kMachChannelPrefix + channel_name;
-
- // This creates our named server port -- needs to happen on the current
- // thread.
-printf("Creating receive port %s\n", channel.c_str());
- port_.reset(new ReceivePort(channel.c_str()));
- }
-
- virtual void Run() {
- // TODO(thakis): Move some place central
- const int kMachPortMessageID = 57;
-
- const int kMachPortMessageReceiveWaitMs = 1000;
-
-
-
- //ReceivePort receivePort(channel_name.c_str());
-
- // TODO(thakis): time histogram between creation and port reception?
- MachReceiveMessage message;
- kern_return_t result = port_->WaitForMessage(
- &message, kMachPortMessageReceiveWaitMs);
- if (result == KERN_SUCCESS) {
- CHECK(kMachPortMessageID == message.GetMessageID());
- CHECK(2 == message.GetDescriptorCount());
-
- // TODO(thakis): Constants for the indices?
- *task_ = message.GetTranslatedPort(0);
- *host_ = message.GetTranslatedPort(1);
- printf("yay\n");
- } else {
- // TODO(thakis): Log somewhere?
- printf("nay\n");
- }
- }
-
- private:
- scoped_ptr<ReceivePort> port_;
- mach_port_t* task_;
- mach_port_t* host_;
-};
-
-class MachTask2 : public Task {
- public:
- MachTask2(mach_port_t task, mach_port_t host, base::ProcessHandle pid)
- : task_(task), host_(host), pid_(pid) {}
-
- virtual void Run() {
- MachBroker::instance()->RegisterPid(
- pid_,
- MachBroker::MachInfo().SetTask(task_).SetHost(host_));
- }
- private:
- mach_port_t task_;
- mach_port_t host_;
- base::ProcessHandle pid_;
-};
-
-class MachThread : public base::Thread {
- public:
- MachThread() : base::Thread("MachThread"), task_(0), host_(0) {}
-
- void DoIt(const std::string& channel_name) {
- DCHECK(message_loop());
- message_loop()->PostTask(FROM_HERE,
- new MachTask(channel_name, &task_, &host_));
- }
-
- void DoIt2(base::ProcessHandle pid) {
- DCHECK(message_loop());
- message_loop()->PostTask(FROM_HERE,
- new MachTask2(task_, host_, pid));
- }
-
- private:
- mach_port_t task_;
- mach_port_t host_;
-};
-#endif
-
// Having the functionality of ChildProcessLauncher be in an internal
// ref counted object allows us to automatically terminate the process when the
// parent class destructs, while still holding on to state that we need.
@@ -253,25 +160,9 @@
}
#endif // defined(OS_LINUX)
-#if defined(OS_MACOSX)
- // TODO(thakis): Possibly somewhere else?
- // (then again, the fds duping stuff is here too, so maybe it's ok)
-
- MachThread mach_thread;
- CHECK(mach_thread.Start());
- mach_thread.DoIt(
- cmd_line->GetSwitchValueASCII(switches::kProcessChannelID));
-#endif
-
-
// Actually launch the app.
if (!base::LaunchApp(cmd_line->argv(), env, fds_to_map, false, &handle))
handle = base::kNullProcessHandle;
-
-#if defined(OS_MACOSX)
- // TODO(thakis): Check |handle| first.
- mach_thread.DoIt2(handle);
-#endif
}
#endif
« no previous file with comments | « no previous file | chrome/browser/mach_broker_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698