Commit 99943a99 authored by Xianzhu Wang's avatar Xianzhu Wang Committed by Commit Bot

Reland "Mark some blink testing targets testonly"

This reverts commit 1a394948.

Reason for revert: crbug.com/1011605 (probably caused by a linker bug
on ARM ChromeOS) has been worked around in crbug.com/1011161.

Original change's description:
> Revert "Mark some blink testing targets testonly"
>
> This reverts commit a4453534.
>
> Reason for revert: http://crbug.com/1011605
>
> Original change's description:
> > Mark some blink testing targets testonly
> >
> > This forbids production code depending on these targets, and enables
> > these targets to depend on other testonly targets in the future.
> >
> > The only dependency prevented core:testing from being testonly was
> > from BlinkLeakDetector. Add Page::PrepareForLeakDetection() and
> > InternalSettingsPageSupplementStub (in page.h) to avoid the
> > dependency.
> >
> > Change-Id: Ie22676a233d9b5c02cf3cde79629f4b84782b572
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1829586
> > Reviewed-by: Chris Harrelson <chrishtr@chromium.org>
> > Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#701334}
>
> TBR=wangxianzhu@chromium.org,chrishtr@chromium.org
>
> # Not skipping CQ checks because original CL landed > 1 day ago.
>
> Change-Id: Icb266b74d3f75ffff2176ec2b0ca4871d99e7587
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1842973
> Reviewed-by: Kuo Jen Wei <inker@chromium.org>
> Commit-Queue: Kuo Jen Wei <inker@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#703202}

TBR=wangxianzhu@chromium.org,chrishtr@chromium.org,inker@chromium.org

Change-Id: I7390267d2f56aed847dd0f615bebdac5e2348526
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1876870Reviewed-by: default avatarXianzhu Wang <wangxianzhu@chromium.org>
Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#708770}
parent 631487bc
......@@ -18,7 +18,6 @@ jumbo_component("controller") {
deps = [
"//skia",
"//third_party/blink/renderer/core",
"//third_party/blink/renderer/core:testing",
"//third_party/blink/renderer/modules",
"//third_party/blink/renderer/platform",
"//v8",
......
......@@ -67,10 +67,7 @@ void BlinkLeakDetector::PerformLeakDetection(
for (auto resource_fetcher : ResourceFetcher::MainThreadFetchers())
resource_fetcher->PrepareForLeakDetection();
// Internal settings are ScriptWrappable and thus may retain documents
// depending on whether the garbage collector(s) are able to find the settings
// object through the Page supplement.
InternalSettings::PrepareForLeakDetection();
Page::PrepareForLeakDetection();
// Task queue may contain delayed object destruction tasks.
// This method is called from navigation hook inside FrameLoader,
......
......@@ -241,6 +241,8 @@ component("core") {
}
jumbo_source_set("testing") {
testonly = true
configs += [
":blink_core_pch",
"//third_party/blink/renderer:config",
......
......@@ -1025,4 +1025,17 @@ Page::PageClients::~PageClients() = default;
template class CORE_TEMPLATE_EXPORT Supplement<Page>;
const char InternalSettingsPageSupplementBase::kSupplementName[] =
"InternalSettings";
// static
void Page::PrepareForLeakDetection() {
// Internal settings are ScriptWrappable and thus may retain documents
// depending on whether the garbage collector(s) are able to find the settings
// object through the Page supplement. Prepares for leak detection by removing
// all InternalSetting objects from Pages.
for (Page* page : OrdinaryPages())
page->RemoveSupplement<InternalSettingsPageSupplementBase>();
}
} // namespace blink
......@@ -341,6 +341,8 @@ class CORE_EXPORT Page final : public GarbageCollected<Page>,
return history_navigation_virtual_time_pauser_;
}
static void PrepareForLeakDetection();
private:
friend class ScopedPagePauser;
......@@ -458,6 +460,12 @@ class CORE_EXPORT Page final : public GarbageCollected<Page>,
extern template class CORE_EXTERN_TEMPLATE_EXPORT Supplement<Page>;
class CORE_EXPORT InternalSettingsPageSupplementBase : public Supplement<Page> {
public:
using Supplement<Page>::Supplement;
static const char kSupplementName[];
};
} // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_CORE_PAGE_PAGE_H_
......@@ -115,13 +115,12 @@ InternalSettings* InternalSettings::From(Page& page) {
}
return supplement;
}
const char InternalSettings::kSupplementName[] = "InternalSettings";
InternalSettings::~InternalSettings() = default;
InternalSettings::InternalSettings(Page& page)
: InternalSettingsGenerated(&page),
Supplement<Page>(page),
InternalSettingsPageSupplementBase(page),
backup_(&page.GetSettings()) {}
void InternalSettings::ResetToConsistentState() {
......@@ -556,12 +555,4 @@ void InternalSettings::setUniversalAccessFromFileURLs(
GetSettings()->SetAllowUniversalAccessFromFileURLs(enabled);
}
void InternalSettings::PrepareForLeakDetection() {
// Prepares for leak detection by removing all InternalSetting objects from
// Pages.
for (Page* page : Page::OrdinaryPages()) {
page->RemoveSupplement<InternalSettings>();
}
}
} // namespace blink
......@@ -44,15 +44,11 @@ class Page;
class Settings;
class InternalSettings final : public InternalSettingsGenerated,
public Supplement<Page> {
public InternalSettingsPageSupplementBase {
USING_GARBAGE_COLLECTED_MIXIN(InternalSettings);
DEFINE_WRAPPERTYPEINFO();
public:
static const char kSupplementName[];
static void PrepareForLeakDetection();
class Backup {
DISALLOW_NEW();
......
......@@ -23,6 +23,8 @@ blink_modules_sources("exported") {
}
static_library("test_support") {
testonly = true
deps = [
"//skia",
"//third_party/blink/renderer/core:testing",
......
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