Member variables should appear before the |WeakPtrFactory|. (flutter/engine#20899)

This commit is contained in:
0xZero 2020-09-04 05:34:01 +08:00 committed by GitHub
parent 03d8863078
commit c70c748e0d
8 changed files with 14 additions and 16 deletions

View File

@ -35,8 +35,8 @@ class TestIOManager final : public IOManager {
task_runner,
fml::TimeDelta::FromNanoseconds(0))),
runner_(task_runner),
weak_factory_(this),
is_gpu_disabled_sync_switch_(std::make_shared<fml::SyncSwitch>()) {
is_gpu_disabled_sync_switch_(std::make_shared<fml::SyncSwitch>()),
weak_factory_(this) {
FML_CHECK(task_runner->RunsTasksOnCurrentThread())
<< "The IO manager must be initialized its primary task runner. The "
"test harness may not be setup correctly/safely.";
@ -85,8 +85,8 @@ class TestIOManager final : public IOManager {
fml::RefPtr<SkiaUnrefQueue> unref_queue_;
fml::WeakPtr<TestIOManager> weak_prototype_;
fml::RefPtr<fml::TaskRunner> runner_;
fml::WeakPtrFactory<TestIOManager> weak_factory_;
std::shared_ptr<fml::SyncSwitch> is_gpu_disabled_sync_switch_;
fml::WeakPtrFactory<TestIOManager> weak_factory_;
FML_DISALLOW_COPY_AND_ASSIGN(TestIOManager);
};

View File

@ -428,8 +428,8 @@ class Rasterizer final : public SnapshotDelegate {
fml::closure next_frame_callback_;
bool user_override_resource_cache_bytes_;
std::optional<size_t> max_cache_bytes_;
fml::TaskRunnerAffineWeakPtrFactory<Rasterizer> weak_factory_;
fml::RefPtr<fml::RasterThreadMerger> raster_thread_merger_;
fml::TaskRunnerAffineWeakPtrFactory<Rasterizer> weak_factory_;
// |SnapshotDelegate|
sk_sp<SkImage> MakeRasterSnapshot(sk_sp<SkPicture> picture,

View File

@ -327,8 +327,8 @@ Shell::Shell(DartVMRef vm, TaskRunners task_runners, Settings settings)
settings_(std::move(settings)),
vm_(std::move(vm)),
is_gpu_disabled_sync_switch_(new fml::SyncSwitch()),
weak_factory_(this),
weak_factory_gpu_(nullptr) {
weak_factory_gpu_(nullptr),
weak_factory_(this) {
FML_CHECK(vm_) << "Must have access to VM to create a shell.";
FML_DCHECK(task_runners_.IsValid());
FML_DCHECK(task_runners_.GetPlatformTaskRunner()->RunsTasksOnCurrentThread());

View File

@ -596,12 +596,11 @@ class Shell final : public PlatformView::Delegate,
const ServiceProtocol::Handler::ServiceProtocolMap& params,
rapidjson::Document* response);
fml::WeakPtrFactory<Shell> weak_factory_;
// For accessing the Shell via the raster thread, necessary for various
// rasterizer callbacks.
std::unique_ptr<fml::TaskRunnerAffineWeakPtrFactory<Shell>> weak_factory_gpu_;
fml::WeakPtrFactory<Shell> weak_factory_;
friend class testing::ShellTest;
FML_DISALLOW_COPY_AND_ASSIGN(Shell);

View File

@ -65,8 +65,8 @@ ShellIOManager::ShellIOManager(
std::move(unref_queue_task_runner),
fml::TimeDelta::FromMilliseconds(8),
GetResourceContext())),
weak_factory_(this),
is_gpu_disabled_sync_switch_(is_gpu_disabled_sync_switch) {
is_gpu_disabled_sync_switch_(is_gpu_disabled_sync_switch),
weak_factory_(this) {
if (!resource_context_) {
#ifndef OS_FUCHSIA
FML_DLOG(WARNING) << "The IO manager was initialized without a resource "

View File

@ -64,10 +64,10 @@ class ShellIOManager final : public IOManager {
// Unref queue management.
fml::RefPtr<flutter::SkiaUnrefQueue> unref_queue_;
fml::WeakPtrFactory<ShellIOManager> weak_factory_;
std::shared_ptr<fml::SyncSwitch> is_gpu_disabled_sync_switch_;
fml::WeakPtrFactory<ShellIOManager> weak_factory_;
FML_DISALLOW_COPY_AND_ASSIGN(ShellIOManager);
};

View File

@ -27,8 +27,8 @@ VsyncWaiter::VsyncWaiter(std::string debug_label,
debug_label_(std::move(debug_label)),
session_wait_(session_present_handle, SessionPresentSignal),
vsync_offset_(vsync_offset),
weak_factory_(this),
weak_factory_ui_(nullptr) {
weak_factory_ui_(nullptr),
weak_factory_(this) {
auto wait_handler = [&](async_dispatcher_t* dispatcher, //
async::Wait* wait, //
zx_status_t status, //

View File

@ -37,11 +37,10 @@ class VsyncWaiter final : public flutter::VsyncWaiter {
async::Wait session_wait_;
fml::TimeDelta vsync_offset_ = fml::TimeDelta::FromMicroseconds(0);
fml::WeakPtrFactory<VsyncWaiter> weak_factory_;
// For accessing the VsyncWaiter via the UI thread, necessary for the callback
// for AwaitVSync()
std::unique_ptr<fml::WeakPtrFactory<VsyncWaiter>> weak_factory_ui_;
fml::WeakPtrFactory<VsyncWaiter> weak_factory_;
// |flutter::VsyncWaiter|
void AwaitVSync() override;