From 200fc7c3ec95bc86f6afb55ca3c691e923463104 Mon Sep 17 00:00:00 2001 From: Leonid Baraz Date: Mon, 19 Dec 2022 21:46:04 +0000 Subject: [PATCH] GCC: fix usage of decltype in reporting::StorageQueue GCC does not allow to use decltype for the default value of a function parameter. Bug: 819294 Change-Id: I7ebb255634375ce889933f8b67acb10f0e56ca8d Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4111548 Reviewed-by: Leonid Baraz Commit-Queue: Leonid Baraz Reviewed-by: Hong Xu Cr-Commit-Position: refs/heads/main@{#1085129} --- diff --git a/components/reporting/storage/storage_queue.cc b/components/reporting/storage/storage_queue.cc index c546d55a..49e0f2c 100644 --- a/components/reporting/storage/storage_queue.cc +++ b/components/reporting/storage/storage_queue.cc @@ -203,7 +203,6 @@ encryption_module_(encryption_module), compression_module_(compression_module) { DETACH_FROM_SEQUENCE(storage_queue_sequence_checker_); - DCHECK(write_contexts_queue_.empty()); } StorageQueue::~StorageQueue() { @@ -2133,9 +2132,7 @@ } void StorageQueue::TestInjectErrorsForOperation( - base::RepeatingCallback< - Status(test::StorageQueueOperationKind operation_kind, int64_t)> - handler) { + test::ErrorInjectionHandlerType handler) { test_injection_handler_ = handler; } diff --git a/components/reporting/storage/storage_queue.h b/components/reporting/storage/storage_queue.h index 39edd8b..04d5f9f 100644 --- a/components/reporting/storage/storage_queue.h +++ b/components/reporting/storage/storage_queue.h @@ -52,6 +52,9 @@ kWriteLowDiskSpace, }; +using ErrorInjectionHandlerType = + base::RepeatingCallback; + } // namespace test // Storage queue represents single queue of data to be collected and stored @@ -142,8 +145,7 @@ // can be returned as a resulting operation status too. // If `handler` is null, error injections is disabled. void TestInjectErrorsForOperation( - base::RepeatingCallback - handler = decltype(handler)()); + test::ErrorInjectionHandlerType handler = base::NullCallback()); // Access queue options. const QueueOptions& options() const { return options_; } @@ -492,8 +494,7 @@ // Test only: records callback to be invoked. It will be called with operation // kind and seq id, and will return Status (non-OK status indicates the // failure to be injected). In production code must be null. - base::RepeatingCallback - test_injection_handler_; + test::ErrorInjectionHandlerType test_injection_handler_{base::NullCallback()}; // Weak pointer factory (must be last member in class). base::WeakPtrFactory weakptr_factory_{this};