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") { ...@@ -18,7 +18,6 @@ jumbo_component("controller") {
deps = [ deps = [
"//skia", "//skia",
"//third_party/blink/renderer/core", "//third_party/blink/renderer/core",
"//third_party/blink/renderer/core:testing",
"//third_party/blink/renderer/modules", "//third_party/blink/renderer/modules",
"//third_party/blink/renderer/platform", "//third_party/blink/renderer/platform",
"//v8", "//v8",
......
...@@ -67,10 +67,7 @@ void BlinkLeakDetector::PerformLeakDetection( ...@@ -67,10 +67,7 @@ void BlinkLeakDetector::PerformLeakDetection(
for (auto resource_fetcher : ResourceFetcher::MainThreadFetchers()) for (auto resource_fetcher : ResourceFetcher::MainThreadFetchers())
resource_fetcher->PrepareForLeakDetection(); resource_fetcher->PrepareForLeakDetection();
// Internal settings are ScriptWrappable and thus may retain documents Page::PrepareForLeakDetection();
// depending on whether the garbage collector(s) are able to find the settings
// object through the Page supplement.
InternalSettings::PrepareForLeakDetection();
// Task queue may contain delayed object destruction tasks. // Task queue may contain delayed object destruction tasks.
// This method is called from navigation hook inside FrameLoader, // This method is called from navigation hook inside FrameLoader,
......
...@@ -241,6 +241,8 @@ component("core") { ...@@ -241,6 +241,8 @@ component("core") {
} }
jumbo_source_set("testing") { jumbo_source_set("testing") {
testonly = true
configs += [ configs += [
":blink_core_pch", ":blink_core_pch",
"//third_party/blink/renderer:config", "//third_party/blink/renderer:config",
......
...@@ -1025,4 +1025,17 @@ Page::PageClients::~PageClients() = default; ...@@ -1025,4 +1025,17 @@ Page::PageClients::~PageClients() = default;
template class CORE_TEMPLATE_EXPORT Supplement<Page>; 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 } // namespace blink
...@@ -341,6 +341,8 @@ class CORE_EXPORT Page final : public GarbageCollected<Page>, ...@@ -341,6 +341,8 @@ class CORE_EXPORT Page final : public GarbageCollected<Page>,
return history_navigation_virtual_time_pauser_; return history_navigation_virtual_time_pauser_;
} }
static void PrepareForLeakDetection();
private: private:
friend class ScopedPagePauser; friend class ScopedPagePauser;
...@@ -458,6 +460,12 @@ class CORE_EXPORT Page final : public GarbageCollected<Page>, ...@@ -458,6 +460,12 @@ class CORE_EXPORT Page final : public GarbageCollected<Page>,
extern template class CORE_EXTERN_TEMPLATE_EXPORT Supplement<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 } // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_CORE_PAGE_PAGE_H_ #endif // THIRD_PARTY_BLINK_RENDERER_CORE_PAGE_PAGE_H_
...@@ -115,13 +115,12 @@ InternalSettings* InternalSettings::From(Page& page) { ...@@ -115,13 +115,12 @@ InternalSettings* InternalSettings::From(Page& page) {
} }
return supplement; return supplement;
} }
const char InternalSettings::kSupplementName[] = "InternalSettings";
InternalSettings::~InternalSettings() = default; InternalSettings::~InternalSettings() = default;
InternalSettings::InternalSettings(Page& page) InternalSettings::InternalSettings(Page& page)
: InternalSettingsGenerated(&page), : InternalSettingsGenerated(&page),
Supplement<Page>(page), InternalSettingsPageSupplementBase(page),
backup_(&page.GetSettings()) {} backup_(&page.GetSettings()) {}
void InternalSettings::ResetToConsistentState() { void InternalSettings::ResetToConsistentState() {
...@@ -556,12 +555,4 @@ void InternalSettings::setUniversalAccessFromFileURLs( ...@@ -556,12 +555,4 @@ void InternalSettings::setUniversalAccessFromFileURLs(
GetSettings()->SetAllowUniversalAccessFromFileURLs(enabled); 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 } // namespace blink
...@@ -44,15 +44,11 @@ class Page; ...@@ -44,15 +44,11 @@ class Page;
class Settings; class Settings;
class InternalSettings final : public InternalSettingsGenerated, class InternalSettings final : public InternalSettingsGenerated,
public Supplement<Page> { public InternalSettingsPageSupplementBase {
USING_GARBAGE_COLLECTED_MIXIN(InternalSettings); USING_GARBAGE_COLLECTED_MIXIN(InternalSettings);
DEFINE_WRAPPERTYPEINFO(); DEFINE_WRAPPERTYPEINFO();
public: public:
static const char kSupplementName[];
static void PrepareForLeakDetection();
class Backup { class Backup {
DISALLOW_NEW(); DISALLOW_NEW();
......
...@@ -23,6 +23,8 @@ blink_modules_sources("exported") { ...@@ -23,6 +23,8 @@ blink_modules_sources("exported") {
} }
static_library("test_support") { static_library("test_support") {
testonly = true
deps = [ deps = [
"//skia", "//skia",
"//third_party/blink/renderer/core:testing", "//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