[BRP] Un-rewrite more raw_ptrs/refs in base/task/ that are stack-scoped
These showed up in profiler data [1]. Upon a closer look, they're all
short-lived (stack-scoped), and we have a rule to avoid rewriting these.
The classes were marked STACK_ALLOCATED to reflect that (hence
RAW_PTR_EXCLUSION isn't needed there).
[1] https://pprofng.corp.google.com/?id=a918472fab52ee23c3cf1f8bb500ab6c&filter=focus:RawPtrBackupRefImpl&tab=bottomup
Bug: 332743723
Change-Id: Ib56efebcbc1071521939ccc34d7e5f218b4c22d4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5446771
Auto-Submit: Bartek Nowierski <[email protected]>
Commit-Queue: Francois Pierre Doray <[email protected]>
Reviewed-by: Francois Pierre Doray <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1285788}
diff --git a/base/task/thread_pool/task_source.h b/base/task/thread_pool/task_source.h
index 739bcbc..d1862210 100644
--- a/base/task/thread_pool/task_source.h
+++ b/base/task/thread_pool/task_source.h
@@ -12,6 +12,7 @@
#include "base/dcheck_is_on.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/ref_counted.h"
+#include "base/memory/stack_allocated.h"
#include "base/sequence_token.h"
#include "base/task/common/checked_lock.h"
#include "base/task/task_traits.h"
@@ -125,6 +126,8 @@
// lifetime of the Transaction. No Transaction must be held when ~TaskSource()
// is called.
class BASE_EXPORT Transaction {
+ STACK_ALLOCATED();
+
public:
Transaction(Transaction&& other);
Transaction(const Transaction&) = delete;
@@ -149,7 +152,7 @@
private:
friend class TaskSource;
- raw_ptr<TaskSource, LeakedDanglingUntriaged> task_source_;
+ TaskSource* task_source_;
};
// |traits| is metadata that applies to all Tasks in the TaskSource.
@@ -345,6 +348,8 @@
// A pair of Transaction and RegisteredTaskSource. Useful to carry a
// RegisteredTaskSource with an associated Transaction.
struct BASE_EXPORT RegisteredTaskSourceAndTransaction {
+ STACK_ALLOCATED();
+
public:
RegisteredTaskSourceAndTransaction(RegisteredTaskSource task_source_in,
TaskSource::Transaction transaction_in);
@@ -365,6 +370,8 @@
};
struct BASE_EXPORT TaskSourceAndTransaction {
+ STACK_ALLOCATED();
+
public:
TaskSourceAndTransaction(scoped_refptr<TaskSource> task_source_in,
TaskSource::Transaction transaction_in);