Skip to content
Permalink
Browse files

doc,v8: use code markup/markdown in headers

PR-URL: #31086
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
  • Loading branch information
Trott authored and BridgeAR committed Dec 24, 2019
1 parent 4672e10 commit 342d3372efe50d99b487379c767e7699097b4565
Showing with 36 additions and 36 deletions.
  1. +36 −36 doc/api/v8.md
@@ -11,7 +11,7 @@ const v8 = require('v8');

The APIs and implementation are subject to change at any time.

## v8.cachedDataVersionTag()
## `v8.cachedDataVersionTag()`
<!-- YAML
added: v8.0.0
-->
@@ -23,7 +23,7 @@ command line flags and detected CPU features. This is useful for determining
whether a [`vm.Script`][] `cachedData` buffer is compatible with this instance
of V8.

## v8.getHeapSpaceStatistics()
## `v8.getHeapSpaceStatistics()`
<!-- YAML
added: v6.0.0
changes:
@@ -88,7 +88,7 @@ The value returned is an array of objects containing the following properties:
]
```

## v8.getHeapSnapshot()
## `v8.getHeapSnapshot()`
<!-- YAML
added: v11.13.0
-->
@@ -106,7 +106,7 @@ const stream = v8.getHeapSnapshot();
stream.pipe(process.stdout);
```

## v8.getHeapStatistics()
## `v8.getHeapStatistics()`
<!-- YAML
added: v1.0.0
changes:
@@ -166,7 +166,7 @@ being non-zero indicates a potential memory leak.
}
```

## v8.getHeapCodeStatistics()
## `v8.getHeapCodeStatistics()`
<!-- YAML
added: v12.8.0
-->
@@ -188,7 +188,7 @@ Returns an object with the following properties:
}
```

