OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef MOJO_DART_EMBEDDER_DART_CONTROLLER_H_ | 5 #ifndef MOJO_DART_EMBEDDER_DART_CONTROLLER_H_ |
6 #define MOJO_DART_EMBEDDER_DART_CONTROLLER_H_ | 6 #define MOJO_DART_EMBEDDER_DART_CONTROLLER_H_ |
7 | 7 |
8 #include <unordered_set> | 8 #include <unordered_set> |
9 | 9 |
10 #include "base/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 virtual MojoHandle ConnectToService(ServiceId service_id) = 0; | 92 virtual MojoHandle ConnectToService(ServiceId service_id) = 0; |
93 }; | 93 }; |
94 | 94 |
95 class DartController { | 95 class DartController { |
96 public: | 96 public: |
97 // Initializes the Dart VM, and starts up Dart's handle watcher. | 97 // Initializes the Dart VM, and starts up Dart's handle watcher. |
98 // If strict_compilation is true, the VM runs scripts with assertions and | 98 // If strict_compilation is true, the VM runs scripts with assertions and |
99 // type checking enabled. | 99 // type checking enabled. |
100 static bool Initialize(DartControllerServiceConnector* service_connector, | 100 static bool Initialize(DartControllerServiceConnector* service_connector, |
101 bool strict_compilation, | 101 bool strict_compilation, |
102 bool observatory_enabled, | 102 bool enable_observatory, |
| 103 bool enable_dart_timeline, |
103 const char** extra_args, | 104 const char** extra_args, |
104 int extra_args_count); | 105 int extra_args_count); |
105 | 106 |
106 // Setup an isolate to run the program specified in |config|. Invokes | 107 // Setup an isolate to run the program specified in |config|. Invokes |
107 // the main function and then exits. | 108 // the main function and then exits. |
108 static Dart_Isolate StartupIsolate(const DartControllerConfig& config); | 109 static Dart_Isolate StartupIsolate(const DartControllerConfig& config); |
109 | 110 |
110 // Cleanup |isolate|. | 111 // Cleanup |isolate|. |
111 static void ShutdownIsolate(Dart_Isolate isolate); | 112 static void ShutdownIsolate(Dart_Isolate isolate); |
112 | 113 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 Dart_IsolateFlags* flags, | 153 Dart_IsolateFlags* flags, |
153 IsolateCallbacks callbacks, | 154 IsolateCallbacks callbacks, |
154 std::string script_uri, | 155 std::string script_uri, |
155 std::string base_uri, | 156 std::string base_uri, |
156 const std::string& package_root, | 157 const std::string& package_root, |
157 char** error, | 158 char** error, |
158 bool use_network_loader, | 159 bool use_network_loader, |
159 bool use_dart_run_loop); | 160 bool use_dart_run_loop); |
160 | 161 |
161 static void InitVmIfNeeded(Dart_EntropySource entropy, | 162 static void InitVmIfNeeded(Dart_EntropySource entropy, |
| 163 bool enable_dart_timeline, |
162 const char** arguments, | 164 const char** arguments, |
163 int arguments_count); | 165 int arguments_count); |
164 | 166 |
165 static void BlockForServiceIsolate(); | 167 static void BlockForServiceIsolate(); |
166 static void BlockForServiceIsolateLocked(); | 168 static void BlockForServiceIsolateLocked(); |
167 | 169 |
168 static tonic::DartLibraryProvider* library_provider_; | 170 static tonic::DartLibraryProvider* library_provider_; |
169 static base::Lock lock_; | 171 static base::Lock lock_; |
170 static MojoHandle handle_watcher_producer_handle_; | 172 static MojoHandle handle_watcher_producer_handle_; |
171 static bool initialized_; | 173 static bool initialized_; |
172 static bool strict_compilation_; | 174 static bool strict_compilation_; |
173 static bool observatory_enabled_; | 175 static bool enable_observatory_; |
174 static bool service_isolate_running_; | 176 static bool service_isolate_running_; |
175 static bool service_isolate_spawned_; | 177 static bool service_isolate_spawned_; |
176 static DartControllerServiceConnector* service_connector_; | 178 static DartControllerServiceConnector* service_connector_; |
177 }; | 179 }; |
178 | 180 |
179 } // namespace dart | 181 } // namespace dart |
180 } // namespace mojo | 182 } // namespace mojo |
181 | 183 |
182 #endif // MOJO_DART_EMBEDDER_DART_CONTROLLER_H_ | 184 #endif // MOJO_DART_EMBEDDER_DART_CONTROLLER_H_ |
OLD | NEW |