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

Side by Side Diff: content/browser/histogram_message_filter.cc

Issue 142923005: Allow MessageFilters to restrict listening to specific message classes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Working patch Created 6 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/histogram_message_filter.h" 5 #include "content/browser/histogram_message_filter.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/metrics/statistics_recorder.h" 9 #include "base/metrics/statistics_recorder.h"
10 #include "content/browser/histogram_controller.h" 10 #include "content/browser/histogram_controller.h"
11 #include "content/browser/tcmalloc_internals_request_job.h" 11 #include "content/browser/tcmalloc_internals_request_job.h"
12 #include "content/common/child_process_messages.h" 12 #include "content/common/child_process_messages.h"
13 #include "content/public/common/content_switches.h" 13 #include "content/public/common/content_switches.h"
14 14
15 namespace content { 15 namespace content {
16 namespace {
17 const uint32 kFilteredMessageClasses[] = {
18 ChildProcessMsgStart,
19 };
20 } // namespace
16 21
17 HistogramMessageFilter::HistogramMessageFilter() {} 22 HistogramMessageFilter::HistogramMessageFilter()
23 : BrowserMessageFilter(
24 kFilteredMessageClasses, arraysize(kFilteredMessageClasses)) {}
18 25
19 bool HistogramMessageFilter::OnMessageReceived(const IPC::Message& message, 26 bool HistogramMessageFilter::OnMessageReceived(const IPC::Message& message,
20 bool* message_was_ok) { 27 bool* message_was_ok) {
21 bool handled = true; 28 bool handled = true;
22 IPC_BEGIN_MESSAGE_MAP_EX(HistogramMessageFilter, message, *message_was_ok) 29 IPC_BEGIN_MESSAGE_MAP_EX(HistogramMessageFilter, message, *message_was_ok)
23 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_ChildHistogramData, 30 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_ChildHistogramData,
24 OnChildHistogramData) 31 OnChildHistogramData)
25 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_GetBrowserHistogram, 32 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_GetBrowserHistogram,
26 OnGetBrowserHistogram) 33 OnGetBrowserHistogram)
27 IPC_MESSAGE_UNHANDLED(handled = false) 34 IPC_MESSAGE_UNHANDLED(handled = false)
(...skipping 27 matching lines...) Expand all
55 base::HistogramBase* histogram = 62 base::HistogramBase* histogram =
56 base::StatisticsRecorder::FindHistogram(name); 63 base::StatisticsRecorder::FindHistogram(name);
57 if (!histogram) { 64 if (!histogram) {
58 *histogram_json = "{}"; 65 *histogram_json = "{}";
59 } else { 66 } else {
60 histogram->WriteJSON(histogram_json); 67 histogram->WriteJSON(histogram_json);
61 } 68 }
62 } 69 }
63 70
64 } // namespace content 71 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698