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

Side by Side Diff: runtime/vm/port.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_handler.h ('k') | runtime/vm/service.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/port.h" 5 #include "vm/port.h"
6 6
7 #include "platform/utils.h" 7 #include "platform/utils.h"
8 #include "vm/dart_api_impl.h" 8 #include "vm/dart_api_impl.h"
9 #include "vm/isolate.h" 9 #include "vm/isolate.h"
10 #include "vm/message_handler.h" 10 #include "vm/message_handler.h"
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 247
248 Isolate* PortMap::GetIsolate(Dart_Port id) { 248 Isolate* PortMap::GetIsolate(Dart_Port id) {
249 MutexLocker ml(mutex_); 249 MutexLocker ml(mutex_);
250 intptr_t index = FindPort(id); 250 intptr_t index = FindPort(id);
251 if (index < 0) { 251 if (index < 0) {
252 // Port does not exist. 252 // Port does not exist.
253 return NULL; 253 return NULL;
254 } 254 }
255 255
256 MessageHandler* handler = map_[index].handler; 256 MessageHandler* handler = map_[index].handler;
257 return handler->GetIsolate(); 257 return handler->isolate();
258 } 258 }
259 259
260 260
261 void PortMap::InitOnce() { 261 void PortMap::InitOnce() {
262 mutex_ = new Mutex(); 262 mutex_ = new Mutex();
263 prng_ = new Random(); 263 prng_ = new Random();
264 264
265 static const intptr_t kInitialCapacity = 8; 265 static const intptr_t kInitialCapacity = 8;
266 // TODO(iposva): Verify whether we want to keep exponentially growing. 266 // TODO(iposva): Verify whether we want to keep exponentially growing.
267 ASSERT(Utils::IsPowerOfTwo(kInitialCapacity)); 267 ASSERT(Utils::IsPowerOfTwo(kInitialCapacity));
268 map_ = new Entry[kInitialCapacity]; 268 map_ = new Entry[kInitialCapacity];
269 memset(map_, 0, kInitialCapacity * sizeof(Entry)); 269 memset(map_, 0, kInitialCapacity * sizeof(Entry));
270 capacity_ = kInitialCapacity; 270 capacity_ = kInitialCapacity;
271 used_ = 0; 271 used_ = 0;
272 deleted_ = 0; 272 deleted_ = 0;
273 } 273 }
274 274
275 } // namespace dart 275 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/message_handler.h ('k') | runtime/vm/service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698