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

Unified Diff: third_party/crashpad/crashpad/util/mac/service_management.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
Index: third_party/crashpad/crashpad/util/mac/service_management.cc
diff --git a/third_party/crashpad/crashpad/util/mac/service_management.cc b/third_party/crashpad/crashpad/util/mac/service_management.cc
index 9940006ade7cfef3558eddb3f35a5b2340690a0c..e1d45f3ce6644f316dcb3d69d5e4d8409529cd34 100644
--- a/third_party/crashpad/crashpad/util/mac/service_management.cc
+++ b/third_party/crashpad/crashpad/util/mac/service_management.cc
@@ -28,10 +28,10 @@ namespace {
launch_data_t LaunchDataDictionaryForJob(const std::string& label) {
base::mac::ScopedLaunchData request(LaunchDataAlloc(LAUNCH_DATA_DICTIONARY));
LaunchDataDictInsert(
- request, LaunchDataNewString(label.c_str()), LAUNCH_KEY_GETJOB);
+ request.get(), LaunchDataNewString(label.c_str()), LAUNCH_KEY_GETJOB);
- base::mac::ScopedLaunchData response(LaunchMsg(request));
- if (LaunchDataGetType(response) != LAUNCH_DATA_DICTIONARY) {
+ base::mac::ScopedLaunchData response(LaunchMsg(request.get()));
+ if (LaunchDataGetType(response.get()) != LAUNCH_DATA_DICTIONARY) {
return nullptr;
}
@@ -47,21 +47,21 @@ bool ServiceManagementSubmitJob(CFDictionaryRef job_cf) {
}
base::mac::ScopedLaunchData jobs(LaunchDataAlloc(LAUNCH_DATA_ARRAY));
- LaunchDataArraySetIndex(jobs, job_launch.release(), 0);
+ LaunchDataArraySetIndex(jobs.get(), job_launch.release(), 0);
base::mac::ScopedLaunchData request(LaunchDataAlloc(LAUNCH_DATA_DICTIONARY));
- LaunchDataDictInsert(request, jobs.release(), LAUNCH_KEY_SUBMITJOB);
+ LaunchDataDictInsert(request.get(), jobs.release(), LAUNCH_KEY_SUBMITJOB);
- base::mac::ScopedLaunchData response(LaunchMsg(request));
- if (LaunchDataGetType(response) != LAUNCH_DATA_ARRAY) {
+ base::mac::ScopedLaunchData response(LaunchMsg(request.get()));
+ if (LaunchDataGetType(response.get()) != LAUNCH_DATA_ARRAY) {
return false;
}
- if (LaunchDataArrayGetCount(response) != 1) {
+ if (LaunchDataArrayGetCount(response.get()) != 1) {
return false;
}
- launch_data_t response_element = LaunchDataArrayGetIndex(response, 0);
+ launch_data_t response_element = LaunchDataArrayGetIndex(response.get(), 0);
if (LaunchDataGetType(response_element) != LAUNCH_DATA_ERRNO) {
return false;
}
@@ -77,14 +77,14 @@ bool ServiceManagementSubmitJob(CFDictionaryRef job_cf) {
bool ServiceManagementRemoveJob(const std::string& label, bool wait) {
base::mac::ScopedLaunchData request(LaunchDataAlloc(LAUNCH_DATA_DICTIONARY));
LaunchDataDictInsert(
- request, LaunchDataNewString(label.c_str()), LAUNCH_KEY_REMOVEJOB);
+ request.get(), LaunchDataNewString(label.c_str()), LAUNCH_KEY_REMOVEJOB);
- base::mac::ScopedLaunchData response(LaunchMsg(request));
- if (LaunchDataGetType(response) != LAUNCH_DATA_ERRNO) {
+ base::mac::ScopedLaunchData response(LaunchMsg(request.get()));
+ if (LaunchDataGetType(response.get()) != LAUNCH_DATA_ERRNO) {
return false;
}
- int err = LaunchDataGetErrno(response);
+ int err = LaunchDataGetErrno(response.get());
if (err == EINPROGRESS) {
if (wait) {
// TODO(mark): Use a kqueue to wait for the process to exit. To avoid a
@@ -108,7 +108,7 @@ bool ServiceManagementRemoveJob(const std::string& label, bool wait) {
bool ServiceManagementIsJobLoaded(const std::string& label) {
base::mac::ScopedLaunchData dictionary(LaunchDataDictionaryForJob(label));
- if (!dictionary) {
+ if (!dictionary.is_valid()) {
return false;
}
@@ -117,11 +117,11 @@ bool ServiceManagementIsJobLoaded(const std::string& label) {
pid_t ServiceManagementIsJobRunning(const std::string& label) {
base::mac::ScopedLaunchData dictionary(LaunchDataDictionaryForJob(label));
- if (!dictionary) {
+ if (!dictionary.is_valid()) {
return 0;
}
- launch_data_t pid = LaunchDataDictLookup(dictionary, LAUNCH_JOBKEY_PID);
+ launch_data_t pid = LaunchDataDictLookup(dictionary.get(), LAUNCH_JOBKEY_PID);
if (!pid) {
return 0;
}

Powered by Google App Engine
This is Rietveld 408576698