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

Unified Diff: base/mac/launchd.cc

Issue 9837098: Move launchd code from chrome/browser/mac to base/mac. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/mac/launchd.h ('k') | base/mac/scoped_launch_data.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/mac/launchd.cc
diff --git a/chrome/browser/mac/launchd.cc b/base/mac/launchd.cc
similarity index 86%
rename from chrome/browser/mac/launchd.cc
rename to base/mac/launchd.cc
index 3a55c3b688b0f82f27dbe04d7a7624807f7d8918..1d384c93a2724cb61a30106ab606de0be08763d3 100644
--- a/chrome/browser/mac/launchd.cc
+++ b/base/mac/launchd.cc
@@ -1,17 +1,14 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/mac/launchd.h"
-
-#include <launch.h>
+#include "base/mac/launchd.h"
#include "base/logging.h"
-#include "chrome/browser/mac/scoped_launch_data.h"
-
-namespace launchd {
+#include "base/mac/scoped_launch_data.h"
-namespace {
+namespace base {
+namespace mac {
// MessageForJob sends a single message to launchd with a simple dictionary
// mapping |operation| to |job_label|, and returns the result of calling
@@ -45,8 +42,6 @@ launch_data_t MessageForJob(const std::string& job_label,
return launch_msg(message);
}
-} // namespace
-
pid_t PIDForJob(const std::string& job_label) {
ScopedLaunchData response(MessageForJob(job_label, LAUNCH_KEY_GETJOB));
if (!response) {
@@ -65,10 +60,8 @@ pid_t PIDForJob(const std::string& job_label) {
launch_data_t pid_data = launch_data_dict_lookup(response,
LAUNCH_JOBKEY_PID);
- if (!pid_data) {
- LOG(ERROR) << "PIDForJob: no pid";
- return -1;
- }
+ if (!pid_data)
+ return 0;
if (launch_data_get_type(pid_data) != LAUNCH_DATA_INTEGER) {
LOG(ERROR) << "PIDForJob: expected integer";
@@ -78,4 +71,5 @@ pid_t PIDForJob(const std::string& job_label) {
return launch_data_get_integer(pid_data);
}
-} // namespace launchd
+} // namespace mac
+} // namespace base
« no previous file with comments | « base/mac/launchd.h ('k') | base/mac/scoped_launch_data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698