зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1709135 - XDR: Make decoded content immutable. r=arai
Differential Revision: https://phabricator.services.mozilla.com/D114627
This commit is contained in:
Родитель
965cab1dbc
Коммит
338eedf93e
|
@ -101,7 +101,7 @@ namespace JS {
|
|||
|
||||
// Reference to a sequence of bytes.
|
||||
// TODO: This type should be Span<cont uint8_t> (Bug 1709135)
|
||||
using SelfHostedCache = mozilla::Span<uint8_t>;
|
||||
using SelfHostedCache = mozilla::Span<const uint8_t>;
|
||||
|
||||
// Callback function used to copy the SelfHosted content to memory or to disk.
|
||||
using SelfHostedWriter = bool (*)(JSContext*, SelfHostedCache);
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace JS {
|
|||
class ReadOnlyCompileOptions;
|
||||
|
||||
using TranscodeBuffer = mozilla::Vector<uint8_t>;
|
||||
using TranscodeRange = mozilla::Range<uint8_t>;
|
||||
using TranscodeRange = mozilla::Range<const uint8_t>;
|
||||
|
||||
struct TranscodeSource final {
|
||||
TranscodeSource(const TranscodeRange& range_, const char* file, uint32_t line)
|
||||
|
@ -80,7 +80,7 @@ inline bool IsTranscodingBytecodeOffsetAligned(size_t offset) {
|
|||
return offset % BytecodeOffsetAlignment == 0;
|
||||
}
|
||||
|
||||
inline bool IsTranscodingBytecodeAligned(void* offset) {
|
||||
inline bool IsTranscodingBytecodeAligned(const void* offset) {
|
||||
return IsTranscodingBytecodeOffsetAligned(size_t(offset));
|
||||
}
|
||||
|
||||
|
|
|
@ -134,7 +134,7 @@ class XDRBuffer<XDR_DECODE> : public XDRBufferBase {
|
|||
|
||||
const uint8_t* read(size_t n) {
|
||||
MOZ_ASSERT(cursor_ < buffer_.length());
|
||||
uint8_t* ptr = &buffer_[cursor_];
|
||||
const uint8_t* ptr = &buffer_[cursor_];
|
||||
cursor_ += n;
|
||||
|
||||
// Don't let buggy code read past our buffer
|
||||
|
@ -147,7 +147,7 @@ class XDRBuffer<XDR_DECODE> : public XDRBufferBase {
|
|||
|
||||
const uint8_t* peek(size_t n) {
|
||||
MOZ_ASSERT(cursor_ < buffer_.length());
|
||||
uint8_t* ptr = &buffer_[cursor_];
|
||||
const uint8_t* ptr = &buffer_[cursor_];
|
||||
|
||||
// Don't let buggy code read past our buffer
|
||||
if (cursor_ + n > buffer_.length()) {
|
||||
|
|
|
@ -31,7 +31,7 @@ class SelfHostedShmem final : public nsIMemoryReporter {
|
|||
|
||||
// NOTE: This type is identical to JS::SelfHostedCache, but we repeat it to
|
||||
// avoid including JS engine API in ipc code.
|
||||
using ContentType = mozilla::Span<uint8_t>;
|
||||
using ContentType = mozilla::Span<const uint8_t>;
|
||||
|
||||
static SelfHostedShmem& GetSingleton();
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче