Chromium Code Reviews| Index: third_party/WebKit/Source/core/dom/Document.cpp |
| diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp |
| index b8178d8ac6d4d502ab047f41ed3a26978f8b2146..6f8ab0f87f4e8e94e805a7bfc0a84884ce534c3f 100644 |
| --- a/third_party/WebKit/Source/core/dom/Document.cpp |
| +++ b/third_party/WebKit/Source/core/dom/Document.cpp |
| @@ -406,7 +406,7 @@ static void recordLoadReasonToHistogram(WouldLoadReason reason) { |
| } |
| class Document::NetworkStateObserver final |
| - : public GarbageCollected<Document::NetworkStateObserver>, |
| + : public GarbageCollectedFinalized<Document::NetworkStateObserver>, |
| public NetworkStateNotifier::NetworkStateObserver, |
| public ContextLifecycleObserver { |
| USING_GARBAGE_COLLECTED_MIXIN(Document::NetworkStateObserver); |
| @@ -419,6 +419,11 @@ class Document::NetworkStateObserver final |
| TaskRunnerHelper::get(TaskType::Networking, getExecutionContext())); |
| } |
| + ~NetworkStateObserver() { |
| + if (getExecutionContext()) |
|
sof
2017/02/24 14:21:59
It's safe to do this eagerly, but how about introd
kinuko
2017/02/24 14:43:16
Sounds good, done.
|
| + contextDestroyed(getExecutionContext()); |
| + } |
| + |
| void onLineStateChange(bool onLine) override { |
| AtomicString eventName = |
| onLine ? EventTypeNames::online : EventTypeNames::offline; |
| @@ -435,6 +440,7 @@ class Document::NetworkStateObserver final |
| } |
| DEFINE_INLINE_VIRTUAL_TRACE() { ContextLifecycleObserver::trace(visitor); } |
| + EAGERLY_FINALIZE(); |
| }; |
| Document::Document(const DocumentInit& initializer, |