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

Side by Side Diff: runtime/lib/isolate.cc

Issue 9141005: Change the thread interface in runtime/platform and use it starting all threads (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Removed Thread::Join as suggested by iposva@ Created 8 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
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 "platform/assert.h" 5 #include "platform/assert.h"
6 #include "vm/bootstrap_natives.h" 6 #include "vm/bootstrap_natives.h"
7 #include "vm/class_finalizer.h" 7 #include "vm/class_finalizer.h"
8 #include "vm/dart.h" 8 #include "vm/dart.h"
9 #include "vm/dart_api_impl.h" 9 #include "vm/dart_api_impl.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 ASSERT(spawned_isolate != NULL); 291 ASSERT(spawned_isolate != NULL);
292 // Check arguments to see if the specified library and classes are 292 // Check arguments to see if the specified library and classes are
293 // loaded, this check will throw an exception if they are not loaded. 293 // loaded, this check will throw an exception if they are not loaded.
294 if (init_successful && CheckArguments(library_url, class_name)) { 294 if (init_successful && CheckArguments(library_url, class_name)) {
295 port_id = spawned_isolate->main_port(); 295 port_id = spawned_isolate->main_port();
296 uword data = reinterpret_cast<uword>( 296 uword data = reinterpret_cast<uword>(
297 new IsolateStartData(spawned_isolate, 297 new IsolateStartData(spawned_isolate,
298 strdup(library_url), 298 strdup(library_url),
299 strdup(class_name), 299 strdup(class_name),
300 port_id)); 300 port_id));
301 new Thread(RunIsolate, data); 301 Thread::Start(RunIsolate, data);
302 } else { 302 } else {
303 // Error spawning the isolate, maybe due to initialization errors or 303 // Error spawning the isolate, maybe due to initialization errors or
304 // errors while loading the application into spawned isolate, shut 304 // errors while loading the application into spawned isolate, shut
305 // it down and report error. 305 // it down and report error.
306 // Make sure to grab the error message out of the isolate before it has 306 // Make sure to grab the error message out of the isolate before it has
307 // been shutdown and to allocate it in the preserved isolates zone. 307 // been shutdown and to allocate it in the preserved isolates zone.
308 { 308 {
309 Zone zone(spawned_isolate); 309 Zone zone(spawned_isolate);
310 HandleScope scope(spawned_isolate); 310 HandleScope scope(spawned_isolate);
311 const Error& err_obj = Error::Handle( 311 const Error& err_obj = Error::Handle(
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 intptr_t send_id = Smi::CheckedHandle(arguments->At(0)).Value(); 359 intptr_t send_id = Smi::CheckedHandle(arguments->At(0)).Value();
360 intptr_t reply_id = Smi::CheckedHandle(arguments->At(1)).Value(); 360 intptr_t reply_id = Smi::CheckedHandle(arguments->At(1)).Value();
361 // TODO(iposva): Allow for arbitrary messages to be sent. 361 // TODO(iposva): Allow for arbitrary messages to be sent.
362 uint8_t* data = SerializeObject(Instance::CheckedHandle(arguments->At(2))); 362 uint8_t* data = SerializeObject(Instance::CheckedHandle(arguments->At(2)));
363 363
364 // TODO(turnidge): Throw an exception when the return value is false? 364 // TODO(turnidge): Throw an exception when the return value is false?
365 PortMap::PostMessage(send_id, reply_id, Api::CastMessage(data)); 365 PortMap::PostMessage(send_id, reply_id, Api::CastMessage(data));
366 } 366 }
367 367
368 } // namespace dart 368 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698