mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Merge pull request #2117 from abarth/load_flx
Add --flx flag to load FLX files
This commit is contained in:
commit
4ef262df1b
@ -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);
|
||||
|
||||
@ -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());
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -24,7 +24,6 @@ class TestRunner {
|
||||
struct TestDescriptor {
|
||||
std::string path;
|
||||
std::string package_root;
|
||||
bool is_snapshot = false;
|
||||
};
|
||||
|
||||
void Run(const TestDescriptor& test);
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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));
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user