summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--base/base.gypi2
-rw-r--r--base/logging.h1
-rw-r--r--base/mac/foundation_util.mm5
-rw-r--r--base/mac/mac_logging.cc29
-rw-r--r--base/mac/mac_logging.h83
-rw-r--r--base/mac/mac_util.mm18
-rw-r--r--chrome/browser/mac/authorization_util.mm7
-rw-r--r--chrome/browser/mac/dock.mm12
-rw-r--r--chrome/browser/mac/install_from_dmg.mm8
-rw-r--r--chrome/browser/mac/keystone_glue.mm7
-rw-r--r--chrome/browser/mac/relauncher.cc5
-rw-r--r--chrome/browser/password_manager/encryptor_password_mac.mm9
-rw-r--r--chrome/browser/password_manager/password_store_mac.cc7
-rw-r--r--chrome/browser/platform_util_mac.mm28
-rw-r--r--chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.mm5
-rw-r--r--chrome/browser/ui/webui/options/advanced_options_utils_mac.mm7
-rw-r--r--chrome/browser/ui/webui/options2/advanced_options_utils2_mac.mm6
-rw-r--r--chrome/common/service_process_util_unittest.cc2
-rw-r--r--chrome/service/chrome_service_application_mac.mm18
-rw-r--r--cloud_print/virtual_driver/posix/installer_util_mac.mm18
-rw-r--r--cloud_print/virtual_driver/posix/printer_driver_util_mac.mm10
-rw-r--r--content/browser/file_metadata_mac.mm7
-rw-r--r--media/audio/mac/audio_input_mac.cc7
-rw-r--r--media/audio/mac/audio_low_latency_input_mac.cc20
-rw-r--r--media/audio/mac/audio_low_latency_output_mac.cc30
-rw-r--r--media/audio/mac/audio_manager_mac.cc7
-rw-r--r--media/audio/mac/audio_output_mac.cc7
-rw-r--r--net/base/cert_database_mac.cc5
-rw-r--r--net/base/keygen_handler_mac.cc5
-rw-r--r--net/base/x509_cert_types_mac.cc5
-rw-r--r--net/base/x509_certificate_mac.cc35
-rw-r--r--net/socket/ssl_client_socket_mac.cc14
-rw-r--r--net/socket/ssl_client_socket_nss.cc5
-rw-r--r--remoting/host/user_authenticator_mac.cc6
34 files changed, 287 insertions, 153 deletions
diff --git a/base/base.gypi b/base/base.gypi
index 238dd75..2d10270 100644
--- a/base/base.gypi
+++ b/base/base.gypi
@@ -151,6 +151,8 @@
'mac/crash_logging.mm',
'mac/foundation_util.h',
'mac/foundation_util.mm',
+ 'mac/mac_logging.h',
+ 'mac/mac_logging.cc',
'mac/mac_util.h',
'mac/mac_util.mm',
'mac/objc_property_releaser.h',
diff --git a/base/logging.h b/base/logging.h
index df31955..e9faca3 100644
--- a/base/logging.h
+++ b/base/logging.h
@@ -438,7 +438,6 @@ const LogSeverity LOG_0 = LOG_ERROR;
// PLOG_STREAM is used by PLOG, which is the usual error logging macro
// for each platform.
#define PLOG_STREAM(severity) LOG_ERRNO_STREAM(severity)
-// TODO(tschmelcher): Should we add OSStatus logging for Mac?
#endif
#define PLOG(severity) \
diff --git a/base/mac/foundation_util.mm b/base/mac/foundation_util.mm
index 6feeaf4..8ab02ab 100644
--- a/base/mac/foundation_util.mm
+++ b/base/mac/foundation_util.mm
@@ -10,6 +10,7 @@
#include "base/file_path.h"
#include "base/logging.h"
#include "base/mac/bundle_locations.h"
+#include "base/mac/mac_logging.h"
#include "base/sys_string_conversions.h"
namespace base {
@@ -28,7 +29,7 @@ static bool UncachedAmIBundled() {
FSRef fsref;
OSStatus pbErr;
if ((pbErr = GetProcessBundleLocation(&psn, &fsref)) != noErr) {
- DLOG(ERROR) << "GetProcessBundleLocation failed: error " << pbErr;
+ OSSTATUS_DLOG(ERROR, pbErr) << "GetProcessBundleLocation failed";
return false;
}
@@ -36,7 +37,7 @@ static bool UncachedAmIBundled() {
OSErr fsErr;
if ((fsErr = FSGetCatalogInfo(&fsref, kFSCatInfoNodeFlags, &info,
NULL, NULL, NULL)) != noErr) {
- DLOG(ERROR) << "FSGetCatalogInfo failed: error " << fsErr;
+ OSSTATUS_DLOG(ERROR, fsErr) << "FSGetCatalogInfo failed";
return false;
}
diff --git a/base/mac/mac_logging.cc b/base/mac/mac_logging.cc
new file mode 100644
index 0000000..353f092
--- /dev/null
+++ b/base/mac/mac_logging.cc
@@ -0,0 +1,29 @@
+// 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 "base/mac/mac_logging.h"
+
+#include <CoreServices/CoreServices.h>
+
+#include <iomanip>
+
+namespace logging {
+
+OSStatusLogMessage::OSStatusLogMessage(const char* file_path,
+ int line,
+ LogSeverity severity,
+ OSStatus status)
+ : LogMessage(file_path, line, severity),
+ status_(status) {
+}
+
+OSStatusLogMessage::~OSStatusLogMessage() {
+ stream() << ": "
+ << GetMacOSStatusErrorString(status_)
+ << " ("
+ << status_
+ << ")";
+}
+
+} // namespace logging
diff --git a/base/mac/mac_logging.h b/base/mac/mac_logging.h
new file mode 100644
index 0000000..e2d0c52
--- /dev/null
+++ b/base/mac/mac_logging.h
@@ -0,0 +1,83 @@
+// 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.
+
+#ifndef BASE_MAC_MAC_LOGGING_H_
+#define BASE_MAC_MAC_LOGGING_H_
+#pragma once
+
+#include <libkern/OSTypes.h>
+
+#include "base/logging.h"
+
+// Use the OSSTATUS_LOG family to log messages related to errors in Mac OS X
+// system routines that report status via an OSStatus or OSErr value. It is
+// similar to the PLOG family which operates on errno, but because there is no
+// global (or thread-local) OSStatus or OSErr value, the specific error must
+// be supplied as an argument to the OSSTATUS_LOG macro. The message logged
+// will contain the symbolic constant name corresponding to the status value,
+// along with the value itself.
+//
+// OSErr is just an older 16-bit form of the newer 32-bit OSStatus. Despite
+// the name, OSSTATUS_LOG can be used equally well for OSStatus and OSErr.
+
+namespace logging {
+
+class OSStatusLogMessage : public logging::LogMessage {
+ public:
+ OSStatusLogMessage(const char* file_path,
+ int line,
+ LogSeverity severity,
+ OSStatus status);
+ ~OSStatusLogMessage();
+
+ private:
+ OSStatus status_;
+
+ DISALLOW_COPY_AND_ASSIGN(OSStatusLogMessage);
+};
+
+} // namespace logging
+
+#define OSSTATUS_LOG_STREAM(severity, status) \
+ COMPACT_GOOGLE_LOG_EX_ ## severity(OSStatusLogMessage, status).stream()
+#define OSSTATUS_VLOG_STREAM(verbose_level, status) \
+ logging::OSStatusLogMessage(__FILE__, __LINE__, \
+ -verbose_level, status).stream()
+
+#define OSSTATUS_LOG(severity, status) \
+ LAZY_STREAM(OSSTATUS_LOG_STREAM(severity, status), LOG_IS_ON(severity))
+#define OSSTATUS_LOG_IF(severity, condition, status) \
+ LAZY_STREAM(OSSTATUS_LOG_STREAM(severity, status), \
+ LOG_IS_ON(severity) && (condition))
+
+#define OSSTATUS_VLOG(verbose_level, status) \
+ LAZY_STREAM(OSSTATUS_VLOG_STREAM(verbose_level, status), \
+ VLOG_IS_ON(verbose_level))
+#define OSSTATUS_VLOG_IF(verbose_level, condition, status) \
+ LAZY_STREAM(OSSTATUS_VLOG_STREAM(verbose_level, status), \
+ VLOG_IS_ON(verbose_level) && (condition))
+
+#define OSSTATUS_CHECK(condition, status) \
+ LAZY_STREAM(OSSTATUS_LOG_STREAM(FATAL, status), !(condition)) \
+ << "Check failed: " # condition << ". "
+
+#define OSSTATUS_DLOG(severity, status) \
+ LAZY_STREAM(OSSTATUS_LOG_STREAM(severity, status), DLOG_IS_ON(severity))
+#define OSSTATUS_DLOG_IF(severity, condition, status) \
+ LAZY_STREAM(OSSTATUS_LOG_STREAM(severity, status), \
+ DLOG_IS_ON(severity) && (condition))
+
+#define OSSTATUS_DVLOG(verbose_level, status) \
+ LAZY_STREAM(OSSTATUS_VPLOG_STREAM(verbose_level, status), \
+ DVLOG_IS_ON(verbose_level))
+#define OSSTATUS_DVLOG_IF(verbose_level, condition, status) \
+ LAZY_STREAM(OSSTATUS_VPLOG_STREAM(verbose_level, status) \
+ DVLOG_IS_ON(verbose_level) && (condition))
+
+#define OSSTATUS_DCHECK(condition, status) \
+ LAZY_STREAM(OSSTATUS_LOG_STREAM(FATAL, status), \
+ DCHECK_IS_ON() && !(condition)) \
+ << "Check failed: " # condition << ". "
+
+#endif // BASE_MAC_MAC_LOGGING_H_
diff --git a/base/mac/mac_util.mm b/base/mac/mac_util.mm
index 7c020e1..e73216e 100644
--- a/base/mac/mac_util.mm
+++ b/base/mac/mac_util.mm
@@ -12,6 +12,7 @@
#include "base/logging.h"
#include "base/mac/bundle_locations.h"
#include "base/mac/foundation_util.h"
+#include "base/mac/mac_logging.h"
#include "base/mac/scoped_cftyperef.h"
#include "base/memory/scoped_nsobject.h"
#include "base/string_number_conversions.h"
@@ -218,7 +219,7 @@ void ActivateProcess(pid_t pid) {
if (status == noErr) {
SetFrontProcess(&process);
} else {
- DLOG(WARNING) << "Unable to get process for pid " << pid;
+ OSSTATUS_DLOG(WARNING, status) << "Unable to get process for pid " << pid;
}
}
@@ -226,7 +227,7 @@ bool AmIForeground() {
ProcessSerialNumber foreground_psn = { 0 };
OSErr err = GetFrontProcess(&foreground_psn);
if (err != noErr) {
- DLOG(WARNING) << "GetFrontProcess: " << err;
+ OSSTATUS_DLOG(WARNING, err) << "GetFrontProcess";
return false;
}
@@ -235,7 +236,7 @@ bool AmIForeground() {
Boolean result = FALSE;
err = SameProcess(&foreground_psn, &my_psn, &result);
if (err != noErr) {
- DLOG(WARNING) << "SameProcess: " << err;
+ OSSTATUS_DLOG(WARNING, err) << "SameProcess";
return false;
}
@@ -256,11 +257,9 @@ bool SetFileBackupExclusion(const FilePath& file_path) {
OSStatus os_err =
CSBackupSetItemExcluded(base::mac::NSToCFCast(file_url), TRUE, FALSE);
if (os_err != noErr) {
- DLOG(WARNING) << "Failed to set backup exclusion for file '"
- << file_path.value().c_str() << "' with error "
- << os_err << " (" << GetMacOSStatusErrorString(os_err)
- << ": " << GetMacOSStatusCommentString(os_err)
- << "). Continuing.";
+ OSSTATUS_DLOG(WARNING, os_err)
+ << "Failed to set backup exclusion for file '"
+ << file_path.value().c_str() << "'";
}
return os_err == noErr;
}
@@ -351,7 +350,8 @@ void SetProcessName(CFStringRef process_name) {
ls_display_name_key,
process_name,
NULL /* optional out param */);
- DLOG_IF(ERROR, err) << "Call to set process name failed, err " << err;
+ OSSTATUS_DLOG_IF(ERROR, err != noErr, err)
+ << "Call to set process name failed";
}
// Converts a NSImage to a CGImageRef. Normally, the system frameworks can do
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 <signal.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/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>(
+ CFStringRef process_bundle_id_cf = base::mac::CFCast<CFStringRef>(
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;
}
diff --git a/chrome/browser/password_manager/encryptor_password_mac.mm b/chrome/browser/password_manager/encryptor_password_mac.mm
index ffdf24c..c888f3a 100644
--- a/chrome/browser/password_manager/encryptor_password_mac.mm
+++ b/chrome/browser/password_manager/encryptor_password_mac.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.
@@ -6,6 +6,7 @@
#import <Security/Security.h>
+#include "base/mac/mac_logging.h"
#include "chrome/browser/keychain_mac.h"
#include "chrome/common/random.h"
#include "ui/base/l10n/l10n_util.h"
@@ -32,7 +33,7 @@ std::string AddRandomPasswordToKeychain(const MacKeychain& keychain,
NULL);
if (error != noErr) {
- DLOG(ERROR) << "Keychain add failed with error " << error;
+ OSSTATUS_DLOG(ERROR, error) << "Keychain add failed";
return std::string();
}
@@ -67,9 +68,7 @@ std::string EncryptorPassword::GetEncryptorPassword() const {
} else if (error == errSecItemNotFound) {
return AddRandomPasswordToKeychain(keychain_, service_name, account_name);
} else {
- DLOG(ERROR) << "Keychain lookup failed with error " << error;
+ OSSTATUS_DLOG(ERROR, error) << "Keychain lookup failed";
return std::string();
}
}
-
-
diff --git a/chrome/browser/password_manager/password_store_mac.cc b/chrome/browser/password_manager/password_store_mac.cc
index f1980ef..8214aad 100644
--- a/chrome/browser/password_manager/password_store_mac.cc
+++ b/chrome/browser/password_manager/password_store_mac.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.
@@ -12,6 +12,7 @@
#include "base/callback.h"
#include "base/logging.h"
+#include "base/mac/mac_logging.h"
#include "base/mac/mac_util.h"
#include "base/message_loop.h"
#include "base/stl_util.h"
@@ -150,7 +151,7 @@ void KeychainSearch::FindMatchingItems(std::vector<SecKeychainItemRef>* items) {
NULL, kSecInternetPasswordItemClass, &search_attributes_, &search_ref_);
if (result != noErr) {
- LOG(ERROR) << "Keychain lookup failed with error " << result;
+ OSSTATUS_LOG(ERROR, result) << "Keychain lookup failed";
return;
}
@@ -260,7 +261,7 @@ bool FillPasswordFormFromKeychainItem(const MacKeychain& keychain,
// We don't log errSecAuthFailed because that just means that the user
// chose not to allow us access to the item.
if (result != errSecAuthFailed) {
- LOG(ERROR) << "Keychain data load failed: " << result;
+ OSSTATUS_LOG(ERROR, result) << "Keychain data load failed";
}
return false;
}
diff --git a/chrome/browser/platform_util_mac.mm b/chrome/browser/platform_util_mac.mm
index 4da8a36..0debf7b 100644
--- a/chrome/browser/platform_util_mac.mm
+++ b/chrome/browser/platform_util_mac.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 "base/file_path.h"
#include "base/logging.h"
+#include "base/mac/mac_logging.h"
#include "base/mac/scoped_aedesc.h"
#include "base/sys_string_conversions.h"
#include "googleurl/src/gurl.h"
@@ -40,17 +41,15 @@ void OpenItem(const FilePath& full_path) {
if (!path_string)
return;
- OSErr status;
-
// Create the target of this AppleEvent, the Finder.
base::mac::ScopedAEDesc<AEAddressDesc> address;
const OSType finderCreatorCode = 'MACS';
- status = AECreateDesc(typeApplSignature, // type
- &finderCreatorCode, // data
- sizeof(finderCreatorCode), // dataSize
- address.OutPointer()); // result
+ OSErr status = AECreateDesc(typeApplSignature, // type
+ &finderCreatorCode, // data
+ sizeof(finderCreatorCode), // dataSize
+ address.OutPointer()); // result
if (status != noErr) {
- LOG(WARNING) << "Could not create OpenItem() AE target";
+ OSSTATUS_LOG(WARNING, status) << "Could not create OpenItem() AE target";
return;
}
@@ -63,7 +62,7 @@ void OpenItem(const FilePath& full_path) {
kAnyTransactionID, // transactionID
theEvent.OutPointer()); // result
if (status != noErr) {
- LOG(WARNING) << "Could not create OpenItem() AE event";
+ OSSTATUS_LOG(WARNING, status) << "Could not create OpenItem() AE event";
return;
}
@@ -74,7 +73,7 @@ void OpenItem(const FilePath& full_path) {
false, // isRecord
fileList.OutPointer()); // resultList
if (status != noErr) {
- LOG(WARNING) << "Could not create OpenItem() AE file list";
+ OSSTATUS_LOG(WARNING, status) << "Could not create OpenItem() AE file list";
return;
}
@@ -89,7 +88,8 @@ void OpenItem(const FilePath& full_path) {
&pathRef, // dataPtr
sizeof(pathRef)); // dataSize
if (status != noErr) {
- LOG(WARNING) << "Could not add file path to AE list in OpenItem()";
+ OSSTATUS_LOG(WARNING, status)
+ << "Could not add file path to AE list in OpenItem()";
return;
}
} else {
@@ -102,7 +102,8 @@ void OpenItem(const FilePath& full_path) {
keyDirectObject, // theAEKeyword
fileList); // theAEDesc
if (status != noErr) {
- LOG(WARNING) << "Could not put the AE file list the path in OpenItem()";
+ OSSTATUS_LOG(WARNING, status)
+ << "Could not put the AE file list the path in OpenItem()";
return;
}
@@ -116,7 +117,8 @@ void OpenItem(const FilePath& full_path) {
NULL, // idleProc
NULL); // filterProc
if (status != noErr) {
- LOG(WARNING) << "Could not send AE to Finder in OpenItem()";
+ OSSTATUS_LOG(WARNING, status)
+ << "Could not send AE to Finder in OpenItem()";
}
}
diff --git a/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.mm b/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.mm
index 14da503..2f2e98b 100644
--- a/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.mm
+++ b/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.mm
@@ -1,10 +1,11 @@
-// 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.
#import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.h"
#include "base/logging.h"
+#include "base/mac/mac_logging.h"
#import "chrome/browser/ui/cocoa/image_utils.h"
#import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.h"
#import "chrome/browser/ui/cocoa/location_bar/location_bar_decoration.h"
@@ -533,7 +534,7 @@ static NSString* UnusedLegalNameForNewDropFile(NSURL* saveLocation,
error:nil];
// Add resource data.
OSErr resStatus = WriteURLToNewWebLocFileResourceFork(outputURL, urlStr);
- DCHECK(resStatus == noErr);
+ OSSTATUS_DCHECK(resStatus == noErr, resStatus);
return [NSArray arrayWithObject:nameWithExtensionStr];
}
diff --git a/chrome/browser/ui/webui/options/advanced_options_utils_mac.mm b/chrome/browser/ui/webui/options/advanced_options_utils_mac.mm
index 7ff5434..8c3aa4c 100644
--- a/chrome/browser/ui/webui/options/advanced_options_utils_mac.mm
+++ b/chrome/browser/ui/webui/options/advanced_options_utils_mac.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.
@@ -7,6 +7,7 @@
#include "chrome/browser/ui/webui/options/advanced_options_utils.h"
#include "base/logging.h"
+#include "base/mac/mac_logging.h"
#include "base/mac/scoped_aedesc.h"
using content::WebContents;
@@ -22,7 +23,8 @@ void AdvancedOptionsUtilities::ShowNetworkProxySettings(
proxyPrefCommand,
strlen(proxyPrefCommand),
openParams.OutPointer());
- LOG_IF(ERROR, status != noErr) << "Failed to create open params: " << status;
+ OSSTATUS_LOG_IF(ERROR, status != noErr, status)
+ << "Failed to create open params";
LSLaunchURLSpec launchSpec = { 0 };
launchSpec.itemURLs = (CFArrayRef)itemsToOpen;
@@ -40,4 +42,3 @@ void AdvancedOptionsUtilities::ShowManageSSLCertificates(
additionalEventParamDescriptor:nil
launchIdentifier:nil];
}
-
diff --git a/chrome/browser/ui/webui/options2/advanced_options_utils2_mac.mm b/chrome/browser/ui/webui/options2/advanced_options_utils2_mac.mm
index b6bd6d91..3e279b0 100644
--- a/chrome/browser/ui/webui/options2/advanced_options_utils2_mac.mm
+++ b/chrome/browser/ui/webui/options2/advanced_options_utils2_mac.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.
@@ -7,6 +7,7 @@
#include "chrome/browser/ui/webui/options2/advanced_options_utils2.h"
#include "base/logging.h"
+#include "base/mac/mac_logging.h"
#include "base/mac/scoped_aedesc.h"
using content::WebContents;
@@ -24,7 +25,8 @@ void AdvancedOptionsUtilities::ShowNetworkProxySettings(
proxyPrefCommand,
strlen(proxyPrefCommand),
openParams.OutPointer());
- LOG_IF(ERROR, status != noErr) << "Failed to create open params: " << status;
+ OSSTATUS_LOG_IF(ERROR, status != noErr, status)
+ << "Failed to create open params";
LSLaunchURLSpec launchSpec = { 0 };
launchSpec.itemURLs = (CFArrayRef)itemsToOpen;
diff --git a/chrome/common/service_process_util_unittest.cc b/chrome/common/service_process_util_unittest.cc
index c0516b9..bd475e60 100644
--- a/chrome/common/service_process_util_unittest.cc
+++ b/chrome/common/service_process_util_unittest.cc
@@ -330,7 +330,7 @@ void TrashFunc(const FilePath& src) {
OSStatus status = FSMoveObjectToTrashSync(&path_ref,
&new_path_ref,
kFSFileOperationDefaultOptions);
- EXPECT_EQ(status, noErr) << "FSMoveObjectToTrashSync " << status;
+ EXPECT_EQ(status, noErr) << "FSMoveObjectToTrashSync " << status;
}
TEST_F(ServiceProcessStateFileManipulationTest, VerifyLaunchD) {
diff --git a/chrome/service/chrome_service_application_mac.mm b/chrome/service/chrome_service_application_mac.mm
index 75f6b05..0b9bc7c 100644
--- a/chrome/service/chrome_service_application_mac.mm
+++ b/chrome/service/chrome_service_application_mac.mm
@@ -1,11 +1,11 @@
-// 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.
#import "chrome/service/chrome_service_application_mac.h"
-#include "base/logging.h"
#include "base/mac/foundation_util.h"
+#include "base/mac/mac_logging.h"
#import "chrome/common/cloud_print/cloud_print_class_mac.h"
#include "chrome/common/chrome_switches.h"
@@ -36,20 +36,17 @@
CFArrayRef passArgv =
CFArrayCreate(NULL, (const void**) flags, 1, &kCFTypeArrayCallBacks);
FSRef ref;
- OSStatus status = noErr;
CFURLRef* kDontWantURL = NULL;
// Get Chrome's bundle ID.
std::string bundleID = base::mac::BaseBundleID();
CFStringRef bundleIDCF =
CFStringCreateWithCString(NULL, bundleID.c_str(), kCFStringEncodingUTF8);
// Use Launch Services to locate Chrome using its bundleID.
- status = LSFindApplicationForInfo(kLSUnknownCreator, bundleIDCF,
- NULL, &ref, kDontWantURL);
+ OSStatus status = LSFindApplicationForInfo(kLSUnknownCreator, bundleIDCF,
+ NULL, &ref, kDontWantURL);
if (status != noErr) {
- LOG(ERROR) << "Failed to make path ref";
- LOG(ERROR) << GetMacOSStatusErrorString(status);
- LOG(ERROR) << GetMacOSStatusCommentString(status);
+ OSSTATUS_LOG(ERROR, status) << "Failed to make path ref";
return;
}
// Actually create the Apple Event.
@@ -78,9 +75,7 @@
// Send the Apple Event Using launch services, launching Chrome if necessary.
status = LSOpenApplication(&params, NULL);
if (status != noErr) {
- LOG(ERROR) << "Unable to launch";
- LOG(ERROR) << GetMacOSStatusErrorString(status);
- LOG(ERROR) << GetMacOSStatusCommentString(status);
+ OSSTATUS_LOG(ERROR, status) << "Unable to launch";
}
}
@@ -98,4 +93,3 @@ void RegisterServiceApp() {
}
} // namespace chrome_service_application_mac
-
diff --git a/cloud_print/virtual_driver/posix/installer_util_mac.mm b/cloud_print/virtual_driver/posix/installer_util_mac.mm
index c6179c1..5b19866 100644
--- a/cloud_print/virtual_driver/posix/installer_util_mac.mm
+++ b/cloud_print/virtual_driver/posix/installer_util_mac.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.
@@ -32,9 +32,11 @@ void sendServiceProcessEvent(const AEEventClass sendClass) {
&ref, kDontWantURL);
if (status != noErr) {
- std::cerr << "Failed to make path ref";
- std::cerr << GetMacOSStatusErrorString(status);
- std::cerr << GetMacOSStatusCommentString(status);
+ std::cerr << "Failed to make path ref: "
+ << GetMacOSStatusErrorString(status)
+ << " ("
+ << status
+ << ")";
exit(-1);
}
@@ -55,9 +57,11 @@ void sendServiceProcessEvent(const AEEventClass sendClass) {
status = LSOpenApplication(&params, NULL);
if (status != noErr) {
- std::cerr << "Unable to launch Chrome to install";
- std::cerr << GetMacOSStatusErrorString(status);
- std::cerr << GetMacOSStatusCommentString(status);
+ std::cerr << "Unable to launch Chrome to install: "
+ << GetMacOSStatusErrorString(status)
+ << " ("
+ << status
+ << ")";
exit(-1);
}
}
diff --git a/cloud_print/virtual_driver/posix/printer_driver_util_mac.mm b/cloud_print/virtual_driver/posix/printer_driver_util_mac.mm
index 129b136..ddda3da 100644
--- a/cloud_print/virtual_driver/posix/printer_driver_util_mac.mm
+++ b/cloud_print/virtual_driver/posix/printer_driver_util_mac.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.
@@ -12,6 +12,7 @@
#include "base/logging.h"
#include "base/mac/foundation_util.h"
+#include "base/mac/mac_logging.h"
#include <cups/backend.h>
@@ -60,7 +61,8 @@ void LaunchPrintDialog(const std::string& outputPath,
NULL, &ref, kDontWantURL);
if (status != noErr) {
- LOG(ERROR) << "Couldn't locate the process to send Apple Event";
+ OSSTATUS_LOG(ERROR, status)
+ << "Couldn't locate the process to send Apple Event";
exit(CUPS_BACKEND_CANCEL);
}
@@ -115,9 +117,7 @@ void LaunchPrintDialog(const std::string& outputPath,
// Deliver the Apple Event using launch services.
status = LSOpenApplication(&params, NULL);
if (status != noErr) {
- LOG(ERROR) << "Unable to launch";
- LOG(ERROR) << GetMacOSStatusErrorString(status);
- LOG(ERROR) << GetMacOSStatusCommentString(status);
+ OSSTATUS_LOG(ERROR, status) << "Unable to launch";
exit(CUPS_BACKEND_CANCEL);
}
diff --git a/content/browser/file_metadata_mac.mm b/content/browser/file_metadata_mac.mm
index 953b063..d7d5ba8 100644
--- a/content/browser/file_metadata_mac.mm
+++ b/content/browser/file_metadata_mac.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.
@@ -9,6 +9,7 @@
#include "base/file_path.h"
#include "base/logging.h"
+#include "base/mac/mac_logging.h"
#include "base/mac/mac_util.h"
#include "base/mac/scoped_cftyperef.h"
#include "googleurl/src/gurl.h"
@@ -159,8 +160,8 @@ void AddQuarantineMetadataToFile(const FilePath& file, const GURL& source,
kLSItemQuarantineProperties,
quarantine_properties);
if (os_error != noErr) {
- LOG(WARNING) << "Unable to set quarantine attributes on file "
- << file.value();
+ OSSTATUS_LOG(WARNING, os_error)
+ << "Unable to set quarantine attributes on file " << file.value();
}
}
diff --git a/media/audio/mac/audio_input_mac.cc b/media/audio/mac/audio_input_mac.cc
index eb6f167..67e5ed5 100644
--- a/media/audio/mac/audio_input_mac.cc
+++ b/media/audio/mac/audio_input_mac.cc
@@ -1,9 +1,11 @@
-// 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 "media/audio/mac/audio_input_mac.h"
+#include <CoreServices/CoreServices.h>
+
#include "base/basictypes.h"
#include "base/logging.h"
#include "media/audio/audio_util.h"
@@ -114,7 +116,8 @@ void PCMQueueInAudioInputStream::Close() {
void PCMQueueInAudioInputStream::HandleError(OSStatus err) {
if (callback_)
callback_->OnError(this, static_cast<int>(err));
- NOTREACHED() << "error code " << err;
+ NOTREACHED() << "error " << GetMacOSStatusErrorString(err)
+ << " (" << err << ")";
}
bool PCMQueueInAudioInputStream::SetupBuffers() {
diff --git a/media/audio/mac/audio_low_latency_input_mac.cc b/media/audio/mac/audio_low_latency_input_mac.cc
index bd534e1..ec97fe9 100644
--- a/media/audio/mac/audio_low_latency_input_mac.cc
+++ b/media/audio/mac/audio_low_latency_input_mac.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.
@@ -8,6 +8,7 @@
#include "base/basictypes.h"
#include "base/logging.h"
+#include "base/mac/mac_logging.h"
#include "media/audio/audio_util.h"
#include "media/audio/mac/audio_manager_mac.h"
@@ -223,18 +224,19 @@ void AUAudioInputStream::Start(AudioInputCallback* callback) {
if (result == noErr) {
started_ = true;
}
- DLOG_IF(ERROR, result != noErr) << "Failed to start acquiring data";
+ OSSTATUS_DLOG_IF(ERROR, result != noErr, result)
+ << "Failed to start acquiring data";
}
void AUAudioInputStream::Stop() {
if (!started_)
return;
- OSStatus result;
- result = AudioOutputUnitStop(audio_unit_);
+ OSStatus result = AudioOutputUnitStop(audio_unit_);
if (result == noErr) {
started_ = false;
}
- DLOG_IF(ERROR, result != noErr) << "Failed to stop acquiring data";
+ OSSTATUS_DLOG_IF(ERROR, result != noErr, result)
+ << "Failed to stop acquiring data";
}
void AUAudioInputStream::Close() {
@@ -327,7 +329,7 @@ double AUAudioInputStream::HardwareSampleRate() {
0,
&info_size,
&device_id);
- DCHECK_EQ(result, 0);
+ OSSTATUS_DCHECK(result == noErr, result);
if (result)
return 0.0;
@@ -367,7 +369,8 @@ double AUAudioInputStream::GetHardwareLatency() {
0,
&audio_unit_latency_sec,
&size);
- DLOG_IF(WARNING, result != noErr) << "Could not get audio unit latency.";
+ OSSTATUS_DLOG_IF(WARNING, result != noErr, result)
+ << "Could not get audio unit latency";
// Get input audio device latency.
AudioObjectPropertyAddress property_address = {
@@ -436,7 +439,8 @@ double AUAudioInputStream::GetCaptureLatency(
}
void AUAudioInputStream::HandleError(OSStatus err) {
- NOTREACHED() << "error code: " << err;
+ NOTREACHED() << "error " << GetMacOSStatusErrorString(err)
+ << " (" << err << ")";
if (sink_)
sink_->OnError(this, static_cast<int>(err));
}
diff --git a/media/audio/mac/audio_low_latency_output_mac.cc b/media/audio/mac/audio_low_latency_output_mac.cc
index a304c64..f600e5f 100644
--- a/media/audio/mac/audio_low_latency_output_mac.cc
+++ b/media/audio/mac/audio_low_latency_output_mac.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.
@@ -8,6 +8,7 @@
#include "base/basictypes.h"
#include "base/logging.h"
+#include "base/mac/mac_logging.h"
#include "media/audio/audio_util.h"
#include "media/audio/mac/audio_manager_mac.h"
@@ -87,7 +88,7 @@ bool AUAudioOutputStream::Open() {
0,
&size,
&output_device_id_);
- DCHECK_EQ(result, 0);
+ OSSTATUS_DCHECK(result == noErr, result);
if (result)
return false;
@@ -104,13 +105,12 @@ bool AUAudioOutputStream::Open() {
DCHECK(comp);
result = OpenAComponent(comp, &output_unit_);
- DCHECK_EQ(result, 0);
+ OSSTATUS_DCHECK(result == noErr, result);
if (result)
return false;
result = AudioUnitInitialize(output_unit_);
-
- DCHECK_EQ(result, 0);
+ OSSTATUS_DCHECK(result == noErr, result);
if (result)
return false;
@@ -131,8 +131,7 @@ bool AUAudioOutputStream::Configure() {
0,
&input,
sizeof(input));
-
- DCHECK_EQ(result, 0);
+ OSSTATUS_DCHECK(result == noErr, result);
if (result)
return false;
@@ -144,7 +143,7 @@ bool AUAudioOutputStream::Configure() {
0,
&format_,
sizeof(format_));
- DCHECK_EQ(result, 0);
+ OSSTATUS_DCHECK(result == noErr, result);
if (result)
return false;
@@ -157,7 +156,7 @@ bool AUAudioOutputStream::Configure() {
0,
&buffer_size,
sizeof(buffer_size));
- DCHECK_EQ(result, 0);
+ OSSTATUS_DCHECK(result == noErr, result);
if (result)
return false;
@@ -269,7 +268,7 @@ double AUAudioOutputStream::HardwareSampleRate() {
0,
&info_size,
&device_id);
- DCHECK_EQ(result, 0);
+ OSSTATUS_DCHECK(result == noErr, result);
if (result)
return 0.0; // error
@@ -287,7 +286,7 @@ double AUAudioOutputStream::HardwareSampleRate() {
0,
&info_size,
&nominal_sample_rate);
- DCHECK_EQ(result, 0);
+ OSSTATUS_DCHECK(result == noErr, result);
if (result)
return 0.0; // error
@@ -309,7 +308,8 @@ double AUAudioOutputStream::GetHardwareLatency() {
0,
&audio_unit_latency_sec,
&size);
- DLOG_IF(WARNING, result != noErr) << "Could not get audio unit latency.";
+ OSSTATUS_DLOG_IF(WARNING, result != noErr, result)
+ << "Could not get audio unit latency";
// Get output audio device latency.
AudioObjectPropertyAddress property_address = {
@@ -325,7 +325,8 @@ double AUAudioOutputStream::GetHardwareLatency() {
NULL,
&size,
&device_latency_frames);
- DLOG_IF(WARNING, result != noErr) << "Could not get audio device latency.";
+ OSSTATUS_DLOG_IF(WARNING, result != noErr, result)
+ << "Could not get audio device latency";
// Get the stream latency.
property_address.mSelector = kAudioDevicePropertyStreams;
@@ -355,7 +356,8 @@ double AUAudioOutputStream::GetHardwareLatency() {
&stream_latency_frames);
}
}
- DLOG_IF(WARNING, result != noErr) << "Could not get audio stream latency.";
+ OSSTATUS_DLOG_IF(WARNING, result != noErr, result)
+ << "Could not get audio stream latency";
return static_cast<double>((audio_unit_latency_sec *
format_.mSampleRate) + device_latency_frames + stream_latency_frames);
diff --git a/media/audio/mac/audio_manager_mac.cc b/media/audio/mac/audio_manager_mac.cc
index 420415d..3751460 100644
--- a/media/audio/mac/audio_manager_mac.cc
+++ b/media/audio/mac/audio_manager_mac.cc
@@ -1,9 +1,10 @@
-// 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 <CoreAudio/AudioHardware.h>
+#include "base/mac/mac_logging.h"
#include "base/mac/mac_util.h"
#include "base/mac/scoped_cftyperef.h"
#include "base/sys_string_conversions.h"
@@ -227,8 +228,8 @@ static AudioDeviceID GetAudioDeviceIdByUId(bool is_input,
}
if (result) {
- DLOG(WARNING) << "Unable to query device " << device_id
- << " for AudioDeviceID ";
+ OSSTATUS_DLOG(WARNING, result) << "Unable to query device " << device_id
+ << " for AudioDeviceID";
}
return audio_device_id;
diff --git a/media/audio/mac/audio_output_mac.cc b/media/audio/mac/audio_output_mac.cc
index c230373..f4f4749 100644
--- a/media/audio/mac/audio_output_mac.cc
+++ b/media/audio/mac/audio_output_mac.cc
@@ -1,9 +1,11 @@
-// 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 "media/audio/mac/audio_output_mac.h"
+#include <CoreServices/CoreServices.h>
+
#include "base/basictypes.h"
#include "base/debug/trace_event.h"
#include "base/logging.h"
@@ -94,7 +96,8 @@ void PCMQueueOutAudioOutputStream::HandleError(OSStatus err) {
AudioSourceCallback* source = GetSource();
if (source)
source->OnError(this, static_cast<int>(err));
- NOTREACHED() << "error code " << err;
+ NOTREACHED() << "error " << GetMacOSStatusErrorString(err)
+ << " (" << err << ")";
}
bool PCMQueueOutAudioOutputStream::Open() {
diff --git a/net/base/cert_database_mac.cc b/net/base/cert_database_mac.cc
index 06b036f..e2542fd 100644
--- a/net/base/cert_database_mac.cc
+++ b/net/base/cert_database_mac.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.
@@ -7,6 +7,7 @@
#include <Security/Security.h>
#include "base/logging.h"
+#include "base/mac/mac_logging.h"
#include "base/synchronization/lock.h"
#include "crypto/mac_security_services_lock.h"
#include "net/base/net_errors.h"
@@ -53,7 +54,7 @@ int CertDatabase::AddUserCert(X509Certificate* cert) {
case errSecDuplicateItem:
return OK;
default:
- LOG(ERROR) << "CertDatabase failed to add cert to keychain: " << err;
+ OSSTATUS_LOG(ERROR, err) << "CertDatabase failed to add cert to keychain";
// TODO(snej): Map the error code more intelligently.
return ERR_ADD_USER_CERT_FAILED;
}
diff --git a/net/base/keygen_handler_mac.cc b/net/base/keygen_handler_mac.cc
index 1bb4038..12a904f2 100644
--- a/net/base/keygen_handler_mac.cc
+++ b/net/base/keygen_handler_mac.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.
@@ -10,6 +10,7 @@
#include "base/base64.h"
#include "base/logging.h"
+#include "base/mac/mac_logging.h"
#include "base/mac/scoped_cftyperef.h"
#include "base/string_util.h"
#include "base/synchronization/lock.h"
@@ -192,7 +193,7 @@ std::string KeygenHandler::GenKeyAndSignChallenge() {
failure:
if (err)
- LOG(ERROR) << "SSL Keygen failed! OSStatus = " << err;
+ OSSTATUS_LOG(ERROR, err) << "SSL Keygen failed!";
else
VLOG(1) << "SSL Keygen succeeded! Output is: " << result;
diff --git a/net/base/x509_cert_types_mac.cc b/net/base/x509_cert_types_mac.cc
index 7f192b1..11073ef 100644
--- a/net/base/x509_cert_types_mac.cc
+++ b/net/base/x509_cert_types_mac.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.
@@ -10,6 +10,7 @@
#include "base/logging.h"
#include "base/i18n/icu_string_conversions.h"
+#include "base/mac/mac_logging.h"
#include "base/utf_string_conversions.h"
namespace net {
@@ -202,7 +203,7 @@ bool CertPrincipal::ParseDistinguishedName(const void* ber_name_data,
OSStatus err = SecAsn1Decode(coder, ber_name_data, length, kNameTemplate,
&name);
if (err) {
- LOG(ERROR) << "SecAsn1Decode returned " << err << "; name=" << name;
+ OSSTATUS_LOG(ERROR, err) << "SecAsn1Decode name=" << name;
SecAsn1CoderRelease(coder);
return false;
}
diff --git a/net/base/x509_certificate_mac.cc b/net/base/x509_certificate_mac.cc
index b796288..b2bdbd0 100644
--- a/net/base/x509_certificate_mac.cc
+++ b/net/base/x509_certificate_mac.cc
@@ -13,6 +13,7 @@
#include "base/lazy_instance.h"
#include "base/logging.h"
+#include "base/mac/mac_logging.h"
#include "base/mac/scoped_cftyperef.h"
#include "base/memory/singleton.h"
#include "base/pickle.h"
@@ -53,11 +54,7 @@ int NetErrorFromOSStatus(OSStatus status) {
case errSecAuthFailed:
return ERR_ACCESS_DENIED;
default: {
- base::mac::ScopedCFTypeRef<CFStringRef> error_string(
- SecCopyErrorMessageString(status, NULL));
- LOG(ERROR) << "Unknown error " << status
- << " (" << base::SysCFStringRefToUTF8(error_string) << ")"
- << " mapped to ERR_FAILED";
+ OSSTATUS_LOG(ERROR, status) << "Unknown error mapped to ERR_FAILED";
return ERR_FAILED;
}
}
@@ -121,11 +118,8 @@ CertStatus CertStatusFromOSStatus(OSStatus status) {
// Failure was due to something Chromium doesn't define a
// specific status for (such as basic constraints violation, or
// unknown critical extension)
- base::mac::ScopedCFTypeRef<CFStringRef> error_string(
- SecCopyErrorMessageString(status, NULL));
- LOG(WARNING) << "Unknown error " << status
- << " (" << base::SysCFStringRefToUTF8(error_string) << ")"
- << " mapped to CERT_STATUS_INVALID";
+ OSSTATUS_LOG(WARNING, status)
+ << "Unknown error mapped to CERT_STATUS_INVALID";
return CERT_STATUS_INVALID;
}
}
@@ -536,8 +530,8 @@ void AddCertificatesFromBytes(const char* data, size_t length,
OSStatus status = SecKeychainItemImport(local_data, NULL, &input_format,
NULL, 0, NULL, NULL, &items);
if (status) {
- DLOG(WARNING) << status << " Unable to import items from data of length "
- << length;
+ OSSTATUS_DLOG(WARNING, status)
+ << "Unable to import items from data of length " << length;
return;
}
@@ -786,7 +780,7 @@ X509Certificate* X509Certificate::CreateSelfSigned(
DCHECK(!subject.empty());
if (valid_duration.InSeconds() > kuint32max) {
- LOG(ERROR) << "valid_duration too big" << valid_duration.InSeconds();
+ LOG(ERROR) << "valid_duration too big " << valid_duration.InSeconds();
valid_duration = base::TimeDelta::FromSeconds(kuint32max);
}
@@ -906,7 +900,7 @@ X509Certificate* X509Certificate::CreateSelfSigned(
SecCertificateCreateFromData(&encCert->CertBlob, encCert->CertType,
encCert->CertEncoding, &certificate_ref);
if (os_status != 0) {
- DLOG(ERROR) << "SecCertificateCreateFromData failed: " << os_status;
+ OSSTATUS_DLOG(ERROR, os_status) << "SecCertificateCreateFromData failed";
return NULL;
}
scoped_cert.reset(certificate_ref);
@@ -1331,8 +1325,7 @@ bool X509Certificate::IsIssuedBy(
const std::vector<CertPrincipal>& valid_issuers) {
// Get the cert's issuer chain.
CFArrayRef cert_chain = NULL;
- OSStatus result;
- result = CopyCertChain(os_cert_handle(), &cert_chain);
+ OSStatus result = CopyCertChain(os_cert_handle(), &cert_chain);
if (result)
return false;
ScopedCFTypeRef<CFArrayRef> scoped_cert_chain(cert_chain);
@@ -1502,7 +1495,7 @@ bool X509Certificate::GetSSLClientCertificates(
}
if (err != errSecItemNotFound) {
- LOG(ERROR) << "SecIdentitySearch error " << err;
+ OSSTATUS_LOG(ERROR, err) << "SecIdentitySearch error ";
return false;
}
return true;
@@ -1510,11 +1503,11 @@ bool X509Certificate::GetSSLClientCertificates(
CFArrayRef X509Certificate::CreateClientCertificateChain() const {
// Initialize the result array with just the IdentityRef of the receiver:
- OSStatus result;
SecIdentityRef identity;
- result = SecIdentityCreateWithCertificate(NULL, cert_handle_, &identity);
+ OSStatus result =
+ SecIdentityCreateWithCertificate(NULL, cert_handle_, &identity);
if (result) {
- LOG(ERROR) << "SecIdentityCreateWithCertificate error " << result;
+ OSSTATUS_LOG(ERROR, result) << "SecIdentityCreateWithCertificate error";
return NULL;
}
ScopedCFTypeRef<CFMutableArrayRef> chain(
@@ -1525,7 +1518,7 @@ CFArrayRef X509Certificate::CreateClientCertificateChain() const {
result = CopyCertChain(cert_handle_, &cert_chain);
ScopedCFTypeRef<CFArrayRef> scoped_cert_chain(cert_chain);
if (result) {
- LOG(ERROR) << "CreateIdentityCertificateChain error " << result;
+ OSSTATUS_LOG(ERROR, result) << "CreateIdentityCertificateChain error";
return chain.release();
}
diff --git a/net/socket/ssl_client_socket_mac.cc b/net/socket/ssl_client_socket_mac.cc
index b6e03f7..824b447 100644
--- a/net/socket/ssl_client_socket_mac.cc
+++ b/net/socket/ssl_client_socket_mac.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.
@@ -13,6 +13,7 @@
#include "base/bind.h"
#include "base/lazy_instance.h"
+#include "base/mac/mac_logging.h"
#include "base/mac/scoped_cftyperef.h"
#include "base/string_util.h"
#include "net/base/address_list.h"
@@ -203,7 +204,7 @@ int NetErrorFromOSStatus(OSStatus status) {
case errSSLPeerCertUnknown...errSSLPeerBadCert:
case errSSLPeerUnknownCA:
case errSSLPeerAccessDenied:
- LOG(WARNING) << "Server rejected client cert (OSStatus=" << status << ")";
+ OSSTATUS_LOG(WARNING, status) << "Server rejected client cert";
return ERR_BAD_SSL_CLIENT_AUTH_CERT;
case errSSLNegotiation:
@@ -215,8 +216,8 @@ int NetErrorFromOSStatus(OSStatus status) {
case errSSLModuleAttach:
case errSSLSessionNotFound:
default:
- LOG(WARNING) << "Unknown error " << status <<
- " mapped to net::ERR_FAILED";
+ OSSTATUS_LOG(WARNING, status)
+ << "Unknown error mapped to net::ERR_FAILED";
return ERR_FAILED;
}
}
@@ -240,8 +241,7 @@ OSStatus OSStatusFromNetError(int net_error) {
case OK:
return noErr;
default:
- LOG(WARNING) << "Unknown error " << net_error <<
- " mapped to paramErr";
+ LOG(WARNING) << "Unknown error " << net_error << " mapped to paramErr";
return paramErr;
}
}
@@ -1196,7 +1196,7 @@ int SSLClientSocketMac::SetClientCert() {
VLOG(1) << "SSLSetCertificate(" << CFArrayGetCount(cert_refs) << " certs)";
OSStatus result = SSLSetCertificate(ssl_context_, cert_refs);
if (result)
- LOG(ERROR) << "SSLSetCertificate returned OSStatus " << result;
+ OSSTATUS_LOG(ERROR, result) << "SSLSetCertificate failed";
return result;
}
diff --git a/net/socket/ssl_client_socket_nss.cc b/net/socket/ssl_client_socket_nss.cc
index 50b7514..6c70615 100644
--- a/net/socket/ssl_client_socket_nss.cc
+++ b/net/socket/ssl_client_socket_nss.cc
@@ -108,6 +108,7 @@
#include <Security/SecBase.h>
#include <Security/SecCertificate.h>
#include <Security/SecIdentity.h>
+#include "base/mac/mac_logging.h"
#elif defined(USE_NSS)
#include <dlfcn.h>
#endif
@@ -2506,8 +2507,8 @@ SECStatus SSLClientSocketNSS::PlatformClientAuthHandler(
cert_count)));
return SECSuccess;
}
- LOG(WARNING) << "Client cert found, but could not be used: "
- << os_error;
+ OSSTATUS_LOG(WARNING, os_error)
+ << "Client cert found, but could not be used";
if (*result_certs) {
CERT_DestroyCertList(*result_certs);
*result_certs = NULL;
diff --git a/remoting/host/user_authenticator_mac.cc b/remoting/host/user_authenticator_mac.cc
index 88c0951..85685cf 100644
--- a/remoting/host/user_authenticator_mac.cc
+++ b/remoting/host/user_authenticator_mac.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.
@@ -9,7 +9,7 @@
#include <string>
#include "base/basictypes.h"
-#include "base/logging.h"
+#include "base/mac/mac_logging.h"
namespace remoting {
@@ -70,7 +70,7 @@ bool UserAuthenticatorMac::Authenticate(const std::string& username,
return false;
default:
- LOG(ERROR) << "AuthorizationCreate returned " << status;
+ OSSTATUS_LOG(ERROR, status) << "AuthorizationCreate";
return false;
}
}