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

Unified Diff: snapshot/mac/process_reader.cc

Issue 727973002: Move some parts of ProcessReader (in snapshot) to ProcessInfo (in util) (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Address review feedback Created 6 years, 1 month 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 | « snapshot/mac/process_reader.h ('k') | util/mac/service_management_test.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: snapshot/mac/process_reader.cc
diff --git a/snapshot/mac/process_reader.cc b/snapshot/mac/process_reader.cc
index 2c9f417e014519c4a005c8f888a6178f2696c9fd..766367584e5063a3c0bee5b28902f2f1292fcd62 100644
--- a/snapshot/mac/process_reader.cc
+++ b/snapshot/mac/process_reader.cc
@@ -90,7 +90,7 @@ ProcessReader::Module::~Module() {
}
ProcessReader::ProcessReader()
- : kern_proc_info_(),
+ : process_info_(),
threads_(),
modules_(),
module_readers_(),
@@ -112,23 +112,11 @@ ProcessReader::~ProcessReader() {
bool ProcessReader::Initialize(task_t task) {
INITIALIZATION_STATE_SET_INITIALIZING(initialized_);
- pid_t pid;
- kern_return_t kr = pid_for_task(task, &pid);
- if (kr != KERN_SUCCESS) {
- MACH_LOG(ERROR, kr) << "pid_for_task";
- return false;
- }
-
- int mib[] = {CTL_KERN, KERN_PROC, KERN_PROC_PID, pid};
- size_t len = sizeof(kern_proc_info_);
- if (sysctl(mib, arraysize(mib), &kern_proc_info_, &len, nullptr, 0) != 0) {
- PLOG(ERROR) << "sysctl for pid " << pid;
+ if (!process_info_.InitializeFromTask(task)) {
return false;
}
- DCHECK_EQ(kern_proc_info_.kp_proc.p_pid, pid);
-
- is_64_bit_ = kern_proc_info_.kp_proc.p_flag & P_LP64;
+ is_64_bit_ = process_info_.Is64Bit();
task_memory_.reset(new TaskMemory(task));
task_ = task;
@@ -137,11 +125,6 @@ bool ProcessReader::Initialize(task_t task) {
return true;
}
-void ProcessReader::StartTime(timeval* start_time) const {
- INITIALIZATION_STATE_DCHECK_VALID(initialized_);
- *start_time = kern_proc_info_.kp_proc.p_starttime;
-}
-
bool ProcessReader::CPUTimes(timeval* user_time, timeval* system_time) const {
INITIALIZATION_STATE_DCHECK_VALID(initialized_);
« no previous file with comments | « snapshot/mac/process_reader.h ('k') | util/mac/service_management_test.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698