-
-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy pathV8PointerValue.h
More file actions
46 lines (33 loc) · 1.12 KB
/
V8PointerValue.h
File metadata and controls
46 lines (33 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
* Copyright (c) Kudo Chien.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#pragma once
#include "V8Runtime.h"
#include "jsi/jsi.h"
#include "v8.h"
namespace rnv8 {
class V8PointerValue final : public V8Runtime::PointerValue {
public:
V8PointerValue(v8::Isolate* isolate, const v8::Local<v8::Value>& value);
// Passing Global value directly
V8PointerValue(v8::Isolate* isolate, v8::Global<v8::Value>&& value);
~V8PointerValue() override;
v8::Local<v8::Value> Get(v8::Isolate* isolate) const;
void Reset(v8::Isolate* isolate, v8::Local<v8::Value> value);
public:
static V8PointerValue* createFromOneByte(v8::Isolate* isolate,
const char* str, size_t length);
static V8PointerValue* createFromUtf8(v8::Isolate* isolate,
const uint8_t* str, size_t length);
private:
void invalidate() override;
private:
friend class JSIV8ValueConverter;
friend class V8Runtime;
v8::Isolate* isolate_;
v8::Global<v8::Value> value_;
};
} // namespace rnv8