Make the Dart isolate constructor private. (flutter/engine#13153)

Found this while attempting to document //flutter/runtime. The only reason this was public was because of the desire to use make_shared. I want to documentation changes to include no code changes. Hence this separate patch.
This commit is contained in:
Chinmay Garde
2019-10-15 15:06:57 -07:00
committed by GitHub
parent 38ed1f857b
commit 55c710af55
2 changed files with 16 additions and 16 deletions

View File

@@ -55,7 +55,7 @@ std::weak_ptr<DartIsolate> DartIsolate::CreateRootIsolate(
// The child isolate preparer is null but will be set when the isolate is
// being prepared to run.
auto root_embedder_data = std::make_unique<std::shared_ptr<DartIsolate>>(
std::make_shared<DartIsolate>(
std::shared_ptr<DartIsolate>(new DartIsolate(
settings, // settings
std::move(isolate_snapshot), // isolate snapshot
std::move(shared_snapshot), // shared snapshot
@@ -67,7 +67,7 @@ std::weak_ptr<DartIsolate> DartIsolate::CreateRootIsolate(
nullptr, // child isolate preparer
isolate_create_callback, // isolate create callback
isolate_shutdown_callback // isolate shutdown callback
));
)));
std::tie(vm_isolate, embedder_isolate) = CreateDartVMAndEmbedderObjectPair(
advisory_script_uri.c_str(), // advisory script URI
@@ -702,7 +702,7 @@ DartIsolate::CreateDartVMAndEmbedderObjectPair(
// Copy most fields from the parent to the child.
embedder_isolate = std::make_unique<std::shared_ptr<DartIsolate>>(
std::make_shared<DartIsolate>(
std::shared_ptr<DartIsolate>(new DartIsolate(
(*raw_embedder_isolate)->GetSettings(), // settings
(*raw_embedder_isolate)->GetIsolateSnapshot(), // isolate_snapshot
(*raw_embedder_isolate)->GetSharedSnapshot(), // shared_snapshot
@@ -714,7 +714,7 @@ DartIsolate::CreateDartVMAndEmbedderObjectPair(
(*raw_embedder_isolate)->child_isolate_preparer_, // preparer
(*raw_embedder_isolate)->isolate_create_callback_, // on create
(*raw_embedder_isolate)->isolate_shutdown_callback_ // on shutdown
)
))
);
}

View File

@@ -54,18 +54,6 @@ class DartIsolate : public UIDartState {
fml::closure isolate_create_callback,
fml::closure isolate_shutdown_callback);
DartIsolate(const Settings& settings,
fml::RefPtr<const DartSnapshot> isolate_snapshot,
fml::RefPtr<const DartSnapshot> shared_snapshot,
TaskRunners task_runners,
fml::WeakPtr<IOManager> io_manager,
fml::WeakPtr<ImageDecoder> image_decoder,
std::string advisory_script_uri,
std::string advisory_script_entrypoint,
ChildIsolatePreparer child_isolate_preparer,
fml::closure isolate_create_callback,
fml::closure isolate_shutdown_callback);
~DartIsolate() override;
const Settings& GetSettings() const;
@@ -139,6 +127,18 @@ class DartIsolate : public UIDartState {
const fml::closure isolate_create_callback_;
const fml::closure isolate_shutdown_callback_;
DartIsolate(const Settings& settings,
fml::RefPtr<const DartSnapshot> isolate_snapshot,
fml::RefPtr<const DartSnapshot> shared_snapshot,
TaskRunners task_runners,
fml::WeakPtr<IOManager> io_manager,
fml::WeakPtr<ImageDecoder> image_decoder,
std::string advisory_script_uri,
std::string advisory_script_entrypoint,
ChildIsolatePreparer child_isolate_preparer,
fml::closure isolate_create_callback,
fml::closure isolate_shutdown_callback);
FML_WARN_UNUSED_RESULT bool Initialize(Dart_Isolate isolate,
bool is_root_isolate);