OLD | NEW |
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 | 16 |
17 HistogramMessageFilter::HistogramMessageFilter() | 17 HistogramMessageFilter::HistogramMessageFilter() |
18 : BrowserMessageFilter(ChildProcessMsgStart) {} | 18 : BrowserMessageFilter(ChildProcessMsgStart) {} |
19 | 19 |
20 bool HistogramMessageFilter::OnMessageReceived(const IPC::Message& message, | 20 bool HistogramMessageFilter::OnMessageReceived(const IPC::Message& message) { |
21 bool* message_was_ok) { | |
22 bool handled = true; | 21 bool handled = true; |
23 IPC_BEGIN_MESSAGE_MAP_EX(HistogramMessageFilter, message, *message_was_ok) | 22 IPC_BEGIN_MESSAGE_MAP(HistogramMessageFilter, message) |
24 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_ChildHistogramData, | 23 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_ChildHistogramData, |
25 OnChildHistogramData) | 24 OnChildHistogramData) |
26 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_GetBrowserHistogram, | 25 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_GetBrowserHistogram, |
27 OnGetBrowserHistogram) | 26 OnGetBrowserHistogram) |
28 IPC_MESSAGE_UNHANDLED(handled = false) | 27 IPC_MESSAGE_UNHANDLED(handled = false) |
29 IPC_END_MESSAGE_MAP_EX() | 28 IPC_END_MESSAGE_MAP() |
30 return handled; | 29 return handled; |
31 } | 30 } |
32 | 31 |
33 HistogramMessageFilter::~HistogramMessageFilter() {} | 32 HistogramMessageFilter::~HistogramMessageFilter() {} |
34 | 33 |
35 void HistogramMessageFilter::OnChildHistogramData( | 34 void HistogramMessageFilter::OnChildHistogramData( |
36 int sequence_number, | 35 int sequence_number, |
37 const std::vector<std::string>& pickled_histograms) { | 36 const std::vector<std::string>& pickled_histograms) { |
38 HistogramController::GetInstance()->OnHistogramDataCollected( | 37 HistogramController::GetInstance()->OnHistogramDataCollected( |
39 sequence_number, pickled_histograms); | 38 sequence_number, pickled_histograms); |
(...skipping 16 matching lines...) Expand all Loading... |
56 base::HistogramBase* histogram = | 55 base::HistogramBase* histogram = |
57 base::StatisticsRecorder::FindHistogram(name); | 56 base::StatisticsRecorder::FindHistogram(name); |
58 if (!histogram) { | 57 if (!histogram) { |
59 *histogram_json = "{}"; | 58 *histogram_json = "{}"; |
60 } else { | 59 } else { |
61 histogram->WriteJSON(histogram_json); | 60 histogram->WriteJSON(histogram_json); |
62 } | 61 } |
63 } | 62 } |
64 | 63 |
65 } // namespace content | 64 } // namespace content |
OLD | NEW |