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

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

Issue 1526123002: VM: Const-correctness fixes. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years 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/vm/compiler.cc ('k') | runtime/vm/dart_api_impl.cc » ('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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 "include/dart_api.h" 5 #include "include/dart_api.h"
6 #include "include/dart_native_api.h" 6 #include "include/dart_native_api.h"
7 7
8 #include "vm/unit_test.h" 8 #include "vm/unit_test.h"
9 9
10 // Custom Isolate Test. 10 // Custom Isolate Test.
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 EXPECT_VALID(Dart_StringToCString(name, &name_str)); 236 EXPECT_VALID(Dart_StringToCString(name, &name_str));
237 if (strcmp(name_str, "native_echo") == 0) { 237 if (strcmp(name_str, "native_echo") == 0) {
238 return &native_echo; 238 return &native_echo;
239 } else if (strcmp(name_str, "CustomIsolateImpl_start") == 0) { 239 } else if (strcmp(name_str, "CustomIsolateImpl_start") == 0) {
240 return &CustomIsolateImpl_start; 240 return &CustomIsolateImpl_start;
241 } 241 }
242 return NULL; 242 return NULL;
243 } 243 }
244 244
245 245
246 const char* saved_echo = NULL; 246 char* saved_echo = NULL;
247 static void native_echo(Dart_NativeArguments args) { 247 static void native_echo(Dart_NativeArguments args) {
248 Dart_EnterScope(); 248 Dart_EnterScope();
249 Dart_Handle arg = Dart_GetNativeArgument(args, 0); 249 Dart_Handle arg = Dart_GetNativeArgument(args, 0);
250 Dart_Handle toString = Dart_ToString(arg); 250 Dart_Handle toString = Dart_ToString(arg);
251 EXPECT_VALID(toString); 251 EXPECT_VALID(toString);
252 const char* c_str = NULL; 252 const char* c_str = NULL;
253 EXPECT_VALID(Dart_StringToCString(toString, &c_str)); 253 EXPECT_VALID(Dart_StringToCString(toString, &c_str));
254 if (saved_echo) { 254 if (saved_echo) {
255 free(const_cast<char*>(saved_echo)); 255 free(saved_echo);
256 } 256 }
257 saved_echo = strdup(c_str); 257 saved_echo = strdup(c_str);
258 OS::Print("-- (isolate=%p) %s\n", Dart_CurrentIsolate(), c_str); 258 OS::Print("-- (isolate=%p) %s\n", Dart_CurrentIsolate(), c_str);
259 Dart_ExitScope(); 259 Dart_ExitScope();
260 } 260 }
261 261
262 262
263 static void CustomIsolateImpl_start(Dart_NativeArguments args) { 263 static void CustomIsolateImpl_start(Dart_NativeArguments args) {
264 OS::Print("-- Enter: CustomIsolateImpl_start --\n"); 264 OS::Print("-- Enter: CustomIsolateImpl_start --\n");
265 265
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 343
344 OS::Print("-- Starting event loop --\n"); 344 OS::Print("-- Starting event loop --\n");
345 Event* event = event_queue->Get(); 345 Event* event = event_queue->Get();
346 while (event) { 346 while (event) {
347 event->Process(); 347 event->Process();
348 delete event; 348 delete event;
349 event = event_queue->Get(); 349 event = event_queue->Get();
350 } 350 }
351 OS::Print("-- Finished event loop --\n"); 351 OS::Print("-- Finished event loop --\n");
352 EXPECT_STREQ("Received: 43", saved_echo); 352 EXPECT_STREQ("Received: 43", saved_echo);
353 free(const_cast<char*>(saved_echo)); 353 free(saved_echo);
354 354
355 delete event_queue; 355 delete event_queue;
356 event_queue = NULL; 356 event_queue = NULL;
357 } 357 }
358 358
359 } // namespace dart 359 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/compiler.cc ('k') | runtime/vm/dart_api_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698