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

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

Issue 796063006: Rename Thread -> OSThread. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/message_handler.h ('k') | runtime/vm/native_symbol_win.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) 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/message_handler.h" 5 #include "vm/message_handler.h"
6 #include "vm/port.h" 6 #include "vm/port.h"
7 #include "vm/unit_test.h" 7 #include "vm/unit_test.h"
8 8
9 namespace dart { 9 namespace dart {
10 10
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 304
305 // Start a thread which sends more messages. 305 // Start a thread which sends more messages.
306 Dart_Port* ports = new Dart_Port[10]; 306 Dart_Port* ports = new Dart_Port[10];
307 for (int i = 0; i < 10; i++) { 307 for (int i = 0; i < 10; i++) {
308 ports[i] = PortMap::CreatePort(&handler); 308 ports[i] = PortMap::CreatePort(&handler);
309 } 309 }
310 ThreadStartInfo info; 310 ThreadStartInfo info;
311 info.handler = &handler; 311 info.handler = &handler;
312 info.ports = ports; 312 info.ports = ports;
313 info.count = 10; 313 info.count = 10;
314 Thread::Start(SendMessages, reinterpret_cast<uword>(&info)); 314 OSThread::Start(SendMessages, reinterpret_cast<uword>(&info));
315 while (sleep < kMaxSleep && handler.message_count() < 11) { 315 while (sleep < kMaxSleep && handler.message_count() < 11) {
316 OS::Sleep(10); 316 OS::Sleep(10);
317 sleep += 10; 317 sleep += 10;
318 } 318 }
319 handler_ports = handler.port_buffer(); 319 handler_ports = handler.port_buffer();
320 EXPECT_EQ(11, handler.message_count()); 320 EXPECT_EQ(11, handler.message_count());
321 EXPECT(handler.start_called()); 321 EXPECT(handler.start_called());
322 EXPECT(!handler.end_called()); 322 EXPECT(!handler.end_called());
323 EXPECT_EQ(port, handler_ports[0]); 323 EXPECT_EQ(port, handler_ports[0]);
324 for (int i = 1; i < 11; i++) { 324 for (int i = 1; i < 11; i++) {
325 EXPECT_EQ(ports[i - 1], handler_ports[i]); 325 EXPECT_EQ(ports[i - 1], handler_ports[i]);
326 } 326 }
327 handler_peer.decrement_live_ports(); 327 handler_peer.decrement_live_ports();
328 EXPECT(!handler.HasLivePorts()); 328 EXPECT(!handler.HasLivePorts());
329 PortMap::ClosePorts(&handler); 329 PortMap::ClosePorts(&handler);
330 } 330 }
331 331
332 } // namespace dart 332 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/message_handler.h ('k') | runtime/vm/native_symbol_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698