## v8.setFlagsFromString(flags)
## `v8.setFlagsFromString(flags)`
<!-- YAML
added: v1.0.0
-->
@@ -212,7 +212,7 @@ v8.setFlagsFromString('--trace_gc');
setTimeout(() => { v8.setFlagsFromString('--notrace_gc'); }, 60e3);
```

## v8.writeHeapSnapshot(\[filename\])
## `v8.writeHeapSnapshot([filename])`
<!-- YAML
added: v11.13.0
-->
@@ -270,7 +270,7 @@ The serialization API provides means of serializing JavaScript values in a way
that is compatible with the [HTML structured clone algorithm][].
The format is backward-compatible (i.e. safe to store to disk).

### v8.serialize(value)
### `v8.serialize(value)`
<!-- YAML
added: v8.0.0
-->
@@ -280,7 +280,7 @@ added: v8.0.0

Uses a [`DefaultSerializer`][] to serialize `value` into a buffer.

### v8.deserialize(buffer)
### `v8.deserialize(buffer)`
<!-- YAML
added: v8.0.0
-->
@@ -290,19 +290,19 @@ added: v8.0.0
Uses a [`DefaultDeserializer`][] with default options to read a JS value
from a buffer.

### class: v8.Serializer
### Class: `v8.Serializer`
<!-- YAML
added: v8.0.0
-->

#### new Serializer()
#### `new Serializer()`
Creates a new `Serializer` object.

#### serializer.writeHeader()
#### `serializer.writeHeader()`

Writes out a header, which includes the serialization format version.

#### serializer.writeValue(value)
#### `serializer.writeValue(value)`

* `value` {any}

@@ -311,15 +311,15 @@ internal buffer.

This throws an error if `value` cannot be serialized.

#### serializer.releaseBuffer()
#### `serializer.releaseBuffer()`

* Returns: {Buffer}

Returns the stored internal buffer. This serializer should not be used once
the buffer is released. Calling this method results in undefined behavior
if a previous write has failed.

#### serializer.transferArrayBuffer(id, arrayBuffer)
#### `serializer.transferArrayBuffer(id, arrayBuffer)`

* `id` {integer} A 32-bit unsigned integer.
* `arrayBuffer` {ArrayBuffer} An `ArrayBuffer` instance.
@@ -328,37 +328,37 @@ Marks an `ArrayBuffer` as having its contents transferred out of band.
Pass the corresponding `ArrayBuffer` in the deserializing context to
[`deserializer.transferArrayBuffer()`][].

#### serializer.writeUint32(value)
#### `serializer.writeUint32(value)`

* `value` {integer}

Write a raw 32-bit unsigned integer.
For use inside of a custom [`serializer._writeHostObject()`][].

#### serializer.writeUint64(hi, lo)
#### `serializer.writeUint64(hi, lo)`

* `hi` {integer}
* `lo` {integer}

Write a raw 64-bit unsigned integer, split into high and low 32-bit parts.
For use inside of a custom [`serializer._writeHostObject()`][].

#### serializer.writeDouble(value)
#### `serializer.writeDouble(value)`

* `value` {number}

Write a JS `number` value.
For use inside of a custom [`serializer._writeHostObject()`][].

#### serializer.writeRawBytes(buffer)
#### `serializer.writeRawBytes(buffer)`

* `buffer` {Buffer|TypedArray|DataView}

Write raw bytes into the serializer’s internal buffer. The deserializer
will require a way to compute the length of the buffer.
For use inside of a custom [`serializer._writeHostObject()`][].

#### serializer.\_writeHostObject(object)
#### `serializer._writeHostObject(object)`

* `object` {Object}

@@ -369,7 +369,7 @@ exception should be thrown.
This method is not present on the `Serializer` class itself but can be provided
by subclasses.

#### serializer.\_getDataCloneError(message)
#### `serializer._getDataCloneError(message)`

* `message` {string}

@@ -379,7 +379,7 @@ object can not be cloned.
This method defaults to the [`Error`][] constructor and can be overridden on
subclasses.

#### serializer.\_getSharedArrayBufferId(sharedArrayBuffer)
#### `serializer._getSharedArrayBufferId(sharedArrayBuffer)`

* `sharedArrayBuffer` {SharedArrayBuffer}

@@ -394,36 +394,36 @@ If the object cannot be serialized, an exception should be thrown.
This method is not present on the `Serializer` class itself but can be provided
by subclasses.

#### serializer.\_setTreatArrayBufferViewsAsHostObjects(flag)
#### `serializer._setTreatArrayBufferViewsAsHostObjects(flag)`

* `flag` {boolean} **Default:** `false`

Indicate whether to treat `TypedArray` and `DataView` objects as
host objects, i.e. pass them to [`serializer._writeHostObject()`][].

### class: v8.Deserializer
### Class: `v8.Deserializer`
<!-- YAML
added: v8.0.0
-->

#### new Deserializer(buffer)
#### `new Deserializer(buffer)`

* `buffer` {Buffer|TypedArray|DataView} A buffer returned by
[`serializer.releaseBuffer()`][].

Creates a new `Deserializer` object.

#### deserializer.readHeader()
#### `deserializer.readHeader()`

Reads and validates a header (including the format version).
May, for example, reject an invalid or unsupported wire format. In that case,
an `Error` is thrown.

#### deserializer.readValue()
#### `deserializer.readValue()`

Deserializes a JavaScript value from the buffer and returns it.

#### deserializer.transferArrayBuffer(id, arrayBuffer)
#### `deserializer.transferArrayBuffer(id, arrayBuffer)`

* `id` {integer} A 32-bit unsigned integer.
* `arrayBuffer` {ArrayBuffer|SharedArrayBuffer} An `ArrayBuffer` instance.
@@ -433,37 +433,37 @@ Pass the corresponding `ArrayBuffer` in the serializing context to
[`serializer.transferArrayBuffer()`][] (or return the `id` from
[`serializer._getSharedArrayBufferId()`][] in the case of `SharedArrayBuffer`s).

#### deserializer.getWireFormatVersion()
#### `deserializer.getWireFormatVersion()`

* Returns: {integer}

Reads the underlying wire format version. Likely mostly to be useful to
legacy code reading old wire format versions. May not be called before
`.readHeader()`.

#### deserializer.readUint32()
#### `deserializer.readUint32()`

* Returns: {integer}

Read a raw 32-bit unsigned integer and return it.
For use inside of a custom [`deserializer._readHostObject()`][].

#### deserializer.readUint64()
#### `deserializer.readUint64()`

* Returns: {integer[]}

Read a raw 64-bit unsigned integer and return it as an array `[hi, lo]`
with two 32-bit unsigned integer entries.
For use inside of a custom [`deserializer._readHostObject()`][].

#### deserializer.readDouble()
#### `deserializer.readDouble()`

* Returns: {number}

Read a JS `number` value.
For use inside of a custom [`deserializer._readHostObject()`][].

#### deserializer.readRawBytes(length)
#### `deserializer.readRawBytes(length)`

* `length` {integer}
* Returns: {Buffer}
@@ -473,7 +473,7 @@ must correspond to the length of the buffer that was passed to
[`serializer.writeRawBytes()`][].
For use inside of a custom [`deserializer._readHostObject()`][].

#### deserializer.\_readHostObject()
#### `deserializer._readHostObject()`

This method is called to read some kind of host object, i.e. an object that is
created by native C++ bindings. If it is not possible to deserialize the data,
@@ -482,7 +482,7 @@ a suitable exception should be thrown.
This method is not present on the `Deserializer` class itself but can be
provided by subclasses.

### class: v8.DefaultSerializer
### Class: `v8.DefaultSerializer`
<!-- YAML
added: v8.0.0
-->
@@ -491,7 +491,7 @@ A subclass of [`Serializer`][] that serializes `TypedArray`
(in particular [`Buffer`][]) and `DataView` objects as host objects, and only
stores the part of their underlying `ArrayBuffer`s that they are referring to.

### class: v8.DefaultDeserializer
### Class: `v8.DefaultDeserializer`
<!-- YAML
added: v8.0.0
-->

0 comments on commit 342d337

Please sign in to comment.
You can’t perform that action at this time.