OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 BIN_VMSERVICE_IMPL_H_ | 5 #ifndef BIN_VMSERVICE_IMPL_H_ |
6 #define BIN_VMSERVICE_IMPL_H_ | 6 #define BIN_VMSERVICE_IMPL_H_ |
7 | 7 |
8 #include "include/dart_api.h" | 8 #include "include/dart_api.h" |
9 | 9 |
10 #include "platform/globals.h" | 10 #include "platform/globals.h" |
11 | 11 |
12 namespace dart { | 12 namespace dart { |
13 namespace bin { | 13 namespace bin { |
14 | 14 |
15 class VmService { | 15 class VmService { |
16 public: | 16 public: |
17 static bool Setup(const char* server_ip, intptr_t server_port); | 17 static bool LoadForGenPrecompiled(); |
| 18 |
| 19 static bool Setup(const char* server_ip, |
| 20 intptr_t server_port, |
| 21 bool running_precompiled); |
18 | 22 |
19 // Error message if startup failed. | 23 // Error message if startup failed. |
20 static const char* GetErrorMessage(); | 24 static const char* GetErrorMessage(); |
21 | 25 |
22 // HTTP server's IP. | 26 // HTTP server's IP. |
23 static const char* GetServerIP() { | 27 static const char* GetServerIP() { |
24 return &server_ip_[0]; | 28 return &server_ip_[0]; |
25 } | 29 } |
26 | 30 |
27 // HTTP server's port. | 31 // HTTP server's port. |
28 static intptr_t GetServerPort() { | 32 static intptr_t GetServerPort() { |
29 return server_port_; | 33 return server_port_; |
30 } | 34 } |
31 | 35 |
32 private: | 36 private: |
33 static const intptr_t kServerIpStringBufferSize = 256; | 37 static const intptr_t kServerIpStringBufferSize = 256; |
34 friend void TriggerResourceLoad(Dart_NativeArguments args); | 38 friend void TriggerResourceLoad(Dart_NativeArguments args); |
35 friend void NotifyServerState(Dart_NativeArguments args); | 39 friend void NotifyServerState(Dart_NativeArguments args); |
36 | 40 |
37 static void SetServerIPAndPort(const char* ip, intptr_t port); | 41 static void SetServerIPAndPort(const char* ip, intptr_t port); |
38 static Dart_Handle GetSource(const char* name); | 42 static Dart_Handle GetSource(const char* name); |
39 static Dart_Handle LoadScript(const char* name); | 43 static Dart_Handle LoadScript(const char* name); |
| 44 static Dart_Handle LoadLibrary(const char* name); |
40 static Dart_Handle LoadSource(Dart_Handle library, const char* name); | 45 static Dart_Handle LoadSource(Dart_Handle library, const char* name); |
41 static Dart_Handle LoadResources(Dart_Handle library); | 46 static Dart_Handle LoadResources(Dart_Handle library); |
42 static Dart_Handle LoadResource(Dart_Handle library, const char* name); | 47 static Dart_Handle LoadResource(Dart_Handle library, const char* name); |
43 static Dart_Handle LibraryTagHandler(Dart_LibraryTag tag, Dart_Handle library, | 48 static Dart_Handle LibraryTagHandler(Dart_LibraryTag tag, Dart_Handle library, |
44 Dart_Handle url); | 49 Dart_Handle url); |
45 | 50 |
46 static const char* error_msg_; | 51 static const char* error_msg_; |
47 static char server_ip_[kServerIpStringBufferSize]; | 52 static char server_ip_[kServerIpStringBufferSize]; |
48 static intptr_t server_port_; | 53 static intptr_t server_port_; |
49 | 54 |
50 DISALLOW_ALLOCATION(); | 55 DISALLOW_ALLOCATION(); |
51 DISALLOW_IMPLICIT_CONSTRUCTORS(VmService); | 56 DISALLOW_IMPLICIT_CONSTRUCTORS(VmService); |
52 }; | 57 }; |
53 | 58 |
54 | 59 |
55 } // namespace bin | 60 } // namespace bin |
56 } // namespace dart | 61 } // namespace dart |
57 | 62 |
58 #endif // BIN_VMSERVICE_IMPL_H_ | 63 #endif // BIN_VMSERVICE_IMPL_H_ |
OLD | NEW |