Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
cfx_v8.cpp
Go to the documentation of this file.
1
// Copyright 2017 The PDFium Authors
2
// Use of this source code is governed by a BSD-style license that can be
3
// found in the LICENSE file.
4
5
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7
#
include
"fxjs/cfx_v8.h"
8
9
#
include
"fxjs/fxv8.h"
10
#
include
"v8/include/v8-isolate.h"
11
12
CFX_V8
::
CFX_V8
(v8::Isolate* isolate) :
m_pIsolate
(
isolate
) {}
13
14
CFX_V8
::~
CFX_V8
() =
default
;
15
16
v8::Local<v8::Value>
CFX_V8
::GetObjectProperty(
17
v8::Local<v8::Object> pObj,
18
ByteStringView bsUTF8PropertyName) {
19
return
fxv8::ReentrantGetObjectPropertyHelper(GetIsolate(), pObj,
20
bsUTF8PropertyName);
21
}
22
23
std::vector<WideString>
CFX_V8
::GetObjectPropertyNames(
24
v8::Local<v8::Object> pObj) {
25
return
fxv8::ReentrantGetObjectPropertyNamesHelper(GetIsolate(), pObj);
26
}
27
28
void
CFX_V8
::PutObjectProperty(v8::Local<v8::Object> pObj,
29
ByteStringView bsUTF8PropertyName,
30
v8::Local<v8::Value> pPut) {
31
fxv8::ReentrantPutObjectPropertyHelper(GetIsolate(), pObj, bsUTF8PropertyName,
32
pPut);
33
}
34
35
void
CFX_V8
::
DisposeIsolate
() {
36
if
(m_pIsolate)
37
m_pIsolate.ExtractAsDangling()->Dispose();
38
}
39
40
v8
::
Local
<
v8
::
Array
>
CFX_V8
::
NewArray
() {
41
return
fxv8::NewArrayHelper(GetIsolate());
42
}
43
44
v8
::
Local
<
v8
::
Object
>
CFX_V8
::
NewObject
() {
45
return
fxv8::NewObjectHelper(GetIsolate());
46
}
47
48
void
CFX_V8
::PutArrayElement(v8::Local<v8::Array> pArray,
49
size_t index,
50
v8::Local<v8::Value> pValue) {
51
fxv8::ReentrantPutArrayElementHelper(GetIsolate(), pArray, index, pValue);
52
}
53
54
v8::Local<v8::Value>
CFX_V8
::GetArrayElement(v8::Local<v8::Array> pArray,
55
size_t index) {
56
return
fxv8::ReentrantGetArrayElementHelper(GetIsolate(), pArray, index);
57
}
58
59
size_t
CFX_V8
::GetArrayLength(v8::Local<v8::Array> pArray) {
60
return
fxv8::GetArrayLengthHelper(pArray);
61
}
62
63
v8
::
Local
<
v8
::
Number
>
CFX_V8
::
NewNumber
(
int
number) {
64
return
fxv8::NewNumberHelper(GetIsolate(), number);
65
}
66
67
v8
::
Local
<
v8
::
Number
>
CFX_V8
::
NewNumber
(
double
number) {
68
return
fxv8::NewNumberHelper(GetIsolate(), number);
69
}
70
71
v8
::
Local
<
v8
::
Number
>
CFX_V8
::
NewNumber
(
float
number) {
72
return
fxv8::NewNumberHelper(GetIsolate(), number);
73
}
74
75
v8
::
Local
<
v8
::
Boolean
>
CFX_V8
::
NewBoolean
(
bool
b) {
76
return
fxv8::NewBooleanHelper(GetIsolate(), b);
77
}
78
79
v8
::
Local
<
v8
::
String
>
CFX_V8
::
NewString
(
ByteStringView
str) {
80
return
fxv8::NewStringHelper(GetIsolate(), str);
81
}
82
83
v8
::
Local
<
v8
::
String
>
CFX_V8
::
NewString
(
WideStringView
str) {
84
// Conversion from pdfium's wchar_t wide-strings to v8's uint16_t
85
// wide-strings isn't handled by v8, so use UTF8 as a common
86
// intermediate format.
87
return
NewString(FX_UTF8Encode(str).AsStringView());
88
}
89
90
v8
::
Local
<
v8
::
Value
>
CFX_V8
::
NewNull
() {
91
return
fxv8::NewNullHelper(GetIsolate());
92
}
93
94
v8
::
Local
<
v8
::
Value
>
CFX_V8
::
NewUndefined
() {
95
return
fxv8::NewUndefinedHelper(GetIsolate());
96
}
97
98
v8
::
Local
<
v8
::
Date
>
CFX_V8
::
NewDate
(
double
d) {
99
return
fxv8::NewDateHelper(GetIsolate(), d);
100
}
101
102
int
CFX_V8
::ToInt32(v8::Local<v8::Value> pValue) {
103
return
fxv8::ReentrantToInt32Helper(GetIsolate(), pValue);
104
}
105
106
bool
CFX_V8
::ToBoolean(v8::Local<v8::Value> pValue) {
107
return
fxv8::ReentrantToBooleanHelper(GetIsolate(), pValue);
108
}
109
110
double
CFX_V8
::ToDouble(v8::Local<v8::Value> pValue) {
111
return
fxv8::ReentrantToDoubleHelper(GetIsolate(), pValue);
112
}
113
114
WideString
CFX_V8
::ToWideString(v8::Local<v8::Value> pValue) {
115
return
fxv8::ReentrantToWideStringHelper(GetIsolate(), pValue);
116
}
117
118
ByteString
CFX_V8
::ToByteString(v8::Local<v8::Value> pValue) {
119
return
fxv8::ReentrantToByteStringHelper(GetIsolate(), pValue);
120
}
121
122
v8::Local<v8::Object>
CFX_V8
::ToObject(v8::Local<v8::Value> pValue) {
123
return
fxv8::ReentrantToObjectHelper(GetIsolate(), pValue);
124
}
125
126
v8::Local<v8::Array>
CFX_V8
::ToArray(v8::Local<v8::Value> pValue) {
127
return
fxv8::ReentrantToArrayHelper(GetIsolate(), pValue);
128
}
129
130
void
CFX_V8IsolateDeleter
::
operator
()(v8::Isolate* ptr) {
131
ptr->Dispose();
132
}
ByteString
fxcrt::ByteString ByteString
Definition
bytestring.h:180
CFX_V8
Definition
cfx_v8.h:18
CFX_V8::NewNumber
v8::Local< v8::Number > NewNumber(double number)
Definition
cfx_v8.cpp:67
CFX_V8::NewNumber
v8::Local< v8::Number > NewNumber(float number)
Definition
cfx_v8.cpp:71
CFX_V8::NewBoolean
v8::Local< v8::Boolean > NewBoolean(bool b)
Definition
cfx_v8.cpp:75
CFX_V8::NewString
v8::Local< v8::String > NewString(WideStringView str)
Definition
cfx_v8.cpp:83
CFX_V8::NewArray
v8::Local< v8::Array > NewArray()
Definition
cfx_v8.cpp:40
CFX_V8::CFX_V8
CFX_V8(v8::Isolate *pIsolate)
Definition
cfx_v8.cpp:12
CFX_V8::NewDate
v8::Local< v8::Date > NewDate(double d)
Definition
cfx_v8.cpp:98
CFX_V8::NewNull
v8::Local< v8::Value > NewNull()
Definition
cfx_v8.cpp:90
CFX_V8::DisposeIsolate
void DisposeIsolate()
Definition
cfx_v8.cpp:35
CFX_V8::NewObject
v8::Local< v8::Object > NewObject()
Definition
cfx_v8.cpp:44
CFX_V8::~CFX_V8
virtual ~CFX_V8()
CFX_V8::NewNumber
v8::Local< v8::Number > NewNumber(int number)
Definition
cfx_v8.cpp:63
CFX_V8::NewString
v8::Local< v8::String > NewString(ByteStringView str)
Definition
cfx_v8.cpp:79
CFX_V8::NewUndefined
v8::Local< v8::Value > NewUndefined()
Definition
cfx_v8.cpp:94
ByteStringView
fxcrt::ByteStringView ByteStringView
Definition
string_view_template.h:325
WideStringView
fxcrt::WideStringView WideStringView
Definition
string_view_template.h:326
CFX_V8IsolateDeleter
Definition
cfx_v8.h:70
CFX_V8IsolateDeleter::operator()
void operator()(v8::Isolate *ptr)
Definition
cfx_v8.cpp:130
WideString
fxcrt::WideString WideString
Definition
widestring.h:207
qtwebengine
src
3rdparty
chromium
third_party
pdfium
fxjs
cfx_v8.cpp
Generated on
for Qt by
1.18.0