Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(816)

Unified Diff: base/process/kill_mac.cc

Issue 18555002: Split out process killing functions from base/process_util.h into base/process/kill.h. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/process/kill.cc ('k') | base/process/kill_posix.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/process/kill_mac.cc
diff --git a/base/process_util_mac.mm b/base/process/kill_mac.cc
similarity index 77%
copy from base/process_util_mac.mm
copy to base/process/kill_mac.cc
index 183463ed003158e7b485bb3ce5ca0ab41d9bd8ba..5ebca5d00762329f5a163a9c8e2878df748f50f6 100644
--- a/base/process_util_mac.mm
+++ b/base/process/kill_mac.cc
@@ -1,75 +1,20 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/process_util.h"
-
-#import <Cocoa/Cocoa.h>
-#include <crt_externs.h>
-#include <errno.h>
-#include <mach/mach.h>
-#include <mach/mach_init.h>
-#include <mach/mach_vm.h>
-#include <mach/shared_region.h>
-#include <mach/task.h>
-#include <malloc/malloc.h>
-#import <objc/runtime.h>
+#include "base/process/kill.h"
+
#include <signal.h>
-#include <spawn.h>
#include <sys/event.h>
-#include <sys/sysctl.h>
#include <sys/types.h>
#include <sys/wait.h>
-#include <new>
-#include <string>
-
-#include "base/containers/hash_tables.h"
-#include "base/debug/debugger.h"
#include "base/file_util.h"
-#include "base/lazy_instance.h"
#include "base/logging.h"
-#include "base/mac/mac_util.h"
-#include "base/mac/scoped_mach_port.h"
#include "base/posix/eintr_wrapper.h"
-#include "base/scoped_clear_errno.h"
-#include "base/strings/string_util.h"
-#include "base/sys_info.h"
-#include "third_party/apple_apsl/CFBase.h"
-#include "third_party/apple_apsl/malloc.h"
namespace base {
-void RestoreDefaultExceptionHandler() {
- // This function is tailored to remove the Breakpad exception handler.
- // exception_mask matches s_exception_mask in
- // breakpad/src/client/mac/handler/exception_handler.cc
- const exception_mask_t exception_mask = EXC_MASK_BAD_ACCESS |
- EXC_MASK_BAD_INSTRUCTION |
- EXC_MASK_ARITHMETIC |
- EXC_MASK_BREAKPOINT;
-
- // Setting the exception port to MACH_PORT_NULL may not be entirely
- // kosher to restore the default exception handler, but in practice,
- // it results in the exception port being set to Apple Crash Reporter,
- // the desired behavior.
- task_set_exception_ports(mach_task_self(), exception_mask, MACH_PORT_NULL,
- EXCEPTION_DEFAULT, THREAD_STATE_NONE);
-}
-
-ProcessId GetParentProcessId(ProcessHandle process) {
- struct kinfo_proc info;
- size_t length = sizeof(struct kinfo_proc);
- int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, process };
- if (sysctl(mib, 4, &info, &length, NULL, 0) < 0) {
- DPLOG(ERROR) << "sysctl";
- return -1;
- }
- if (length == 0)
- return -1;
- return info.kp_eproc.e_ppid;
-}
-
namespace {
const int kWaitBeforeKillSeconds = 2;
« no previous file with comments | « base/process/kill.cc ('k') | base/process/kill_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698