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

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

Issue 1317653003: Set paused_timestamp before notifying (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 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
« 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 "vm/message_handler.h" 5 #include "vm/message_handler.h"
6 6
7 #include "vm/dart.h" 7 #include "vm/dart.h"
8 #include "vm/lockers.h" 8 #include "vm/lockers.h"
9 #include "vm/os.h" 9 #include "vm/os.h"
10 #include "vm/port.h" 10 #include "vm/port.h"
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 { 242 {
243 MonitorLocker ml(&monitor_); 243 MonitorLocker ml(&monitor_);
244 // Initialize the message handler by running its start function, 244 // Initialize the message handler by running its start function,
245 // if we have one. For an isolate, this will run the isolate's 245 // if we have one. For an isolate, this will run the isolate's
246 // main() function. 246 // main() function.
247 if (pause_on_start()) { 247 if (pause_on_start()) {
248 if (!paused_on_start_) { 248 if (!paused_on_start_) {
249 // Temporarily drop the lock when calling out to NotifyPauseOnStart. 249 // Temporarily drop the lock when calling out to NotifyPauseOnStart.
250 // This avoids a dead lock that can occur when this message handler 250 // This avoids a dead lock that can occur when this message handler
251 // tries to post a message while a message is being posted to it. 251 // tries to post a message while a message is being posted to it.
252 paused_on_start_ = true;
253 paused_timestamp_ = OS::GetCurrentTimeMillis();
252 monitor_.Exit(); 254 monitor_.Exit();
253 NotifyPauseOnStart(); 255 NotifyPauseOnStart();
254 monitor_.Enter(); 256 monitor_.Enter();
255 paused_on_start_ = true;
256 paused_timestamp_ = OS::GetCurrentTimeMillis();
257 } 257 }
258 HandleMessages(false, false); 258 HandleMessages(false, false);
259 if (pause_on_start()) { 259 if (pause_on_start()) {
260 // Still paused. 260 // Still paused.
261 task_ = NULL; // No task in queue. 261 task_ = NULL; // No task in queue.
262 return; 262 return;
263 } else { 263 } else {
264 paused_on_start_ = false; 264 paused_on_start_ = false;
265 paused_timestamp_ = -1; 265 paused_timestamp_ = -1;
266 } 266 }
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 388
389 389
390 void MessageHandler::AcquireQueues(AcquiredQueues* acquired_queues) { 390 void MessageHandler::AcquireQueues(AcquiredQueues* acquired_queues) {
391 ASSERT(acquired_queues != NULL); 391 ASSERT(acquired_queues != NULL);
392 // No double dipping. 392 // No double dipping.
393 ASSERT(acquired_queues->handler_ == NULL); 393 ASSERT(acquired_queues->handler_ == NULL);
394 acquired_queues->Reset(this); 394 acquired_queues->Reset(this);
395 } 395 }
396 396
397 } // namespace dart 397 } // 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