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/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
13 #include "base/path_service.h" | 13 #include "base/path_service.h" |
14 #include "base/process_util.h" | 14 #include "base/process_util.h" |
15 #include "base/stl_util.h" | 15 #include "base/stl_util.h" |
16 #include "base/string_util.h" | 16 #include "base/string_util.h" |
| 17 #include "content/browser/histogram_message_filter.h" |
17 #include "content/browser/profiler_message_filter.h" | 18 #include "content/browser/profiler_message_filter.h" |
18 #include "content/browser/renderer_host/resource_message_filter.h" | 19 #include "content/browser/renderer_host/resource_message_filter.h" |
19 #include "content/browser/trace_message_filter.h" | 20 #include "content/browser/trace_message_filter.h" |
20 #include "content/common/child_process_host_impl.h" | 21 #include "content/common/child_process_host_impl.h" |
21 #include "content/common/plugin_messages.h" | 22 #include "content/common/plugin_messages.h" |
22 #include "content/public/browser/browser_thread.h" | 23 #include "content/public/browser/browser_thread.h" |
23 #include "content/public/browser/browser_child_process_host_delegate.h" | 24 #include "content/public/browser/browser_child_process_host_delegate.h" |
24 #include "content/public/browser/child_process_data.h" | 25 #include "content/public/browser/child_process_data.h" |
25 #include "content/public/browser/content_browser_client.h" | 26 #include "content/public/browser/content_browser_client.h" |
26 #include "content/public/browser/notification_service.h" | 27 #include "content/public/browser/notification_service.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 BrowserChildProcessHostImpl::BrowserChildProcessHostImpl( | 79 BrowserChildProcessHostImpl::BrowserChildProcessHostImpl( |
79 content::ProcessType type, | 80 content::ProcessType type, |
80 BrowserChildProcessHostDelegate* delegate) | 81 BrowserChildProcessHostDelegate* delegate) |
81 : data_(type), | 82 : data_(type), |
82 delegate_(delegate) { | 83 delegate_(delegate) { |
83 data_.id = ChildProcessHostImpl::GenerateChildProcessUniqueId(); | 84 data_.id = ChildProcessHostImpl::GenerateChildProcessUniqueId(); |
84 | 85 |
85 child_process_host_.reset(ChildProcessHost::Create(this)); | 86 child_process_host_.reset(ChildProcessHost::Create(this)); |
86 child_process_host_->AddFilter(new TraceMessageFilter); | 87 child_process_host_->AddFilter(new TraceMessageFilter); |
87 child_process_host_->AddFilter(new content::ProfilerMessageFilter(type)); | 88 child_process_host_->AddFilter(new content::ProfilerMessageFilter(type)); |
| 89 child_process_host_->AddFilter(new content::HistogramMessageFilter()); |
88 | 90 |
89 g_child_process_list.Get().push_back(this); | 91 g_child_process_list.Get().push_back(this); |
90 content::GetContentClient()->browser()->BrowserChildProcessHostCreated(this); | 92 content::GetContentClient()->browser()->BrowserChildProcessHostCreated(this); |
91 } | 93 } |
92 | 94 |
93 BrowserChildProcessHostImpl::~BrowserChildProcessHostImpl() { | 95 BrowserChildProcessHostImpl::~BrowserChildProcessHostImpl() { |
94 g_child_process_list.Get().remove(this); | 96 g_child_process_list.Get().remove(this); |
95 } | 97 } |
96 | 98 |
97 // static | 99 // static |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 } | 251 } |
250 | 252 |
251 void BrowserChildProcessHostImpl::OnProcessLaunched() { | 253 void BrowserChildProcessHostImpl::OnProcessLaunched() { |
252 if (!child_process_->GetHandle()) { | 254 if (!child_process_->GetHandle()) { |
253 delete delegate_; // Will delete us | 255 delete delegate_; // Will delete us |
254 return; | 256 return; |
255 } | 257 } |
256 data_.handle = child_process_->GetHandle(); | 258 data_.handle = child_process_->GetHandle(); |
257 delegate_->OnProcessLaunched(); | 259 delegate_->OnProcessLaunched(); |
258 } | 260 } |
OLD | NEW |