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

Side by Side Diff: runtime/vm/port.cc

Issue 1189543003: Ports page for isolates (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 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
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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/port.h" 5 #include "vm/port.h"
6 6
7 #include "vm/dart_entry.h"
7 #include "platform/utils.h" 8 #include "platform/utils.h"
8 #include "vm/dart_api_impl.h" 9 #include "vm/dart_api_impl.h"
9 #include "vm/isolate.h" 10 #include "vm/isolate.h"
10 #include "vm/lockers.h" 11 #include "vm/lockers.h"
11 #include "vm/message_handler.h" 12 #include "vm/message_handler.h"
12 #include "vm/os_thread.h" 13 #include "vm/os_thread.h"
13 14
14 namespace dart { 15 namespace dart {
15 16
16 DECLARE_FLAG(bool, trace_isolates); 17 DECLARE_FLAG(bool, trace_isolates);
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 static const intptr_t kInitialCapacity = 8; 295 static const intptr_t kInitialCapacity = 8;
295 // TODO(iposva): Verify whether we want to keep exponentially growing. 296 // TODO(iposva): Verify whether we want to keep exponentially growing.
296 ASSERT(Utils::IsPowerOfTwo(kInitialCapacity)); 297 ASSERT(Utils::IsPowerOfTwo(kInitialCapacity));
297 map_ = new Entry[kInitialCapacity]; 298 map_ = new Entry[kInitialCapacity];
298 memset(map_, 0, kInitialCapacity * sizeof(Entry)); 299 memset(map_, 0, kInitialCapacity * sizeof(Entry));
299 capacity_ = kInitialCapacity; 300 capacity_ = kInitialCapacity;
300 used_ = 0; 301 used_ = 0;
301 deleted_ = 0; 302 deleted_ = 0;
302 } 303 }
303 304
305
306 void PortMap::PrintPortsForMessageHandler(MessageHandler* handler,
307 JSONStream* stream) {
308 JSONObject jsobj(stream);
309 jsobj.AddProperty("type", "_Ports");
310 Object& msg_handler = Object::Handle();
311 {
312 JSONArray ports(&jsobj, "ports");
313 MutexLocker ml(mutex_);
314 for (intptr_t i = 0; i < capacity_; i++) {
315 if (map_[i].handler == handler) {
316 if (map_[i].state == kLivePort) {
317 JSONObject port(&ports);
318 port.AddProperty("type", "_Port");
319 port.AddPropertyF("name", "Isolate Port (%" Pd64 ")", map_[i].port);
320 msg_handler = DartLibraryCalls::LookupHandler(map_[i].port);
321 port.AddProperty("handler", msg_handler);
322 }
323 }
324 }
325 }
326 }
327
304 } // namespace dart 328 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698