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

Unified Diff: base/process_win.cc

Issue 19519008: Move the remaning base/process* files into base/process/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: '' Created 7 years, 5 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_util_unittest_ios.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/process_win.cc
diff --git a/base/process_win.cc b/base/process_win.cc
deleted file mode 100644
index 3f683ab3e5a70a58dacddb5798dfaafdbf8ea15f..0000000000000000000000000000000000000000
--- a/base/process_win.cc
+++ /dev/null
@@ -1,92 +0,0 @@
-// Copyright (c) 2011 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.h"
-#include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
-#include "base/process_util.h"
-#include "base/win/windows_version.h"
-
-namespace base {
-
-void Process::Close() {
- if (!process_)
- return;
-
- // Don't call CloseHandle on a pseudo-handle.
- if (process_ != ::GetCurrentProcess())
- ::CloseHandle(process_);
-
- process_ = NULL;
-}
-
-void Process::Terminate(int result_code) {
- if (!process_)
- return;
-
- // Call NtTerminateProcess directly, without going through the import table,
- // which might have been hooked with a buggy replacement by third party
- // software. http://crbug.com/81449.
- HMODULE module = GetModuleHandle(L"ntdll.dll");
- typedef UINT (WINAPI *TerminateProcessPtr)(HANDLE handle, UINT code);
- TerminateProcessPtr terminate_process = reinterpret_cast<TerminateProcessPtr>(
- GetProcAddress(module, "NtTerminateProcess"));
- terminate_process(process_, result_code);
-}
-
-bool Process::IsProcessBackgrounded() const {
- if (!process_)
- return false; // Failure case.
- DWORD priority = GetPriority();
- if (priority == 0)
- return false; // Failure case.
- return ((priority == BELOW_NORMAL_PRIORITY_CLASS) ||
- (priority == IDLE_PRIORITY_CLASS));
-}
-
-bool Process::SetProcessBackgrounded(bool value) {
- if (!process_)
- return false;
- // Vista and above introduce a real background mode, which not only
- // sets the priority class on the threads but also on the IO generated
- // by it. Unfortunately it can only be set for the calling process.
- DWORD priority;
- if ((base::win::GetVersion() >= base::win::VERSION_VISTA) &&
- (process_ == ::GetCurrentProcess())) {
- priority = value ? PROCESS_MODE_BACKGROUND_BEGIN :
- PROCESS_MODE_BACKGROUND_END;
- } else {
- priority = value ? BELOW_NORMAL_PRIORITY_CLASS : NORMAL_PRIORITY_CLASS;
- }
-
- return (::SetPriorityClass(process_, priority) != 0);
-}
-
-ProcessId Process::pid() const {
- if (process_ == 0)
- return 0;
-
- return GetProcId(process_);
-}
-
-bool Process::is_current() const {
- return process_ == GetCurrentProcess();
-}
-
-// static
-Process Process::Current() {
- return Process(::GetCurrentProcess());
-}
-
-// static
-bool Process::CanBackgroundProcesses() {
- return true;
-}
-
-int Process::GetPriority() const {
- DCHECK(process_);
- return ::GetPriorityClass(process_);
-}
-
-} // namespace base
« no previous file with comments | « base/process_util_unittest_ios.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698