WeakPtrFactory should be destroyed before any other members. (flutter/engine#29402)

This commit is contained in:
Rulong Chen(陈汝龙)
2021-11-11 22:08:01 +08:00
committed by GitHub
parent c1b10793e4
commit d0e356a496
19 changed files with 193 additions and 183 deletions

View File

@@ -57,7 +57,6 @@ class ImageDecoder {
std::shared_ptr<fml::ConcurrentTaskRunner> concurrent_task_runner_;
fml::WeakPtr<IOManager> io_manager_;
fml::WeakPtrFactory<ImageDecoder> weak_factory_;
FML_DISALLOW_COPY_AND_ASSIGN(ImageDecoder);
};

View File

@@ -910,29 +910,6 @@ class Engine final : public RuntimeDelegate, PointerDataDispatcher::Delegate {
}
private:
Engine::Delegate& delegate_;
const Settings settings_;
std::unique_ptr<Animator> animator_;
std::unique_ptr<RuntimeController> runtime_controller_;
// The pointer_data_dispatcher_ depends on animator_ and runtime_controller_.
// So it should be defined after them to ensure that pointer_data_dispatcher_
// is destructed first.
std::unique_ptr<PointerDataDispatcher> pointer_data_dispatcher_;
std::string last_entry_point_;
std::string last_entry_point_library_;
std::string initial_route_;
ViewportMetrics viewport_metrics_;
std::shared_ptr<AssetManager> asset_manager_;
bool activity_running_;
bool have_surface_;
std::shared_ptr<FontCollection> font_collection_;
ImageDecoder image_decoder_;
ImageGeneratorRegistry image_generator_registry_;
TaskRunners task_runners_;
fml::WeakPtrFactory<Engine> weak_factory_;
// |RuntimeDelegate|
std::string DefaultRouteName() override;
@@ -981,6 +958,28 @@ class Engine final : public RuntimeDelegate, PointerDataDispatcher::Delegate {
friend class testing::ShellTest;
Engine::Delegate& delegate_;
const Settings settings_;
std::unique_ptr<Animator> animator_;
std::unique_ptr<RuntimeController> runtime_controller_;
// The pointer_data_dispatcher_ depends on animator_ and runtime_controller_.
// So it should be defined after them to ensure that pointer_data_dispatcher_
// is destructed first.
std::unique_ptr<PointerDataDispatcher> pointer_data_dispatcher_;
std::string last_entry_point_;
std::string last_entry_point_library_;
std::string initial_route_;
ViewportMetrics viewport_metrics_;
std::shared_ptr<AssetManager> asset_manager_;
bool activity_running_;
bool have_surface_;
std::shared_ptr<FontCollection> font_collection_;
ImageDecoder image_decoder_;
ImageGeneratorRegistry image_generator_registry_;
TaskRunners task_runners_;
fml::WeakPtrFactory<Engine> weak_factory_; // Must be the last member.
FML_DISALLOW_COPY_AND_ASSIGN(Engine);
};

View File

@@ -823,16 +823,15 @@ class PlatformView {
const;
protected:
PlatformView::Delegate& delegate_;
const TaskRunners task_runners_;
PointerDataPacketConverter pointer_data_packet_converter_;
SkISize size_;
fml::WeakPtrFactory<PlatformView> weak_factory_;
// This is the only method called on the raster task runner.
virtual std::unique_ptr<Surface> CreateRenderingSurface();
PlatformView::Delegate& delegate_;
const TaskRunners task_runners_;
PointerDataPacketConverter pointer_data_packet_converter_;
SkISize size_;
fml::WeakPtrFactory<PlatformView> weak_factory_; // Must be the last member.
private:
FML_DISALLOW_COPY_AND_ASSIGN(PlatformView);
};

View File

@@ -147,20 +147,18 @@ class SmoothPointerDataDispatcher : public DefaultPointerDataDispatcher {
virtual ~SmoothPointerDataDispatcher();
private:
void DispatchPendingPacket();
void ScheduleSecondaryVsyncCallback();
// If non-null, this will be a pending pointer data packet for the next frame
// to consume. This is used to smooth out the irregular drag events delivery.
// See also `DispatchPointerDataPacket` and input_events_unittests.cc.
std::unique_ptr<PointerDataPacket> pending_packet_;
int pending_trace_flow_id_ = -1;
bool is_pointer_data_in_progress_ = false;
// WeakPtrFactory must be the last member.
fml::WeakPtrFactory<SmoothPointerDataDispatcher> weak_factory_;
void DispatchPendingPacket();
void ScheduleSecondaryVsyncCallback();
FML_DISALLOW_COPY_AND_ASSIGN(SmoothPointerDataDispatcher);
};

View File

@@ -448,22 +448,6 @@ class Rasterizer final : public SnapshotDelegate {
void DisableThreadMergerIfNeeded();
private:
Delegate& delegate_;
std::unique_ptr<Surface> surface_;
std::unique_ptr<SnapshotSurfaceProducer> snapshot_surface_producer_;
std::unique_ptr<flutter::CompositorContext> compositor_context_;
// This is the last successfully rasterized layer tree.
std::unique_ptr<flutter::LayerTree> last_layer_tree_;
// Set when we need attempt to rasterize the layer tree again. This layer_tree
// has not successfully rasterized. This can happen due to the change in the
// thread configuration. This will be inserted to the front of the pipeline.
std::unique_ptr<flutter::LayerTree> resubmitted_layer_tree_;
fml::closure next_frame_callback_;
bool user_override_resource_cache_bytes_;
std::optional<size_t> max_cache_bytes_;
fml::RefPtr<fml::RasterThreadMerger> raster_thread_merger_;
fml::TaskRunnerAffineWeakPtrFactory<Rasterizer> weak_factory_;
std::shared_ptr<ExternalViewEmbedder> external_view_embedder_;
// |SnapshotDelegate|
sk_sp<SkImage> MakeRasterSnapshot(
std::function<void(SkCanvas*)> draw_callback,
@@ -500,6 +484,24 @@ class Rasterizer final : public SnapshotDelegate {
static bool NoDiscard(const flutter::LayerTree& layer_tree) { return false; }
Delegate& delegate_;
std::unique_ptr<Surface> surface_;
std::unique_ptr<SnapshotSurfaceProducer> snapshot_surface_producer_;
std::unique_ptr<flutter::CompositorContext> compositor_context_;
// This is the last successfully rasterized layer tree.
std::unique_ptr<flutter::LayerTree> last_layer_tree_;
// Set when we need attempt to rasterize the layer tree again. This layer_tree
// has not successfully rasterized. This can happen due to the change in the
// thread configuration. This will be inserted to the front of the pipeline.
std::unique_ptr<flutter::LayerTree> resubmitted_layer_tree_;
fml::closure next_frame_callback_;
bool user_override_resource_cache_bytes_;
std::optional<size_t> max_cache_bytes_;
fml::RefPtr<fml::RasterThreadMerger> raster_thread_merger_;
std::shared_ptr<ExternalViewEmbedder> external_view_embedder_;
// WeakPtrFactory must be the last member.
fml::TaskRunnerAffineWeakPtrFactory<Rasterizer> weak_factory_;
FML_DISALLOW_COPY_AND_ASSIGN(Rasterizer);
};

View File

@@ -54,6 +54,14 @@ class GPUSurfaceGL : public Surface {
bool AllowsDrawingWhenGpuDisabled() const override;
private:
bool CreateOrUpdateSurfaces(const SkISize& size);
sk_sp<SkSurface> AcquireRenderSurface(
const SkISize& untransformed_size,
const SkMatrix& root_surface_transformation);
bool PresentSurface(SkCanvas* canvas);
GPUSurfaceGLDelegate* delegate_;
sk_sp<GrDirectContext> context_;
sk_sp<SkSurface> onscreen_surface_;
@@ -66,16 +74,9 @@ class GPUSurfaceGL : public Surface {
// external view embedder is present.
const bool render_to_surface_ = true;
bool valid_ = false;
// WeakPtrFactory must be the last member.
fml::TaskRunnerAffineWeakPtrFactory<GPUSurfaceGL> weak_factory_;
bool CreateOrUpdateSurfaces(const SkISize& size);
sk_sp<SkSurface> AcquireRenderSurface(
const SkISize& untransformed_size,
const SkMatrix& root_surface_transformation);
bool PresentSurface(SkCanvas* canvas);
FML_DISALLOW_COPY_AND_ASSIGN(GPUSurfaceGL);
};

View File

@@ -39,7 +39,6 @@ class GPUSurfaceSoftware : public Surface {
// external view embedder is present.
const bool render_to_surface_;
fml::TaskRunnerAffineWeakPtrFactory<GPUSurfaceSoftware> weak_factory_;
FML_DISALLOW_COPY_AND_ASSIGN(GPUSurfaceSoftware);
};

View File

@@ -55,7 +55,6 @@ class GPUSurfaceVulkan : public Surface {
const bool render_to_surface_;
fml::WeakPtrFactory<GPUSurfaceVulkan> weak_factory_;
FML_DISALLOW_COPY_AND_ASSIGN(GPUSurfaceVulkan);
};

View File

@@ -199,6 +199,10 @@ static constexpr int kNumProfilerSamplesPerSec = 5;
object:self
userInfo:nil];
// It will be destroyed and invalidate its weak pointers
// before any other members are destroyed.
_weakFactory.reset();
/// nil out weak references.
[_registrars
enumerateKeysAndObjectsUsingBlock:^(id key, FlutterEngineRegistrar* registrar, BOOL* stop) {

View File

@@ -49,6 +49,10 @@ static constexpr CFTimeInterval kDistantFuture = 1.0e10;
}
- (void)dealloc {
// It will be destroyed and invalidate its weak pointers
// before any other members are destroyed.
_weakFactory.reset();
[_primaryResponders removeAllObjects];
[_secondaryResponders removeAllObjects];
[_primaryResponders release];

View File

@@ -236,6 +236,10 @@ static void DNSSD_API registrationCallback(DNSServiceRef sdRef,
}
- (void)dealloc {
// It will be destroyed and invalidate its weak pointers
// before any other members are destroyed.
_weakFactory.reset();
[_delegate stopService];
[_url release];

View File

@@ -182,67 +182,6 @@ class FlutterPlatformViewsController {
using LayersMap = std::map<int64_t, std::vector<std::shared_ptr<FlutterPlatformViewLayer>>>;
// The pool of reusable view layers. The pool allows to recycle layer in each frame.
std::unique_ptr<FlutterPlatformViewLayerPool> layer_pool_;
// The platform view's R-tree keyed off the view id, which contains any subsequent
// draw operation until the next platform view or the last leaf node in the layer tree.
//
// The R-trees are deleted by the FlutterPlatformViewsController.reset().
std::map<int64_t, sk_sp<RTree>> platform_view_rtrees_;
// The platform view's picture recorder keyed off the view id, which contains any subsequent
// operation until the next platform view or the end of the last leaf node in the layer tree.
std::map<int64_t, std::unique_ptr<SkPictureRecorder>> picture_recorders_;
fml::scoped_nsobject<FlutterMethodChannel> channel_;
fml::scoped_nsobject<UIView> flutter_view_;
fml::scoped_nsobject<UIViewController> flutter_view_controller_;
std::map<std::string, fml::scoped_nsobject<NSObject<FlutterPlatformViewFactory>>> factories_;
std::map<int64_t, fml::scoped_nsobject<NSObject<FlutterPlatformView>>> views_;
std::map<int64_t, fml::scoped_nsobject<FlutterTouchInterceptingView>> touch_interceptors_;
// Mapping a platform view ID to the top most parent view (root_view) of a platform view. In
// |SubmitFrame|, root_views_ are added to flutter_view_ as child views.
//
// The platform view with the view ID is a child of the root view; If the platform view is not
// clipped, and no clipping view is added, the root view will be the intercepting view.
std::map<int64_t, fml::scoped_nsobject<UIView>> root_views_;
// Mapping a platform view ID to its latest composition params.
std::map<int64_t, EmbeddedViewParams> current_composition_params_;
// Mapping a platform view ID to the count of the clipping operations that were applied to the
// platform view last time it was composited.
std::map<int64_t, int64_t> clip_count_;
SkISize frame_size_;
// The number of frames the rasterizer task runner will continue
// to run on the platform thread after no platform view is rendered.
//
// Note: this is an arbitrary number that attempts to account for cases
// where the platform view might be momentarily off the screen.
static const int kDefaultMergedLeaseDuration = 10;
// Method channel `OnDispose` calls adds the views to be disposed to this set to be disposed on
// the next frame.
std::unordered_set<int64_t> views_to_dispose_;
// A vector of embedded view IDs according to their composition order.
// The last ID in this vector belond to the that is composited on top of all others.
std::vector<int64_t> composition_order_;
// The latest composition order that was presented in Present().
std::vector<int64_t> active_composition_order_;
// Only compoiste platform views in this set.
std::unordered_set<int64_t> views_to_recomposite_;
// The FlutterPlatformViewGestureRecognizersBlockingPolicy for each type of platform view.
std::map<std::string, FlutterPlatformViewGestureRecognizersBlockingPolicy>
gesture_recognizers_blocking_policies;
std::unique_ptr<fml::WeakPtrFactory<FlutterPlatformViewsController>> weak_factory_;
bool catransaction_added_ = false;
void OnCreate(FlutterMethodCall* call, FlutterResult& result);
void OnDispose(FlutterMethodCall* call, FlutterResult& result);
void OnAcceptGesture(FlutterMethodCall* call, FlutterResult& result);
@@ -302,6 +241,67 @@ class FlutterPlatformViewsController {
// Resets the state of the frame.
void ResetFrameState();
// The pool of reusable view layers. The pool allows to recycle layer in each frame.
std::unique_ptr<FlutterPlatformViewLayerPool> layer_pool_;
// The platform view's R-tree keyed off the view id, which contains any subsequent
// draw operation until the next platform view or the last leaf node in the layer tree.
//
// The R-trees are deleted by the FlutterPlatformViewsController.reset().
std::map<int64_t, sk_sp<RTree>> platform_view_rtrees_;
// The platform view's picture recorder keyed off the view id, which contains any subsequent
// operation until the next platform view or the end of the last leaf node in the layer tree.
std::map<int64_t, std::unique_ptr<SkPictureRecorder>> picture_recorders_;
fml::scoped_nsobject<FlutterMethodChannel> channel_;
fml::scoped_nsobject<UIView> flutter_view_;
fml::scoped_nsobject<UIViewController> flutter_view_controller_;
std::map<std::string, fml::scoped_nsobject<NSObject<FlutterPlatformViewFactory>>> factories_;
std::map<int64_t, fml::scoped_nsobject<NSObject<FlutterPlatformView>>> views_;
std::map<int64_t, fml::scoped_nsobject<FlutterTouchInterceptingView>> touch_interceptors_;
// Mapping a platform view ID to the top most parent view (root_view) of a platform view. In
// |SubmitFrame|, root_views_ are added to flutter_view_ as child views.
//
// The platform view with the view ID is a child of the root view; If the platform view is not
// clipped, and no clipping view is added, the root view will be the intercepting view.
std::map<int64_t, fml::scoped_nsobject<UIView>> root_views_;
// Mapping a platform view ID to its latest composition params.
std::map<int64_t, EmbeddedViewParams> current_composition_params_;
// Mapping a platform view ID to the count of the clipping operations that were applied to the
// platform view last time it was composited.
std::map<int64_t, int64_t> clip_count_;
SkISize frame_size_;
// The number of frames the rasterizer task runner will continue
// to run on the platform thread after no platform view is rendered.
//
// Note: this is an arbitrary number that attempts to account for cases
// where the platform view might be momentarily off the screen.
static const int kDefaultMergedLeaseDuration = 10;
// Method channel `OnDispose` calls adds the views to be disposed to this set to be disposed on
// the next frame.
std::unordered_set<int64_t> views_to_dispose_;
// A vector of embedded view IDs according to their composition order.
// The last ID in this vector belond to the that is composited on top of all others.
std::vector<int64_t> composition_order_;
// The latest composition order that was presented in Present().
std::vector<int64_t> active_composition_order_;
// Only compoiste platform views in this set.
std::unordered_set<int64_t> views_to_recomposite_;
// The FlutterPlatformViewGestureRecognizersBlockingPolicy for each type of platform view.
std::map<std::string, FlutterPlatformViewGestureRecognizersBlockingPolicy>
gesture_recognizers_blocking_policies;
bool catransaction_added_ = false;
// WeakPtrFactory must be the last member.
std::unique_ptr<fml::WeakPtrFactory<FlutterPlatformViewsController>> weak_factory_;
FML_DISALLOW_COPY_AND_ASSIGN(FlutterPlatformViewsController);
};

View File

@@ -784,6 +784,10 @@ static void sendFakeTouchEvent(FlutterEngine* engine,
}
- (void)dealloc {
// It will be destroyed and invalidate its weak pointers
// before any other members are destroyed.
_weakFactory.reset();
[self removeInternalPlugins];
[self deregisterNotifications];
[super dealloc];

View File

@@ -99,12 +99,11 @@ class AccessibilityBridge final : public AccessibilityBridgeIos {
int32_t last_focused_semantics_object_id_;
fml::scoped_nsobject<NSMutableDictionary<NSNumber*, SemanticsObject*>> objects_;
fml::scoped_nsprotocol<FlutterBasicMessageChannel*> accessibility_channel_;
fml::WeakPtrFactory<AccessibilityBridge> weak_factory_;
int32_t previous_route_id_;
std::unordered_map<int32_t, flutter::CustomAccessibilityAction> actions_;
std::vector<int32_t> previous_routes_;
std::unique_ptr<IosDelegate> ios_delegate_;
fml::WeakPtrFactory<AccessibilityBridge> weak_factory_; // Must be the last member.
FML_DISALLOW_COPY_AND_ASSIGN(AccessibilityBridge);
};

View File

@@ -46,11 +46,11 @@ AccessibilityBridge::AccessibilityBridge(
platform_views_controller_(platform_views_controller),
last_focused_semantics_object_id_(kSemanticObjectIdInvalid),
objects_([[NSMutableDictionary alloc] init]),
weak_factory_(this),
previous_route_id_(0),
previous_routes_({}),
ios_delegate_(ios_delegate ? std::move(ios_delegate)
: std::make_unique<DefaultIosDelegate>()) {
: std::make_unique<DefaultIosDelegate>()),
weak_factory_(this) {
accessibility_channel_.reset([[FlutterBasicMessageChannel alloc]
initWithName:@"flutter/accessibility"
binaryMessenger:platform_view->GetOwnerViewController().get().engine.binaryMessenger

View File

@@ -81,28 +81,6 @@ class ComponentV1 final : public Engine::Delegate,
#endif // !defined(DART_PRODUCT)
private:
flutter::Settings settings_;
FlutterRunnerProductConfiguration product_config_;
TerminationCallback termination_callback_;
const std::string debug_label_;
UniqueFDIONS fdio_ns_ = UniqueFDIONSCreate();
fml::UniqueFD component_data_directory_;
fml::UniqueFD component_assets_directory_;
fidl::Binding<fuchsia::sys::ComponentController> component_controller_;
fuchsia::io::DirectoryPtr directory_ptr_;
fuchsia::io::NodePtr cloned_directory_ptr_;
fidl::InterfaceRequest<fuchsia::io::Directory> directory_request_;
std::unique_ptr<vfs::PseudoDir> outgoing_dir_;
std::shared_ptr<sys::ServiceDirectory> svc_;
std::shared_ptr<sys::ServiceDirectory> runner_incoming_services_;
fidl::BindingSet<fuchsia::ui::app::ViewProvider> shells_bindings_;
fml::RefPtr<flutter::DartSnapshot> isolate_snapshot_;
std::set<std::unique_ptr<Engine>> shell_holders_;
std::pair<bool, uint32_t> last_return_code_;
fml::WeakPtrFactory<ComponentV1> weak_factory_;
ComponentV1(
TerminationCallback termination_callback,
fuchsia::sys::Package package,
@@ -133,6 +111,27 @@ class ComponentV1 final : public Engine::Delegate,
// |flutter::Engine::Delegate|
void OnEngineTerminate(const Engine* holder) override;
flutter::Settings settings_;
FlutterRunnerProductConfiguration product_config_;
TerminationCallback termination_callback_;
const std::string debug_label_;
UniqueFDIONS fdio_ns_ = UniqueFDIONSCreate();
fml::UniqueFD component_data_directory_;
fml::UniqueFD component_assets_directory_;
fidl::Binding<fuchsia::sys::ComponentController> component_controller_;
fuchsia::io::DirectoryPtr directory_ptr_;
fuchsia::io::NodePtr cloned_directory_ptr_;
fidl::InterfaceRequest<fuchsia::io::Directory> directory_request_;
std::unique_ptr<vfs::PseudoDir> outgoing_dir_;
std::shared_ptr<sys::ServiceDirectory> svc_;
std::shared_ptr<sys::ServiceDirectory> runner_incoming_services_;
fidl::BindingSet<fuchsia::ui::app::ViewProvider> shells_bindings_;
fml::RefPtr<flutter::DartSnapshot> isolate_snapshot_;
std::set<std::unique_ptr<Engine>> shell_holders_;
std::pair<bool, uint32_t> last_return_code_;
fml::WeakPtrFactory<ComponentV1> weak_factory_; // Must be the last member.
FML_DISALLOW_COPY_AND_ASSIGN(ComponentV1);
};

View File

@@ -86,30 +86,6 @@ class ComponentV2 final
#endif // !defined(DART_PRODUCT)
private:
flutter::Settings settings_;
FlutterRunnerProductConfiguration product_config_;
TerminationCallback termination_callback_;
const std::string debug_label_;
UniqueFDIONS fdio_ns_ = UniqueFDIONSCreate();
fml::UniqueFD component_data_directory_;
fml::UniqueFD component_assets_directory_;
fidl::Binding<fuchsia::component::runner::ComponentController>
component_controller_;
fuchsia::io::DirectoryPtr directory_ptr_;
fuchsia::io::NodePtr cloned_directory_ptr_;
fidl::InterfaceRequest<fuchsia::io::Directory> directory_request_;
std::unique_ptr<vfs::PseudoDir> outgoing_dir_;
std::unique_ptr<vfs::PseudoDir> runtime_dir_;
std::shared_ptr<sys::ServiceDirectory> svc_;
std::shared_ptr<sys::ServiceDirectory> runner_incoming_services_;
fidl::BindingSet<fuchsia::ui::app::ViewProvider> shells_bindings_;
fml::RefPtr<flutter::DartSnapshot> isolate_snapshot_;
std::set<std::unique_ptr<Engine>> shell_holders_;
std::pair<bool, uint32_t> last_return_code_;
fml::WeakPtrFactory<ComponentV2> weak_factory_;
ComponentV2(
TerminationCallback termination_callback,
fuchsia::component::runner::ComponentStartInfo start_info,
@@ -149,6 +125,29 @@ class ComponentV2 final
// |flutter::Engine::Delegate|
void OnEngineTerminate(const Engine* holder) override;
flutter::Settings settings_;
FlutterRunnerProductConfiguration product_config_;
TerminationCallback termination_callback_;
const std::string debug_label_;
UniqueFDIONS fdio_ns_ = UniqueFDIONSCreate();
fml::UniqueFD component_data_directory_;
fml::UniqueFD component_assets_directory_;
fidl::Binding<fuchsia::component::runner::ComponentController>
component_controller_;
fuchsia::io::DirectoryPtr directory_ptr_;
fuchsia::io::NodePtr cloned_directory_ptr_;
fidl::InterfaceRequest<fuchsia::io::Directory> directory_request_;
std::unique_ptr<vfs::PseudoDir> outgoing_dir_;
std::unique_ptr<vfs::PseudoDir> runtime_dir_;
std::shared_ptr<sys::ServiceDirectory> svc_;
std::shared_ptr<sys::ServiceDirectory> runner_incoming_services_;
fidl::BindingSet<fuchsia::ui::app::ViewProvider> shells_bindings_;
fml::RefPtr<flutter::DartSnapshot> isolate_snapshot_;
std::set<std::unique_ptr<Engine>> shell_holders_;
std::pair<bool, uint32_t> last_return_code_;
fml::WeakPtrFactory<ComponentV2> weak_factory_; // Must be the last member.
FML_DISALLOW_COPY_AND_ASSIGN(ComponentV2);
};

View File

@@ -171,7 +171,6 @@ class Engine final : public fuchsia::memorypressure::Watcher {
bool intercept_all_input_ = false;
fml::WeakPtrFactory<Engine> weak_factory_;
friend class testing::EngineTest;
FML_DISALLOW_COPY_AND_ASSIGN(Engine);

View File

@@ -56,6 +56,14 @@ class VulkanSurfaceProducer final : public SurfaceProducer,
bool TransitionSurfacesToExternal(
const std::vector<std::unique_ptr<SurfaceProducerSurface>>& surfaces);
// Keep track of the last time we produced a surface. This is used to
// determine whether it is safe to shrink |surface_pool_| or not.
zx::time last_produce_time_ = async::Now(async_get_default_dispatcher());
// Disallow copy and assignment.
VulkanSurfaceProducer(const VulkanSurfaceProducer&) = delete;
VulkanSurfaceProducer& operator=(const VulkanSurfaceProducer&) = delete;
// Note: the order here is very important. The proctable must be destroyed
// last because it contains the function pointers for VkDestroyDevice and
// VkDestroyInstance.
@@ -66,14 +74,8 @@ class VulkanSurfaceProducer final : public SurfaceProducer,
std::unique_ptr<VulkanSurfacePool> surface_pool_;
bool valid_ = false;
// Keep track of the last time we produced a surface. This is used to
// determine whether it is safe to shrink |surface_pool_| or not.
zx::time last_produce_time_ = async::Now(async_get_default_dispatcher());
// WeakPtrFactory must be the last member.
fml::WeakPtrFactory<VulkanSurfaceProducer> weak_factory_{this};
// Disallow copy and assignment.
VulkanSurfaceProducer(const VulkanSurfaceProducer&) = delete;
VulkanSurfaceProducer& operator=(const VulkanSurfaceProducer&) = delete;
};
} // namespace flutter_runner