Commit c35af225 authored by Yuta Kitamura's avatar Yuta Kitamura Committed by Commit Bot

Closures for swap promises must be cross-thread.

Upon landing of <http://crrev.com/c/765749>, which tightened up the threading
check of WTF::Function, a few assertion failures were reported.

The stack traces indicated closures for swap promises (in PaintTiming.cpp
and FirstMeaningfulPaintDetector.cpp) might end up getting destructed on the
compositor thread. To allow this, WTF::CrossThreadBind() must be used instead
of WTF::Bind().

Bug: 786194
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2
Change-Id: I9252eff15ca00e1bc0dfc8f87629ccb9acb56714
Reviewed-on: https://chromium-review.googlesource.com/776343Reviewed-by: default avatarTaiju Tsuiki <tzik@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Reviewed-by: default avatarenne <enne@chromium.org>
Commit-Queue: enne <enne@chromium.org>
Cr-Commit-Position: refs/heads/master@{#517471}
parent 86da8cb2
......@@ -7,10 +7,10 @@
#include "core/css/FontFaceSetDocument.h"
#include "core/paint/PaintTiming.h"
#include "core/probe/CoreProbes.h"
#include "platform/CrossThreadFunctional.h"
#include "platform/Histogram.h"
#include "platform/instrumentation/tracing/TraceEvent.h"
#include "platform/loader/fetch/ResourceFetcher.h"
#include "platform/wtf/Functional.h"
#include "public/platform/TaskType.h"
#include "public/platform/WebLayerTreeView.h"
......@@ -247,8 +247,8 @@ void FirstMeaningfulPaintDetector::ReportHistograms() {
void FirstMeaningfulPaintDetector::RegisterNotifySwapTime(PaintEvent event) {
++outstanding_swap_promise_count_;
paint_timing_->RegisterNotifySwapTime(
event, WTF::Bind(&FirstMeaningfulPaintDetector::ReportSwapTime,
WrapCrossThreadWeakPersistent(this), event));
event, CrossThreadBind(&FirstMeaningfulPaintDetector::ReportSwapTime,
WrapCrossThreadWeakPersistent(this), event));
}
void FirstMeaningfulPaintDetector::ReportSwapTime(
......
......@@ -19,6 +19,7 @@
#include "core/probe/CoreProbes.h"
#include "core/timing/DOMWindowPerformance.h"
#include "core/timing/Performance.h"
#include "platform/CrossThreadFunctional.h"
#include "platform/Histogram.h"
#include "platform/WebFrameScheduler.h"
#include "platform/instrumentation/tracing/TraceEvent.h"
......@@ -185,9 +186,9 @@ void PaintTiming::SetFirstContentfulPaint(double stamp) {
}
void PaintTiming::RegisterNotifySwapTime(PaintEvent event) {
RegisterNotifySwapTime(event,
WTF::Bind(&PaintTiming::ReportSwapTime,
WrapCrossThreadWeakPersistent(this), event));
RegisterNotifySwapTime(
event, CrossThreadBind(&PaintTiming::ReportSwapTime,
WrapCrossThreadWeakPersistent(this), event));
}
void PaintTiming::RegisterNotifySwapTime(PaintEvent event,
......
......@@ -29,7 +29,7 @@ class CORE_EXPORT PaintTiming final
USING_GARBAGE_COLLECTED_MIXIN(PaintTiming);
friend class FirstMeaningfulPaintDetector;
using ReportTimeCallback =
WTF::Function<void(WebLayerTreeView::SwapResult, double)>;
WTF::CrossThreadFunction<void(WebLayerTreeView::SwapResult, double)>;
public:
virtual ~PaintTiming() {}
......
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