0

Remove several SupportsWeakPtr uses from code comments

Bug: 40485134
Change-Id: Idf8f2754917082ac6be1fa9ea322f20eb99ab773
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5857866
Commit-Queue: Andrew Williams <awillia@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Justin DeWitt <dewittj@chromium.org>
Reviewed-by: Mikel Astiz <mastiz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1357042}
This commit is contained in:
Andrew Williams
2024-09-18 13:06:51 +00:00
committed by Chromium LUCI CQ
parent ca4e1d5a37
commit bfae87ed83
5 changed files with 11 additions and 10 deletions
base
components/sync/base
third_party/blink/tools/blinkpy/presubmit
ui/message_center

@@ -1909,7 +1909,7 @@ struct BindHelper {
// If `IsWeakReceiver<T>::value` is `true` and `T` is used as a method receiver,
// `Bind()` cancels the method invocation if the receiver tests as false.
// ```
// struct S : SupportsWeakPtr<S> {
// struct S {
// void f() {}
// };
//

@@ -94,20 +94,22 @@ class BASE_EXPORT TaskRunner
// };
//
//
// class DataLoader : public SupportsWeakPtr<DataLoader> {
// class DataLoader {
// public:
// void GetData() {
// scoped_refptr<DataBuffer> buffer = new DataBuffer();
// target_thread_.task_runner()->PostTaskAndReply(
// FROM_HERE,
// base::BindOnce(&DataBuffer::AddData, buffer),
// base::BindOnce(&DataLoader::OnDataReceived, AsWeakPtr(), buffer));
// base::BindOnce(&DataLoader::OnDataReceived,
// weak_ptr_factory_.GetWeakPtr(), buffer));
// }
//
// private:
// void OnDataReceived(scoped_refptr<DataBuffer> buffer) {
// // Do something with buffer.
// }
// base::WeakPtrFactory<DataLoader> weak_ptr_factory_{this};
// };
//
//

@@ -19,7 +19,7 @@
// Weak handles provides a way to refer to weak pointers from another sequence.
// This is useful because it is not safe to reference a weak pointer from a
// sequence other than the sequence on which it was created.
// sequence other than the sequence on which it will be invalidated.
//
// Weak handles can be passed across sequences, so for example, you can use them
// to do the "real" work on one thread and get notified on another thread:
@@ -36,10 +36,11 @@
// const WeakHandle<Foo> foo_;
// };
//
// class Foo : public SupportsWeakPtr<Foo> {
// class Foo {
// public:
// Foo() {
// SpawnFooIOWorkerOnIOThread(base::MakeWeakHandle(AsWeakPtr()));
// SpawnFooIOWorkerOnIOThread(
// MakeWeakHandle(weak_ptr_factory_.GetWeakPtr()));
// }
//
// /* Will always be called on the correct sequence, and only if this
@@ -48,6 +49,8 @@
//
// private:
// SEQUENCE_CHECKER(sequence_checker_);
//
// base::WeakPtrFactory<Foo> weak_ptr_factory_{this};
// };
namespace base {

@@ -140,7 +140,6 @@ _CONFIG = [
'base::Span(OrSize|Reader|Writer)',
'base::StringPiece',
'base::SubstringSetMatcher',
'base::SupportsWeakPtr',
'base::SysInfo',
'base::ThreadChecker',
'base::ThreadTicks',

@@ -20,9 +20,6 @@ namespace message_center {
// A class that manages all the timers running for individual notification popup
// windows. It supports weak pointers in order to allow safe callbacks when
// timers expire.
// We can use SupportsWeakPtr<> because PopupTimer does not
// access this class in its destructor so it is safe to invalidate weak pointers
// after we destroy |popup_timers_|
class MESSAGE_CENTER_EXPORT PopupTimersController
: public MessageCenterObserver,
public PopupTimer::Delegate {