Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1256)

Unified Diff: sky/tools/packager/main.cc

Issue 1212623002: Support snapshots in sky_shell (again) (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/tools/packager/loader.cc ('k') | sky/tools/packager/switches.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/tools/packager/main.cc
diff --git a/sky/tools/packager/main.cc b/sky/tools/packager/main.cc
index 7b5e1f3f2b2f2d43eecd0f5a60fd717905b3760e..fcfd111cae5e2ec68f13897aa222d6bf1af4deb8 100644
--- a/sky/tools/packager/main.cc
+++ b/sky/tools/packager/main.cc
@@ -18,6 +18,12 @@
#include "sky/tools/packager/switches.h"
#include "sky/tools/packager/vm.h"
+void Usage() {
+ std::cerr << "Usage: sky_packager"
+ << " --" << switches::kPackageRoot << " --" << switches::kSnapshot
+ << " <sky-app>" << std::endl;
+}
+
void WriteSnapshot(base::FilePath path) {
uint8_t* buffer;
intptr_t size;
@@ -35,13 +41,19 @@ int main(int argc, const char* argv[]) {
base::EnableTerminationOnHeapCorruption();
base::CommandLine::Init(argc, argv);
+ const base::CommandLine& command_line =
+ *base::CommandLine::ForCurrentProcess();
+
+ if (command_line.HasSwitch(switches::kHelp) ||
+ command_line.GetArgs().empty()) {
+ Usage();
+ return 0;
+ }
+
InitDartVM();
Dart_Isolate isolate = CreateDartIsolate();
CHECK(isolate);
- const base::CommandLine& command_line =
- *base::CommandLine::ForCurrentProcess();
-
DartIsolateScope scope(isolate);
DartApiScope api_scope;
@@ -51,8 +63,8 @@ int main(int argc, const char* argv[]) {
CHECK(!LogIfError(Dart_FinalizeLoading(true)));
- CHECK(command_line.HasSwitch(kSnapshot)) << "Need --snapshot";
- WriteSnapshot(command_line.GetSwitchValuePath(kSnapshot));
+ CHECK(command_line.HasSwitch(switches::kSnapshot)) << "Need --snapshot";
+ WriteSnapshot(command_line.GetSwitchValuePath(switches::kSnapshot));
return 0;
}
« no previous file with comments | « sky/tools/packager/loader.cc ('k') | sky/tools/packager/switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698