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" |
21 #include "content/browser/profiler_message_filter.h" | 22 #include "content/browser/profiler_message_filter.h" |
22 #include "content/browser/tracing/trace_message_filter.h" | 23 #include "content/browser/tracing/trace_message_filter.h" |
23 #include "content/common/child_process_host_impl.h" | 24 #include "content/common/child_process_host_impl.h" |
24 #include "content/public/browser/browser_child_process_host_delegate.h" | 25 #include "content/public/browser/browser_child_process_host_delegate.h" |
25 #include "content/public/browser/browser_child_process_observer.h" | 26 #include "content/public/browser/browser_child_process_observer.h" |
26 #include "content/public/browser/browser_thread.h" | 27 #include "content/public/browser/browser_thread.h" |
27 #include "content/public/browser/child_process_data.h" | 28 #include "content/public/browser/child_process_data.h" |
28 #include "content/public/browser/content_browser_client.h" | 29 #include "content/public/browser/content_browser_client.h" |
29 #include "content/public/common/content_switches.h" | 30 #include "content/public/common/content_switches.h" |
30 #include "content/public/common/process_type.h" | 31 #include "content/public/common/process_type.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 BrowserChildProcessHostDelegate* delegate) | 114 BrowserChildProcessHostDelegate* delegate) |
114 : data_(process_type), | 115 : data_(process_type), |
115 delegate_(delegate), | 116 delegate_(delegate), |
116 power_monitor_message_broadcaster_(this) { | 117 power_monitor_message_broadcaster_(this) { |
117 data_.id = ChildProcessHostImpl::GenerateChildProcessUniqueId(); | 118 data_.id = ChildProcessHostImpl::GenerateChildProcessUniqueId(); |
118 | 119 |
119 child_process_host_.reset(ChildProcessHost::Create(this)); | 120 child_process_host_.reset(ChildProcessHost::Create(this)); |
120 AddFilter(new TraceMessageFilter(data_.id)); | 121 AddFilter(new TraceMessageFilter(data_.id)); |
121 AddFilter(new ProfilerMessageFilter(process_type)); | 122 AddFilter(new ProfilerMessageFilter(process_type)); |
122 AddFilter(new HistogramMessageFilter); | 123 AddFilter(new HistogramMessageFilter); |
| 124 AddFilter(new MemoryMessageFilter); |
123 | 125 |
124 g_child_process_list.Get().push_back(this); | 126 g_child_process_list.Get().push_back(this); |
125 GetContentClient()->browser()->BrowserChildProcessHostCreated(this); | 127 GetContentClient()->browser()->BrowserChildProcessHostCreated(this); |
126 | 128 |
127 power_monitor_message_broadcaster_.Init(); | 129 power_monitor_message_broadcaster_.Init(); |
128 } | 130 } |
129 | 131 |
130 BrowserChildProcessHostImpl::~BrowserChildProcessHostImpl() { | 132 BrowserChildProcessHostImpl::~BrowserChildProcessHostImpl() { |
131 g_child_process_list.Get().remove(this); | 133 g_child_process_list.Get().remove(this); |
132 } | 134 } |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 | 388 |
387 #if defined(OS_WIN) | 389 #if defined(OS_WIN) |
388 | 390 |
389 void BrowserChildProcessHostImpl::OnObjectSignaled(HANDLE object) { | 391 void BrowserChildProcessHostImpl::OnObjectSignaled(HANDLE object) { |
390 OnChildDisconnected(); | 392 OnChildDisconnected(); |
391 } | 393 } |
392 | 394 |
393 #endif | 395 #endif |
394 | 396 |
395 } // namespace content | 397 } // namespace content |
OLD | NEW |