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

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

Issue 456983002: Refactor isolate startup code in preparation for making isolate spawning more truly non-blocking. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: code review Created 6 years, 4 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/object.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_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/port.h" 9 #include "vm/port.h"
10 10
(...skipping 16 matching lines...) Expand all
27 private: 27 private:
28 MessageHandler* handler_; 28 MessageHandler* handler_;
29 29
30 DISALLOW_COPY_AND_ASSIGN(MessageHandlerTask); 30 DISALLOW_COPY_AND_ASSIGN(MessageHandlerTask);
31 }; 31 };
32 32
33 33
34 MessageHandler::MessageHandler() 34 MessageHandler::MessageHandler()
35 : queue_(new MessageQueue()), 35 : queue_(new MessageQueue()),
36 oob_queue_(new MessageQueue()), 36 oob_queue_(new MessageQueue()),
37 control_ports_(0),
38 live_ports_(0), 37 live_ports_(0),
39 paused_(0), 38 paused_(0),
40 pause_on_start_(false), 39 pause_on_start_(false),
41 pause_on_exit_(false), 40 pause_on_exit_(false),
42 paused_on_exit_(false), 41 paused_on_exit_(false),
43 pool_(NULL), 42 pool_(NULL),
44 task_(NULL), 43 task_(NULL),
45 start_callback_(NULL), 44 start_callback_(NULL),
46 end_callback_(NULL), 45 end_callback_(NULL),
47 callback_data_(0) { 46 callback_data_(0) {
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 } 264 }
266 } 265 }
267 266
268 267
269 void MessageHandler::ClosePort(Dart_Port port) { 268 void MessageHandler::ClosePort(Dart_Port port) {
270 MonitorLocker ml(&monitor_); 269 MonitorLocker ml(&monitor_);
271 if (FLAG_trace_isolates) { 270 if (FLAG_trace_isolates) {
272 OS::Print("[-] Closing port:\n" 271 OS::Print("[-] Closing port:\n"
273 "\thandler: %s\n" 272 "\thandler: %s\n"
274 "\tport: %" Pd64 "\n" 273 "\tport: %" Pd64 "\n"
275 "\tports: control(%" Pd ") live(%" Pd ")\n", 274 "\tports: live(%" Pd ")\n",
276 name(), port, control_ports_, live_ports_); 275 name(), port, live_ports_);
277 } 276 }
278 } 277 }
279 278
280 279
281 void MessageHandler::CloseAllPorts() { 280 void MessageHandler::CloseAllPorts() {
282 MonitorLocker ml(&monitor_); 281 MonitorLocker ml(&monitor_);
283 if (FLAG_trace_isolates) { 282 if (FLAG_trace_isolates) {
284 OS::Print("[-] Closing all ports:\n" 283 OS::Print("[-] Closing all ports:\n"
285 "\thandler: %s\n", 284 "\thandler: %s\n",
286 name()); 285 name());
(...skipping 13 matching lines...) Expand all
300 299
301 300
302 void MessageHandler::decrement_live_ports() { 301 void MessageHandler::decrement_live_ports() {
303 MonitorLocker ml(&monitor_); 302 MonitorLocker ml(&monitor_);
304 #if defined(DEBUG) 303 #if defined(DEBUG)
305 CheckAccess(); 304 CheckAccess();
306 #endif 305 #endif
307 live_ports_--; 306 live_ports_--;
308 } 307 }
309 308
310
311 void MessageHandler::increment_control_ports() {
312 MonitorLocker ml(&monitor_);
313 #if defined(DEBUG)
314 CheckAccess();
315 #endif
316 control_ports_++;
317 }
318
319
320 void MessageHandler::decrement_control_ports() {
321 MonitorLocker ml(&monitor_);
322 #if defined(DEBUG)
323 CheckAccess();
324 #endif
325 control_ports_--;
326 }
327
328 } // namespace dart 309 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/message_handler.h ('k') | runtime/vm/object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698