Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit ac8b9c4

Browse files
authored
Member variables should appear before the |WeakPtrFactory|. (#20899)
1 parent e284598 commit ac8b9c4

File tree

8 files changed

+14
-16
lines changed

8 files changed

+14
-16
lines changed

lib/ui/painting/image_decoder_unittests.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ class TestIOManager final : public IOManager {
3535
task_runner,
3636
fml::TimeDelta::FromNanoseconds(0))),
3737
runner_(task_runner),
38-
weak_factory_(this),
39-
is_gpu_disabled_sync_switch_(std::make_shared<fml::SyncSwitch>()) {
38+
is_gpu_disabled_sync_switch_(std::make_shared<fml::SyncSwitch>()),
39+
weak_factory_(this) {
4040
FML_CHECK(task_runner->RunsTasksOnCurrentThread())
4141
<< "The IO manager must be initialized its primary task runner. The "
4242
"test harness may not be setup correctly/safely.";
@@ -85,8 +85,8 @@ class TestIOManager final : public IOManager {
8585
fml::RefPtr<SkiaUnrefQueue> unref_queue_;
8686
fml::WeakPtr<TestIOManager> weak_prototype_;
8787
fml::RefPtr<fml::TaskRunner> runner_;
88-
fml::WeakPtrFactory<TestIOManager> weak_factory_;
8988
std::shared_ptr<fml::SyncSwitch> is_gpu_disabled_sync_switch_;
89+
fml::WeakPtrFactory<TestIOManager> weak_factory_;
9090

9191
FML_DISALLOW_COPY_AND_ASSIGN(TestIOManager);
9292
};

shell/common/rasterizer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,8 +428,8 @@ class Rasterizer final : public SnapshotDelegate {
428428
fml::closure next_frame_callback_;
429429
bool user_override_resource_cache_bytes_;
430430
std::optional<size_t> max_cache_bytes_;
431-
fml::TaskRunnerAffineWeakPtrFactory<Rasterizer> weak_factory_;
432431
fml::RefPtr<fml::RasterThreadMerger> raster_thread_merger_;
432+
fml::TaskRunnerAffineWeakPtrFactory<Rasterizer> weak_factory_;
433433

434434
// |SnapshotDelegate|
435435
sk_sp<SkImage> MakeRasterSnapshot(sk_sp<SkPicture> picture,

shell/common/shell.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,8 +327,8 @@ Shell::Shell(DartVMRef vm, TaskRunners task_runners, Settings settings)
327327
settings_(std::move(settings)),
328328
vm_(std::move(vm)),
329329
is_gpu_disabled_sync_switch_(new fml::SyncSwitch()),
330-
weak_factory_(this),
331-
weak_factory_gpu_(nullptr) {
330+
weak_factory_gpu_(nullptr),
331+
weak_factory_(this) {
332332
FML_CHECK(vm_) << "Must have access to VM to create a shell.";
333333
FML_DCHECK(task_runners_.IsValid());
334334
FML_DCHECK(task_runners_.GetPlatformTaskRunner()->RunsTasksOnCurrentThread());

shell/common/shell.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -596,12 +596,11 @@ class Shell final : public PlatformView::Delegate,
596596
const ServiceProtocol::Handler::ServiceProtocolMap& params,
597597
rapidjson::Document* response);
598598

599-
fml::WeakPtrFactory<Shell> weak_factory_;
600-
601599
// For accessing the Shell via the raster thread, necessary for various
602600
// rasterizer callbacks.
603601
std::unique_ptr<fml::TaskRunnerAffineWeakPtrFactory<Shell>> weak_factory_gpu_;
604602

603+
fml::WeakPtrFactory<Shell> weak_factory_;
605604
friend class testing::ShellTest;
606605

607606
FML_DISALLOW_COPY_AND_ASSIGN(Shell);

shell/common/shell_io_manager.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ ShellIOManager::ShellIOManager(
6565
std::move(unref_queue_task_runner),
6666
fml::TimeDelta::FromMilliseconds(8),
6767
GetResourceContext())),
68-
weak_factory_(this),
69-
is_gpu_disabled_sync_switch_(is_gpu_disabled_sync_switch) {
68+
is_gpu_disabled_sync_switch_(is_gpu_disabled_sync_switch),
69+
weak_factory_(this) {
7070
if (!resource_context_) {
7171
#ifndef OS_FUCHSIA
7272
FML_DLOG(WARNING) << "The IO manager was initialized without a resource "

shell/common/shell_io_manager.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@ class ShellIOManager final : public IOManager {
6464
// Unref queue management.
6565
fml::RefPtr<flutter::SkiaUnrefQueue> unref_queue_;
6666

67-
fml::WeakPtrFactory<ShellIOManager> weak_factory_;
68-
6967
std::shared_ptr<fml::SyncSwitch> is_gpu_disabled_sync_switch_;
7068

69+
fml::WeakPtrFactory<ShellIOManager> weak_factory_;
70+
7171
FML_DISALLOW_COPY_AND_ASSIGN(ShellIOManager);
7272
};
7373

shell/platform/fuchsia/flutter/vsync_waiter.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ VsyncWaiter::VsyncWaiter(std::string debug_label,
2727
debug_label_(std::move(debug_label)),
2828
session_wait_(session_present_handle, SessionPresentSignal),
2929
vsync_offset_(vsync_offset),
30-
weak_factory_(this),
31-
weak_factory_ui_(nullptr) {
30+
weak_factory_ui_(nullptr),
31+
weak_factory_(this) {
3232
auto wait_handler = [&](async_dispatcher_t* dispatcher, //
3333
async::Wait* wait, //
3434
zx_status_t status, //

shell/platform/fuchsia/flutter/vsync_waiter.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,10 @@ class VsyncWaiter final : public flutter::VsyncWaiter {
3737
async::Wait session_wait_;
3838
fml::TimeDelta vsync_offset_ = fml::TimeDelta::FromMicroseconds(0);
3939

40-
fml::WeakPtrFactory<VsyncWaiter> weak_factory_;
41-
4240
// For accessing the VsyncWaiter via the UI thread, necessary for the callback
4341
// for AwaitVSync()
4442
std::unique_ptr<fml::WeakPtrFactory<VsyncWaiter>> weak_factory_ui_;
43+
fml::WeakPtrFactory<VsyncWaiter> weak_factory_;
4544

4645
// |flutter::VsyncWaiter|
4746
void AwaitVSync() override;

0 commit comments

Comments
 (0)