mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 00:13:50 +00:00
![Martin Kustermann](/assets/img/avatar_default.png)
We already allow sending closures (if immutable via sharing otherwise via copying). This CL makes use of this to allow the argument to `Isolate.spawn()` to be any closure. Similar to normal message sending, the spawn will fail if the closure cannot be sent (or causes an error on the new isolate, e.g. rehashing error). Issue https://github.com/dart-lang/sdk/issues/46623 TEST=vm/dart{_2,}/isolates/closure_entrypoint_test Change-Id: Iab342267d87bd87bc8c0c82d16aec58a69a3df44 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212295 Reviewed-by: Alexander Aprelev <aam@google.com> Commit-Queue: Martin Kustermann <kustermann@google.com>
36 lines
1.2 KiB
C++
36 lines
1.2 KiB
C++
// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
#ifndef RUNTIME_VM_MESSAGE_SNAPSHOT_H_
|
|
#define RUNTIME_VM_MESSAGE_SNAPSHOT_H_
|
|
|
|
#include <memory>
|
|
|
|
#include "include/dart_native_api.h"
|
|
#include "vm/message.h"
|
|
#include "vm/object.h"
|
|
|
|
namespace dart {
|
|
|
|
std::unique_ptr<Message> WriteMessage(bool can_send_any_object,
|
|
bool same_group,
|
|
const Object& obj,
|
|
Dart_Port dest_port,
|
|
Message::Priority priority);
|
|
|
|
std::unique_ptr<Message> WriteApiMessage(Zone* zone,
|
|
Dart_CObject* obj,
|
|
Dart_Port dest_port,
|
|
Message::Priority priority);
|
|
|
|
ObjectPtr ReadObjectGraphCopyMessage(Thread* thread, PersistentHandle* handle);
|
|
|
|
ObjectPtr ReadMessage(Thread* thread, Message* message);
|
|
|
|
Dart_CObject* ReadApiMessage(Zone* zone, Message* message);
|
|
|
|
} // namespace dart
|
|
|
|
#endif // RUNTIME_VM_MESSAGE_SNAPSHOT_H_
|