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

Unified Diff: third_party/WebKit/Source/web/WebLeakDetector.cpp

Issue 1715203002: Stop async spellchecker before running the leak detector. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase + parameterize WebLeakDetector over WebFrames instead Created 4 years, 10 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
Index: third_party/WebKit/Source/web/WebLeakDetector.cpp
diff --git a/third_party/WebKit/Source/web/WebLeakDetector.cpp b/third_party/WebKit/Source/web/WebLeakDetector.cpp
index a77a8ee361d9f09f7b441e886b157e385b0555f9..f3440dc60c5f75c8af9b2b9371c3ffe421eb2d39 100644
--- a/third_party/WebKit/Source/web/WebLeakDetector.cpp
+++ b/third_party/WebKit/Source/web/WebLeakDetector.cpp
@@ -35,6 +35,7 @@
#include "bindings/core/v8/V8GCController.h"
#include "core/dom/ActiveDOMObject.h"
#include "core/dom/Document.h"
+#include "core/editing/spellcheck/SpellChecker.h"
#include "core/fetch/MemoryCache.h"
#include "core/inspector/InstanceCounters.h"
#include "core/layout/LayoutObject.h"
@@ -42,7 +43,8 @@
#include "modules/webaudio/AudioNode.h"
#include "platform/Timer.h"
#include "public/web/WebDocument.h"
-#include "public/web/WebLocalFrame.h"
+#include "public/web/WebFrame.h"
+#include "web/WebLocalFrameImpl.h"
namespace blink {
@@ -62,7 +64,7 @@ public:
~WebLeakDetectorImpl() override {}
- void prepareForLeakDetection() override;
+ void prepareForLeakDetection(WebFrame*) override;
void collectGarbageAndReport() override;
private:
@@ -75,7 +77,7 @@ private:
int m_numberOfGCNeeded;
};
-void WebLeakDetectorImpl::prepareForLeakDetection()
+void WebLeakDetectorImpl::prepareForLeakDetection(WebFrame* frame)
{
v8::Isolate* isolate = v8::Isolate::GetCurrent();
v8::HandleScope handleScope(isolate);
@@ -90,6 +92,17 @@ void WebLeakDetectorImpl::prepareForLeakDetection()
WorkerThread::terminateAndWaitForAllWorkers();
memoryCache()->evictResources();
+ // If the spellchecker is allowed to continue issuing requests while the
+ // leak detector runs, leaks may flakily be reported as the requests keep
+ // their associated element (and document) alive.
+ //
+ // Stop the spellchecker to prevent this.
+ if (frame->isWebLocalFrame()) {
+ WebLocalFrameImpl* localFrame = toWebLocalFrameImpl(frame);
+ SpellChecker& spellChecker = localFrame->frame()->spellChecker();
+ spellChecker.prepareForLeakDetection();
+ }
+
// FIXME: HTML5 Notification should be closed because notification affects the result of number of DOM objects.
V8PerIsolateData::from(isolate)->clearScriptRegexpContext();
« no previous file with comments | « third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.cpp ('k') | third_party/WebKit/public/web/WebLeakDetector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698