Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
dart::IsolateSpawnState Class Reference

Public Member Functions

 IsolateSpawnState (Dart_Port parent_port, Dart_Port origin_id, const char *script_url, PersistentHandle *closure_tuple_handle, SerializedObjectBuffer *message_buffer, const char *package_config, bool paused, bool errorsAreFatal, Dart_Port onExit, Dart_Port onError, const char *debug_name, IsolateGroup *group)
 
 IsolateSpawnState (Dart_Port parent_port, const char *script_url, const char *package_config, SerializedObjectBuffer *args_buffer, SerializedObjectBuffer *message_buffer, bool paused, bool errorsAreFatal, Dart_Port onExit, Dart_Port onError, const char *debug_name, IsolateGroup *group)
 
 ~IsolateSpawnState ()
 
Isolateisolate () const
 
void set_isolate (Isolate *value)
 
Dart_Port parent_port () const
 
Dart_Port origin_id () const
 
Dart_Port on_exit_port () const
 
Dart_Port on_error_port () const
 
const char * script_url () const
 
const char * package_config () const
 
const char * debug_name () const
 
bool is_spawn_uri () const
 
bool paused () const
 
bool errors_are_fatal () const
 
Dart_IsolateFlagsisolate_flags ()
 
PersistentHandleclosure_tuple_handle () const
 
ObjectPtr ResolveFunction ()
 
ObjectPtr BuildArgs (Thread *thread)
 
ObjectPtr BuildMessage (Thread *thread)
 
IsolateGroupisolate_group () const
 

Detailed Description

Definition at line 348 of file isolate.cc.

Constructor & Destructor Documentation

◆ IsolateSpawnState() [1/2]

dart::IsolateSpawnState::IsolateSpawnState ( Dart_Port  parent_port,
Dart_Port  origin_id,
const char *  script_url,
PersistentHandle closure_tuple_handle,
SerializedObjectBuffer message_buffer,
const char *  package_config,
bool  paused,
bool  errorsAreFatal,
Dart_Port  onExit,
Dart_Port  onError,
const char *  debug_name,
IsolateGroup group 
)

Definition at line 427 of file isolate.cc.

439 : parent_port_(parent_port),
440 origin_id_(origin_id),
441 on_exit_port_(on_exit_port),
442 on_error_port_(on_error_port),
443 script_url_(script_url),
444 package_config_(package_config),
445 debug_name_(debug_name),
446 closure_tuple_handle_(closure_tuple_handle),
447 isolate_group_(isolate_group),
448 serialized_args_(nullptr),
449 serialized_message_(message_buffer->StealMessage()),
450 paused_(paused),
451 errors_are_fatal_(errors_are_fatal) {
452 ASSERT(closure_tuple_handle_ != nullptr);
453
454 auto thread = Thread::Current();
455 auto isolate = thread->isolate();
456
457 // Inherit flags from spawning isolate.
459}
const char * script_url() const
Definition: isolate.cc:382
bool paused() const
Definition: isolate.cc:388
Dart_Port parent_port() const
Definition: isolate.cc:378
const char * debug_name() const
Definition: isolate.cc:384
PersistentHandle * closure_tuple_handle() const
Definition: isolate.cc:391
Dart_Port on_error_port() const
Definition: isolate.cc:381
const char * package_config() const
Definition: isolate.cc:383
IsolateGroup * isolate_group() const
Definition: isolate.cc:399
Dart_IsolateFlags * isolate_flags()
Definition: isolate.cc:390
Dart_Port origin_id() const
Definition: isolate.cc:379
bool errors_are_fatal() const
Definition: isolate.cc:389
Isolate * isolate() const
Definition: isolate.cc:375
Dart_Port on_exit_port() const
Definition: isolate.cc:380
void FlagsCopyTo(Dart_IsolateFlags *api_flags) const
Definition: isolate.cc:1661
static Thread * Current()
Definition: thread.h:362
#define ASSERT(E)

◆ IsolateSpawnState() [2/2]

dart::IsolateSpawnState::IsolateSpawnState ( Dart_Port  parent_port,
const char *  script_url,
const char *  package_config,
SerializedObjectBuffer args_buffer,
SerializedObjectBuffer message_buffer,
bool  paused,
bool  errorsAreFatal,
Dart_Port  onExit,
Dart_Port  onError,
const char *  debug_name,
IsolateGroup group 
)

Definition at line 461 of file isolate.cc.

472 : parent_port_(parent_port),
473 on_exit_port_(on_exit_port),
474 on_error_port_(on_error_port),
475 script_url_(script_url),
476 package_config_(package_config),
477 debug_name_(debug_name),
478 isolate_group_(isolate_group),
479 serialized_args_(args_buffer->StealMessage()),
480 serialized_message_(message_buffer->StealMessage()),
481 isolate_flags_(),
482 paused_(paused),
483 errors_are_fatal_(errors_are_fatal) {
484 if (debug_name_ == nullptr) {
485 debug_name_ = NewConstChar("main");
486 }
487
488 // By default inherit flags from spawning isolate. These can be overridden
489 // from the calling code.
491}
static Isolate * Current()
Definition: isolate.h:986
static const char * NewConstChar(const char *chars)
Definition: isolate.cc:420

◆ ~IsolateSpawnState()

dart::IsolateSpawnState::~IsolateSpawnState ( )

