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

Side by Side Diff: content/child/child_histogram_message_filter.cc

Issue 324143002: Decouple IPC::MessageFilter from IPC::Channel (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Landing Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « content/child/child_histogram_message_filter.h ('k') | content/child/child_thread.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/child/child_histogram_message_filter.h" 5 #include "content/child/child_histogram_message_filter.h"
6 6
7 #include <ctype.h> 7 #include <ctype.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
11 #include "base/metrics/histogram_delta_serialization.h" 11 #include "base/metrics/histogram_delta_serialization.h"
12 #include "content/child/child_process.h" 12 #include "content/child/child_process.h"
13 #include "content/child/child_thread.h" 13 #include "content/child/child_thread.h"
14 #include "content/common/child_process_messages.h" 14 #include "content/common/child_process_messages.h"
15 #include "ipc/ipc_channel.h" 15 #include "ipc/ipc_sender.h"
16 16
17 namespace content { 17 namespace content {
18 18
19 ChildHistogramMessageFilter::ChildHistogramMessageFilter() 19 ChildHistogramMessageFilter::ChildHistogramMessageFilter()
20 : channel_(NULL), 20 : sender_(NULL),
21 io_message_loop_(ChildProcess::current()->io_message_loop_proxy()) { 21 io_message_loop_(ChildProcess::current()->io_message_loop_proxy()) {
22 } 22 }
23 23
24 ChildHistogramMessageFilter::~ChildHistogramMessageFilter() { 24 ChildHistogramMessageFilter::~ChildHistogramMessageFilter() {
25 } 25 }
26 26
27 void ChildHistogramMessageFilter::OnFilterAdded(IPC::Channel* channel) { 27 void ChildHistogramMessageFilter::OnFilterAdded(IPC::Sender* sender) {
28 channel_ = channel; 28 sender_ = sender;
29 } 29 }
30 30
31 void ChildHistogramMessageFilter::OnFilterRemoved() { 31 void ChildHistogramMessageFilter::OnFilterRemoved() {
32 } 32 }
33 33
34 bool ChildHistogramMessageFilter::OnMessageReceived( 34 bool ChildHistogramMessageFilter::OnMessageReceived(
35 const IPC::Message& message) { 35 const IPC::Message& message) {
36 bool handled = true; 36 bool handled = true;
37 IPC_BEGIN_MESSAGE_MAP(ChildHistogramMessageFilter, message) 37 IPC_BEGIN_MESSAGE_MAP(ChildHistogramMessageFilter, message)
38 IPC_MESSAGE_HANDLER(ChildProcessMsg_GetChildHistogramData, 38 IPC_MESSAGE_HANDLER(ChildProcessMsg_GetChildHistogramData,
(...skipping 14 matching lines...) Expand all
53 } 53 }
54 54
55 void ChildHistogramMessageFilter::UploadAllHistograms(int sequence_number) { 55 void ChildHistogramMessageFilter::UploadAllHistograms(int sequence_number) {
56 if (!histogram_delta_serialization_) { 56 if (!histogram_delta_serialization_) {
57 histogram_delta_serialization_.reset( 57 histogram_delta_serialization_.reset(
58 new base::HistogramDeltaSerialization("ChildProcess")); 58 new base::HistogramDeltaSerialization("ChildProcess"));
59 } 59 }
60 60
61 std::vector<std::string> deltas; 61 std::vector<std::string> deltas;
62 histogram_delta_serialization_->PrepareAndSerializeDeltas(&deltas); 62 histogram_delta_serialization_->PrepareAndSerializeDeltas(&deltas);
63 channel_->Send( 63 sender_->Send(
64 new ChildProcessHostMsg_ChildHistogramData(sequence_number, deltas)); 64 new ChildProcessHostMsg_ChildHistogramData(sequence_number, deltas));
65 65
66 static int count = 0; 66 static int count = 0;
67 count++; 67 count++;
68 DHISTOGRAM_COUNTS("Histogram.ChildProcessHistogramSentCount", count); 68 DHISTOGRAM_COUNTS("Histogram.ChildProcessHistogramSentCount", count);
69 } 69 }
70 70
71 } // namespace content 71 } // namespace content
OLDNEW
« no previous file with comments | « content/child/child_histogram_message_filter.h ('k') | content/child/child_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698