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

Unified Diff: content/child/child_histogram_message_filter.cc

Issue 1671933002: Create and pass shared-histogram-allocator from browser to renderer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@hsm-merge
Patch Set: fixed test to not use SharedMemory which doesn't work on all builds (and rebased) Created 4 years, 8 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
« no previous file with comments | « content/child/child_histogram_message_filter.h ('k') | content/common/child_process_messages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..d49e6d1d2bca8a733c0fa2f20093d8c786ad3335 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,13 +36,29 @@ bool ChildHistogramMessageFilter::OnMessageReceived(
const IPC::Message& message) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(ChildHistogramMessageFilter, message)
- IPC_MESSAGE_HANDLER(ChildProcessMsg_GetChildHistogramData,
+ IPC_MESSAGE_HANDLER(ChildProcessMsg_SetHistogramMemory,
+ OnSetHistogramMemory)
+ IPC_MESSAGE_HANDLER(ChildProcessMsg_GetChildNonPersistentHistogramData,
OnGetChildHistogramData)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
}
+void ChildHistogramMessageFilter::OnSetHistogramMemory(
+ const base::SharedMemoryHandle& memory_handle,
+ int memory_size) {
+ // This message must be received only once. Multiple calls to create a global
+ // allocator will cause a CHECK() failure.
+ base::GlobalHistogramAllocator::CreateWithSharedMemoryHandle(memory_handle,
+ memory_size);
+
+ base::PersistentHistogramAllocator* global_allocator =
+ base::GlobalHistogramAllocator::Get();
+ 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,
« no previous file with comments | « content/child/child_histogram_message_filter.h ('k') | content/common/child_process_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698