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/browser_child_process_host_impl.h" | 5 #include "content/browser/browser_child_process_host_impl.h" |
6 | 6 |
7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/dump_without_crashing.h" | 10 #include "base/debug/dump_without_crashing.h" |
11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
12 #include "base/lazy_instance.h" | 12 #include "base/lazy_instance.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
15 #include "base/profiler/scoped_tracker.h" | 15 #include "base/profiler/scoped_tracker.h" |
16 #include "base/stl_util.h" | 16 #include "base/stl_util.h" |
17 #include "base/strings/string_util.h" | 17 #include "base/strings/string_util.h" |
18 #include "base/synchronization/waitable_event.h" | 18 #include "base/synchronization/waitable_event.h" |
19 #include "content/browser/histogram_message_filter.h" | 19 #include "content/browser/histogram_message_filter.h" |
20 #include "content/browser/loader/resource_message_filter.h" | 20 #include "content/browser/loader/resource_message_filter.h" |
21 #include "content/browser/memory/memory_message_filter.h" | |
22 #include "content/browser/profiler_message_filter.h" | 21 #include "content/browser/profiler_message_filter.h" |
23 #include "content/browser/tracing/trace_message_filter.h" | 22 #include "content/browser/tracing/trace_message_filter.h" |
24 #include "content/common/child_process_host_impl.h" | 23 #include "content/common/child_process_host_impl.h" |
25 #include "content/public/browser/browser_child_process_host_delegate.h" | 24 #include "content/public/browser/browser_child_process_host_delegate.h" |
26 #include "content/public/browser/browser_child_process_observer.h" | 25 #include "content/public/browser/browser_child_process_observer.h" |
27 #include "content/public/browser/browser_thread.h" | 26 #include "content/public/browser/browser_thread.h" |
28 #include "content/public/browser/child_process_data.h" | 27 #include "content/public/browser/child_process_data.h" |
29 #include "content/public/browser/content_browser_client.h" | 28 #include "content/public/browser/content_browser_client.h" |
30 #include "content/public/common/content_switches.h" | 29 #include "content/public/common/content_switches.h" |
31 #include "content/public/common/process_type.h" | 30 #include "content/public/common/process_type.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 BrowserChildProcessHostDelegate* delegate) | 113 BrowserChildProcessHostDelegate* delegate) |
115 : data_(process_type), | 114 : data_(process_type), |
116 delegate_(delegate), | 115 delegate_(delegate), |
117 power_monitor_message_broadcaster_(this) { | 116 power_monitor_message_broadcaster_(this) { |
118 data_.id = ChildProcessHostImpl::GenerateChildProcessUniqueId(); | 117 data_.id = ChildProcessHostImpl::GenerateChildProcessUniqueId(); |
119 | 118 |
120 child_process_host_.reset(ChildProcessHost::Create(this)); | 119 child_process_host_.reset(ChildProcessHost::Create(this)); |
121 AddFilter(new TraceMessageFilter(data_.id)); | 120 AddFilter(new TraceMessageFilter(data_.id)); |
122 AddFilter(new ProfilerMessageFilter(process_type)); | 121 AddFilter(new ProfilerMessageFilter(process_type)); |
123 AddFilter(new HistogramMessageFilter); | 122 AddFilter(new HistogramMessageFilter); |
124 AddFilter(new MemoryMessageFilter); | |
125 | 123 |
126 g_child_process_list.Get().push_back(this); | 124 g_child_process_list.Get().push_back(this); |
127 GetContentClient()->browser()->BrowserChildProcessHostCreated(this); | 125 GetContentClient()->browser()->BrowserChildProcessHostCreated(this); |
128 | 126 |
129 power_monitor_message_broadcaster_.Init(); | 127 power_monitor_message_broadcaster_.Init(); |
130 } | 128 } |
131 | 129 |
132 BrowserChildProcessHostImpl::~BrowserChildProcessHostImpl() { | 130 BrowserChildProcessHostImpl::~BrowserChildProcessHostImpl() { |
133 g_child_process_list.Get().remove(this); | 131 g_child_process_list.Get().remove(this); |
134 } | 132 } |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 | 386 |
389 #if defined(OS_WIN) | 387 #if defined(OS_WIN) |
390 | 388 |
391 void BrowserChildProcessHostImpl::OnObjectSignaled(HANDLE object) { | 389 void BrowserChildProcessHostImpl::OnObjectSignaled(HANDLE object) { |
392 OnChildDisconnected(); | 390 OnChildDisconnected(); |
393 } | 391 } |
394 | 392 |
395 #endif | 393 #endif |
396 | 394 |
397 } // namespace content | 395 } // namespace content |
OLD | NEW |