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

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

Issue 300223011: - Add possibility to redirect messages if they were not delivered. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 6 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.h ('k') | runtime/vm/message_handler.h » ('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 "vm/message.h" 5 #include "vm/message.h"
6 6
7 #include "vm/port.h"
8
7 namespace dart { 9 namespace dart {
8 10
11 bool Message::RedirectToDeliveryFailurePort() {
12 if (delivery_failure_port_ == kIllegalPort) {
13 return false;
14 }
15 dest_port_ = delivery_failure_port_;
16 delivery_failure_port_ = kIllegalPort;
17 return true;
18 }
19
20
9 MessageQueue::MessageQueue() { 21 MessageQueue::MessageQueue() {
10 head_ = NULL; 22 head_ = NULL;
11 tail_ = NULL; 23 tail_ = NULL;
12 } 24 }
13 25
14 26
15 MessageQueue::~MessageQueue() { 27 MessageQueue::~MessageQueue() {
16 // Ensure that all pending messages have been released. 28 // Ensure that all pending messages have been released.
17 Clear(); 29 Clear();
18 ASSERT(head_ == NULL); 30 ASSERT(head_ == NULL);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 return NULL; 64 return NULL;
53 } 65 }
54 66
55 67
56 void MessageQueue::Clear() { 68 void MessageQueue::Clear() {
57 Message* cur = head_; 69 Message* cur = head_;
58 head_ = NULL; 70 head_ = NULL;
59 tail_ = NULL; 71 tail_ = NULL;
60 while (cur != NULL) { 72 while (cur != NULL) {
61 Message* next = cur->next_; 73 Message* next = cur->next_;
62 delete cur; 74 if (cur->RedirectToDeliveryFailurePort()) {
75 PortMap::PostMessage(cur);
76 } else {
77 delete cur;
78 }
63 cur = next; 79 cur = next;
64 } 80 }
65 } 81 }
66 82
67 83
68 } // namespace dart 84 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/message.h ('k') | runtime/vm/message_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698