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

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

Issue 725353003: Don't pass ProcessHandle through ChildProcessHostDelegate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix typo 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 unified diff | Download patch
« no previous file with comments | « base/process/process_unittest.cc ('k') | chrome/service/service_utility_process_host.h » ('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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/win/windows_version.h" 9 #include "base/win/windows_version.h"
10 10
(...skipping 21 matching lines...) Expand all
32 } 32 }
33 33
34 // static 34 // static
35 Process Process::Current() { 35 Process Process::Current() {
36 Process process; 36 Process process;
37 process.is_current_process_ = true; 37 process.is_current_process_ = true;
38 return process.Pass(); 38 return process.Pass();
39 } 39 }
40 40
41 // static 41 // static
42 Process Process::DeprecatedGetProcessFromHandle(ProcessHandle handle) {
43 DCHECK_NE(handle, ::GetCurrentProcess());
44 ProcessHandle out_handle;
45 if (!::DuplicateHandle(GetCurrentProcess(), handle,
46 GetCurrentProcess(), &out_handle,
47 0, FALSE, DUPLICATE_SAME_ACCESS)) {
48 return Process();
49 }
50 return Process(out_handle);
51 }
52
53 // static
42 bool Process::CanBackgroundProcesses() { 54 bool Process::CanBackgroundProcesses() {
43 return true; 55 return true;
44 } 56 }
45 57
46 bool Process::IsValid() const { 58 bool Process::IsValid() const {
47 return process_.IsValid() || is_current(); 59 return process_.IsValid() || is_current();
48 } 60 }
49 61
50 ProcessHandle Process::Handle() const { 62 ProcessHandle Process::Handle() const {
51 return is_current_process_ ? GetCurrentProcess() : process_.Get(); 63 return is_current_process_ ? GetCurrentProcess() : process_.Get();
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 134
123 return (::SetPriorityClass(Handle(), priority) != 0); 135 return (::SetPriorityClass(Handle(), priority) != 0);
124 } 136 }
125 137
126 int Process::GetPriority() const { 138 int Process::GetPriority() const {
127 DCHECK(IsValid()); 139 DCHECK(IsValid());
128 return ::GetPriorityClass(Handle()); 140 return ::GetPriorityClass(Handle());
129 } 141 }
130 142
131 } // namespace base 143 } // namespace base
OLDNEW
« no previous file with comments | « base/process/process_unittest.cc ('k') | chrome/service/service_utility_process_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698