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 #include "vm/service.h" | 5 #include "vm/service.h" |
6 | 6 |
7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
8 #include "include/dart_native_api.h" | 8 #include "include/dart_native_api.h" |
9 #include "platform/globals.h" | 9 #include "platform/globals.h" |
10 | 10 |
(...skipping 30 matching lines...) Expand all Loading... | |
41 DECLARE_FLAG(bool, trace_service_pause_events); | 41 DECLARE_FLAG(bool, trace_service_pause_events); |
42 | 42 |
43 ServiceIdZone::ServiceIdZone() { | 43 ServiceIdZone::ServiceIdZone() { |
44 } | 44 } |
45 | 45 |
46 | 46 |
47 ServiceIdZone::~ServiceIdZone() { | 47 ServiceIdZone::~ServiceIdZone() { |
48 } | 48 } |
49 | 49 |
50 | 50 |
51 RingServiceIdZone::RingServiceIdZone( | 51 RingServiceIdZone::RingServiceIdZone() |
52 ObjectIdRing* ring, ObjectIdRing::IdPolicy policy) | 52 : ring_(NULL) { |
rmacnak
2015/08/18 21:09:00
policy_ uninitialized. Mac/Clang build will compla
Cutch
2015/08/18 21:50:18
Done.
| |
53 : ring_(ring), | |
54 policy_(policy) { | |
55 ASSERT(ring_ != NULL); | |
56 } | 53 } |
57 | 54 |
58 | 55 |
59 RingServiceIdZone::~RingServiceIdZone() { | 56 RingServiceIdZone::~RingServiceIdZone() { |
60 } | 57 } |
61 | 58 |
62 | 59 |
60 void RingServiceIdZone::Init( | |
61 ObjectIdRing* ring, ObjectIdRing::IdPolicy policy) { | |
62 ring_ = ring; | |
63 policy_ = policy; | |
64 } | |
65 | |
66 | |
63 char* RingServiceIdZone::GetServiceId(const Object& obj) { | 67 char* RingServiceIdZone::GetServiceId(const Object& obj) { |
68 ASSERT(ring_ != NULL); | |
64 Thread* thread = Thread::Current(); | 69 Thread* thread = Thread::Current(); |
65 Zone* zone = thread->zone(); | 70 Zone* zone = thread->zone(); |
66 ASSERT(zone != NULL); | 71 ASSERT(zone != NULL); |
67 const intptr_t id = ring_->GetIdForObject(obj.raw(), policy_); | 72 const intptr_t id = ring_->GetIdForObject(obj.raw(), policy_); |
68 return zone->PrintToString("objects/%" Pd "", id); | 73 return zone->PrintToString("objects/%" Pd "", id); |
69 } | 74 } |
70 | 75 |
71 | 76 |
72 // TODO(johnmccutchan): Unify embedder service handler lists and their APIs. | 77 // TODO(johnmccutchan): Unify embedder service handler lists and their APIs. |
73 EmbedderServiceHandler* Service::isolate_service_handler_head_ = NULL; | 78 EmbedderServiceHandler* Service::isolate_service_handler_head_ = NULL; |
(...skipping 922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
996 } | 1001 } |
997 | 1002 |
998 | 1003 |
999 static bool DumpIdZone(Isolate* isolate, JSONStream* js) { | 1004 static bool DumpIdZone(Isolate* isolate, JSONStream* js) { |
1000 // TODO(johnmccutchan): Respect _idZone parameter passed to RPC. For now, | 1005 // TODO(johnmccutchan): Respect _idZone parameter passed to RPC. For now, |
1001 // always send the ObjectIdRing. | 1006 // always send the ObjectIdRing. |
1002 // | 1007 // |
1003 ObjectIdRing* ring = isolate->object_id_ring(); | 1008 ObjectIdRing* ring = isolate->object_id_ring(); |
1004 ASSERT(ring != NULL); | 1009 ASSERT(ring != NULL); |
1005 // When printing the ObjectIdRing, force object id reuse policy. | 1010 // When printing the ObjectIdRing, force object id reuse policy. |
1006 RingServiceIdZone reuse_zone(ring, ObjectIdRing::kReuseId); | 1011 RingServiceIdZone reuse_zone; |
1012 reuse_zone.Init(ring, ObjectIdRing::kReuseId); | |
1007 js->set_id_zone(&reuse_zone); | 1013 js->set_id_zone(&reuse_zone); |
1008 ring->PrintJSON(js); | 1014 ring->PrintJSON(js); |
1009 return true; | 1015 return true; |
1010 } | 1016 } |
1011 | 1017 |
1012 | 1018 |
1013 static bool Echo(Isolate* isolate, JSONStream* js) { | 1019 static bool Echo(Isolate* isolate, JSONStream* js) { |
1014 JSONObject jsobj(js); | 1020 JSONObject jsobj(js); |
1015 return HandleCommonEcho(&jsobj, js); | 1021 return HandleCommonEcho(&jsobj, js); |
1016 } | 1022 } |
(...skipping 2108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3125 ServiceMethodDescriptor& method = service_methods_[i]; | 3131 ServiceMethodDescriptor& method = service_methods_[i]; |
3126 if (strcmp(method_name, method.name) == 0) { | 3132 if (strcmp(method_name, method.name) == 0) { |
3127 return &method; | 3133 return &method; |
3128 } | 3134 } |
3129 } | 3135 } |
3130 return NULL; | 3136 return NULL; |
3131 } | 3137 } |
3132 | 3138 |
3133 | 3139 |
3134 } // namespace dart | 3140 } // namespace dart |
OLD | NEW |