@@ -438,15 +438,29 @@ class Shell final : public PlatformView::Delegate,
438438 const std::shared_ptr<fml::ConcurrentTaskRunner>
439439 GetConcurrentWorkerTaskRunner () const ;
440440
441+ // Infer the VM ref and the isolate snapshot based on the settings.
442+ //
443+ // If the VM is already running, the settings are ignored, but the returned
444+ // isolate snapshot always prioritize what is specified by the settings, and
445+ // falls back to the one VM was launched with.
446+ //
447+ // This function is what Shell::Create uses to infer snapshot settings.
448+ //
449+ // TODO(dkwingsmt): Extracting this method is part of a bigger change. If the
450+ // entire change is not eventually landed, we should merge this method back
451+ // to Create. https://github.com/flutter/flutter/issues/136826
452+ static std::pair<DartVMRef, fml::RefPtr<const DartSnapshot>>
453+ InferVmInitDataFromSettings (Settings& settings);
454+
441455 private:
442456 using ServiceProtocolHandler =
443457 std::function<bool (const ServiceProtocol::Handler::ServiceProtocolMap&,
444458 rapidjson::Document*)>;
445459
446460 // / A collection of message channels (by name) that have sent at least one
447- // / message from a non-platform thread. Used to prevent printing the error log
448- // / more than once per channel, as a badly behaving plugin may send multiple
449- // / messages per second indefinitely.
461+ // / message from a non-platform thread. Used to prevent printing the error
462+ // / log more than once per channel, as a badly behaving plugin may send
463+ // / multiple messages per second indefinitely.
450464 std::mutex misbehaving_message_channels_mutex_;
451465 std::set<std::string> misbehaving_message_channels_;
452466 const TaskRunners task_runners_;
@@ -497,19 +511,20 @@ class Shell final : public PlatformView::Delegate,
497511 bool frame_timings_report_scheduled_ = false ;
498512
499513 // Vector of FrameTiming::kCount * n timestamps for n frames whose timings
500- // have not been reported yet. Vector of ints instead of FrameTiming is stored
501- // here for easier conversions to Dart objects.
514+ // have not been reported yet. Vector of ints instead of FrameTiming is
515+ // stored here for easier conversions to Dart objects.
502516 std::vector<int64_t > unreported_timings_;
503517
504- // / Manages the displays. This class is thread safe, can be accessed from any
505- // / of the threads.
518+ // / Manages the displays. This class is thread safe, can be accessed from
519+ // / any of the threads.
506520 std::unique_ptr<DisplayManager> display_manager_;
507521
508522 // protects expected_frame_size_ which is set on platform thread and read on
509523 // raster thread
510524 std::mutex resize_mutex_;
511525
512- // used to discard wrong size layer tree produced during interactive resizing
526+ // used to discard wrong size layer tree produced during interactive
527+ // resizing
513528 std::unordered_map<int64_t , SkISize> expected_frame_sizes_;
514529
515530 // Used to communicate the right frame bounds via service protocol.
@@ -746,7 +761,8 @@ class Shell final : public PlatformView::Delegate,
746761
747762 // Service protocol handler
748763 //
749- // The returned SkSLs are base64 encoded. Decode before storing them to files.
764+ // The returned SkSLs are base64 encoded. Decode before storing them to
765+ // files.
750766 bool OnServiceProtocolGetSkSLs (
751767 const ServiceProtocol::Handler::ServiceProtocolMap& params,
752768 rapidjson::Document* response);
@@ -767,8 +783,8 @@ class Shell final : public PlatformView::Delegate,
767783
768784 // Service protocol handler
769785 //
770- // Forces the FontCollection to reload the font manifest. Used to support hot
771- // reload for fonts.
786+ // Forces the FontCollection to reload the font manifest. Used to support
787+ // hot reload for fonts.
772788 bool OnServiceProtocolReloadAssetFonts (
773789 const ServiceProtocol::Handler::ServiceProtocolMap& params,
774790 rapidjson::Document* response);
0 commit comments