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

Side by Side Diff: runtime/lib/vmservice.cc

Issue 1678203002: Remove more feature in product mode (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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 | « runtime/lib/timeline.cc ('k') | runtime/observatory/tests/service/service.status » ('j') | 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 "vm/bootstrap_natives.h" 5 #include "vm/bootstrap_natives.h"
6 #include "vm/dart_api_impl.h" 6 #include "vm/dart_api_impl.h"
7 #include "vm/datastream.h" 7 #include "vm/datastream.h"
8 #include "vm/exceptions.h" 8 #include "vm/exceptions.h"
9 #include "vm/flags.h" 9 #include "vm/flags.h"
10 #include "vm/growable_array.h" 10 #include "vm/growable_array.h"
11 #include "vm/message.h" 11 #include "vm/message.h"
12 #include "vm/native_entry.h" 12 #include "vm/native_entry.h"
13 #include "vm/object.h" 13 #include "vm/object.h"
14 #include "vm/port.h" 14 #include "vm/port.h"
15 #include "vm/service_isolate.h" 15 #include "vm/service_isolate.h"
16 #include "vm/symbols.h" 16 #include "vm/symbols.h"
17 17
18 namespace dart { 18 namespace dart {
19 19
20 DECLARE_FLAG(bool, trace_service); 20 DECLARE_FLAG(bool, trace_service);
21 21
22 static uint8_t* allocator(uint8_t* ptr, intptr_t old_size, intptr_t new_size) { 22 static uint8_t* allocator(uint8_t* ptr, intptr_t old_size, intptr_t new_size) {
23 void* new_ptr = realloc(reinterpret_cast<void*>(ptr), new_size); 23 void* new_ptr = realloc(reinterpret_cast<void*>(ptr), new_size);
24 return reinterpret_cast<uint8_t*>(new_ptr); 24 return reinterpret_cast<uint8_t*>(new_ptr);
25 } 25 }
26 26
27 27
28 #ifndef PRODUCT
28 class RegisterRunningIsolatesVisitor : public IsolateVisitor { 29 class RegisterRunningIsolatesVisitor : public IsolateVisitor {
29 public: 30 public:
30 explicit RegisterRunningIsolatesVisitor(Thread* thread) 31 explicit RegisterRunningIsolatesVisitor(Thread* thread)
31 : IsolateVisitor(), 32 : IsolateVisitor(),
32 register_function_(Function::Handle(thread->zone())), 33 register_function_(Function::Handle(thread->zone())),
33 service_isolate_(thread->isolate()) { 34 service_isolate_(thread->isolate()) {
34 ASSERT(ServiceIsolate::IsServiceIsolate(Isolate::Current())); 35 ASSERT(ServiceIsolate::IsServiceIsolate(Isolate::Current()));
35 // Get library. 36 // Get library.
36 const String& library_url = Symbols::DartVMService(); 37 const String& library_url = Symbols::DartVMService();
37 ASSERT(!library_url.IsNull()); 38 ASSERT(!library_url.IsNull());
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 name.ToCString(), 73 name.ToCString(),
73 port_id); 74 port_id);
74 } 75 }
75 ASSERT(!r.IsError()); 76 ASSERT(!r.IsError());
76 } 77 }
77 78
78 private: 79 private:
79 Function& register_function_; 80 Function& register_function_;
80 Isolate* service_isolate_; 81 Isolate* service_isolate_;
81 }; 82 };
82 83 #endif // !PRODUCT
83 84
84 DEFINE_NATIVE_ENTRY(VMService_SendIsolateServiceMessage, 2) { 85 DEFINE_NATIVE_ENTRY(VMService_SendIsolateServiceMessage, 2) {
86 if (!FLAG_support_service) {
87 return Bool::Get(false).raw();
88 }
85 GET_NON_NULL_NATIVE_ARGUMENT(SendPort, sp, arguments->NativeArgAt(0)); 89 GET_NON_NULL_NATIVE_ARGUMENT(SendPort, sp, arguments->NativeArgAt(0));
86 GET_NON_NULL_NATIVE_ARGUMENT(Array, message, arguments->NativeArgAt(1)); 90 GET_NON_NULL_NATIVE_ARGUMENT(Array, message, arguments->NativeArgAt(1));
87 91
88 // Set the type of the OOB message. 92 // Set the type of the OOB message.
89 message.SetAt(0, Smi::Handle(thread->zone(), 93 message.SetAt(0, Smi::Handle(thread->zone(),
90 Smi::New(Message::kServiceOOBMsg))); 94 Smi::New(Message::kServiceOOBMsg)));
91 95
92 // Serialize message. 96 // Serialize message.
93 uint8_t* data = NULL; 97 uint8_t* data = NULL;
94 MessageWriter writer(&data, &allocator, false); 98 MessageWriter writer(&data, &allocator, false);
(...skipping 15 matching lines...) Expand all
110 return Object::null(); 114 return Object::null();
111 } 115 }
112 116
113 117
114 DEFINE_NATIVE_ENTRY(VMService_OnStart, 0) { 118 DEFINE_NATIVE_ENTRY(VMService_OnStart, 0) {
115 if (FLAG_trace_service) { 119 if (FLAG_trace_service) {
116 OS::Print("vm-service: Booting dart:vmservice library.\n"); 120 OS::Print("vm-service: Booting dart:vmservice library.\n");
117 } 121 }
118 // Boot the dart:vmservice library. 122 // Boot the dart:vmservice library.
119 ServiceIsolate::BootVmServiceLibrary(); 123 ServiceIsolate::BootVmServiceLibrary();
120 124 if (!FLAG_support_service) {
125 return Object::null();
126 }
127 #ifndef PRODUCT
121 // Register running isolates with service. 128 // Register running isolates with service.
122 RegisterRunningIsolatesVisitor register_isolates(thread); 129 RegisterRunningIsolatesVisitor register_isolates(thread);
123 if (FLAG_trace_service) { 130 if (FLAG_trace_service) {
124 OS::Print("vm-service: Registering running isolates.\n"); 131 OS::Print("vm-service: Registering running isolates.\n");
125 } 132 }
126 Isolate::VisitIsolates(&register_isolates); 133 Isolate::VisitIsolates(&register_isolates);
127 134 #endif
128 return Object::null(); 135 return Object::null();
129 } 136 }
130 137
131 138
132 DEFINE_NATIVE_ENTRY(VMService_OnExit, 0) { 139 DEFINE_NATIVE_ENTRY(VMService_OnExit, 0) {
133 if (FLAG_trace_service) { 140 if (FLAG_trace_service) {
134 OS::Print("vm-service: processed exit message.\n"); 141 OS::Print("vm-service: processed exit message.\n");
135 } 142 }
136 return Object::null(); 143 return Object::null();
137 } 144 }
138 145
139 146
140 DEFINE_NATIVE_ENTRY(VMService_OnServerAddressChange, 1) { 147 DEFINE_NATIVE_ENTRY(VMService_OnServerAddressChange, 1) {
148 if (!FLAG_support_service) {
149 return Object::null();
150 }
141 GET_NATIVE_ARGUMENT(String, address, arguments->NativeArgAt(0)); 151 GET_NATIVE_ARGUMENT(String, address, arguments->NativeArgAt(0));
142 if (address.IsNull()) { 152 if (address.IsNull()) {
143 ServiceIsolate::SetServerAddress(NULL); 153 ServiceIsolate::SetServerAddress(NULL);
144 } else { 154 } else {
145 ServiceIsolate::SetServerAddress(address.ToCString()); 155 ServiceIsolate::SetServerAddress(address.ToCString());
146 } 156 }
147 return Object::null(); 157 return Object::null();
148 } 158 }
149 159
150 160
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 idx += 2; 431 idx += 2;
422 } 432 }
423 433
424 return result_list.raw(); 434 return result_list.raw();
425 #else 435 #else
426 return Object::null(); 436 return Object::null();
427 #endif 437 #endif
428 } 438 }
429 439
430 } // namespace dart 440 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/lib/timeline.cc ('k') | runtime/observatory/tests/service/service.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698