Definition at line 493 of file isolate.cc.

493 {
494 delete[] script_url_;
495 delete[] package_config_;
496 delete[] debug_name_;
497}

Member Function Documentation

◆ BuildArgs()

ObjectPtr dart::IsolateSpawnState::BuildArgs ( Thread thread)

Definition at line 538 of file isolate.cc.

538 {
539 const Object& result =
540 Object::Handle(DeserializeMessage(thread, serialized_args_.get()));
541 serialized_args_.reset();
542 return result.ptr();
543}
static Object & Handle()
Definition: object.h:407
GAsyncResult * result
static ObjectPtr DeserializeMessage(Thread *thread, Message *message)
Definition: isolate.cc:527

◆ BuildMessage()

ObjectPtr dart::IsolateSpawnState::BuildMessage ( Thread thread)

Definition at line 545 of file isolate.cc.

545 {
546 const Object& result =
547 Object::Handle(DeserializeMessage(thread, serialized_message_.get()));
548 serialized_message_.reset();
549 return result.ptr();
550}

◆ closure_tuple_handle()

PersistentHandle * dart::IsolateSpawnState::closure_tuple_handle ( ) const
inline

Definition at line 391 of file isolate.cc.

391 {
392 return closure_tuple_handle_;
393 }

◆ debug_name()

const char * dart::IsolateSpawnState::debug_name ( ) const
inline

Definition at line 384 of file isolate.cc.

384{ return debug_name_; }

◆ errors_are_fatal()

bool dart::IsolateSpawnState::errors_are_fatal ( ) const
inline

Definition at line 389 of file isolate.cc.

389{ return errors_are_fatal_; }

◆ is_spawn_uri()

bool dart::IsolateSpawnState::is_spawn_uri ( ) const
inline

Definition at line 385 of file isolate.cc.

385 {
386 return closure_tuple_handle_ == nullptr; // No closure entrypoint.
387 }

◆ isolate()

Isolate * dart::IsolateSpawnState::isolate ( ) const
inline

Definition at line 375 of file isolate.cc.

375{ return isolate_; }

◆ isolate_flags()

Dart_IsolateFlags * dart::IsolateSpawnState::isolate_flags ( )
inline

Definition at line 390 of file isolate.cc.

390{ return &isolate_flags_; }

◆ isolate_group()

IsolateGroup * dart::IsolateSpawnState::isolate_group ( ) const
inline

Definition at line 399 of file isolate.cc.

399{ return isolate_group_; }

◆ on_error_port()

Dart_Port dart::IsolateSpawnState::on_error_port ( ) const
inline

Definition at line 381 of file isolate.cc.

381{ return on_error_port_; }

◆ on_exit_port()

Dart_Port dart::IsolateSpawnState::on_exit_port ( ) const
inline

Definition at line 380 of file isolate.cc.

380{ return on_exit_port_; }

◆ origin_id()

Dart_Port dart::IsolateSpawnState::origin_id ( ) const
inline

Definition at line 379 of file isolate.cc.

379{ return origin_id_; }

◆ package_config()

const char * dart::IsolateSpawnState::package_config ( ) const
inline

Definition at line 383 of file isolate.cc.

383{ return package_config_; }

◆ parent_port()

Dart_Port dart::IsolateSpawnState::parent_port ( ) const
inline

Definition at line 378 of file isolate.cc.

378{ return parent_port_; }

◆ paused()

bool dart::IsolateSpawnState::paused ( ) const
inline

Definition at line 388 of file isolate.cc.

388{ return paused_; }

◆ ResolveFunction()

ObjectPtr dart::IsolateSpawnState::ResolveFunction ( )

Definition at line 499 of file isolate.cc.

499 {
500 Thread* thread = Thread::Current();
501 auto IG = thread->isolate_group();
502 Zone* zone = thread->zone();
503
504 // Handle spawnUri lookup rules.
505 // Check whether the root library defines a main function.
506 const Library& lib =
507 Library::Handle(zone, IG->object_store()->root_library());
508 const String& main = String::Handle(zone, String::New("main"));
509 Function& func = Function::Handle(zone, lib.LookupFunctionAllowPrivate(main));
510 if (func.IsNull()) {
511 // Check whether main is reexported from the root library.
512 const Object& obj = Object::Handle(zone, lib.LookupReExport(main));
513 if (obj.IsFunction()) {
514 func ^= obj.ptr();
515 }
516 }
517 if (func.IsNull()) {
518 const String& msg = String::Handle(
519 zone,
521 "Unable to resolve function 'main' in script '%s'.", script_url()));
522 return LanguageError::New(msg);
523 }
524 return func.ptr();
525}
static StringPtr NewFormatted(const char *format,...) PRINTF_ATTRIBUTE(1
Definition: object.cc:24004
static StringPtr New(const char *cstr, Heap::Space space=Heap::kNew)
Definition: object.cc:23698
Definition: main.py:1
#define IG
Definition: isolate.cc:104

◆ script_url()

const char * dart::IsolateSpawnState::script_url ( ) const
inline

Definition at line 382 of file isolate.cc.

382{ return script_url_; }

◆ set_isolate()

void dart::IsolateSpawnState::set_isolate ( Isolate value)
inline

Definition at line 376 of file isolate.cc.

376{ isolate_ = value; }
uint8_t value

The documentation for this class was generated from the following file: