diff --git a/sky/engine/core/script/dart_init.cc b/sky/engine/core/script/dart_init.cc index d087c7ca5807320850dcc1fa0656512f50771dd3..5d399e6d5266286391c071a444d5ffdcceea338a 100644 --- a/sky/engine/core/script/dart_init.cc +++ b/sky/engine/core/script/dart_init.cc @@ -160,9 +160,9 @@ Dart_Isolate IsolateCreateCallback(const char* script_uri, if (!IsRunningPrecompiledCode()) { CHECK(base::StartsWith(script_uri, kFileUriPrefix, base::CompareCase::SENSITIVE)); - base::FilePath flx_path(script_uri + strlen(kFileUriPrefix)); + base::FilePath bundle_path(script_uri + strlen(kFileUriPrefix)); scoped_refptr zip_asset_bundle( - new ZipAssetBundle(flx_path, nullptr)); + new ZipAssetBundle(bundle_path, nullptr)); CHECK(zip_asset_bundle->GetAsBuffer(kSnapshotAssetKey, &snapshot_data)); } diff --git a/sky/services/engine/sky_engine.mojom b/sky/services/engine/sky_engine.mojom index 48ac724c768ffdecd0b2fb6e2482820409101654..009d6f862026a8287bbecfe964220817cdeb6e0a 100644 --- a/sky/services/engine/sky_engine.mojom +++ b/sky/services/engine/sky_engine.mojom @@ -48,11 +48,11 @@ interface SkyEngine { PushRoute(string route); PopRoute(); - RunFromFile(string main, string package_root, string bundle); - RunFromPrecompiledSnapshot(string path); - RunFromBundle(string path); + RunFromFile(string main, string package_root, string bundle_path); + RunFromPrecompiledSnapshot(string bundle_path); + RunFromBundle(string script_uri, string bundle_path); // Run the app from a bundle, but obtain the snapshot from snapshot_path // instead of using the snapshot within the bundle. - RunFromBundleAndSnapshot(string bundle_path, string snapshot_path); + RunFromBundleAndSnapshot(string script_uri, string bundle_path, string snapshot_path); }; diff --git a/sky/shell/platform/android/org/domokit/sky/shell/PlatformViewAndroid.java b/sky/shell/platform/android/org/domokit/sky/shell/PlatformViewAndroid.java index a6a18b60d13606ac7cd3937839fd17ca7acf03f4..35c8716631ab0d88254b29a9f135fd514ecd7381 100644 --- a/sky/shell/platform/android/org/domokit/sky/shell/PlatformViewAndroid.java +++ b/sky/shell/platform/android/org/domokit/sky/shell/PlatformViewAndroid.java @@ -366,10 +366,11 @@ public class PlatformViewAndroid extends SurfaceView resetAccessibilityTree(); + String scriptUri = "file://" + bundlePath; if (snapshotPath != null) { - mSkyEngine.runFromBundleAndSnapshot(bundlePath, snapshotPath); + mSkyEngine.runFromBundleAndSnapshot(scriptUri, bundlePath, snapshotPath); } else { - mSkyEngine.runFromBundle(bundlePath); + mSkyEngine.runFromBundle(scriptUri, bundlePath); } } diff --git a/sky/shell/platform/mac/sky_window.mm b/sky/shell/platform/mac/sky_window.mm index bcbbba589ff78dd185c7429ff7f5d177125ed917..577f322a5400757e08579ed100bf801be4265025 100644 --- a/sky/shell/platform/mac/sky_window.mm +++ b/sky/shell/platform/mac/sky_window.mm @@ -93,10 +93,11 @@ static inline pointer::PointerType EventTypeFromNSEventPhase( base::CommandLine& command_line = *base::CommandLine::ForCurrentProcess(); - std::string flx = + std::string bundle_path = command_line.GetSwitchValueASCII(sky::shell::switches::kFLX); - if (!flx.empty()) { - _sky_engine->RunFromBundle(flx); + if (!bundle_path.empty()) { + std::string script_uri = std::string("file://") + bundle_path; + _sky_engine->RunFromBundle(script_uri, bundle_path); return; } diff --git a/sky/shell/platform/mojo/application_impl.cc b/sky/shell/platform/mojo/application_impl.cc index a656d06376782494934cd94a0fed74cad5f0c399..19c0fbd821967796a09a22eedc4ce364039c9c55 100644 --- a/sky/shell/platform/mojo/application_impl.cc +++ b/sky/shell/platform/mojo/application_impl.cc @@ -20,8 +20,8 @@ ApplicationImpl::ApplicationImpl( } ApplicationImpl::~ApplicationImpl() { - if (!flx_path_.empty()) { - base::DeleteFile(flx_path_, false); + if (!bundle_path_.empty()) { + base::DeleteFile(bundle_path_, false); } } @@ -82,18 +82,18 @@ void ApplicationImpl::CreateView( services->services_provided_to_embedder = outgoing_services.Pass(); ViewImpl* view = new ViewImpl(view_owner.Pass(), services.Pass(), url_); - view->Run(flx_path_); + view->Run(bundle_path_); } void ApplicationImpl::UnpackInitialResponse(mojo::Shell* shell) { DCHECK(initial_response_); - DCHECK(flx_path_.empty()); + DCHECK(bundle_path_.empty()); - if (!base::CreateTemporaryFile(&flx_path_)) { + if (!base::CreateTemporaryFile(&bundle_path_)) { LOG(ERROR) << "Unable to create temporary file"; return; } - FILE* temp_file = base::OpenFile(flx_path_, "w"); + FILE* temp_file = base::OpenFile(bundle_path_, "w"); if (temp_file == nullptr) { LOG(ERROR) << "Unable to open temporary file"; return; diff --git a/sky/shell/platform/mojo/application_impl.h b/sky/shell/platform/mojo/application_impl.h index 494792698932574d178aaaad80f9294c3f6f7f93..e15f23280730d8a5239f6dfe68b07af1e93c1889 100644 --- a/sky/shell/platform/mojo/application_impl.h +++ b/sky/shell/platform/mojo/application_impl.h @@ -66,7 +66,7 @@ class ApplicationImpl : public mojo::Application, mojo::BindingSet view_provider_bindings_; std::string url_; mojo::ShellPtr shell_; - base::FilePath flx_path_; + base::FilePath bundle_path_; }; } // namespace shell diff --git a/sky/shell/platform/mojo/view_impl.cc b/sky/shell/platform/mojo/view_impl.cc index 02546e4738e9c79a7bb17a09a2c45e2ec246dd2e..8ff54cafb8815252c0ce65a404eae30cfe6732d4 100644 --- a/sky/shell/platform/mojo/view_impl.cc +++ b/sky/shell/platform/mojo/view_impl.cc @@ -57,8 +57,8 @@ ViewImpl::ViewImpl(mojo::InterfaceRequest view_owner, ViewImpl::~ViewImpl() { } -void ViewImpl::Run(base::FilePath flx_path) { - engine_->RunFromBundle(mojo::String(flx_path.value())); +void ViewImpl::Run(base::FilePath bundle_path) { + engine_->RunFromBundle(url_, bundle_path.value()); } void ViewImpl::OnLayout(mojo::ui::ViewLayoutParamsPtr layout_params, diff --git a/sky/shell/platform/mojo/view_impl.h b/sky/shell/platform/mojo/view_impl.h index 05586d37153296566a147f6ba6257aa5af370ef2..7c9c7201836d91b0f64b3bdbe49492ba20d80e07 100644 --- a/sky/shell/platform/mojo/view_impl.h +++ b/sky/shell/platform/mojo/view_impl.h @@ -28,7 +28,7 @@ class ViewImpl : public mojo::ui::ViewListener, const std::string& url); ~ViewImpl() override; - void Run(base::FilePath flx_path); + void Run(base::FilePath bundle_path); private: // mojo::ui::ViewListener diff --git a/sky/shell/ui/engine.cc b/sky/shell/ui/engine.cc index 090d7f332a521da23348c418c01b10392a406c15..6d5fc338cea1db1db9eb9fc814ad1b7e8ad68706 100644 --- a/sky/shell/ui/engine.cc +++ b/sky/shell/ui/engine.cc @@ -176,10 +176,9 @@ void Engine::RunFromLibrary(const std::string& name) { } void Engine::RunFromSnapshotStream( - const std::string& bundle_path, + const std::string& script_uri, mojo::ScopedDataPipeConsumerHandle snapshot) { TRACE_EVENT0("flutter", "Engine::RunFromSnapshotStream"); - std::string script_uri = std::string("file://") + bundle_path; sky_view_ = blink::SkyView::Create(this); sky_view_->CreateView(script_uri); sky_view_->RunFromSnapshot(snapshot.Pass()); @@ -223,7 +222,8 @@ void Engine::RunFromFile(const mojo::String& main, RunFromLibrary(main); } -void Engine::RunFromBundle(const mojo::String& path) { +void Engine::RunFromBundle(const mojo::String& script_uri, + const mojo::String& path) { TRACE_EVENT0("flutter", "Engine::RunFromBundle"); ConfigureZipAssetBundle(path); @@ -231,10 +231,11 @@ void Engine::RunFromBundle(const mojo::String& path) { root_bundle_->GetAsStream( blink::kSnapshotAssetKey, base::Bind(&Engine::RunFromSnapshotStream, weak_factory_.GetWeakPtr(), - std::string{path})); + script_uri)); } -void Engine::RunFromBundleAndSnapshot(const mojo::String& bundle_path, +void Engine::RunFromBundleAndSnapshot(const mojo::String& script_uri, + const mojo::String& bundle_path, const mojo::String& snapshot_path) { TRACE_EVENT0("flutter", "Engine::RunFromBundleAndSnapshot"); @@ -247,7 +248,7 @@ void Engine::RunFromBundleAndSnapshot(const mojo::String& bundle_path, root_bundle_->GetAsStream( blink::kSnapshotAssetKey, base::Bind(&Engine::RunFromSnapshotStream, weak_factory_.GetWeakPtr(), - std::string{bundle_path})); + script_uri)); } void Engine::PushRoute(const mojo::String& route) { diff --git a/sky/shell/ui/engine.h b/sky/shell/ui/engine.h index 3d13cda87380e3b481a1272843d8906869b56dcd..4004f383ef76227fee299bc312ca102b9371b775 100644 --- a/sky/shell/ui/engine.h +++ b/sky/shell/ui/engine.h @@ -74,8 +74,10 @@ class Engine : public UIDelegate, const mojo::String& package_root, const mojo::String& bundle) override; void RunFromPrecompiledSnapshot(const mojo::String& bundle_path) override; - void RunFromBundle(const mojo::String& path) override; - void RunFromBundleAndSnapshot(const mojo::String& bundle_path, + void RunFromBundle(const mojo::String& script_uri, + const mojo::String& bundle_path) override; + void RunFromBundleAndSnapshot(const mojo::String& script_uri, + const mojo::String& bundle_path, const mojo::String& snapshot_path) override; void PushRoute(const mojo::String& route) override; void PopRoute() override; @@ -92,7 +94,7 @@ class Engine : public UIDelegate, mojo::InterfaceRequest request); void RunFromLibrary(const std::string& name); - void RunFromSnapshotStream(const std::string& name, + void RunFromSnapshotStream(const std::string& script_uri, mojo::ScopedDataPipeConsumerHandle snapshot); void SetupAssetBundle(const mojo::String& bundle_path);