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

Unified Diff: base/mac/launchd.cc

Issue 1551943002: Rewrite most of the scopers in //base/mac to use ScopedTypeRef or ScopedGeneric. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix iOS Created 5 years 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 | « no previous file | base/mac/scoped_block.h » ('j') | base/mac/scoped_launch_data.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/mac/launchd.cc
diff --git a/base/mac/launchd.cc b/base/mac/launchd.cc
index 1d384c93a2724cb61a30106ab606de0be08763d3..0337d2e60970751e467b783f2710c058a937e26d 100644
--- a/base/mac/launchd.cc
+++ b/base/mac/launchd.cc
@@ -18,7 +18,7 @@ launch_data_t MessageForJob(const std::string& job_label,
const char* operation) {
// launch_data_alloc returns something that needs to be freed.
ScopedLaunchData message(launch_data_alloc(LAUNCH_DATA_DICTIONARY));
- if (!message) {
+ if (!message.is_valid()) {
LOG(ERROR) << "launch_data_alloc";
return NULL;
}
@@ -28,38 +28,38 @@ launch_data_t MessageForJob(const std::string& job_label,
// called, so put it in a scoper and .release() it when given to the
// dictionary.
ScopedLaunchData job_label_launchd(launch_data_new_string(job_label.c_str()));
- if (!job_label_launchd) {
+ if (!job_label_launchd.is_valid()) {
LOG(ERROR) << "launch_data_new_string";
return NULL;
}
- if (!launch_data_dict_insert(message,
- job_label_launchd.release(),
+ if (!launch_data_dict_insert(message.get(), job_label_launchd.release(),
operation)) {
return NULL;
}
- return launch_msg(message);
+ return launch_msg(message.get());
}
pid_t PIDForJob(const std::string& job_label) {
ScopedLaunchData response(MessageForJob(job_label, LAUNCH_KEY_GETJOB));
- if (!response) {
+ if (!response.is_valid()) {
return -1;
}
- launch_data_type_t response_type = launch_data_get_type(response);
+ launch_data_type_t response_type = launch_data_get_type(response.get());
if (response_type != LAUNCH_DATA_DICTIONARY) {
if (response_type == LAUNCH_DATA_ERRNO) {
- LOG(ERROR) << "PIDForJob: error " << launch_data_get_errno(response);
+ LOG(ERROR) << "PIDForJob: error "
+ << launch_data_get_errno(response.get());
} else {
LOG(ERROR) << "PIDForJob: expected dictionary, got " << response_type;
}
return -1;
}
- launch_data_t pid_data = launch_data_dict_lookup(response,
- LAUNCH_JOBKEY_PID);
+ launch_data_t pid_data =
+ launch_data_dict_lookup(response.get(), LAUNCH_JOBKEY_PID);
if (!pid_data)
return 0;
« no previous file with comments | « no previous file | base/mac/scoped_block.h » ('j') | base/mac/scoped_launch_data.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698