Revert rtc_dcheck_always_on.
This CL reverts:
https://webrtc-review.googlesource.com/c/src/+/226864
https://webrtc-review.googlesource.com/c/src/+/226563
Reason for revert:
See also V8 equivalent: crrev.com/c/3055294.
This has been properly fixed by crrev.com/c/3053740.
Now dcheck_always_on already defaults to false for subprojects
like WebRTC and no other switch is required. The switch didn't fully
work anyways due to https://crbug.com/1231890.
No-Try: True
Bug: chromium:1225701, webrtc:12988
Change-Id: I9888d7ac02ef2ba4fdc372de20f1d2d71f6d0299
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/227021
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Andrey Logvin <landrey@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34603}
diff --git a/BUILD.gn b/BUILD.gn
index 4afbdc7..e28485f 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -122,10 +122,6 @@
defines = [ "WEBRTC_ENABLE_SYMBOL_EXPORT" ]
}
- if (rtc_dcheck_always_on) {
- defines += [ "RTC_DCHECK_ALWAYS_ON" ]
- }
-
if (build_with_mozilla) {
defines += [ "WEBRTC_MOZILLA_BUILD" ]
}
diff --git a/rtc_base/checks.h b/rtc_base/checks.h
index 9dfd6ba..4015338 100644
--- a/rtc_base/checks.h
+++ b/rtc_base/checks.h
@@ -14,7 +14,7 @@
// If you for some reson need to know if DCHECKs are on, test the value of
// RTC_DCHECK_IS_ON. (Test its value, not if it's defined; it'll always be
// defined, to either a true or a false value.)
-#if !defined(NDEBUG) || defined(RTC_DCHECK_ALWAYS_ON)
+#if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)
#define RTC_DCHECK_IS_ON 1
#else
#define RTC_DCHECK_IS_ON 0
diff --git a/rtc_base/thread.cc b/rtc_base/thread.cc
index cadf6ad..692d802 100644
--- a/rtc_base/thread.cc
+++ b/rtc_base/thread.cc
@@ -1044,7 +1044,7 @@
}
void Thread::AllowInvokesToThread(Thread* thread) {
-#if (!defined(NDEBUG) || defined(RTC_DCHECK_ALWAYS_ON))
+#if (!defined(NDEBUG) || RTC_DCHECK_IS_ON)
if (!IsCurrent()) {
PostTask(webrtc::ToQueuedTask(
[thread, this]() { AllowInvokesToThread(thread); }));
@@ -1057,7 +1057,7 @@
}
void Thread::DisallowAllInvokes() {
-#if (!defined(NDEBUG) || defined(RTC_DCHECK_ALWAYS_ON))
+#if (!defined(NDEBUG) || RTC_DCHECK_IS_ON)
if (!IsCurrent()) {
PostTask(webrtc::ToQueuedTask([this]() { DisallowAllInvokes(); }));
return;
@@ -1082,7 +1082,7 @@
// Returns true if no policies added or if there is at least one policy
// that permits invocation to `target` thread.
bool Thread::IsInvokeToThreadAllowed(rtc::Thread* target) {
-#if (!defined(NDEBUG) || defined(RTC_DCHECK_ALWAYS_ON))
+#if (!defined(NDEBUG) || RTC_DCHECK_IS_ON)
RTC_DCHECK_RUN_ON(this);
if (!invoke_policy_enabled_) {
return true;
diff --git a/rtc_base/thread.h b/rtc_base/thread.h
index d950b06..38e9732 100644
--- a/rtc_base/thread.h
+++ b/rtc_base/thread.h
@@ -28,6 +28,7 @@
#include "api/function_view.h"
#include "api/task_queue/queued_task.h"
#include "api/task_queue/task_queue_base.h"
+#include "rtc_base/checks.h"
#include "rtc_base/constructor_magic.h"
#include "rtc_base/deprecated/recursive_critical_section.h"
#include "rtc_base/location.h"
@@ -400,16 +401,16 @@
// Allows invoke to specified `thread`. Thread never will be dereferenced and
// will be used only for reference-based comparison, so instance can be safely
- // deleted. If NDEBUG is defined and RTC_DCHECK_ALWAYS_ON is undefined do
+ // deleted. If NDEBUG is defined and RTC_DCHECK_IS_ON is undefined do
// nothing.
void AllowInvokesToThread(Thread* thread);
- // If NDEBUG is defined and RTC_DCHECK_ALWAYS_ON is undefined do nothing.
+ // If NDEBUG is defined and RTC_DCHECK_IS_ON is undefined do nothing.
void DisallowAllInvokes();
// Returns true if `target` was allowed by AllowInvokesToThread() or if no
// calls were made to AllowInvokesToThread and DisallowAllInvokes. Otherwise
// returns false.
- // If NDEBUG is defined and RTC_DCHECK_ALWAYS_ON is undefined always returns
+ // If NDEBUG is defined and RTC_DCHECK_IS_ON is undefined always returns
// true.
bool IsInvokeToThreadAllowed(rtc::Thread* target);
diff --git a/rtc_base/thread_unittest.cc b/rtc_base/thread_unittest.cc
index ce79cf7..6c1253a 100644
--- a/rtc_base/thread_unittest.cc
+++ b/rtc_base/thread_unittest.cc
@@ -17,6 +17,7 @@
#include "rtc_base/async_invoker.h"
#include "rtc_base/async_udp_socket.h"
#include "rtc_base/atomic_ops.h"
+#include "rtc_base/checks.h"
#include "rtc_base/event.h"
#include "rtc_base/gunit.h"
#include "rtc_base/internal/default_socket_server.h"
@@ -366,7 +367,7 @@
ThreadManager::Instance()->SetCurrentThread(current_thread);
}
-#if (!defined(NDEBUG) || defined(RTC_DCHECK_ALWAYS_ON))
+#if (!defined(NDEBUG) || RTC_DCHECK_IS_ON)
TEST(ThreadTest, InvokeToThreadAllowedReturnsTrueWithoutPolicies) {
// Create and start the thread.
auto thread1 = Thread::CreateWithSocketServer();
@@ -410,7 +411,7 @@
Thread* th_main = Thread::Current();
th_main->ProcessMessages(100);
}
-#endif // (!defined(NDEBUG) || defined(RTC_DCHECK_ALWAYS_ON))
+#endif // (!defined(NDEBUG) || RTC_DCHECK_IS_ON)
TEST(ThreadTest, InvokesAllowedByDefault) {
// Create and start the thread.
diff --git a/tools_webrtc/coverage/generate_ios_coverage_command.py b/tools_webrtc/coverage/generate_ios_coverage_command.py
index ff17c58..4feaacd 100644
--- a/tools_webrtc/coverage/generate_ios_coverage_command.py
+++ b/tools_webrtc/coverage/generate_ios_coverage_command.py
@@ -89,7 +89,7 @@
target_cpu = 'x64' if is_simulator else 'arm64'
return ([] + ['target_os="ios"'] + ['target_cpu="%s"' % target_cpu] +
['use_clang_coverage=true'] + ['is_component_build=false'] +
- ['rtc_dcheck_always_on=true'])
+ ['dcheck_always_on=true'])
def GenerateIOSSimulatorCommand():
diff --git a/tools_webrtc/mb/docs/user_guide.md b/tools_webrtc/mb/docs/user_guide.md
index a8857d2..8c66cd3 100644
--- a/tools_webrtc/mb/docs/user_guide.md
+++ b/tools_webrtc/mb/docs/user_guide.md
@@ -248,8 +248,8 @@
}
'mixins': {
'bot': {
- 'gyp_defines': 'use_goma=1 rtc_dcheck_always_on=0',
- 'gn_args': 'use_goma=true rtc_dcheck_always_on=false',
+ 'gyp_defines': 'use_goma=1 dcheck_always_on=0',
+ 'gn_args': 'use_goma=true dcheck_always_on=false',
},
'debug': {
'gn_args': 'is_debug=true',
@@ -267,8 +267,8 @@
'gyp_defines': 'component=shared_library',
},
'trybot': {
- 'gyp_defines': 'rtc_dcheck_always_on=1',
- 'gn_args': 'rtc_dcheck_always_on=true',
+ 'gyp_defines': 'dcheck_always_on=1',
+ 'gn_args': 'dcheck_always_on=true',
}
}
}
@@ -276,7 +276,7 @@
and you ran `mb gen -c linux_release_trybot //out/Release`, it would
translate into a call to `gyp_chromium -G Release` with `GYP_DEFINES` set to
-`"use_goma=true rtc_dcheck_always_on=false rtc_dcheck_always_on=true"`.
+`"use_goma=true dcheck_always_on=false dcheck_always_on=true"`.
(From that you can see that mb is intentionally dumb and does not
attempt to de-dup the flags, it lets gyp do that).
diff --git a/tools_webrtc/mb/mb_config.pyl b/tools_webrtc/mb/mb_config.pyl
index c3c593e..e5ea769 100644
--- a/tools_webrtc/mb/mb_config.pyl
+++ b/tools_webrtc/mb/mb_config.pyl
@@ -459,12 +459,8 @@
'gn_args': 'is_clang=true',
},
- # This mixin also sets 'dcheck_always_on=true' to ensure Chromium's
- # GN files (e.g. things in //build, etc..) agree with the value of
- # 'rtc_dcheck_always_on' when they read 'dcheck_always_on'.
- # See crbug.com/1231890#c9 for more info.
- 'rtc_dcheck_always_on': {
- 'gn_args': 'rtc_dcheck_always_on=true dcheck_always_on=true',
+ 'dcheck_always_on': {
+ 'gn_args': 'dcheck_always_on=true',
},
'debug': {
@@ -544,22 +540,21 @@
},
'release': {
- 'gn_args': 'is_debug=false dcheck_always_on=false',
+ 'gn_args': 'is_debug=false',
},
# The 'pure_release_bot' configuration is for release bots that are doing a
# 100% release build without DCHECKs while 'release_bot' is a partial
- # release configs since both `rtc_dcheck_always_on` and `dcheck_always_on`
- # are set to true.
+ # release configs since `dcheck_always_on` is set to true.
'pure_release_bot': {
'mixins': ['release', 'goma'],
},
'release_bot': {
- 'mixins': ['pure_release_bot', 'rtc_dcheck_always_on'],
+ 'mixins': ['pure_release_bot', 'dcheck_always_on'],
},
'release_bot_no_goma': {
- 'mixins': ['release', 'no_goma', 'rtc_dcheck_always_on'],
+ 'mixins': ['release', 'no_goma', 'dcheck_always_on'],
},
'tsan': {
diff --git a/webrtc.gni b/webrtc.gni
index a63f1dd..32417b4 100644
--- a/webrtc.gni
+++ b/webrtc.gni
@@ -6,7 +6,6 @@
# in the file PATENTS. All contributing project authors may
# be found in the AUTHORS file in the root of the source tree.
import("//build/config/arm.gni")
-import("//build/config/dcheck_always_on.gni")
import("//build/config/features.gni")
import("//build/config/mips.gni")
import("//build/config/sanitizers/sanitizers.gni")
@@ -37,11 +36,6 @@
}
declare_args() {
- # Separate control for dchecks in WebRTC. Defaults to Chromium's behavior if
- # built with Chromium.
- # When set to true, it will enable RTC_DCHECK() also in Release builds.
- rtc_dcheck_always_on = build_with_chromium && dcheck_always_on
-
# Setting this to true will make RTC_EXPORT (see rtc_base/system/rtc_export.h)
# expand to code that will manage symbols visibility.
rtc_enable_symbol_export = false