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

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

Issue 63843002: Add ChildMessageFilter, a base class for renderer/worker cross-thread MessageFilter (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: RemoveFilter fix Created 7 years, 1 month 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/child/child_thread.h" 5 #include "content/child/child_thread.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/allocator/allocator_extension.h" 9 #include "base/allocator/allocator_extension.h"
10 #include "base/base_switches.h" 10 #include "base/base_switches.h"
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 quota_message_filter_ = 194 quota_message_filter_ =
195 new QuotaMessageFilter(thread_safe_sender_.get()); 195 new QuotaMessageFilter(thread_safe_sender_.get());
196 quota_dispatcher_.reset(new QuotaDispatcher(thread_safe_sender_.get(), 196 quota_dispatcher_.reset(new QuotaDispatcher(thread_safe_sender_.get(),
197 quota_message_filter_.get())); 197 quota_message_filter_.get()));
198 198
199 channel_->AddFilter(histogram_message_filter_.get()); 199 channel_->AddFilter(histogram_message_filter_.get());
200 channel_->AddFilter(sync_message_filter_.get()); 200 channel_->AddFilter(sync_message_filter_.get());
201 channel_->AddFilter(new tracing::ChildTraceMessageFilter( 201 channel_->AddFilter(new tracing::ChildTraceMessageFilter(
202 ChildProcess::current()->io_message_loop_proxy())); 202 ChildProcess::current()->io_message_loop_proxy()));
203 channel_->AddFilter(resource_message_filter_.get()); 203 channel_->AddFilter(resource_message_filter_.get());
204 channel_->AddFilter(quota_message_filter_.get()); 204 channel_->AddFilter(quota_message_filter_->GetFilter());
205 channel_->AddFilter(service_worker_message_filter_.get()); 205 channel_->AddFilter(service_worker_message_filter_->GetFilter());
206 206
207 // In single process mode we may already have a power monitor 207 // In single process mode we may already have a power monitor
208 if (!base::PowerMonitor::Get()) { 208 if (!base::PowerMonitor::Get()) {
209 scoped_ptr<PowerMonitorBroadcastSource> power_monitor_source( 209 scoped_ptr<PowerMonitorBroadcastSource> power_monitor_source(
210 new PowerMonitorBroadcastSource()); 210 new PowerMonitorBroadcastSource());
211 channel_->AddFilter(power_monitor_source->GetMessageFilter()); 211 channel_->AddFilter(power_monitor_source->GetMessageFilter());
212 212
213 power_monitor_.reset(new base::PowerMonitor( 213 power_monitor_.reset(new base::PowerMonitor(
214 power_monitor_source.PassAs<base::PowerMonitorSource>())); 214 power_monitor_source.PassAs<base::PowerMonitorSource>()));
215 } 215 }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 ::HeapProfilerStop, 257 ::HeapProfilerStop,
258 ::GetHeapProfile)); 258 ::GetHeapProfile));
259 #endif 259 #endif
260 } 260 }
261 261
262 ChildThread::~ChildThread() { 262 ChildThread::~ChildThread() {
263 #ifdef IPC_MESSAGE_LOG_ENABLED 263 #ifdef IPC_MESSAGE_LOG_ENABLED
264 IPC::Logging::GetInstance()->SetIPCSender(NULL); 264 IPC::Logging::GetInstance()->SetIPCSender(NULL);
265 #endif 265 #endif
266 266
267 channel_->RemoveFilter(service_worker_message_filter_.get());
268 channel_->RemoveFilter(quota_message_filter_.get());
269 channel_->RemoveFilter(histogram_message_filter_.get()); 267 channel_->RemoveFilter(histogram_message_filter_.get());
270 channel_->RemoveFilter(sync_message_filter_.get()); 268 channel_->RemoveFilter(sync_message_filter_.get());
271 269
272 // The ChannelProxy object caches a pointer to the IPC thread, so need to 270 // The ChannelProxy object caches a pointer to the IPC thread, so need to
273 // reset it as it's not guaranteed to outlive this object. 271 // reset it as it's not guaranteed to outlive this object.
274 // NOTE: this also has the side-effect of not closing the main IPC channel to 272 // NOTE: this also has the side-effect of not closing the main IPC channel to
275 // the browser process. This is needed because this is the signal that the 273 // the browser process. This is needed because this is the signal that the
276 // browser uses to know that this process has died, so we need it to be alive 274 // browser uses to know that this process has died, so we need it to be alive
277 // until this process is shut down, and the OS closes the handle 275 // until this process is shut down, and the OS closes the handle
278 // automatically. We used to watch the object handle on Windows to do this, 276 // automatically. We used to watch the object handle on Windows to do this,
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 // inflight that would addref it. 487 // inflight that would addref it.
490 Send(new ChildProcessHostMsg_ShutdownRequest); 488 Send(new ChildProcessHostMsg_ShutdownRequest);
491 } 489 }
492 490
493 void ChildThread::EnsureConnected() { 491 void ChildThread::EnsureConnected() {
494 LOG(INFO) << "ChildThread::EnsureConnected()"; 492 LOG(INFO) << "ChildThread::EnsureConnected()";
495 base::KillProcess(base::GetCurrentProcessHandle(), 0, false); 493 base::KillProcess(base::GetCurrentProcessHandle(), 0, false);
496 } 494 }
497 495
498 } // namespace content 496 } // namespace content
OLDNEW
« no previous file with comments | « content/child/child_message_filter.cc ('k') | content/child/indexed_db/indexed_db_message_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698