Skip to content

Commit 38789f7

Browse files
committed
Use final in generated callback code
https://bugs.webkit.org/show_bug.cgi?id=219169 Reviewed by Darin Adler. Generated callbacks descend from ContextDestructionObserver and are final. The scriptExecutionContext method is not virtual so adding override errors. Remove the virtual for that case and mark the destructor as final. Regenerated bindings through run-bindings-tests. * bindings/scripts/CodeGeneratorJS.pm: * bindings/scripts/test/JS/JSTestCallbackFunction.h: * bindings/scripts/test/JS/JSTestCallbackFunctionRethrow.h: * bindings/scripts/test/JS/JSTestCallbackFunctionWithThisObject.h: * bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.h: * bindings/scripts/test/JS/JSTestCallbackInterface.h: * bindings/scripts/test/JS/JSTestVoidCallbackFunction.h: Canonical link: https://commits.webkit.org/231824@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@270115 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 8306b84 commit 38789f7

8 files changed

Lines changed: 35 additions & 14 deletions

Source/WebCore/ChangeLog

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
1+
2020-11-20 Don Olmstead <don.olmstead@sony.com>
2+
3+
Use final in generated callback code
4+
https://bugs.webkit.org/show_bug.cgi?id=219169
5+
6+
Reviewed by Darin Adler.
7+
8+
Generated callbacks descend from ContextDestructionObserver and are final. The
9+
scriptExecutionContext method is not virtual so adding override errors. Remove the virtual
10+
for that case and mark the destructor as final.
11+
12+
Regenerated bindings through run-bindings-tests.
13+
14+
* bindings/scripts/CodeGeneratorJS.pm:
15+
* bindings/scripts/test/JS/JSTestCallbackFunction.h:
16+
* bindings/scripts/test/JS/JSTestCallbackFunctionRethrow.h:
17+
* bindings/scripts/test/JS/JSTestCallbackFunctionWithThisObject.h:
18+
* bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.h:
19+
* bindings/scripts/test/JS/JSTestCallbackInterface.h:
20+
* bindings/scripts/test/JS/JSTestVoidCallbackFunction.h:
21+
122
2020-11-20 Zalan Bujtas <zalan@apple.com>
223

324
[LFC][IFC] Move horizontal space tracking from Line to LineBuilder

Source/WebCore/bindings/scripts/CodeGeneratorJS.pm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6477,9 +6477,9 @@ sub GenerateCallbackHeaderContent
64776477
push(@$contentRef, " return adoptRef(*new ${className}(callback, globalObject));\n");
64786478
push(@$contentRef, " }\n\n");
64796479

6480-
push(@$contentRef, " virtual ScriptExecutionContext* scriptExecutionContext() const { return ContextDestructionObserver::scriptExecutionContext(); }\n\n");
6480+
push(@$contentRef, " ScriptExecutionContext* scriptExecutionContext() const { return ContextDestructionObserver::scriptExecutionContext(); }\n\n");
64816481

6482-
push(@$contentRef, " virtual ~$className();\n");
6482+
push(@$contentRef, " ~$className() final;\n");
64836483

64846484
push(@$contentRef, " ${callbackDataType}* callbackData() { return m_data; }\n");
64856485

Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunction.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ class JSTestCallbackFunction final : public TestCallbackFunction {
3434
return adoptRef(*new JSTestCallbackFunction(callback, globalObject));
3535
}
3636

37-
virtual ScriptExecutionContext* scriptExecutionContext() const { return ContextDestructionObserver::scriptExecutionContext(); }
37+
ScriptExecutionContext* scriptExecutionContext() const { return ContextDestructionObserver::scriptExecutionContext(); }
3838

39-
virtual ~JSTestCallbackFunction();
39+
~JSTestCallbackFunction() final;
4040
JSCallbackDataStrong* callbackData() { return m_data; }
4141

4242
// Functions

Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunctionRethrow.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ class JSTestCallbackFunctionRethrow final : public TestCallbackFunctionRethrow {
3434
return adoptRef(*new JSTestCallbackFunctionRethrow(callback, globalObject));
3535
}
3636

37-
virtual ScriptExecutionContext* scriptExecutionContext() const { return ContextDestructionObserver::scriptExecutionContext(); }
37+
ScriptExecutionContext* scriptExecutionContext() const { return ContextDestructionObserver::scriptExecutionContext(); }
3838

39-
virtual ~JSTestCallbackFunctionRethrow();
39+
~JSTestCallbackFunctionRethrow() final;
4040
JSCallbackDataStrong* callbackData() { return m_data; }
4141

4242
// Functions

Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunctionWithThisObject.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ class JSTestCallbackFunctionWithThisObject final : public TestCallbackFunctionWi
3434
return adoptRef(*new JSTestCallbackFunctionWithThisObject(callback, globalObject));
3535
}
3636

37-
virtual ScriptExecutionContext* scriptExecutionContext() const { return ContextDestructionObserver::scriptExecutionContext(); }
37+
ScriptExecutionContext* scriptExecutionContext() const { return ContextDestructionObserver::scriptExecutionContext(); }
3838

39-
virtual ~JSTestCallbackFunctionWithThisObject();
39+
~JSTestCallbackFunctionWithThisObject() final;
4040
JSCallbackDataStrong* callbackData() { return m_data; }
4141

4242
// Functions

Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ class JSTestCallbackFunctionWithTypedefs final : public TestCallbackFunctionWith
3434
return adoptRef(*new JSTestCallbackFunctionWithTypedefs(callback, globalObject));
3535
}
3636

37-
virtual ScriptExecutionContext* scriptExecutionContext() const { return ContextDestructionObserver::scriptExecutionContext(); }
37+
ScriptExecutionContext* scriptExecutionContext() const { return ContextDestructionObserver::scriptExecutionContext(); }
3838

39-
virtual ~JSTestCallbackFunctionWithTypedefs();
39+
~JSTestCallbackFunctionWithTypedefs() final;
4040
JSCallbackDataStrong* callbackData() { return m_data; }
4141

4242
// Functions

Source/WebCore/bindings/scripts/test/JS/JSTestCallbackInterface.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ class JSTestCallbackInterface final : public TestCallbackInterface {
3838
return adoptRef(*new JSTestCallbackInterface(callback, globalObject));
3939
}
4040

41-
virtual ScriptExecutionContext* scriptExecutionContext() const { return ContextDestructionObserver::scriptExecutionContext(); }
41+
ScriptExecutionContext* scriptExecutionContext() const { return ContextDestructionObserver::scriptExecutionContext(); }
4242

43-
virtual ~JSTestCallbackInterface();
43+
~JSTestCallbackInterface() final;
4444
JSCallbackDataStrong* callbackData() { return m_data; }
4545
static JSC::JSValue getConstructor(JSC::VM&, const JSC::JSGlobalObject*);
4646

Source/WebCore/bindings/scripts/test/JS/JSTestVoidCallbackFunction.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ class JSTestVoidCallbackFunction final : public TestVoidCallbackFunction {
3636
return adoptRef(*new JSTestVoidCallbackFunction(callback, globalObject));
3737
}
3838

39-
virtual ScriptExecutionContext* scriptExecutionContext() const { return ContextDestructionObserver::scriptExecutionContext(); }
39+
ScriptExecutionContext* scriptExecutionContext() const { return ContextDestructionObserver::scriptExecutionContext(); }
4040

41-
virtual ~JSTestVoidCallbackFunction();
41+
~JSTestVoidCallbackFunction() final;
4242
JSCallbackDataStrong* callbackData() { return m_data; }
4343

4444
// Functions

0 commit comments

Comments
 (0)