summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorrmcilroy@chromium.org <rmcilroy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-16 11:59:29 +0000
committerrmcilroy@chromium.org <rmcilroy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-16 11:59:29 +0000
commit87fc6b5bf4d5c9104ace1520fb9d8816139d80d0 (patch)
treea9605891c303c6218acb5384e923dcecc32fd6af /content
parent6b11dfe74b69c8507ff39184aba57cbc95b357d9 (diff)
downloadchromium_src-87fc6b5bf4d5c9104ace1520fb9d8816139d80d0.zip
chromium_src-87fc6b5bf4d5c9104ace1520fb9d8816139d80d0.tar.gz
chromium_src-87fc6b5bf4d5c9104ace1520fb9d8816139d80d0.tar.bz2
Pass StatsTable shared memory via global descriptors on Posix rather than using named shared memory.
This is required for to enable chrome://stats Android where there is no /dev/shm. This also provides the added advantage of not requiring the --no-sandbox command line flag with the --enable-stats-table on Posix. BUG=None Review URL: https://codereview.chromium.org/22911027 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@228903 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/browser/child_process_launcher.cc31
-rw-r--r--content/public/common/content_descriptors.h2
2 files changed, 19 insertions, 14 deletions
diff --git a/content/browser/child_process_launcher.cc b/content/browser/child_process_launcher.cc
index 721cd5a..3b95c14 100644
--- a/content/browser/child_process_launcher.cc
+++ b/content/browser/child_process_launcher.cc
@@ -32,6 +32,7 @@
#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"
@@ -39,6 +40,7 @@
#endif
#if defined(OS_POSIX)
+#include "base/metrics/stats_table.h"
#include "base/posix/global_descriptors.h"
#endif
@@ -197,17 +199,27 @@ class ChildProcessLauncher::Context
#if defined(OS_WIN)
scoped_ptr<SandboxedProcessLauncherDelegate> delegate_deleter(delegate);
base::ProcessHandle handle = StartSandboxedProcess(delegate, cmd_line);
-#elif defined(OS_ANDROID)
- // Android WebView runs in single process, ensure that we never get here
- // when running in single process mode.
- CHECK(!cmd_line->HasSwitch(switches::kSingleProcess));
-
+#elif defined(OS_POSIX)
std::string process_type =
cmd_line->GetSwitchValueASCII(switches::kProcessType);
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()));
+ }
+#endif
+
+#if defined(OS_ANDROID)
+ // Android WebView runs in single process, ensure that we never get here
+ // when running in single process mode.
+ CHECK(!cmd_line->HasSwitch(switches::kSingleProcess));
GetContentClient()->browser()->
GetAdditionalMappedFilesForChildProcess(*cmd_line, child_process_id,
@@ -223,13 +235,6 @@ class ChildProcessLauncher::Context
// child termination.
file_util::ScopedFD ipcfd_closer(&ipcfd);
- std::string process_type =
- cmd_line->GetSwitchValueASCII(switches::kProcessType);
- std::vector<FileDescriptorInfo> files_to_register;
- files_to_register.push_back(
- FileDescriptorInfo(kPrimaryIPCChannel,
- base::FileDescriptor(ipcfd, false)));
-
#if !defined(OS_MACOSX)
GetContentClient()->browser()->
GetAdditionalMappedFilesForChildProcess(*cmd_line, child_process_id,
diff --git a/content/public/common/content_descriptors.h b/content/public/common/content_descriptors.h
index 3640ea5..ce7ab0e 100644
--- a/content/public/common/content_descriptors.h
+++ b/content/public/common/content_descriptors.h
@@ -10,7 +10,7 @@
// This is a list of global descriptor keys to be used with the
// base::GlobalDescriptors object (see base/posix/global_descriptors.h)
enum {
- kCrashDumpSignal = kPrimaryIPCChannel + 1,
+ kCrashDumpSignal = kIPCDescriptorMax,
kSandboxIPCChannel, // http://code.google.com/p/chromium/LinuxSandboxIPC
#if defined(OS_ANDROID)