| Index: chrome/browser/child_process_launcher.cc
|
| diff --git a/chrome/browser/child_process_launcher.cc b/chrome/browser/child_process_launcher.cc
|
| index 9b8cae9dc4aa78d553982ec6264c16570c54e7a6..890d5729dca05a15e6a0ea4e02d2b3ae2e495011 100644
|
| --- a/chrome/browser/child_process_launcher.cc
|
| +++ b/chrome/browser/child_process_launcher.cc
|
| @@ -27,6 +27,10 @@
|
| #include "base/global_descriptors_posix.h"
|
| #endif
|
|
|
| +#include "chrome/common/mach_ipc_mac.h"
|
| +#include <mach/host_info.h>
|
| +#include <mach/processor_info.h>
|
| +
|
| // 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.
|
| @@ -164,6 +168,53 @@ class ChildProcessLauncher::Context
|
| }
|
| #endif
|
|
|
| + // This creates our named server port
|
| + ReceivePort receivePort("com.Google.MyService");
|
| +
|
| + MachReceiveMessage message;
|
| + kern_return_t result = receivePort.WaitForMessage(&message, 1000); // timeout 1000ms
|
| +
|
| + if (result == KERN_SUCCESS && message.GetMessageID() == 57) {
|
| +
|
| + mach_port_t task = message.GetTranslatedPort(0);
|
| + mach_port_t thread = message.GetTranslatedPort(1);
|
| + mach_port_t host = message.GetTranslatedPort(2);
|
| +
|
| + unsigned char *messageString = static_cast<unsigned char*>(message.GetData());
|
| +
|
| + printf("message string = %s %lu %lu\n", messageString, (unsigned long)task, (unsigned long)thread);
|
| +
|
| + kern_return_t error;
|
| + host_cpu_load_info_data_t /*prev_cpu_load, */cpu_load;
|
| + mach_msg_type_number_t count = HOST_CPU_LOAD_INFO_COUNT;
|
| + error = host_statistics(host,
|
| + HOST_CPU_LOAD_INFO,
|
| + (host_info_t)&cpu_load,
|
| + &count);
|
| + if (error != KERN_SUCCESS) {
|
| + fprintf(stderr, "error 1 %lu\n", (unsigned long) error);
|
| + }
|
| + printf("(%d %d %d)\n",
|
| + cpu_load.cpu_ticks[CPU_STATE_USER],
|
| + cpu_load.cpu_ticks[CPU_STATE_SYSTEM],
|
| + cpu_load.cpu_ticks[CPU_STATE_IDLE]);
|
| +
|
| + task_basic_info_data_t ti;
|
| +// count = TASK_EVENTS_INFO_COUNT;
|
| +// error = task_info(task, TASK_EVENTS_INFO, (task_info_t)&ti, &count);
|
| + count = TASK_BASIC_INFO_COUNT;
|
| + error = task_info(task, TASK_BASIC_INFO, (task_info_t)&ti, &count);
|
| +
|
| + if (error != KERN_SUCCESS) {
|
| + fprintf(stderr, "error 1 %lu\n", (unsigned long) error);
|
| + }
|
| +
|
| + // TODO: error checking (if renderer turns into a zombie)
|
| + fprintf(stderr, "mem real %d virtual %d\n", ti.resident_size, ti.virtual_size);
|
| + } else {
|
| + fprintf(stderr, "Failed to receive message %lu\n", (unsigned long)result);
|
| + }
|
| +
|
| ChromeThread::PostTask(
|
| client_thread_id_, FROM_HERE,
|
| NewRunnableMethod(
|
|
|