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

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

Issue 8724008: Fix the linux build. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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 6
7 #include "vm/unit_test.h" 7 #include "vm/unit_test.h"
8 8
9 // Custom Isolate Test. 9 // Custom Isolate Test.
10 // 10 //
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 271
272 static bool PostMessage(Dart_Isolate dest_isolate, 272 static bool PostMessage(Dart_Isolate dest_isolate,
273 Dart_Port dest_port, 273 Dart_Port dest_port,
274 Dart_Port reply_port, 274 Dart_Port reply_port,
275 Dart_Message message) { 275 Dart_Message message) {
276 OS::Print("-- Posting message dest(%d) reply(%d) --\n", 276 OS::Print("-- Posting message dest(%d) reply(%d) --\n",
277 dest_port, reply_port); 277 dest_port, reply_port);
278 OS::Print("-- Adding MessageEvent to queue --\n"); 278 OS::Print("-- Adding MessageEvent to queue --\n");
279 event_queue->Add( 279 event_queue->Add(
280 new MessageEvent(dest_isolate, dest_port, reply_port, message)); 280 new MessageEvent(dest_isolate, dest_port, reply_port, message));
281 return true;
281 } 282 }
282 283
283 284
284 static void ClosePort(Dart_Isolate isolate, 285 static void ClosePort(Dart_Isolate isolate,
285 Dart_Port port) { 286 Dart_Port port) {
286 OS::Print("-- Closing port (%lld) for isolate(%p) --\n", 287 OS::Print("-- Closing port (%lld) for isolate(%p) --\n",
287 port, isolate); 288 port, isolate);
288 289
289 // Remove any pending events for the isolate/port. 290 // Remove any pending events for the isolate/port.
290 event_queue->ClosePort(isolate, port); 291 event_queue->ClosePort(isolate, port);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 free(const_cast<char*>(saved_echo)); 332 free(const_cast<char*>(saved_echo));
332 } 333 }
333 saved_echo = strdup(c_str); 334 saved_echo = strdup(c_str);
334 OS::Print("-- (isolate=%p) %s\n", Dart_CurrentIsolate(), c_str); 335 OS::Print("-- (isolate=%p) %s\n", Dart_CurrentIsolate(), c_str);
335 Dart_ExitScope(); 336 Dart_ExitScope();
336 } 337 }
337 338
338 339
339 static void CustomIsolateImpl_start(Dart_NativeArguments args) { 340 static void CustomIsolateImpl_start(Dart_NativeArguments args) {
340 OS::Print("-- Enter: CustomIsolateImpl_start --\n"); 341 OS::Print("-- Enter: CustomIsolateImpl_start --\n");
341 Dart_Handle result;
342 342
343 // We would probably want to pass in the this pointer too, so we 343 // We would probably want to pass in the this pointer too, so we
344 // could associate the CustomIsolateImpl instance with the 344 // could associate the CustomIsolateImpl instance with the
345 // Dart_Isolate by storing it in a native field. 345 // Dart_Isolate by storing it in a native field.
346 EXPECT_EQ(1, Dart_GetNativeArgumentCount(args)); 346 EXPECT_EQ(1, Dart_GetNativeArgumentCount(args));
347 Dart_Handle param = Dart_GetNativeArgument(args, 0); 347 Dart_Handle param = Dart_GetNativeArgument(args, 0);
348 EXPECT_VALID(param); 348 EXPECT_VALID(param);
349 EXPECT(Dart_IsString(param)); 349 EXPECT(Dart_IsString(param));
350 const char* isolate_main = NULL; 350 const char* isolate_main = NULL;
351 EXPECT_VALID(Dart_StringToCString(param, &isolate_main)); 351 EXPECT_VALID(Dart_StringToCString(param, &isolate_main));
(...skipping 22 matching lines...) Expand all
374 374
375 OS::Print("-- Exit: CustomIsolateImpl_start --\n"); 375 OS::Print("-- Exit: CustomIsolateImpl_start --\n");
376 Dart_ExitScope(); 376 Dart_ExitScope();
377 } 377 }
378 378
379 379
380 UNIT_TEST_CASE(CustomIsolates) { 380 UNIT_TEST_CASE(CustomIsolates) {
381 event_queue = new EventQueue(); 381 event_queue = new EventQueue();
382 current_event = NULL; 382 current_event = NULL;
383 383
384 Dart_Isolate main_isolate = Dart_CreateIsolate(NULL, NULL); 384 Dart_CreateIsolate(NULL, NULL);
385 Dart_SetMessageCallbacks(&PostMessage, &ClosePort); 385 Dart_SetMessageCallbacks(&PostMessage, &ClosePort);
386 Dart_EnterScope(); 386 Dart_EnterScope();
387 Dart_Handle result; 387 Dart_Handle result;
388 388
389 // Create a test library. 389 // Create a test library.
390 Dart_Handle lib = TestCase::LoadTestScript(kCustomIsolateScriptChars, 390 Dart_Handle lib = TestCase::LoadTestScript(kCustomIsolateScriptChars,
391 NativeLookup); 391 NativeLookup);
392 EXPECT_VALID(lib); 392 EXPECT_VALID(lib);
393 393
394 // Run main. 394 // Run main.
(...skipping 23 matching lines...) Expand all
418 OS::Print("-- Finished event loop --\n"); 418 OS::Print("-- Finished event loop --\n");
419 EXPECT_STREQ("Received: 43", saved_echo); 419 EXPECT_STREQ("Received: 43", saved_echo);
420 free(const_cast<char*>(saved_echo)); 420 free(const_cast<char*>(saved_echo));
421 421
422 delete event_queue; 422 delete event_queue;
423 } 423 }
424 424
425 #endif // TARGET_ARCH_IA32. 425 #endif // TARGET_ARCH_IA32.
426 426
427 } // namespace dart 427 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698