Skip to content

Commit

Permalink
Restore PendingScript prefinalizer.
Browse files Browse the repository at this point in the history
Under some as yet unknown conditions, PendingScript objects can become garbage
without having been explicitly detached/disposed of first. Hence restore the
prefinalizer that r396656 removed.

R=
BUG=615977

Review-Url: https://codereview.chromium.org/2021773004
Cr-Commit-Position: refs/heads/master@{#396813}
  • Loading branch information
sigbjornf authored and Commit bot committed May 31, 2016
1 parent f22b1b6 commit 0c49fbd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
3 changes: 1 addition & 2 deletions third_party/WebKit/Source/core/dom/PendingScript.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,11 @@ PendingScript::PendingScript(Element* element, ScriptResource* resource)
, m_client(nullptr)
{
setScriptResource(resource);
ThreadState::current()->registerPreFinalizer(this);
}

PendingScript::~PendingScript()
{
// Verify explicit dispose().
CHECK(!m_client && !m_element && !m_streamer);
}

void PendingScript::dispose()
Expand Down
1 change: 1 addition & 0 deletions third_party/WebKit/Source/core/dom/PendingScript.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class ScriptSourceCode;
// lifetime in order to guarantee that the data buffer will not be purged.
class CORE_EXPORT PendingScript final : public GarbageCollectedFinalized<PendingScript>, public ResourceOwner<ScriptResource> {
USING_GARBAGE_COLLECTED_MIXIN(PendingScript);
USING_PRE_FINALIZER(PendingScript, dispose);
WTF_MAKE_NONCOPYABLE(PendingScript);
public:
static PendingScript* create(Element*, ScriptResource*);
Expand Down

0 comments on commit 0c49fbd

Please sign in to comment.