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" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 void NotifyProcessHostConnected(const ChildProcessData& data) { | 46 void NotifyProcessHostConnected(const ChildProcessData& data) { |
47 FOR_EACH_OBSERVER(BrowserChildProcessObserver, g_observers.Get(), | 47 FOR_EACH_OBSERVER(BrowserChildProcessObserver, g_observers.Get(), |
48 BrowserChildProcessHostConnected(data)); | 48 BrowserChildProcessHostConnected(data)); |
49 } | 49 } |
50 | 50 |
51 void NotifyProcessHostDisconnected(const ChildProcessData& data) { | 51 void NotifyProcessHostDisconnected(const ChildProcessData& data) { |
52 FOR_EACH_OBSERVER(BrowserChildProcessObserver, g_observers.Get(), | 52 FOR_EACH_OBSERVER(BrowserChildProcessObserver, g_observers.Get(), |
53 BrowserChildProcessHostDisconnected(data)); | 53 BrowserChildProcessHostDisconnected(data)); |
54 } | 54 } |
55 | 55 |
56 void NotifyProcessCrashed(const ChildProcessData& data) { | 56 void NotifyProcessCrashed(const ChildProcessData& data, int exit_code) { |
57 FOR_EACH_OBSERVER(BrowserChildProcessObserver, g_observers.Get(), | 57 FOR_EACH_OBSERVER(BrowserChildProcessObserver, g_observers.Get(), |
58 BrowserChildProcessCrashed(data)); | 58 BrowserChildProcessCrashed(data, exit_code)); |
59 } | 59 } |
60 | 60 |
61 } // namespace | 61 } // namespace |
62 | 62 |
63 BrowserChildProcessHost* BrowserChildProcessHost::Create( | 63 BrowserChildProcessHost* BrowserChildProcessHost::Create( |
64 content::ProcessType process_type, | 64 content::ProcessType process_type, |
65 BrowserChildProcessHostDelegate* delegate) { | 65 BrowserChildProcessHostDelegate* delegate) { |
66 return new BrowserChildProcessHostImpl(process_type, delegate); | 66 return new BrowserChildProcessHostImpl(process_type, delegate); |
67 } | 67 } |
68 | 68 |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 early_exit_watcher_.StopWatching(); | 275 early_exit_watcher_.StopWatching(); |
276 #endif | 276 #endif |
277 if (child_process_.get() || data_.handle) { | 277 if (child_process_.get() || data_.handle) { |
278 int exit_code; | 278 int exit_code; |
279 base::TerminationStatus status = GetTerminationStatus( | 279 base::TerminationStatus status = GetTerminationStatus( |
280 true /* known_dead */, &exit_code); | 280 true /* known_dead */, &exit_code); |
281 switch (status) { | 281 switch (status) { |
282 case base::TERMINATION_STATUS_PROCESS_CRASHED: | 282 case base::TERMINATION_STATUS_PROCESS_CRASHED: |
283 case base::TERMINATION_STATUS_ABNORMAL_TERMINATION: { | 283 case base::TERMINATION_STATUS_ABNORMAL_TERMINATION: { |
284 delegate_->OnProcessCrashed(exit_code); | 284 delegate_->OnProcessCrashed(exit_code); |
285 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 285 BrowserThread::PostTask( |
286 base::Bind(&NotifyProcessCrashed, data_)); | 286 BrowserThread::UI, FROM_HERE, |
| 287 base::Bind(&NotifyProcessCrashed, data_, exit_code)); |
287 UMA_HISTOGRAM_ENUMERATION("ChildProcess.Crashed2", | 288 UMA_HISTOGRAM_ENUMERATION("ChildProcess.Crashed2", |
288 data_.process_type, | 289 data_.process_type, |
289 PROCESS_TYPE_MAX); | 290 PROCESS_TYPE_MAX); |
290 break; | 291 break; |
291 } | 292 } |
292 case base::TERMINATION_STATUS_PROCESS_WAS_KILLED: { | 293 case base::TERMINATION_STATUS_PROCESS_WAS_KILLED: { |
293 delegate_->OnProcessCrashed(exit_code); | 294 delegate_->OnProcessCrashed(exit_code); |
294 // Report that this child process was killed. | 295 // Report that this child process was killed. |
295 UMA_HISTOGRAM_ENUMERATION("ChildProcess.Killed2", | 296 UMA_HISTOGRAM_ENUMERATION("ChildProcess.Killed2", |
296 data_.process_type, | 297 data_.process_type, |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 | 349 |
349 #if defined(OS_WIN) | 350 #if defined(OS_WIN) |
350 | 351 |
351 void BrowserChildProcessHostImpl::OnObjectSignaled(HANDLE object) { | 352 void BrowserChildProcessHostImpl::OnObjectSignaled(HANDLE object) { |
352 OnChildDisconnected(); | 353 OnChildDisconnected(); |
353 } | 354 } |
354 | 355 |
355 #endif | 356 #endif |
356 | 357 |
357 } // namespace content | 358 } // namespace content |
OLD | NEW |