Skip to content
This repository was archived by the owner on Mar 29, 2024. It is now read-only.

Commit f4e652a

Browse files
committed
Remove deprecated V8\Context::EstimatedSize() method
1 parent 2f9104b commit f4e652a

File tree

3 files changed

+5
-35
lines changed

3 files changed

+5
-35
lines changed

src/php_v8_context.cc

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -262,20 +262,6 @@ static PHP_METHOD(V8Context, SetErrorMessageForCodeGenerationFromStrings)
262262
context->SetErrorMessageForCodeGenerationFromStrings(local_string);
263263
}
264264

265-
static PHP_METHOD(V8Context, EstimatedSize)
266-
{
267-
if (zend_parse_parameters_none() == FAILURE) {
268-
return;
269-
}
270-
271-
PHP_V8_CONTEXT_FETCH_WITH_CHECK(getThis(), php_v8_context);
272-
273-
PHP_V8_ENTER_STORED_ISOLATE(php_v8_context);
274-
PHP_V8_ENTER_CONTEXT(php_v8_context);
275-
276-
RETURN_LONG(context->EstimatedSize());
277-
}
278-
279265
ZEND_BEGIN_ARG_INFO_EX(arginfo_v8_context___construct, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1)
280266
ZEND_ARG_OBJ_INFO(0, isolate, V8\\Isolate, 0)
281267
ZEND_ARG_OBJ_INFO(0, global_template, V8\\ObjectTemplate, 1)
@@ -318,9 +304,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_v8_context_SetErrorMessageForCodeGenerationFromSt
318304
ZEND_ARG_OBJ_INFO(0, message, V8\\StringValue, 0)
319305
ZEND_END_ARG_INFO()
320306

321-
PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_v8_context_EstimatedSize, ZEND_RETURN_VALUE, 0, IS_LONG, 0)
322-
ZEND_END_ARG_INFO()
323-
324307

325308
static const zend_function_entry php_v8_context_methods[] = {
326309
PHP_ME(V8Context, __construct, arginfo_v8_context___construct, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
@@ -337,8 +320,6 @@ static const zend_function_entry php_v8_context_methods[] = {
337320
PHP_ME(V8Context, IsCodeGenerationFromStringsAllowed, arginfo_v8_context_IsCodeGenerationFromStringsAllowed, ZEND_ACC_PUBLIC)
338321
PHP_ME(V8Context, SetErrorMessageForCodeGenerationFromStrings, arginfo_v8_context_SetErrorMessageForCodeGenerationFromStrings, ZEND_ACC_PUBLIC)
339322

340-
PHP_ME(V8Context, EstimatedSize, arginfo_v8_context_EstimatedSize, ZEND_ACC_PUBLIC)
341-
342323
PHP_FE_END
343324
};
344325

stubs/src/Context.php

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function __construct(
5555
/**
5656
* @return \V8\Isolate
5757
*/
58-
public function GetIsolate() : Isolate
58+
public function GetIsolate(): Isolate
5959
{
6060
return $this->isolate;
6161
}
@@ -74,7 +74,7 @@ public function GetIsolate() : Isolate
7474
*
7575
* @return \V8\ObjectValue
7676
*/
77-
public function GlobalObject() : ObjectValue
77+
public function GlobalObject(): ObjectValue
7878
{
7979
}
8080

@@ -110,7 +110,7 @@ public function UseDefaultSecurityToken()
110110
*
111111
* @return \V8\Value
112112
*/
113-
public function GetSecurityToken() : Value
113+
public function GetSecurityToken(): Value
114114
{
115115
}
116116

@@ -139,7 +139,7 @@ public function AllowCodeGenerationFromStrings(bool $allow)
139139
*
140140
* @return bool
141141
*/
142-
public function IsCodeGenerationFromStringsAllowed() : bool
142+
public function IsCodeGenerationFromStringsAllowed(): bool
143143
{
144144
}
145145

@@ -153,11 +153,4 @@ public function IsCodeGenerationFromStringsAllowed() : bool
153153
public function SetErrorMessageForCodeGenerationFromStrings(StringValue $message)
154154
{
155155
}
156-
157-
/**
158-
* Estimate the memory in bytes retained by this context.
159-
*/
160-
public function EstimatedSize() : int
161-
{
162-
}
163156
}

tests/V8Context.phpt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ $v8_helper = new PhpV8Helpers($helper);
1414
$isolate1 = new \V8\Isolate();
1515

1616
$context = new \V8\Context($isolate1);
17-
$helper->pretty_dump('Estimated memory usage size by this context', $context->EstimatedSize());
1817

1918
$helper->method_matches_instanceof($context, 'GlobalObject', \V8\ObjectValue::class);
2019

@@ -37,11 +36,9 @@ $res = $v8_helper->CompileTryRun($context, 'eval("1+1")');
3736
$context->SetErrorMessageForCodeGenerationFromStrings(new \V8\StringValue($isolate1, 'Whoa! Nope. No eval this time, sorry.'));
3837
$res = $v8_helper->CompileTryRun($context, 'eval("2+2")');
3938

40-
$helper->pretty_dump('Estimated memory usage size by this context', $context->EstimatedSize());
4139

4240
?>
43-
--EXPECTF--
44-
Estimated memory usage size by this context: int(%d)
41+
--EXPECT--
4542
V8\Context::GlobalObject() result is instance of V8\ObjectValue
4643
CHECK $global->SameValue($context->GlobalObject()): OK
4744
V8\Context::IsCodeGenerationFromStringsAllowed() matches expected value
@@ -50,4 +47,3 @@ Code generation is not allowed: ok
5047
V8\Context::IsCodeGenerationFromStringsAllowed() matches expected false
5148
eval("1+1"): V8\Exceptions\TryCatchException: EvalError: Code generation from strings disallowed for this context
5249
eval("2+2"): V8\Exceptions\TryCatchException: EvalError: Whoa! Nope. No eval this time, sorry.
53-
Estimated memory usage size by this context: int(%d)

0 commit comments

Comments
 (0)