OLD | NEW |
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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 | 54 |
55 const base::CommandLine& command_line = | 55 const base::CommandLine& command_line = |
56 *base::CommandLine::ForCurrentProcess(); | 56 *base::CommandLine::ForCurrentProcess(); |
57 | 57 |
58 if (command_line.HasSwitch(kHelp) || command_line.GetArgs().empty()) { | 58 if (command_line.HasSwitch(kHelp) || command_line.GetArgs().empty()) { |
59 Usage(); | 59 Usage(); |
60 return 0; | 60 return 0; |
61 } | 61 } |
62 | 62 |
63 // Initialize mojo. | 63 // Initialize mojo. |
64 mojo::embedder::Init( | 64 // TODO(vtl): Use make_unique when C++14 is available. |
65 make_scoped_ptr(new mojo::embedder::SimplePlatformSupport())); | 65 mojo::embedder::Init(std::unique_ptr<mojo::embedder::PlatformSupport>( |
| 66 new mojo::embedder::SimplePlatformSupport())); |
66 | 67 |
67 InitDartVM(); | 68 InitDartVM(); |
68 | 69 |
69 CHECK(command_line.HasSwitch(kPackageRoot)) << "Need --package-root"; | 70 CHECK(command_line.HasSwitch(kPackageRoot)) << "Need --package-root"; |
70 CHECK(command_line.HasSwitch(kSnapshot)) << "Need --snapshot"; | 71 CHECK(command_line.HasSwitch(kSnapshot)) << "Need --snapshot"; |
71 auto args = command_line.GetArgs(); | 72 auto args = command_line.GetArgs(); |
72 CHECK(args.size() == 1); | 73 CHECK(args.size() == 1); |
73 | 74 |
74 Dart_Isolate isolate = CreateDartIsolate(); | 75 Dart_Isolate isolate = CreateDartIsolate(); |
75 CHECK(isolate); | 76 CHECK(isolate); |
(...skipping 15 matching lines...) Expand all Loading... |
91 | 92 |
92 // Load script. | 93 // Load script. |
93 tonic::DartScriptLoaderSync::LoadScript(args[0], | 94 tonic::DartScriptLoaderSync::LoadScript(args[0], |
94 isolate_data->library_provider()); | 95 isolate_data->library_provider()); |
95 | 96 |
96 // Write snapshot. | 97 // Write snapshot. |
97 WriteSnapshot(command_line.GetSwitchValuePath(kSnapshot)); | 98 WriteSnapshot(command_line.GetSwitchValuePath(kSnapshot)); |
98 | 99 |
99 return 0; | 100 return 0; |
100 } | 101 } |
OLD | NEW |