Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(92)

Unified Diff: third_party/WebKit/Source/bindings/IDLExtendedAttributes.md

Issue 2265873003: binding: Moves hasPendingActivity from ActiveScriptWrappable to ScriptWrappable. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed review comments. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/core/v8/ActiveScriptWrappable.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/bindings/IDLExtendedAttributes.md
diff --git a/third_party/WebKit/Source/bindings/IDLExtendedAttributes.md b/third_party/WebKit/Source/bindings/IDLExtendedAttributes.md
index 4e15b52adf5850dbd1efa2c2d71f72abc5841c53..ee6b3929762b256134611f623f1560dc4d00d493 100644
--- a/third_party/WebKit/Source/bindings/IDLExtendedAttributes.md
+++ b/third_party/WebKit/Source/bindings/IDLExtendedAttributes.md
@@ -509,18 +509,21 @@ If an interface X has `[ActiveScriptWrappable]` and an interface Y inherits the
```webidl
[
ActiveScriptWrappable,
+ DependentLifetime,
] interface Foo {};
-```
interface Bar : Foo {}; // inherits [ActiveScriptWrappable] from Foo
+```
+
If a given DOM object needs to be kept alive as long as the DOM object has pending activities, you need to specify `[ActiveScriptWrappable]` and `[DependentLifetime]`. For example, `[ActiveScriptWrappable]` can be used when the DOM object is expecting events to be raised in the future.
-If you use `[ActiveScriptWrappable]`, the corresponding Blink class needs to inherit ActiveScriptWrappable. For example, in case of XMLHttpRequest, core/xml/XMLHttpRequest.h would look like this:
+If you use `[ActiveScriptWrappable]`, the corresponding Blink class needs to inherit ActiveScriptWrappable and override hasPendingActivity(). For example, in case of XMLHttpRequest, core/xml/XMLHttpRequest.h would look like this:
```c++
class XMLHttpRequest : public ActiveScriptWrappable
{
- ...;
+ // Returns true if the object needs to be kept alive.
+ bool hasPendingActivity() const override { return ...; }
}
```
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/core/v8/ActiveScriptWrappable.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698