OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <dirent.h> | 5 #include <dirent.h> |
6 #include <errno.h> | 6 #include <errno.h> |
7 #include <fcntl.h> | 7 #include <fcntl.h> |
8 #include <signal.h> | 8 #include <signal.h> |
9 #include <stdlib.h> | 9 #include <stdlib.h> |
10 #include <sys/resource.h> | 10 #include <sys/resource.h> |
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 ProcessMetrics::ProcessMetrics(ProcessHandle process) | 461 ProcessMetrics::ProcessMetrics(ProcessHandle process) |
462 #else | 462 #else |
463 ProcessMetrics::ProcessMetrics(ProcessHandle process, | 463 ProcessMetrics::ProcessMetrics(ProcessHandle process, |
464 ProcessMetrics::PortProvider* port_provider) | 464 ProcessMetrics::PortProvider* port_provider) |
465 #endif | 465 #endif |
466 : process_(process), | 466 : process_(process), |
467 last_time_(0), | 467 last_time_(0), |
468 last_system_time_(0) | 468 last_system_time_(0) |
469 #if defined(OS_LINUX) | 469 #if defined(OS_LINUX) |
470 , last_cpu_(0) | 470 , last_cpu_(0) |
471 #elif defined (OS_MACOSX) | 471 #elif defined(OS_MACOSX) |
472 , port_provider_(port_provider) | 472 , port_provider_(port_provider) |
473 #endif | 473 #endif |
474 { | 474 { |
475 processor_count_ = base::SysInfo::NumberOfProcessors(); | 475 processor_count_ = base::SysInfo::NumberOfProcessors(); |
476 } | 476 } |
477 | 477 |
478 // static | 478 // static |
479 #if !defined(OS_MACOSX) | 479 #if !defined(OS_MACOSX) |
480 ProcessMetrics* ProcessMetrics::CreateProcessMetrics(ProcessHandle process) { | 480 ProcessMetrics* ProcessMetrics::CreateProcessMetrics(ProcessHandle process) { |
481 return new ProcessMetrics(process); | 481 return new ProcessMetrics(process); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 // the child hasn't exited yet. | 534 // the child hasn't exited yet. |
535 if (child_exited) | 535 if (child_exited) |
536 *child_exited = false; | 536 *child_exited = false; |
537 return false; | 537 return false; |
538 } | 538 } |
539 | 539 |
540 if (child_exited) | 540 if (child_exited) |
541 *child_exited = true; | 541 *child_exited = true; |
542 | 542 |
543 if (WIFSIGNALED(status)) { | 543 if (WIFSIGNALED(status)) { |
544 switch(WTERMSIG(status)) { | 544 switch (WTERMSIG(status)) { |
545 case SIGSEGV: | 545 case SIGSEGV: |
546 case SIGILL: | 546 case SIGILL: |
547 case SIGABRT: | 547 case SIGABRT: |
548 case SIGFPE: | 548 case SIGFPE: |
549 return true; | 549 return true; |
550 default: | 550 default: |
551 return false; | 551 return false; |
552 } | 552 } |
553 } | 553 } |
554 | 554 |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
774 const ProcessFilter* filter) { | 774 const ProcessFilter* filter) { |
775 bool exited_cleanly = | 775 bool exited_cleanly = |
776 WaitForProcessesToExit(executable_name, wait_milliseconds, | 776 WaitForProcessesToExit(executable_name, wait_milliseconds, |
777 filter); | 777 filter); |
778 if (!exited_cleanly) | 778 if (!exited_cleanly) |
779 KillProcesses(executable_name, exit_code, filter); | 779 KillProcesses(executable_name, exit_code, filter); |
780 return exited_cleanly; | 780 return exited_cleanly; |
781 } | 781 } |
782 | 782 |
783 } // namespace base | 783 } // namespace base |
OLD | NEW |