Remove rtc_base_approved_objc and introduce rtc_base:logging_mac.

This CL removes the need of having rtc_base:rtc_base_approved_generic
and rtc_base:rtc_base_approved_objc since it removes the _objc build
target by moving the declaration of rtc::DescriptionFromOSStatus into
rtc_base/logging_mac.h in order to have a new target
rtc_base:logging_mac on which rtc_base:logging can depend on.

The target rtc_base:rtc_base_approved_generic will be removed in a
follow up CL.

Bug: webrtc:9838
Change-Id: Id93ac7bced213128e7d654694ff15337c26dab62
Reviewed-on: https://webrtc-review.googlesource.com/c/104802
Reviewed-by: Kári Helgason <kthelgason@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25085}
This commit is contained in:
Mirko Bonadei
2018-10-09 16:45:14 +02:00
committed by Commit Bot
parent edc49c1d6e
commit 99a70a2d78
4 changed files with 42 additions and 25 deletions

View File

@ -85,9 +85,6 @@ rtc_source_set("rtc_base_approved") {
":thread_checker",
":timeutils",
]
if (is_mac && !build_with_chromium) {
public_deps += [ ":rtc_base_approved_objc" ]
}
}
rtc_source_set("macromagic") {
@ -220,6 +217,10 @@ rtc_source_set("logging") {
]
deps += [ "system:inline" ]
if (is_mac) {
deps += [ ":logging_mac" ]
}
# logging.h needs the deprecation header while downstream projects are
# removing code that depends on logging implementation details.
deps += [ ":deprecation" ]
@ -488,20 +489,13 @@ rtc_source_set("rtc_base_approved_generic") {
}
if (is_mac && !build_with_chromium) {
config("rtc_base_approved_objc_all_dependent_config") {
visibility = [ ":rtc_base_approved_objc" ]
libs = [ "Foundation.framework" ] # needed for logging_mac.mm
}
rtc_source_set("rtc_base_approved_objc") {
visibility = [ ":rtc_base_approved" ]
all_dependent_configs = [ ":rtc_base_approved_objc_all_dependent_config" ]
rtc_source_set("logging_mac") {
visibility = [ ":logging" ]
libs = [ "Foundation.framework" ]
sources = [
"logging_mac.h",
"logging_mac.mm",
]
deps = [
":logging",
]
}
}

View File

@ -51,16 +51,16 @@
#include <string>
#include <utility>
#if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS)
#include <CoreServices/CoreServices.h>
#endif
#include "absl/strings/string_view.h"
#include "rtc_base/constructormagic.h"
#include "rtc_base/deprecation.h"
#include "rtc_base/strings/string_builder.h"
#include "rtc_base/system/inline.h"
#if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS)
#include "rtc_base/logging_mac.h"
#endif // WEBRTC_MAC
#if !defined(NDEBUG) || defined(DLOG_ALWAYS_ON)
#define RTC_DLOG_IS_ON 1
#else
@ -69,11 +69,6 @@
namespace rtc {
#if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS)
// Returns a UTF8 description from an OS X Status error.
std::string DescriptionFromOSStatus(OSStatus err);
#endif
//////////////////////////////////////////////////////////////////////
// Note that the non-standard LoggingSeverity aliases exist because they are

28
rtc_base/logging_mac.h Normal file
View File

@ -0,0 +1,28 @@
/*
* Copyright 2018 The WebRTC Project Authors. All rights reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef RTC_BASE_LOGGING_MAC_H_
#define RTC_BASE_LOGGING_MAC_H_
#if !defined(WEBRTC_MAC) || defined(WEBRTC_IOS)
#error "Only include this header in macOS builds"
#endif
#include <CoreServices/CoreServices.h>
#include <string>
namespace rtc {
// Returns a UTF8 description from an OS X Status error.
std::string DescriptionFromOSStatus(OSStatus err);
} // namespace rtc
#endif // RTC_BASE_LOGGING_MAC_H_

View File

@ -8,15 +8,15 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "rtc_base/logging.h"
#include "rtc_base/logging_mac.h"
#import <Foundation/Foundation.h>
namespace rtc {
std::string DescriptionFromOSStatus(OSStatus err) {
NSError* error =
[NSError errorWithDomain:NSOSStatusErrorDomain code:err userInfo:nil];
return error.description.UTF8String;
}
} // namespace rtc