Commit faa05510 authored by hiroshige's avatar hiroshige Committed by Commit bot

Do not call Dispose() as ClassicPendingScript's prefinalizer

Because the things in ClassicPendingScript::DisposeInternal() except for
ScriptStreamer::Cancel() doesn't have to be called as a prefinalizer,
this CL introduces ClassicPendingScript::Prefinalize() that only calls
ScriptStreamer::Cancel() and thus makes Dispose() not to be called there.

This CL simplified the prefinalization of ClassicPendingScript, especially
order dependencies between ClassicPendingScript's prefinalizer and the
prefinalizer of its parent class (ResourceOwner).
Leaving ClassicPendingScript in a not-Dispose()d state is not observable
if the related classes obeys the rule of Oilpan, and checks that in case there were
a bug.


Cr-Commit-Position: refs/heads/master@{#467299}
parent e9f7bc11
......@@ -47,8 +47,11 @@ NOINLINE void ClassicPendingScript::CheckState() const {
CHECK(!streamer_ || streamer_->GetResource() == GetResource());
NOINLINE void ClassicPendingScript::Dispose() {
void ClassicPendingScript::Prefinalize() {
// TODO(hiroshige): Consider moving this to ScriptStreamer's prefinalizer.
if (streamer_)
prefinalizer_called_ = true;
......@@ -27,11 +27,7 @@ class CORE_EXPORT ClassicPendingScript final
public ResourceOwner<ScriptResource>,
public MemoryCoordinatorClient {
// In order to call Dispose() before ResourceOwner's prefinalizer, we
// also register ClassicPendingScript::Dispose() as the prefinalizer of
// ClassicPendingScript here.
USING_PRE_FINALIZER(ClassicPendingScript, Dispose);
USING_PRE_FINALIZER(ClassicPendingScript, Prefinalize);
// For script from an external file.
......@@ -61,11 +57,7 @@ class CORE_EXPORT ClassicPendingScript final
void RemoveFromMemoryCache() override;
void DisposeInternal() override;
// Just used as the prefinalizer, does the same as PendingScript::Dispose().
// We define Dispose() with NOINLINE in ClassicPendingScript just to make
// the prefinalizers of PendingScript and ClassicPendingScript have
// different addresses to avoid assertion failures on Windows test bots.
void Dispose();
void Prefinalize();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment