Chromium Code Reviews| Index: content/child/child_histogram_message_filter.cc |
| diff --git a/content/child/child_histogram_message_filter.cc b/content/child/child_histogram_message_filter.cc |
| index f749cf812fb571c502af103b8068c53b71aeb271..eacec3bb2f39e1af179371a4a9aa186b0c94f5a5 100644 |
| --- a/content/child/child_histogram_message_filter.cc |
| +++ b/content/child/child_histogram_message_filter.cc |
| @@ -9,6 +9,7 @@ |
| #include "base/bind.h" |
| #include "base/location.h" |
| #include "base/metrics/histogram_delta_serialization.h" |
| +#include "base/metrics/persistent_histogram_allocator.h" |
| #include "base/single_thread_task_runner.h" |
| #include "content/child/child_process.h" |
| #include "content/common/child_process_messages.h" |
| @@ -35,6 +36,8 @@ bool ChildHistogramMessageFilter::OnMessageReceived( |
| const IPC::Message& message) { |
| bool handled = true; |
| IPC_BEGIN_MESSAGE_MAP(ChildHistogramMessageFilter, message) |
| + IPC_MESSAGE_HANDLER(ChildProcessMsg_SetHistogramMemory, |
| + OnSetHistogramMemory) |
| IPC_MESSAGE_HANDLER(ChildProcessMsg_GetChildHistogramData, |
| OnGetChildHistogramData) |
| IPC_MESSAGE_UNHANDLED(handled = false) |
| @@ -42,6 +45,19 @@ bool ChildHistogramMessageFilter::OnMessageReceived( |
| return handled; |
| } |
| +void ChildHistogramMessageFilter::OnSetHistogramMemory( |
| + const base::SharedMemoryHandle& mem_handle, |
|
Alexei Svitkine (slow)
2016/03/29 17:51:24
Nit: memory_handle and memory_size
bcwhite
2016/03/30 21:25:55
Done.
|
| + int mem_size) { |
| + base::PersistentHistogramAllocator::CreateGlobalAllocatorOnSharedMemoryHandle( |
| + mem_handle, mem_size); |
| + |
| + base::PersistentHistogramAllocator* global_allocator = |
| + base::PersistentHistogramAllocator::GetGlobalAllocator(); |
| + if (global_allocator) { |
| + global_allocator->CreateTrackingHistograms(global_allocator->Name()); |
| + } |
| +} |
| + |
| void ChildHistogramMessageFilter::SendHistograms(int sequence_number) { |
| io_task_runner_->PostTask( |
| FROM_HERE, base::Bind(&ChildHistogramMessageFilter::UploadAllHistograms, |