diff options
author | sgjesse@chromium.org <sgjesse@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-20 11:01:33 +0000 |
---|---|---|
committer | sgjesse@chromium.org <sgjesse@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-20 11:01:33 +0000 |
commit | 349feecde71c4d71834870c88bb701830e75f927 (patch) | |
tree | b415ba0265ecfd07bf1cb650f09facff53fc86b6 /webkit/port/bindings/v8/v8_custom.h | |
parent | 292c90d8dfa53f696f79d6ba50e9699146a9602d (diff) | |
download | chromium_src-349feecde71c4d71834870c88bb701830e75f927.zip chromium_src-349feecde71c4d71834870c88bb701830e75f927.tar.gz chromium_src-349feecde71c4d71834870c88bb701830e75f927.tar.bz2 |
Added GC protection support for objects with possible pending activity which is only backed by weak wrappers.
The objects which can have pending activity are XMLHttpRequest and MessagePort. In WebKit these two classes are both instances of ActiveDOMObject. In the V8 binding layer these two types of objects are now beeing tracked so that before GC their wrappers can be made not weak if there is currently pending activity. In addition to that MessagePort wrappers now have an additional internal field to reference their entangled port when entangled.
Before MessagePort where added to WebKit pending activity for XMLHttpRequest was handled through a direct GC protect mechanism which protected/unprotected the object when its state changed. However, using this for MessagePort would require an GC protection check in each MessagePort message as the transition to/from pending is not as explicit as for XMLHttpRequest.
Changed direct calls to dom_object_map().set(...) to use SetJSWrapperForDOMObject and added an ASSERT to check that SetJSWrapperForDOMObject is called with a DOM wrapper object. Changed the order of calls to SetDOMWrapper and SetJSWrapperForDOMObject to make sure that SetDOMWrapper is called first.
This fixes 3 GC related layout tests
chrome/fast/dom/xmlhttprequest-gc.html
LayoutTests/fast/events/message-channel-gc-2.html
LayoutTests/fast/events/message-channel-gc-3.html
Added a chrome specific GC layout test for MessagePort (chrome/fast/dom/xmlhttprequest-gc.html) to match the existing one for XMLHttpRequest (chrome/fast/dom/xmlhttprequest-gc.html).
This change forks MessagePort.cpp.
Review URL: http://codereview.chromium.org/11205
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5770 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/port/bindings/v8/v8_custom.h')
-rw-r--r-- | webkit/port/bindings/v8/v8_custom.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/webkit/port/bindings/v8/v8_custom.h b/webkit/port/bindings/v8/v8_custom.h index d3bee4c..de64bd7 100644 --- a/webkit/port/bindings/v8/v8_custom.h +++ b/webkit/port/bindings/v8/v8_custom.h @@ -63,8 +63,10 @@ class V8Custom { static const int kMessagePortRequestCacheIndex = kDefaultWrapperInternalFieldCount + 0; - static const int kMessagePortInternalFieldCount = + static const int kMessagePortEntangledPortIndex = kDefaultWrapperInternalFieldCount + 1; + static const int kMessagePortInternalFieldCount = + kDefaultWrapperInternalFieldCount + 2; static const int kDOMWindowLocationIndex = kDefaultWrapperInternalFieldCount + 0; |