99#include < pthread.h>
1010#include < sys/resource.h>
1111#include < sys/time.h>
12- #include < cstddef>
1312#include < memory>
1413#include < optional>
1514
@@ -150,7 +149,9 @@ AndroidShellHolder::AndroidShellHolder(
150149 shell_(std::move(shell)) {
151150 FML_DCHECK (jni_facade);
152151 FML_DCHECK (shell_);
152+ FML_DCHECK (shell_->IsSetup ());
153153 FML_DCHECK (platform_view_);
154+ FML_DCHECK (thread_host_);
154155 is_valid_ = shell_ != nullptr ;
155156}
156157
@@ -171,10 +172,16 @@ std::unique_ptr<AndroidShellHolder> AndroidShellHolder::Spawn(
171172 std::shared_ptr<PlatformViewAndroidJNI> jni_facade,
172173 std::string entrypoint,
173174 std::string libraryUrl) const {
174- FML_DCHECK (shell_) << " A new Shell can only be spawned if the current Shell "
175- " is properly constructed" ;
175+ FML_DCHECK (shell_ && shell_->IsSetup ())
176+ << " A new Shell can only be spawned "
177+ " if the current Shell is properly constructed" ;
176178
179+ // Pull out the new PlatformViewAndroid from the new Shell to feed to it to
180+ // the new AndroidShellHolder.
177181 fml::WeakPtr<PlatformViewAndroid> weak_platform_view;
182+
183+ // Take out the old AndroidContext to reuse inside the PlatformViewAndroid
184+ // of the new Shell.
178185 PlatformViewAndroid* android_platform_view = platform_view_.get ();
179186 // There's some indirection with platform_view_ being a weak pointer but
180187 // we just checked that the shell_ exists above and a valid shell is the
@@ -192,8 +199,7 @@ std::unique_ptr<AndroidShellHolder> AndroidShellHolder::Spawn(
192199 shell, // delegate
193200 shell.GetTaskRunners (), // task runners
194201 jni_facade, // JNI interop
195- shell.GetSettings ()
196- .enable_software_rendering // use software rendering
202+ android_context // Android context
197203 );
198204 weak_platform_view = platform_view_android->GetWeakPtr ();
199205 shell.OnDisplayUpdates (DisplayUpdateType::kStartup ,
@@ -205,9 +211,12 @@ std::unique_ptr<AndroidShellHolder> AndroidShellHolder::Spawn(
205211 return std::make_unique<Rasterizer>(shell);
206212 };
207213
208- FML_DLOG (ERROR) << " Spawned run" ;
214+ // TODO(xster): could be worth tracing this to investigate whether
215+ // the IsolateConfiguration could be cached somewhere.
209216 auto config = BuildRunConfiguration (asset_manager_, entrypoint, libraryUrl);
210217 if (!config) {
218+ // If the RunConfiguration was null, the kernel blob wasn't readable.
219+ // Fail the whole thing.
211220 return nullptr ;
212221 }
213222
0 commit comments