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 "platform/globals.h" | 5 #include "platform/globals.h" |
6 | 6 |
7 #include "include/dart_tools_api.h" | 7 #include "include/dart_tools_api.h" |
8 #include "vm/dart_api_impl.h" | 8 #include "vm/dart_api_impl.h" |
9 #include "vm/dart_entry.h" | 9 #include "vm/dart_entry.h" |
10 #include "vm/debugger.h" | 10 #include "vm/debugger.h" |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 ObjectIdRing* ring = isolate->object_id_ring(); | 113 ObjectIdRing* ring = isolate->object_id_ring(); |
114 | 114 |
115 const String& test_a = String::Handle(isolate, String::New("a")); | 115 const String& test_a = String::Handle(isolate, String::New("a")); |
116 const String& test_b = String::Handle(isolate, String::New("b")); | 116 const String& test_b = String::Handle(isolate, String::New("b")); |
117 const String& test_c = String::Handle(isolate, String::New("c")); | 117 const String& test_c = String::Handle(isolate, String::New("c")); |
118 const String& test_d = String::Handle(isolate, String::New("d")); | 118 const String& test_d = String::Handle(isolate, String::New("d")); |
119 | 119 |
120 // Both RingServiceIdZones share the same backing store and id space. | 120 // Both RingServiceIdZones share the same backing store and id space. |
121 | 121 |
122 // Always allocate a new id. | 122 // Always allocate a new id. |
123 RingServiceIdZone always_new_zone(ring, ObjectIdRing::kAllocateId); | 123 RingServiceIdZone always_new_zone; |
| 124 always_new_zone.Init(ring, ObjectIdRing::kAllocateId); |
124 EXPECT_STREQ("objects/0", always_new_zone.GetServiceId(test_a)); | 125 EXPECT_STREQ("objects/0", always_new_zone.GetServiceId(test_a)); |
125 EXPECT_STREQ("objects/1", always_new_zone.GetServiceId(test_a)); | 126 EXPECT_STREQ("objects/1", always_new_zone.GetServiceId(test_a)); |
126 EXPECT_STREQ("objects/2", always_new_zone.GetServiceId(test_a)); | 127 EXPECT_STREQ("objects/2", always_new_zone.GetServiceId(test_a)); |
127 EXPECT_STREQ("objects/3", always_new_zone.GetServiceId(test_b)); | 128 EXPECT_STREQ("objects/3", always_new_zone.GetServiceId(test_b)); |
128 EXPECT_STREQ("objects/4", always_new_zone.GetServiceId(test_c)); | 129 EXPECT_STREQ("objects/4", always_new_zone.GetServiceId(test_c)); |
129 | 130 |
130 // Reuse an existing id or allocate a new id. | 131 // Reuse an existing id or allocate a new id. |
131 RingServiceIdZone reuse_zone(ring, ObjectIdRing::kReuseId); | 132 RingServiceIdZone reuse_zone; |
| 133 reuse_zone.Init(ring, ObjectIdRing::kReuseId); |
132 EXPECT_STREQ("objects/0", reuse_zone.GetServiceId(test_a)); | 134 EXPECT_STREQ("objects/0", reuse_zone.GetServiceId(test_a)); |
133 EXPECT_STREQ("objects/0", reuse_zone.GetServiceId(test_a)); | 135 EXPECT_STREQ("objects/0", reuse_zone.GetServiceId(test_a)); |
134 EXPECT_STREQ("objects/3", reuse_zone.GetServiceId(test_b)); | 136 EXPECT_STREQ("objects/3", reuse_zone.GetServiceId(test_b)); |
135 EXPECT_STREQ("objects/3", reuse_zone.GetServiceId(test_b)); | 137 EXPECT_STREQ("objects/3", reuse_zone.GetServiceId(test_b)); |
136 EXPECT_STREQ("objects/4", reuse_zone.GetServiceId(test_c)); | 138 EXPECT_STREQ("objects/4", reuse_zone.GetServiceId(test_c)); |
137 EXPECT_STREQ("objects/4", reuse_zone.GetServiceId(test_c)); | 139 EXPECT_STREQ("objects/4", reuse_zone.GetServiceId(test_c)); |
138 EXPECT_STREQ("objects/5", reuse_zone.GetServiceId(test_d)); | 140 EXPECT_STREQ("objects/5", reuse_zone.GetServiceId(test_d)); |
139 EXPECT_STREQ("objects/5", reuse_zone.GetServiceId(test_d)); | 141 EXPECT_STREQ("objects/5", reuse_zone.GetServiceId(test_d)); |
140 } | 142 } |
141 | 143 |
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
626 Eval(lib, "[0, port, '0', '_getCpuProfile', ['tags'], ['Bogus']]"); | 628 Eval(lib, "[0, port, '0', '_getCpuProfile', ['tags'], ['Bogus']]"); |
627 Service::HandleIsolateMessage(isolate, service_msg); | 629 Service::HandleIsolateMessage(isolate, service_msg); |
628 handler.HandleNextMessage(); | 630 handler.HandleNextMessage(); |
629 // Expect error. | 631 // Expect error. |
630 EXPECT_SUBSTRING("\"error\"", handler.msg()); | 632 EXPECT_SUBSTRING("\"error\"", handler.msg()); |
631 } | 633 } |
632 | 634 |
633 #endif // !defined(TARGET_ARCH_ARM64) | 635 #endif // !defined(TARGET_ARCH_ARM64) |
634 | 636 |
635 } // namespace dart | 637 } // namespace dart |
OLD | NEW |