blob: 7e4dab43f05addcbbfe3499c6e7b0a0e026dead9 [file] [log] [blame]
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/shell/test_runner/layout_and_paint_async_then.h"
#include "base/barrier_closure.h"
#include "base/callback.h"
#include "base/trace_event/trace_event.h"
#include "third_party/blink/public/web/web_page_popup.h"
#include "third_party/blink/public/web/web_widget.h"
namespace test_runner {
void LayoutAndPaintAsyncThen(blink::WebPagePopup* popup,
blink::WebWidget* web_widget,
base::OnceClosure callback) {
TRACE_EVENT0("shell", "LayoutAndPaintAsyncThen");
if (popup) {
auto barrier = base::BarrierClosure(2, std::move(callback));
web_widget->LayoutAndPaintAsync(barrier);
popup->LayoutAndPaintAsync(barrier);
} else {
web_widget->LayoutAndPaintAsync(std::move(callback));
}
}
} // namespace test_runner