[api] mark readonly usage of StartupData as const
This doesn’t have much practical effect, since the actual byte contents referred to by `StartupData` are already marked `const`, but adding the qualifier communicates more clearly to users that V8 does not perform modifications on the object. Practically speaking, this also allows for cases in which the startup data is included as readonly data in the current executable without requiring a `const_cast`. Refs: https://github.com/nodejs/node/pull/45786#discussion_r1043489245 Change-Id: I53075ebb493c3617e470decb601b803f5294848d Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4089203 Reviewed-by: Michael Lippautz <mlippautz@chromium.org> Commit-Queue: Michael Lippautz <mlippautz@chromium.org> Cr-Commit-Position: refs/heads/main@{#84764}
This commit is contained in:
parent
748e6d7c45
commit
ccddea063b
@ -233,7 +233,7 @@ class V8_EXPORT Isolate {
|
|||||||
* Explicitly specify a startup snapshot blob. The embedder owns the blob.
|
* Explicitly specify a startup snapshot blob. The embedder owns the blob.
|
||||||
* The embedder *must* ensure that the snapshot is from a trusted source.
|
* The embedder *must* ensure that the snapshot is from a trusted source.
|
||||||
*/
|
*/
|
||||||
StartupData* snapshot_blob = nullptr;
|
const StartupData* snapshot_blob = nullptr;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enables the host application to provide a mechanism for recording
|
* Enables the host application to provide a mechanism for recording
|
||||||
|
@ -91,7 +91,7 @@ class V8_EXPORT SnapshotCreator {
|
|||||||
*/
|
*/
|
||||||
SnapshotCreator(Isolate* isolate,
|
SnapshotCreator(Isolate* isolate,
|
||||||
const intptr_t* external_references = nullptr,
|
const intptr_t* external_references = nullptr,
|
||||||
StartupData* existing_blob = nullptr);
|
const StartupData* existing_blob = nullptr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create and enter an isolate, and set it up for serialization.
|
* Create and enter an isolate, and set it up for serialization.
|
||||||
@ -102,7 +102,7 @@ class V8_EXPORT SnapshotCreator {
|
|||||||
* that must be equivalent to CreateParams::external_references.
|
* that must be equivalent to CreateParams::external_references.
|
||||||
*/
|
*/
|
||||||
SnapshotCreator(const intptr_t* external_references = nullptr,
|
SnapshotCreator(const intptr_t* external_references = nullptr,
|
||||||
StartupData* existing_blob = nullptr);
|
const StartupData* existing_blob = nullptr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destroy the snapshot creator, and exit and dispose of the Isolate
|
* Destroy the snapshot creator, and exit and dispose of the Isolate
|
||||||
|
@ -546,7 +546,7 @@ struct SnapshotCreatorData {
|
|||||||
|
|
||||||
SnapshotCreator::SnapshotCreator(Isolate* v8_isolate,
|
SnapshotCreator::SnapshotCreator(Isolate* v8_isolate,
|
||||||
const intptr_t* external_references,
|
const intptr_t* external_references,
|
||||||
StartupData* existing_snapshot) {
|
const StartupData* existing_snapshot) {
|
||||||
SnapshotCreatorData* data = new SnapshotCreatorData(v8_isolate);
|
SnapshotCreatorData* data = new SnapshotCreatorData(v8_isolate);
|
||||||
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
|
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
|
||||||
i_isolate->set_array_buffer_allocator(&data->allocator_);
|
i_isolate->set_array_buffer_allocator(&data->allocator_);
|
||||||
@ -568,7 +568,7 @@ SnapshotCreator::SnapshotCreator(Isolate* v8_isolate,
|
|||||||
}
|
}
|
||||||
|
|
||||||
SnapshotCreator::SnapshotCreator(const intptr_t* external_references,
|
SnapshotCreator::SnapshotCreator(const intptr_t* external_references,
|
||||||
StartupData* existing_snapshot)
|
const StartupData* existing_snapshot)
|
||||||
: SnapshotCreator(Isolate::Allocate(), external_references,
|
: SnapshotCreator(Isolate::Allocate(), external_references,
|
||||||
existing_snapshot) {}
|
existing_snapshot) {}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user