GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: node_wasm_web_api.h Lines: 5 7 71.4 %
Date: 2022-05-16 04:15:04 Branches: 0 0 - %

Line Branch Exec Source
1
#ifndef SRC_NODE_WASM_WEB_API_H_
2
#define SRC_NODE_WASM_WEB_API_H_
3
4
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
5
6
#include "base_object-inl.h"
7
#include "v8.h"
8
9
namespace node {
10
namespace wasm_web_api {
11
12
// Wrapper for interacting with a v8::WasmStreaming instance from JavaScript.
13
class WasmStreamingObject final : public BaseObject {
14
 public:
15
  static v8::Local<v8::Function> Initialize(Environment* env);
16
17
  static void RegisterExternalReferences(ExternalReferenceRegistry* registry);
18
19
  void MemoryInfo(MemoryTracker* tracker) const override;
20
  SET_MEMORY_INFO_NAME(WasmStreamingObject)
21
  SET_SELF_SIZE(WasmStreamingObject)
22
23
  static v8::MaybeLocal<v8::Object> Create(
24
      Environment* env, std::shared_ptr<v8::WasmStreaming> streaming);
25
26
 private:
27
228
  WasmStreamingObject(Environment* env, v8::Local<v8::Object> object)
28
228
      : BaseObject(env, object) {
29
228
    MakeWeak();
30
228
  }
31
32
912
  ~WasmStreamingObject() override {}
33
34
 private:
35
  static void New(const v8::FunctionCallbackInfo<v8::Value>& args);
36
  static void SetURL(const v8::FunctionCallbackInfo<v8::Value>& args);
37
  static void Push(const v8::FunctionCallbackInfo<v8::Value>& args);
38
  static void Finish(const v8::FunctionCallbackInfo<v8::Value>& args);
39
  static void Abort(const v8::FunctionCallbackInfo<v8::Value>& args);
40
41
  std::shared_ptr<v8::WasmStreaming> streaming_;
42
  size_t wasm_size_ = 0;
43
};
44
45
// This is a v8::WasmStreamingCallback implementation that must be passed to
46
// v8::Isolate::SetWasmStreamingCallback when setting up the isolate in order to
47
// enable the WebAssembly.(compile|instantiate)Streaming APIs.
48
void StartStreamingCompilation(const v8::FunctionCallbackInfo<v8::Value>& args);
49
50
}  // namespace wasm_web_api
51
}  // namespace node
52
53
#endif  // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
54
55
#endif  // SRC_NODE_WASM_WEB_API_H_