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

Side by Side Diff: base/process/process_posix.cc

Issue 1980743002: Track thread activities in order to diagnose hangs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@readwrite-mmf
Patch Set: rebased Created 4 years, 4 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 unified diff | Download patch
« no previous file with comments | « base/debug/task_annotator.cc ('k') | base/process/process_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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 "base/process/process.h" 5 #include "base/process/process.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <sys/resource.h> 9 #include <sys/resource.h>
10 #include <sys/wait.h> 10 #include <sys/wait.h>
11 11
12 #include "base/debug/activity_tracker.h"
12 #include "base/files/scoped_file.h" 13 #include "base/files/scoped_file.h"
13 #include "base/logging.h" 14 #include "base/logging.h"
14 #include "base/posix/eintr_wrapper.h" 15 #include "base/posix/eintr_wrapper.h"
15 #include "base/process/kill.h" 16 #include "base/process/kill.h"
16 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" 17 #include "base/third_party/dynamic_annotations/dynamic_annotations.h"
17 #include "build/build_config.h" 18 #include "build/build_config.h"
18 19
19 #if defined(OS_MACOSX) 20 #if defined(OS_MACOSX)
20 #include <sys/event.h> 21 #include <sys/event.h>
21 #endif 22 #endif
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 348
348 return result; 349 return result;
349 } 350 }
350 #endif // !defined(OS_NACL_NONSFI) 351 #endif // !defined(OS_NACL_NONSFI)
351 352
352 bool Process::WaitForExit(int* exit_code) { 353 bool Process::WaitForExit(int* exit_code) {
353 return WaitForExitWithTimeout(TimeDelta::Max(), exit_code); 354 return WaitForExitWithTimeout(TimeDelta::Max(), exit_code);
354 } 355 }
355 356
356 bool Process::WaitForExitWithTimeout(TimeDelta timeout, int* exit_code) { 357 bool Process::WaitForExitWithTimeout(TimeDelta timeout, int* exit_code) {
358 // Record the event that this thread is blocking upon (for hang diagnosis).
359 base::debug::ScopedProcessWaitActivity process_activity(this);
360
357 return WaitForExitWithTimeoutImpl(Handle(), exit_code, timeout); 361 return WaitForExitWithTimeoutImpl(Handle(), exit_code, timeout);
358 } 362 }
359 363
360 #if !defined(OS_LINUX) 364 #if !defined(OS_LINUX)
361 bool Process::IsProcessBackgrounded() const { 365 bool Process::IsProcessBackgrounded() const {
362 // See SetProcessBackgrounded(). 366 // See SetProcessBackgrounded().
363 DCHECK(IsValid()); 367 DCHECK(IsValid());
364 return false; 368 return false;
365 } 369 }
366 370
367 bool Process::SetProcessBackgrounded(bool value) { 371 bool Process::SetProcessBackgrounded(bool value) {
368 // Not implemented for POSIX systems other than Linux. With POSIX, if we were 372 // Not implemented for POSIX systems other than Linux. With POSIX, if we were
369 // to lower the process priority we wouldn't be able to raise it back to its 373 // to lower the process priority we wouldn't be able to raise it back to its
370 // initial priority. 374 // initial priority.
371 NOTIMPLEMENTED(); 375 NOTIMPLEMENTED();
372 return false; 376 return false;
373 } 377 }
374 #endif // !defined(OS_LINUX) 378 #endif // !defined(OS_LINUX)
375 379
376 int Process::GetPriority() const { 380 int Process::GetPriority() const {
377 DCHECK(IsValid()); 381 DCHECK(IsValid());
378 return getpriority(PRIO_PROCESS, process_); 382 return getpriority(PRIO_PROCESS, process_);
379 } 383 }
380 384
381 } // namespace base 385 } // namespace base
OLDNEW
« no previous file with comments | « base/debug/task_annotator.cc ('k') | base/process/process_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698