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 RUNTIME_BIN_VMSERVICE_IMPL_H_ | 5 #ifndef RUNTIME_BIN_VMSERVICE_IMPL_H_ |
6 #define RUNTIME_BIN_VMSERVICE_IMPL_H_ | 6 #define RUNTIME_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 LoadForGenPrecompiled(); | 17 static bool LoadForGenPrecompiled(); |
18 | 18 |
19 static bool Setup(const char* server_ip, | 19 static bool Setup(const char* server_ip, |
20 intptr_t server_port, | 20 intptr_t server_port, |
21 bool running_precompiled, | 21 bool running_precompiled, |
22 bool dev_mode_server); | 22 bool dev_mode_server); |
23 | 23 |
24 // Error message if startup failed. | 24 // Error message if startup failed. |
25 static const char* GetErrorMessage(); | 25 static const char* GetErrorMessage(); |
26 | 26 |
27 // HTTP server's IP. | 27 // HTTP Server's address. |
28 static const char* GetServerIP() { | 28 static const char* GetServerAddress() { |
29 return &server_ip_[0]; | 29 return &server_uri_[0]; |
30 } | |
31 | |
32 // HTTP server's port. | |
33 static intptr_t GetServerPort() { | |
34 return server_port_; | |
35 } | 30 } |
36 | 31 |
37 private: | 32 private: |
38 static const intptr_t kServerIpStringBufferSize = 256; | 33 static const intptr_t kServerUriStringBufferSize = 1024; |
39 friend void NotifyServerState(Dart_NativeArguments args); | 34 friend void NotifyServerState(Dart_NativeArguments args); |
40 | 35 |
41 static void SetServerIPAndPort(const char* ip, intptr_t port); | 36 static void SetServerAddress(const char* server_uri_); |
42 static Dart_Handle GetSource(const char* name); | 37 static Dart_Handle GetSource(const char* name); |
43 static Dart_Handle LoadScript(const char* name); | 38 static Dart_Handle LoadScript(const char* name); |
44 static Dart_Handle LoadLibrary(const char* name); | 39 static Dart_Handle LoadLibrary(const char* name); |
45 static Dart_Handle LoadSource(Dart_Handle library, const char* name); | 40 static Dart_Handle LoadSource(Dart_Handle library, const char* name); |
46 static Dart_Handle LoadResources(Dart_Handle library); | 41 static Dart_Handle LoadResources(Dart_Handle library); |
47 static Dart_Handle LoadResource(Dart_Handle library, const char* name); | 42 static Dart_Handle LoadResource(Dart_Handle library, const char* name); |
48 static Dart_Handle LibraryTagHandler(Dart_LibraryTag tag, Dart_Handle library, | 43 static Dart_Handle LibraryTagHandler(Dart_LibraryTag tag, Dart_Handle library, |
49 Dart_Handle url); | 44 Dart_Handle url); |
50 | 45 |
51 static const char* error_msg_; | 46 static const char* error_msg_; |
52 static char server_ip_[kServerIpStringBufferSize]; | 47 static char server_uri_[kServerUriStringBufferSize]; |
53 static intptr_t server_port_; | |
54 | 48 |
55 DISALLOW_ALLOCATION(); | 49 DISALLOW_ALLOCATION(); |
56 DISALLOW_IMPLICIT_CONSTRUCTORS(VmService); | 50 DISALLOW_IMPLICIT_CONSTRUCTORS(VmService); |
57 }; | 51 }; |
58 | 52 |
59 } // namespace bin | 53 } // namespace bin |
60 } // namespace dart | 54 } // namespace dart |
61 | 55 |
62 #endif // RUNTIME_BIN_VMSERVICE_IMPL_H_ | 56 #endif // RUNTIME_BIN_VMSERVICE_IMPL_H_ |
OLD | NEW |