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

Unified Diff: content/browser/child_process_launcher.cc

Issue 22911027: Pass StatsTable shared memory via global descriptors on Posix rather than using named shared memory. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address Jar's comments. Created 7 years, 4 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: content/browser/child_process_launcher.cc
diff --git a/content/browser/child_process_launcher.cc b/content/browser/child_process_launcher.cc
index b5bb3f491f070688914d8f2f8146969509e341db..876fd938f9ec25601b93ea2e3193db55cfa61a58 100644
--- a/content/browser/child_process_launcher.cc
+++ b/content/browser/child_process_launcher.cc
@@ -32,12 +32,14 @@
#include "base/android/jni_android.h"
#include "content/browser/android/child_process_launcher_android.h"
#elif defined(OS_POSIX)
+#include "base/memory/shared_memory.h"
#include "base/memory/singleton.h"
#include "content/browser/renderer_host/render_sandbox_host_linux.h"
#include "content/browser/zygote_host/zygote_host_impl_linux.h"
#endif
#if defined(OS_POSIX)
+#include "base/metrics/stats_table.h"
#include "base/posix/global_descriptors.h"
#endif
@@ -206,7 +208,13 @@ class ChildProcessLauncher::Context
std::vector<FileDescriptorInfo> files_to_register;
files_to_register.push_back(
FileDescriptorInfo(kPrimaryIPCChannel,
- base::FileDescriptor(ipcfd, false)));
+ base::FileDescriptor(ipcfd, false)));
+ base::StatsTable* stats_table = base::StatsTable::current();
+ if (stats_table &&
+ base::SharedMemory::IsHandleValid(stats_table->GetSharedMemoryHandle()))
+ files_to_register.push_back(
+ FileDescriptorInfo(kStatsTableSharedMemFd,
+ stats_table->GetSharedMemoryHandle()));
GetContentClient()->browser()->
GetAdditionalMappedFilesForChildProcess(*cmd_line, child_process_id,
@@ -227,8 +235,13 @@ class ChildProcessLauncher::Context
std::vector<FileDescriptorInfo> files_to_register;
files_to_register.push_back(
FileDescriptorInfo(kPrimaryIPCChannel,
- base::FileDescriptor(ipcfd, false)));
-
+ base::FileDescriptor(ipcfd, false)));
+ base::StatsTable* stats_table = base::StatsTable::current();
+ if (stats_table &&
+ base::SharedMemory::IsHandleValid(stats_table->GetSharedMemoryHandle()))
+ files_to_register.push_back(
+ FileDescriptorInfo(kStatsTableSharedMemFd,
+ stats_table->GetSharedMemoryHandle()));
#if !defined(OS_MACOSX)
GetContentClient()->browser()->
GetAdditionalMappedFilesForChildProcess(*cmd_line, child_process_id,

Powered by Google App Engine
This is Rietveld 408576698