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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 delegate_(delegate), | 85 delegate_(delegate), |
85 #if !defined(OS_WIN) | 86 #if !defined(OS_WIN) |
86 ALLOW_THIS_IN_INITIALIZER_LIST(task_factory_(this)), | 87 ALLOW_THIS_IN_INITIALIZER_LIST(task_factory_(this)), |
87 #endif | 88 #endif |
88 disconnect_was_alive_(false) { | 89 disconnect_was_alive_(false) { |
89 data_.id = ChildProcessHostImpl::GenerateChildProcessUniqueId(); | 90 data_.id = ChildProcessHostImpl::GenerateChildProcessUniqueId(); |
90 | 91 |
91 child_process_host_.reset(ChildProcessHost::Create(this)); | 92 child_process_host_.reset(ChildProcessHost::Create(this)); |
92 child_process_host_->AddFilter(new TraceMessageFilter); | 93 child_process_host_->AddFilter(new TraceMessageFilter); |
93 child_process_host_->AddFilter(new content::ProfilerMessageFilter(type)); | 94 child_process_host_->AddFilter(new content::ProfilerMessageFilter(type)); |
| 95 child_process_host_->AddFilter(new content::HistogramMessageFilter()); |
94 | 96 |
95 g_child_process_list.Get().push_back(this); | 97 g_child_process_list.Get().push_back(this); |
96 content::GetContentClient()->browser()->BrowserChildProcessHostCreated(this); | 98 content::GetContentClient()->browser()->BrowserChildProcessHostCreated(this); |
97 } | 99 } |
98 | 100 |
99 BrowserChildProcessHostImpl::~BrowserChildProcessHostImpl() { | 101 BrowserChildProcessHostImpl::~BrowserChildProcessHostImpl() { |
100 g_child_process_list.Get().remove(this); | 102 g_child_process_list.Get().remove(this); |
101 } | 103 } |
102 | 104 |
103 // static | 105 // static |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 | 323 |
322 | 324 |
323 void BrowserChildProcessHostImpl::OnProcessLaunched() { | 325 void BrowserChildProcessHostImpl::OnProcessLaunched() { |
324 if (!child_process_->GetHandle()) { | 326 if (!child_process_->GetHandle()) { |
325 delete delegate_; // Will delete us | 327 delete delegate_; // Will delete us |
326 return; | 328 return; |
327 } | 329 } |
328 data_.handle = child_process_->GetHandle(); | 330 data_.handle = child_process_->GetHandle(); |
329 delegate_->OnProcessLaunched(); | 331 delegate_->OnProcessLaunched(); |
330 } | 332 } |
OLD | NEW |