| Index: content/browser/renderer_host/render_process_host_impl.cc
|
| diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
|
| index e393673e44ba62ce6ddd97c410b8ba3aa24cb858..13ddefc0604c490bb3981e16a5b4733bfc4b812c 100644
|
| --- a/content/browser/renderer_host/render_process_host_impl.cc
|
| +++ b/content/browser/renderer_host/render_process_host_impl.cc
|
| @@ -26,6 +26,8 @@
|
| #include "base/macros.h"
|
| #include "base/metrics/field_trial.h"
|
| #include "base/metrics/histogram.h"
|
| +#include "base/metrics/histogram_persistence.h"
|
| +#include "base/metrics/persistent_memory_allocator.h"
|
| #include "base/process/process_handle.h"
|
| #include "base/rand_util.h"
|
| #include "base/single_thread_task_runner.h"
|
| @@ -1132,6 +1134,11 @@ ServiceRegistry* RenderProcessHostImpl::GetServiceRegistry() {
|
| return mojo_application_host_->service_registry();
|
| }
|
|
|
| +scoped_ptr<base::SharedPersistentMemoryAllocator>
|
| +RenderProcessHostImpl::GetMetricsAllocator() {
|
| + return std::move(metrics_allocator_);
|
| +}
|
| +
|
| const base::TimeTicks& RenderProcessHostImpl::GetInitTimeForNavigationMetrics()
|
| const {
|
| return init_time_;
|
| @@ -2565,6 +2572,26 @@ void RenderProcessHostImpl::OnProcessLaunched() {
|
| #else
|
| UpdateProcessPriority();
|
| #endif
|
| +
|
| + // Create a persistent memory segment for renderer histograms only if
|
| + // they're active in the browser.
|
| + if (base::GetPersistentHistogramMemoryAllocator()) {
|
| + DCHECK(!metrics_allocator_);
|
| + // TODO(bcwhite): Update this with the correct memory size.
|
| + metrics_allocator_.reset(
|
| + base::CreateSharedPersistentHistogramMemoryAllocator(
|
| + 2 << 20, // 2 MiB
|
| + "RendererMetrics",
|
| + child_process_launcher_->GetProcess().Pid()));
|
| +
|
| + if (metrics_allocator_) {
|
| + base::SharedMemoryHandle shm_handle;
|
| + metrics_allocator_->shared_memory()->ShareToProcess(
|
| + child_process_launcher_->GetProcess().Handle(), &shm_handle);
|
| + Send(new ChildProcessMsg_SetHistogramMemory(
|
| + shm_handle, metrics_allocator_->shared_memory()->mapped_size()));
|
| + }
|
| + }
|
| }
|
|
|
| // NOTE: This needs to be before sending queued messages because
|
|
|