OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #ifndef RUNTIME_VM_KERNEL_ISOLATE_H_ | 5 #ifndef RUNTIME_VM_KERNEL_ISOLATE_H_ |
6 #define RUNTIME_VM_KERNEL_ISOLATE_H_ | 6 #define RUNTIME_VM_KERNEL_ISOLATE_H_ |
7 | 7 |
8 #if !defined(DART_PRECOMPILED_RUNTIME) | 8 #if !defined(DART_PRECOMPILED_RUNTIME) |
9 | 9 |
10 #include "include/dart_api.h" | 10 #include "include/dart_api.h" |
11 | 11 |
12 #include "vm/allocation.h" | 12 #include "vm/allocation.h" |
13 #include "vm/dart.h" | 13 #include "vm/dart.h" |
14 #include "vm/os_thread.h" | 14 #include "vm/os_thread.h" |
15 | 15 |
16 namespace dart { | 16 namespace dart { |
17 | 17 |
18 class KernelIsolate : public AllStatic { | 18 class KernelIsolate : public AllStatic { |
19 public: | 19 public: |
20 static const char* kName; | 20 static const char* kName; |
21 | 21 |
22 static void Run(); | 22 static void Run(); |
23 | 23 |
24 static bool Exists(); | 24 static bool Exists(); |
25 static bool IsRunning(); | 25 static bool IsRunning(); |
26 static bool IsKernelIsolate(const Isolate* isolate); | 26 static bool IsKernelIsolate(const Isolate* isolate); |
27 static Dart_Port WaitForKernelPort(); | 27 static Dart_Port WaitForKernelPort(); |
28 static Dart_Port KernelPort() { return kernel_port_; } | 28 static Dart_Port KernelPort() { return kernel_port_; } |
29 | 29 |
30 static Dart_KernelCompilationResult CompileToKernel( | 30 static Dart_KernelCompilationResult CompileToKernel(const char* script_uri); |
31 const char* script_uri, | |
32 int source_files_count = 0, | |
33 Dart_SourceFile source_files[] = NULL); | |
34 | 31 |
35 protected: | 32 protected: |
36 static Monitor* monitor_; | 33 static Monitor* monitor_; |
37 static Dart_IsolateCreateCallback create_callback_; | 34 static Dart_IsolateCreateCallback create_callback_; |
38 | 35 |
39 static void InitCallback(Isolate* I); | 36 static void InitCallback(Isolate* I); |
40 static void SetKernelIsolate(Isolate* isolate); | 37 static void SetKernelIsolate(Isolate* isolate); |
41 static void SetLoadPort(Dart_Port port); | 38 static void SetLoadPort(Dart_Port port); |
42 static void FinishedInitializing(); | 39 static void FinishedInitializing(); |
43 | 40 |
44 static Dart_Port kernel_port_; | 41 static Dart_Port kernel_port_; |
45 static Isolate* isolate_; | 42 static Isolate* isolate_; |
46 static bool initializing_; | 43 static bool initializing_; |
47 | 44 |
48 static Dart_IsolateCreateCallback create_callback() { | 45 static Dart_IsolateCreateCallback create_callback() { |
49 return create_callback_; | 46 return create_callback_; |
50 } | 47 } |
51 | 48 |
52 friend class Dart; | 49 friend class Dart; |
53 friend class RunKernelTask; | 50 friend class RunKernelTask; |
54 }; | 51 }; |
55 | 52 |
56 } // namespace dart | 53 } // namespace dart |
57 | 54 |
58 #endif // DART_PRECOMPILED_RUNTIME | 55 #endif // DART_PRECOMPILED_RUNTIME |
59 | 56 |
60 #endif // RUNTIME_VM_KERNEL_ISOLATE_H_ | 57 #endif // RUNTIME_VM_KERNEL_ISOLATE_H_ |
OLD | NEW |