From 68dfad8e9204f30abe5191df53cc660a7e8eb270 Mon Sep 17 00:00:00 2001 From: Adam Barth Date: Fri, 27 Nov 2015 22:19:38 -0800 Subject: [PATCH] Add --flx flag to load FLX files Also, remove the --snapshot flag because using FLX files is the path we're paving. --- sky/services/engine/sky_engine.mojom | 1 - .../android/org/domokit/sky/shell/SkyActivity.java | 5 ----- .../org/domokit/sky/shell/SkyApplication.java | 3 +-- sky/shell/platform/mac/sky_window.mm | 6 +++--- sky/shell/switches.cc | 4 ++-- sky/shell/switches.h | 8 ++++---- sky/shell/testing/test_runner.cc | 5 +---- sky/shell/testing/test_runner.h | 1 - sky/shell/testing/testing.cc | 14 ++++---------- sky/shell/ui/engine.cc | 5 ----- sky/shell/ui/engine.h | 1 - 11 files changed, 15 insertions(+), 38 deletions(-) diff --git a/sky/services/engine/sky_engine.mojom b/sky/services/engine/sky_engine.mojom index c80a9a37bfe..ecaafe9a9ce 100644 --- a/sky/services/engine/sky_engine.mojom +++ b/sky/services/engine/sky_engine.mojom @@ -43,7 +43,6 @@ interface SkyEngine { RunFromFile(string main, string package_root); RunFromPrecompiledSnapshot(string path); - RunFromSnapshot(string path); RunFromBundle(string path); RunFromAssetBundle(string url, mojo.asset_bundle.AssetBundle bundle); diff --git a/sky/shell/platform/android/org/domokit/sky/shell/SkyActivity.java b/sky/shell/platform/android/org/domokit/sky/shell/SkyActivity.java index 9fa0f4005d8..ffeeb80ff4a 100644 --- a/sky/shell/platform/android/org/domokit/sky/shell/SkyActivity.java +++ b/sky/shell/platform/android/org/domokit/sky/shell/SkyActivity.java @@ -117,11 +117,6 @@ public class SkyActivity extends Activity { return; } File dataDir = new File(PathUtils.getDataDirectory(this)); - File snapshot = new File(dataDir, SkyApplication.SNAPSHOT); - if (snapshot.exists()) { - mView.getEngine().runFromSnapshot(snapshot.getPath()); - return; - } File appBundle = new File(dataDir, SkyApplication.APP_BUNDLE); if (appBundle.exists()) { mView.getEngine().runFromBundle(appBundle.getPath()); diff --git a/sky/shell/platform/android/org/domokit/sky/shell/SkyApplication.java b/sky/shell/platform/android/org/domokit/sky/shell/SkyApplication.java index b8d59eb65f0..1dbf2983c2d 100644 --- a/sky/shell/platform/android/org/domokit/sky/shell/SkyApplication.java +++ b/sky/shell/platform/android/org/domokit/sky/shell/SkyApplication.java @@ -32,13 +32,12 @@ import org.domokit.vsync.VSyncProviderImpl; * state and initializations. */ public class SkyApplication extends BaseChromiumApplication { - static final String SNAPSHOT = "snapshot_blob.bin"; static final String APP_BUNDLE = "app.flx"; static final String MANIFEST = "flutter.yaml"; private static final String TAG = "SkyApplication"; private static final String PRIVATE_DATA_DIRECTORY_SUFFIX = "sky_shell"; - private static final String[] SKY_RESOURCES = {"icudtl.dat", SNAPSHOT, APP_BUNDLE, MANIFEST}; + private static final String[] SKY_RESOURCES = {"icudtl.dat", APP_BUNDLE, MANIFEST}; private ResourceExtractor mResourceExtractor; diff --git a/sky/shell/platform/mac/sky_window.mm b/sky/shell/platform/mac/sky_window.mm index cb295e92119..0b6dfb2fc72 100644 --- a/sky/shell/platform/mac/sky_window.mm +++ b/sky/shell/platform/mac/sky_window.mm @@ -87,9 +87,9 @@ static inline pointer::PointerType EventTypeFromNSEventPhase(NSEventPhase phase) base::CommandLine& command_line = *base::CommandLine::ForCurrentProcess(); - if (command_line.HasSwitch(sky::shell::switches::kSnapshot)) { - auto snapshot = command_line.GetSwitchValueASCII(sky::shell::switches::kSnapshot); - _sky_engine->RunFromSnapshot(snapshot); + std::string flx = command_line.GetSwitchValueASCII(sky::shell::switches::kFLX); + if (!flx.empty()) { + _sky_engine->RunFromBundle(flx); return; } diff --git a/sky/shell/switches.cc b/sky/shell/switches.cc index 2ef6545fb1d..7a6a062692e 100644 --- a/sky/shell/switches.cc +++ b/sky/shell/switches.cc @@ -11,17 +11,17 @@ namespace shell { namespace switches { const char kEnableCheckedMode[] = "enable-checked-mode"; +const char kFLX[] = "flx"; const char kHelp[] = "help"; const char kNonInteractive[] = "non-interactive"; const char kPackageRoot[] = "package-root"; -const char kSnapshot[] = "snapshot"; void PrintUsage(const std::string& executable_name) { std::cerr << "Usage: " << executable_name << " --" << kEnableCheckedMode << " --" << kNonInteractive + << " --" << kFLX << "=FLX" << " --" << kPackageRoot << "=PACKAGE_ROOT" - << " --" << kSnapshot << "=SNAPSHOT" << " [ MAIN_DART ]" << std::endl; } diff --git a/sky/shell/switches.h b/sky/shell/switches.h index e812e4d826a..10a9e256d09 100644 --- a/sky/shell/switches.h +++ b/sky/shell/switches.h @@ -11,11 +11,11 @@ namespace sky { namespace shell { namespace switches { -extern const char kHelp[]; -extern const char kPackageRoot[]; -extern const char kNonInteractive[]; -extern const char kSnapshot[]; extern const char kEnableCheckedMode[]; +extern const char kFLX[]; +extern const char kHelp[]; +extern const char kNonInteractive[]; +extern const char kPackageRoot[]; void PrintUsage(const std::string& executable_name); diff --git a/sky/shell/testing/test_runner.cc b/sky/shell/testing/test_runner.cc index 241ac3c7a51..eeaac0a3256 100644 --- a/sky/shell/testing/test_runner.cc +++ b/sky/shell/testing/test_runner.cc @@ -43,10 +43,7 @@ TestRunner& TestRunner::Shared() { } void TestRunner::Run(const TestDescriptor& test) { - if (test.is_snapshot) - sky_engine_->RunFromSnapshot(test.path); - else - sky_engine_->RunFromFile(test.path, test.package_root); + sky_engine_->RunFromFile(test.path, test.package_root); } } // namespace shell diff --git a/sky/shell/testing/test_runner.h b/sky/shell/testing/test_runner.h index 1f787491881..4d0b71923ec 100644 --- a/sky/shell/testing/test_runner.h +++ b/sky/shell/testing/test_runner.h @@ -24,7 +24,6 @@ class TestRunner { struct TestDescriptor { std::string path; std::string package_root; - bool is_snapshot = false; }; void Run(const TestDescriptor& test); diff --git a/sky/shell/testing/testing.cc b/sky/shell/testing/testing.cc index c40ea846be9..f80048c7baa 100644 --- a/sky/shell/testing/testing.cc +++ b/sky/shell/testing/testing.cc @@ -19,16 +19,10 @@ bool InitForTesting() { TestRunner::TestDescriptor test; test.package_root = command_line.GetSwitchValueASCII(switches::kPackageRoot); - - if (command_line.HasSwitch(switches::kSnapshot)) { - test.path = command_line.GetSwitchValueASCII(switches::kSnapshot); - test.is_snapshot = true; - } else { - auto args = command_line.GetArgs(); - if (args.empty()) - return false; - test.path = args[0]; - } + auto args = command_line.GetArgs(); + if (args.empty()) + return false; + test.path = args[0]; TestRunner::Shared().Run(test); return true; diff --git a/sky/shell/ui/engine.cc b/sky/shell/ui/engine.cc index ad446c80990..99d83cf056d 100644 --- a/sky/shell/ui/engine.cc +++ b/sky/shell/ui/engine.cc @@ -200,11 +200,6 @@ void Engine::RunFromFile(const mojo::String& main, RunFromLibrary(main); } -void Engine::RunFromSnapshot(const mojo::String& path) { - std::string path_str = path; - RunFromSnapshotStream(path_str, Fetch(base::FilePath(path_str))); -} - void Engine::RunFromBundle(const mojo::String& path) { AssetUnpackerJob* unpacker = new AssetUnpackerJob( mojo::GetProxy(&root_bundle_), base::WorkerPool::GetTaskRunner(true)); diff --git a/sky/shell/ui/engine.h b/sky/shell/ui/engine.h index cf70a029ea6..a680f9a7ace 100644 --- a/sky/shell/ui/engine.h +++ b/sky/shell/ui/engine.h @@ -66,7 +66,6 @@ class Engine : public UIDelegate, void RunFromFile(const mojo::String& main, const mojo::String& package_root) override; void RunFromPrecompiledSnapshot(const mojo::String& bundle_path) override; - void RunFromSnapshot(const mojo::String& path) override; void RunFromBundle(const mojo::String& path) override; void RunFromAssetBundle(const mojo::String& url, mojo::asset_bundle::AssetBundlePtr bundle) override;