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

Side by Side Diff: content/common/child_thread.cc

Issue 10454086: Histograms - Support histograms for Plugins, GPU (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 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
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/common/child_thread.h" 5 #include "content/common/child_thread.h"
6 6
7 #include "base/allocator/allocator_extension.h" 7 #include "base/allocator/allocator_extension.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/process.h" 10 #include "base/process.h"
11 #include "base/string_util.h" 11 #include "base/string_util.h"
12 #include "base/tracked_objects.h" 12 #include "base/tracked_objects.h"
13 #include "content/common/child_histogram_message_filter.h"
13 #include "content/common/child_process.h" 14 #include "content/common/child_process.h"
14 #include "content/common/child_process_messages.h" 15 #include "content/common/child_process_messages.h"
15 #include "content/common/child_trace_message_filter.h" 16 #include "content/common/child_trace_message_filter.h"
16 #include "content/common/fileapi/file_system_dispatcher.h" 17 #include "content/common/fileapi/file_system_dispatcher.h"
17 #include "content/common/quota_dispatcher.h" 18 #include "content/common/quota_dispatcher.h"
18 #include "content/common/resource_dispatcher.h" 19 #include "content/common/resource_dispatcher.h"
19 #include "content/common/socket_stream_dispatcher.h" 20 #include "content/common/socket_stream_dispatcher.h"
20 #include "content/public/common/content_switches.h" 21 #include "content/public/common/content_switches.h"
21 #include "ipc/ipc_logging.h" 22 #include "ipc/ipc_logging.h"
22 #include "ipc/ipc_switches.h" 23 #include "ipc/ipc_switches.h"
(...skipping 29 matching lines...) Expand all
52 IPC::Logging::GetInstance()->SetIPCSender(this); 53 IPC::Logging::GetInstance()->SetIPCSender(this);
53 #endif 54 #endif
54 55
55 resource_dispatcher_.reset(new ResourceDispatcher(this)); 56 resource_dispatcher_.reset(new ResourceDispatcher(this));
56 socket_stream_dispatcher_.reset(new SocketStreamDispatcher()); 57 socket_stream_dispatcher_.reset(new SocketStreamDispatcher());
57 file_system_dispatcher_.reset(new FileSystemDispatcher()); 58 file_system_dispatcher_.reset(new FileSystemDispatcher());
58 quota_dispatcher_.reset(new QuotaDispatcher()); 59 quota_dispatcher_.reset(new QuotaDispatcher());
59 60
60 sync_message_filter_ = 61 sync_message_filter_ =
61 new IPC::SyncMessageFilter(ChildProcess::current()->GetShutDownEvent()); 62 new IPC::SyncMessageFilter(ChildProcess::current()->GetShutDownEvent());
63 histogram_message_filter_ = new content::ChildHistogramMessageFilter();
64
65 channel_->AddFilter(histogram_message_filter_.get());
jar (doing other things) 2012/07/09 23:04:12 Where is the corresponding code for the profiler?
ramant (doing other things) 2012/07/11 23:52:54 ChildThread::OnMessageReceive implemented GetChild
62 channel_->AddFilter(sync_message_filter_.get()); 66 channel_->AddFilter(sync_message_filter_.get());
63 channel_->AddFilter(new ChildTraceMessageFilter()); 67 channel_->AddFilter(new ChildTraceMessageFilter());
64 } 68 }
65 69
66 ChildThread::~ChildThread() { 70 ChildThread::~ChildThread() {
67 #ifdef IPC_MESSAGE_LOG_ENABLED 71 #ifdef IPC_MESSAGE_LOG_ENABLED
68 IPC::Logging::GetInstance()->SetIPCSender(NULL); 72 IPC::Logging::GetInstance()->SetIPCSender(NULL);
69 #endif 73 #endif
70 74
75 channel_->RemoveFilter(histogram_message_filter_.get());
71 channel_->RemoveFilter(sync_message_filter_.get()); 76 channel_->RemoveFilter(sync_message_filter_.get());
72 77
73 // Close this channel before resetting the message loop attached to it so 78 // Close this channel before resetting the message loop attached to it so
74 // the message loop can call ChannelProxy::Context::OnChannelClosed(), which 79 // the message loop can call ChannelProxy::Context::OnChannelClosed(), which
75 // releases the reference count to this channel. 80 // releases the reference count to this channel.
76 channel_->Close(); 81 channel_->Close();
77 82
78 // The ChannelProxy object caches a pointer to the IPC thread, so need to 83 // The ChannelProxy object caches a pointer to the IPC thread, so need to
79 // reset it as it's not guaranteed to outlive this object. 84 // reset it as it's not guaranteed to outlive this object.
80 // NOTE: this also has the side-effect of not closing the main IPC channel to 85 // NOTE: this also has the side-effect of not closing the main IPC channel to
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 } 281 }
277 282
278 // The child process shutdown sequence is a request response based mechanism, 283 // The child process shutdown sequence is a request response based mechanism,
279 // where we send out an initial feeler request to the child process host 284 // where we send out an initial feeler request to the child process host
280 // instance in the browser to verify if it's ok to shutdown the child process. 285 // instance in the browser to verify if it's ok to shutdown the child process.
281 // The browser then sends back a response if it's ok to shutdown. This avoids 286 // The browser then sends back a response if it's ok to shutdown. This avoids
282 // race conditions if the process refcount is 0 but there's an IPC message 287 // race conditions if the process refcount is 0 but there's an IPC message
283 // inflight that would addref it. 288 // inflight that would addref it.
284 Send(new ChildProcessHostMsg_ShutdownRequest); 289 Send(new ChildProcessHostMsg_ShutdownRequest);
285 } 290 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698