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

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

Issue 1446363003: Deleted OS_WIN and all Windows specific files from base. (Closed) Base URL: https://github.com/domokit/mojo.git@base_tests
Patch Set: Created 5 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_iterator.h ('k') | base/process/process_metrics.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "base/process/process_iterator.h"
6
7 namespace base {
8
9 ProcessIterator::ProcessIterator(const ProcessFilter* filter)
10 : started_iteration_(false),
11 filter_(filter) {
12 snapshot_ = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
13 }
14
15 ProcessIterator::~ProcessIterator() {
16 CloseHandle(snapshot_);
17 }
18
19 bool ProcessIterator::CheckForNextProcess() {
20 InitProcessEntry(&entry_);
21
22 if (!started_iteration_) {
23 started_iteration_ = true;
24 return !!Process32First(snapshot_, &entry_);
25 }
26
27 return !!Process32Next(snapshot_, &entry_);
28 }
29
30 void ProcessIterator::InitProcessEntry(ProcessEntry* entry) {
31 memset(entry, 0, sizeof(*entry));
32 entry->dwSize = sizeof(*entry);
33 }
34
35 bool NamedProcessIterator::IncludeEntry() {
36 // Case insensitive.
37 return _wcsicmp(executable_name_.c_str(), entry().exe_file()) == 0 &&
38 ProcessIterator::IncludeEntry();
39 }
40
41 } // namespace base
OLDNEW
« no previous file with comments | « base/process/process_iterator.h ('k') | base/process/process_metrics.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698