Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(201)

Side by Side Diff: runtime/bin/vmservice_dartium.cc

Issue 2944303003: Support for IPV6 for observatory in Dartium. (Closed)
Patch Set: cleanup Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 #include "bin/vmservice_dartium.h" 5 #include "bin/vmservice_dartium.h"
6 6
7 #include "bin/builtin.h" 7 #include "bin/builtin.h"
8 #include "bin/dartutils.h" 8 #include "bin/dartutils.h"
9 #include "bin/eventhandler.h" 9 #include "bin/eventhandler.h"
10 #include "bin/platform.h" 10 #include "bin/platform.h"
11 #include "bin/thread.h" 11 #include "bin/thread.h"
12 #include "bin/utils.h" 12 #include "bin/utils.h"
13 #include "bin/vmservice_impl.h" 13 #include "bin/vmservice_impl.h"
14 #include "zlib/zlib.h" 14 #include "zlib/zlib.h"
15 15
16 namespace dart { 16 namespace dart {
17 namespace bin { 17 namespace bin {
18 18
19 #define CHECK_RESULT(result) \ 19 #define CHECK_RESULT(result) \
20 if (Dart_IsError(result)) { \ 20 if (Dart_IsError(result)) { \
21 fprintf(stderr, "CHECK_RESULT failed: %s", Dart_GetError(result)); \ 21 fprintf(stderr, "CHECK_RESULT failed: %s", Dart_GetError(result)); \
22 Dart_ExitScope(); \ 22 Dart_ExitScope(); \
23 Dart_ShutdownIsolate(); \ 23 Dart_ShutdownIsolate(); \
24 return 0; \ 24 return 0; \
25 } 25 }
26 26
27 static const char* DART_IPV6_ONLY_FLAG = "DART_IPV6_ONLY";
28 static const char* DEFAULT_VM_SERVICE_SERVER_IP_V6 = "localhost";
rmacnak 2017/06/20 21:24:06 Do you mean ::1? localhost could resolve to 127.0
terry 2017/06/20 21:39:01 Done.
29 static const char* DEFAULT_VM_SERVICE_SERVER_IP_V4 = "127.0.0.1";
30 static const int DEFAULT_VM_SERVICE_SERVER_PORT = 0;
27 31
28 static const char* DEFAULT_VM_SERVICE_SERVER_IP = "127.0.0.1"; 32 static int IsIpv6Only() {
rmacnak 2017/06/20 21:24:06 int -> bool
terry 2017/06/20 21:39:02 Done.
29 static const int DEFAULT_VM_SERVICE_SERVER_PORT = 0; 33 char* v = getenv(DART_IPV6_ONLY_FLAG);
34 if (!v) return 0;
35 return v[0] == '1';
36 }
30 37
31 void VmServiceServer::Bootstrap() { 38 void VmServiceServer::Bootstrap() {
32 if (!Platform::Initialize()) { 39 if (!Platform::Initialize()) {
33 fprintf(stderr, "Platform::Initialize() failed\n"); 40 fprintf(stderr, "Platform::Initialize() failed\n");
34 } 41 }
35 DartUtils::SetOriginalWorkingDirectory(); 42 DartUtils::SetOriginalWorkingDirectory();
36 Thread::InitOnce(); 43 Thread::InitOnce();
37 TimerUtils::InitOnce(); 44 TimerUtils::InitOnce();
38 EventHandler::Start(); 45 EventHandler::Start();
39 } 46 }
(...skipping 11 matching lines...) Expand all
51 if (!isolate) { 58 if (!isolate) {
52 fprintf(stderr, "Dart_CreateIsolate failed: %s\n", error); 59 fprintf(stderr, "Dart_CreateIsolate failed: %s\n", error);
53 return 0; 60 return 0;
54 } 61 }
55 62
56 Dart_EnterScope(); 63 Dart_EnterScope();
57 Builtin::SetNativeResolver(Builtin::kBuiltinLibrary); 64 Builtin::SetNativeResolver(Builtin::kBuiltinLibrary);
58 Builtin::SetNativeResolver(Builtin::kIOLibrary); 65 Builtin::SetNativeResolver(Builtin::kIOLibrary);
59 66
60 ASSERT(Dart_IsServiceIsolate(isolate)); 67 ASSERT(Dart_IsServiceIsolate(isolate));
68 int ipv6 = IsIpv6Only();
rmacnak 2017/06/20 21:24:05 int -> bool
terry 2017/06/20 21:39:02 Done.
61 if (!VmService::Setup( 69 if (!VmService::Setup(
62 DEFAULT_VM_SERVICE_SERVER_IP, DEFAULT_VM_SERVICE_SERVER_PORT, 70 ipv6 ? DEFAULT_VM_SERVICE_SERVER_IP_V6 :
71 DEFAULT_VM_SERVICE_SERVER_IP_V4,
72 DEFAULT_VM_SERVICE_SERVER_PORT,
63 false /* running_precompiled */, false /* disable origin checks */, 73 false /* running_precompiled */, false /* disable origin checks */,
64 false /* trace_loading */)) { 74 false /* trace_loading */)) {
65 fprintf(stderr, "Vmservice::Setup failed: %s\n", 75 fprintf(stderr, "Vmservice::Setup failed: %s\n",
66 VmService::GetErrorMessage()); 76 VmService::GetErrorMessage());
67 isolate = NULL; 77 isolate = NULL;
68 } 78 }
69 Dart_ExitScope(); 79 Dart_ExitScope();
70 Dart_ExitIsolate(); 80 Dart_ExitIsolate();
71 return isolate; 81 return isolate;
72 } 82 }
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 151
142 152
143 /* DISALLOW_ALLOCATION */ 153 /* DISALLOW_ALLOCATION */
144 void VmServiceServer::operator delete(void* pointer) { 154 void VmServiceServer::operator delete(void* pointer) {
145 fprintf(stderr, "unreachable code\n"); 155 fprintf(stderr, "unreachable code\n");
146 abort(); 156 abort();
147 } 157 }
148 158
149 } // namespace bin 159 } // namespace bin
150 } // namespace dart 160 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698