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

Side by Side Diff: components/browser_watcher/exit_code_watcher_win.cc

Issue 1752233002: Convert Pass()→std::move() on Windows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 9 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
OLDNEW
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2014 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 "components/browser_watcher/exit_code_watcher_win.h" 5 #include "components/browser_watcher/exit_code_watcher_win.h"
6 6
7 #include <utility>
8
7 #include "base/logging.h" 9 #include "base/logging.h"
8 #include "base/process/kill.h" 10 #include "base/process/kill.h"
9 #include "base/strings/stringprintf.h" 11 #include "base/strings/stringprintf.h"
10 #include "base/win/registry.h" 12 #include "base/win/registry.h"
11 13
12 namespace browser_watcher { 14 namespace browser_watcher {
13 15
14 namespace { 16 namespace {
15 17
16 base::string16 GetValueName(const base::Time creation_time, 18 base::string16 GetValueName(const base::Time creation_time,
(...skipping 26 matching lines...) Expand all
43 45
44 FILETIME creation_time = {}; 46 FILETIME creation_time = {};
45 FILETIME dummy = {}; 47 FILETIME dummy = {};
46 if (!::GetProcessTimes(process.Handle(), &creation_time, &dummy, &dummy, 48 if (!::GetProcessTimes(process.Handle(), &creation_time, &dummy, &dummy,
47 &dummy)) { 49 &dummy)) {
48 PLOG(ERROR) << "Invalid parent handle, can't get parent process times."; 50 PLOG(ERROR) << "Invalid parent handle, can't get parent process times.";
49 return false; 51 return false;
50 } 52 }
51 53
52 // Success, take ownership of the process. 54 // Success, take ownership of the process.
53 process_ = process.Pass(); 55 process_ = std::move(process);
54 process_creation_time_ = base::Time::FromFileTime(creation_time); 56 process_creation_time_ = base::Time::FromFileTime(creation_time);
55 57
56 // Start by writing the value STILL_ACTIVE to registry, to allow detection 58 // Start by writing the value STILL_ACTIVE to registry, to allow detection
57 // of the case where the watcher itself is somehow terminated before it can 59 // of the case where the watcher itself is somehow terminated before it can
58 // write the process' actual exit code. 60 // write the process' actual exit code.
59 return WriteProcessExitCode(STILL_ACTIVE); 61 return WriteProcessExitCode(STILL_ACTIVE);
60 } 62 }
61 63
62 void ExitCodeWatcher::WaitForExit() { 64 void ExitCodeWatcher::WaitForExit() {
63 if (!process_.WaitForExit(&exit_code_)) { 65 if (!process_.WaitForExit(&exit_code_)) {
(...skipping 14 matching lines...) Expand all
78 ULONG result = key.WriteValue(value_name.c_str(), exit_code); 80 ULONG result = key.WriteValue(value_name.c_str(), exit_code);
79 if (result != ERROR_SUCCESS) { 81 if (result != ERROR_SUCCESS) {
80 LOG(ERROR) << "Unable to write to registry, error " << result; 82 LOG(ERROR) << "Unable to write to registry, error " << result;
81 return false; 83 return false;
82 } 84 }
83 85
84 return true; 86 return true;
85 } 87 }
86 88
87 } // namespace browser_watcher 89 } // namespace browser_watcher
OLDNEW
« no previous file with comments | « chrome/utility/printing_handler.cc ('k') | components/browser_watcher/exit_code_watcher_win_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698