Allow absl::Nonnull and absl::Nullable.

This CL includes follow-up changes from
https://webrtc-review.googlesource.com/c/src/+/324280

Bug: none
Change-Id: I6abad16e05cac7197c51ffa7b1d3fb991843df6e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/325243
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41030}
This commit is contained in:
Tommi 2023-10-27 22:38:33 +02:00 committed by WebRTC LUCI CQ
parent bcaaefdcfc
commit fd3b346e27
5 changed files with 12 additions and 4 deletions

1
DEPS
View file

@ -2602,6 +2602,7 @@ include_rules = [
"+absl/base/attributes.h",
"+absl/base/config.h",
"+absl/base/const_init.h",
"+absl/base/nullability.h",
"+absl/base/macros.h",
"+absl/cleanup/cleanup.h",
"+absl/container/inlined_vector.h",

View file

@ -132,7 +132,10 @@ rtc_library("pending_task_safety_flag") {
"../../rtc_base/system:no_unique_address",
"../../rtc_base/system:rtc_export",
]
absl_deps = [ "//third_party/abseil-cpp/absl/functional:any_invocable" ]
absl_deps = [
"//third_party/abseil-cpp/absl/base:nullability",
"//third_party/abseil-cpp/absl/functional:any_invocable",
]
}
if (rtc_include_tests) {

View file

@ -37,7 +37,8 @@ PendingTaskSafetyFlag::CreateDetached() {
rtc::scoped_refptr<PendingTaskSafetyFlag>
PendingTaskSafetyFlag::CreateAttachedToTaskQueue(
bool alive,
TaskQueueBase* attached_queue) {
absl::Nonnull<TaskQueueBase*> attached_queue) {
RTC_DCHECK(attached_queue) << "Null TaskQueue provided";
return rtc::scoped_refptr<PendingTaskSafetyFlag>(
new PendingTaskSafetyFlag(alive, attached_queue));
}

View file

@ -13,6 +13,7 @@
#include <utility>
#include "absl/base/nullability.h"
#include "absl/functional/any_invocable.h"
#include "api/ref_counted_base.h"
#include "api/scoped_refptr.h"
@ -72,7 +73,7 @@ class RTC_EXPORT PendingTaskSafetyFlag final
// a given task queue and the `alive()` flag specified.
static rtc::scoped_refptr<PendingTaskSafetyFlag> CreateAttachedToTaskQueue(
bool alive,
TaskQueueBase* attached_queue);
absl::Nonnull<TaskQueueBase*> attached_queue);
// Same as `CreateDetached()` except the initial state of the returned flag
// will be `!alive()`.
@ -101,7 +102,8 @@ class RTC_EXPORT PendingTaskSafetyFlag final
protected:
explicit PendingTaskSafetyFlag(bool alive) : alive_(alive) {}
PendingTaskSafetyFlag(bool alive, TaskQueueBase* attached_queue)
PendingTaskSafetyFlag(bool alive,
absl::Nonnull<TaskQueueBase*> attached_queue)
: alive_(alive), main_sequence_(attached_queue) {}
private:

View file

@ -29,6 +29,7 @@ will generate a shared library.
* `absl::bind_front`
* `absl::Cleanup`
* `absl::InlinedVector`
* `absl::Nonnull` and `absl::Nullable`
* `absl::WrapUnique`
* `absl::optional` and related stuff from `absl/types/optional.h`.
* `absl::string_view`