From 33b9820a5039e8a9925ddc0ebaced8f50112ce3b Mon Sep 17 00:00:00 2001 From: "mark@chromium.org" Date: Fri, 27 Jan 2012 23:06:49 +0000 Subject: Add OSSTATUS_LOG API. Review URL: https://chromiumcodereview.appspot.com/9235084 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@119511 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/mac/authorization_util.mm | 7 ++++--- chrome/browser/mac/dock.mm | 12 +++++------- chrome/browser/mac/install_from_dmg.mm | 8 +++++--- chrome/browser/mac/keystone_glue.mm | 7 +++++-- chrome/browser/mac/relauncher.cc | 5 +++-- 5 files changed, 22 insertions(+), 17 deletions(-) (limited to 'chrome/browser/mac') diff --git a/chrome/browser/mac/authorization_util.mm b/chrome/browser/mac/authorization_util.mm index 3c9504f..734ee7f 100644 --- a/chrome/browser/mac/authorization_util.mm +++ b/chrome/browser/mac/authorization_util.mm @@ -1,4 +1,4 @@ -// 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. @@ -13,6 +13,7 @@ #include "base/eintr_wrapper.h" #include "base/logging.h" #include "base/mac/bundle_locations.h" +#include "base/mac/mac_logging.h" #import "base/mac/mac_util.h" #include "base/string_number_conversions.h" #include "base/string_util.h" @@ -28,7 +29,7 @@ AuthorizationRef AuthorizationCreateToRunAsRoot(CFStringRef prompt) { kAuthorizationFlagDefaults, &authorization); if (status != errAuthorizationSuccess) { - LOG(ERROR) << "AuthorizationCreate: " << status; + OSSTATUS_LOG(ERROR, status) << "AuthorizationCreate"; return NULL; } @@ -73,7 +74,7 @@ AuthorizationRef AuthorizationCreateToRunAsRoot(CFStringRef prompt) { NULL); if (status != errAuthorizationSuccess) { if (status != errAuthorizationCanceled) { - LOG(ERROR) << "AuthorizationCopyRights: " << status; + OSSTATUS_LOG(ERROR, status) << "AuthorizationCopyRights"; } return NULL; } diff --git a/chrome/browser/mac/dock.mm b/chrome/browser/mac/dock.mm index 200e6b0..8928436 100644 --- a/chrome/browser/mac/dock.mm +++ b/chrome/browser/mac/dock.mm @@ -1,4 +1,4 @@ -// 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. @@ -10,6 +10,7 @@ #include #include "base/logging.h" +#include "base/mac/mac_logging.h" #include "base/mac/mac_util.h" #include "base/mac/scoped_cftyperef.h" #include "base/mac/scoped_nsautorelease_pool.h" @@ -86,7 +87,7 @@ pid_t PIDForProcessBundleID(const std::string& bundle_id) { while ((status = GetNextProcess(&psn)) == noErr) { pid_t process_pid; if ((status = GetProcessPID(&psn, &process_pid)) != noErr) { - LOG(ERROR) << "GetProcessPID: " << status; + OSSTATUS_LOG(ERROR, status) << "GetProcessPID"; continue; } @@ -98,14 +99,11 @@ pid_t PIDForProcessBundleID(const std::string& bundle_id) { continue; } - CFStringRef process_bundle_id_cf = static_cast( + CFStringRef process_bundle_id_cf = base::mac::CFCast( CFDictionaryGetValue(process_dictionary, kCFBundleIdentifierKey)); if (!process_bundle_id_cf) { // Not all processes have a bundle ID. continue; - } else if (CFGetTypeID(process_bundle_id_cf) != CFStringGetTypeID()) { - LOG(ERROR) << "process_bundle_id_cf not CFStringRef"; - continue; } std::string process_bundle_id = @@ -117,7 +115,7 @@ pid_t PIDForProcessBundleID(const std::string& bundle_id) { } // status will be procNotFound (-600) if the process wasn't found. - LOG(ERROR) << "GetNextProcess: " << status; + OSSTATUS_LOG(ERROR, status) << "GetNextProcess"; return -1; } diff --git a/chrome/browser/mac/install_from_dmg.mm b/chrome/browser/mac/install_from_dmg.mm index caf05a0..1d11ecd 100644 --- a/chrome/browser/mac/install_from_dmg.mm +++ b/chrome/browser/mac/install_from_dmg.mm @@ -22,6 +22,7 @@ #include "base/file_path.h" #include "base/logging.h" #include "base/mac/bundle_locations.h" +#include "base/mac/mac_logging.h" #import "base/mac/mac_util.h" #include "base/mac/scoped_cftyperef.h" #include "base/mac/scoped_nsautorelease_pool.h" @@ -308,7 +309,8 @@ bool InstallFromDiskImage(AuthorizationRef authorization_arg, NULL, // pipe &exit_status); if (status != errAuthorizationSuccess) { - LOG(ERROR) << "AuthorizationExecuteWithPrivileges install: " << status; + OSSTATUS_LOG(ERROR, status) + << "AuthorizationExecuteWithPrivileges install"; return false; } } else { @@ -659,7 +661,7 @@ void EjectAndTrashDiskImage(const std::string& dmg_bsd_device_name) { &disk_image_path_in_trash_c, kFSFileOperationDefaultOptions); if (status != noErr) { - LOG(ERROR) << "FSPathMoveObjectToTrashSync: " << status; + OSSTATUS_LOG(ERROR, status) << "FSPathMoveObjectToTrashSync"; return; } @@ -677,7 +679,7 @@ void EjectAndTrashDiskImage(const std::string& dmg_bsd_device_name) { kFNDirectoryModifiedMessage, kNilOptions); if (status != noErr) { - LOG(ERROR) << "FNNotifyByPath: " << status; + OSSTATUS_LOG(ERROR, status) << "FNNotifyByPath"; return; } } diff --git a/chrome/browser/mac/keystone_glue.mm b/chrome/browser/mac/keystone_glue.mm index c0c1cd3..35eaca9 100644 --- a/chrome/browser/mac/keystone_glue.mm +++ b/chrome/browser/mac/keystone_glue.mm @@ -14,6 +14,7 @@ #include "base/location.h" #include "base/logging.h" #include "base/mac/bundle_locations.h" +#include "base/mac/mac_logging.h" #include "base/mac/mac_util.h" #include "base/mac/scoped_nsautorelease_pool.h" #include "base/mac/scoped_nsexception_enabler.h" @@ -853,7 +854,8 @@ NSString* const kVersionKey = @"KSVersion"; NULL, // pipe &exit_status); if (status != errAuthorizationSuccess) { - LOG(ERROR) << "AuthorizationExecuteWithPrivileges preflight: " << status; + OSSTATUS_LOG(ERROR, status) + << "AuthorizationExecuteWithPrivileges preflight"; [self updateStatus:kAutoupdatePromoteFailed version:nil]; return; } @@ -940,7 +942,8 @@ NSString* const kVersionKey = @"KSVersion"; NULL, // pipe &exit_status); if (status != errAuthorizationSuccess) { - LOG(ERROR) << "AuthorizationExecuteWithPrivileges postflight: " << status; + OSSTATUS_LOG(ERROR, status) + << "AuthorizationExecuteWithPrivileges postflight"; } else if (exit_status != 0) { LOG(ERROR) << "keystone_promote_postflight status " << exit_status; } diff --git a/chrome/browser/mac/relauncher.cc b/chrome/browser/mac/relauncher.cc index 700f8da..138ab17 100644 --- a/chrome/browser/mac/relauncher.cc +++ b/chrome/browser/mac/relauncher.cc @@ -1,4 +1,4 @@ -// 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. @@ -20,6 +20,7 @@ #include "base/eintr_wrapper.h" #include "base/file_util.h" #include "base/logging.h" +#include "base/mac/mac_logging.h" #include "base/mac/mac_util.h" #include "base/mac/scoped_cftyperef.h" #include "base/path_service.h" @@ -370,7 +371,7 @@ int RelauncherMain(const content::MainFunctionParams& main_parameters) { OSStatus status = LSOpenApplication(&ls_parameters, NULL); if (status != noErr) { - LOG(ERROR) << "LSOpenApplication: " << status; + OSSTATUS_LOG(ERROR, status) << "LSOpenApplication"; return 1; } -- cgit v1.1