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

Side by Side Diff: sky/tools/packager/main.cc

Issue 1211253004: Add MineDigger.apk that works offline (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: one more examples 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 unified diff | Download patch
« no previous file with comments | « sky/shell/ui/engine.cc ('k') | sky/tools/sky_packager.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <iostream> 5 #include <iostream>
6 6
7 #include "base/at_exit.h" 7 #include "base/at_exit.h"
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 13 matching lines...) Expand all
24 << " <sky-app>" << std::endl; 24 << " <sky-app>" << std::endl;
25 } 25 }
26 26
27 void WriteSnapshot(base::FilePath path) { 27 void WriteSnapshot(base::FilePath path) {
28 uint8_t* buffer; 28 uint8_t* buffer;
29 intptr_t size; 29 intptr_t size;
30 CHECK(!LogIfError(Dart_CreateScriptSnapshot(&buffer, &size))); 30 CHECK(!LogIfError(Dart_CreateScriptSnapshot(&buffer, &size)));
31 31
32 CHECK_EQ(base::WriteFile(path, reinterpret_cast<const char*>(buffer), size), 32 CHECK_EQ(base::WriteFile(path, reinterpret_cast<const char*>(buffer), size),
33 size); 33 size);
34
35 std::cout << "Successfully wrote snapshot to " << path.LossyDisplayName()
36 << " (" << size << " bytes)." << std::endl;
37 } 34 }
38 35
39 int main(int argc, const char* argv[]) { 36 int main(int argc, const char* argv[]) {
40 base::AtExitManager exit_manager; 37 base::AtExitManager exit_manager;
41 base::EnableTerminationOnHeapCorruption(); 38 base::EnableTerminationOnHeapCorruption();
42 base::CommandLine::Init(argc, argv); 39 base::CommandLine::Init(argc, argv);
43 40
44 const base::CommandLine& command_line = 41 const base::CommandLine& command_line =
45 *base::CommandLine::ForCurrentProcess(); 42 *base::CommandLine::ForCurrentProcess();
46 43
(...skipping 14 matching lines...) Expand all
61 CHECK(args.size() == 1); 58 CHECK(args.size() == 1);
62 LoadScript(args[0]); 59 LoadScript(args[0]);
63 60
64 CHECK(!LogIfError(Dart_FinalizeLoading(true))); 61 CHECK(!LogIfError(Dart_FinalizeLoading(true)));
65 62
66 CHECK(command_line.HasSwitch(switches::kSnapshot)) << "Need --snapshot"; 63 CHECK(command_line.HasSwitch(switches::kSnapshot)) << "Need --snapshot";
67 WriteSnapshot(command_line.GetSwitchValuePath(switches::kSnapshot)); 64 WriteSnapshot(command_line.GetSwitchValuePath(switches::kSnapshot));
68 65
69 return 0; 66 return 0;
70 } 67 }
OLDNEW
« no previous file with comments | « sky/shell/ui/engine.cc ('k') | sky/tools/sky_packager.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698