Commit 77eb2269 authored by Gyuyoung Kim's avatar Gyuyoung Kim Committed by Commit Bot

OnionSoup: Remove all uses of UseCounter::Count(const LocalFrame*) in blink/renderer/core/frame

According to the plan to replace |const LocalFrame*| arguement with |const Document&|,
|ExecutionContext*|, or |DocumentLoader*| in UseCounter::Count(), this CL
replaces all uses of UseCounter::Count(const LocalFrame*) with
UseCounter::Count(const Document&) in frame directory.

Bug: 936187
Change-Id: I41f03b9908258881d4a1d932defb7e42e2deae9a
Reviewed-on: https://chromium-review.googlesource.com/c/1491060Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Gyuyoung Kim <gyuyoung@igalia.com>
Cr-Commit-Position: refs/heads/master@{#636659}
parent 30351787
...@@ -467,17 +467,17 @@ void DOMWindow::DoPostMessage(scoped_refptr<SerializedScriptValue> message, ...@@ -467,17 +467,17 @@ void DOMWindow::DoPostMessage(scoped_refptr<SerializedScriptValue> message,
->ToString()); ->ToString());
if (MixedContentChecker::IsMixedContent(source_document->GetSecurityOrigin(), if (MixedContentChecker::IsMixedContent(source_document->GetSecurityOrigin(),
target_url)) { target_url)) {
UseCounter::Count(source->GetFrame(), UseCounter::Count(source_document,
WebFeature::kPostMessageFromSecureToInsecure); WebFeature::kPostMessageFromSecureToInsecure);
} else if (MixedContentChecker::IsMixedContent( } else if (MixedContentChecker::IsMixedContent(
GetFrame()->GetSecurityContext()->GetSecurityOrigin(), GetFrame()->GetSecurityContext()->GetSecurityOrigin(),
source_document->Url())) { source_document->Url())) {
UseCounter::Count(source->GetFrame(), UseCounter::Count(source_document,
WebFeature::kPostMessageFromInsecureToSecure); WebFeature::kPostMessageFromInsecureToSecure);
if (MixedContentChecker::IsMixedContent( if (MixedContentChecker::IsMixedContent(
GetFrame()->Tree().Top().GetSecurityContext()->GetSecurityOrigin(), GetFrame()->Tree().Top().GetSecurityContext()->GetSecurityOrigin(),
source_document->Url())) { source_document->Url())) {
UseCounter::Count(source->GetFrame(), UseCounter::Count(source_document,
WebFeature::kPostMessageFromInsecureToSecureToplevel); WebFeature::kPostMessageFromInsecureToSecureToplevel);
} }
} }
...@@ -486,7 +486,7 @@ void DOMWindow::DoPostMessage(scoped_refptr<SerializedScriptValue> message, ...@@ -486,7 +486,7 @@ void DOMWindow::DoPostMessage(scoped_refptr<SerializedScriptValue> message,
target_url, RedirectStatus::kNoRedirect, target_url, RedirectStatus::kNoRedirect,
SecurityViolationReportingPolicy::kSuppressReporting)) { SecurityViolationReportingPolicy::kSuppressReporting)) {
UseCounter::Count( UseCounter::Count(
source->GetFrame(), source_document,
WebFeature::kPostMessageOutgoingWouldBeBlockedByConnectSrc); WebFeature::kPostMessageOutgoingWouldBeBlockedByConnectSrc);
} }
UserActivation* user_activation = nullptr; UserActivation* user_activation = nullptr;
......
...@@ -1028,9 +1028,10 @@ bool LocalFrame::CanNavigate(const Frame& target_frame, ...@@ -1028,9 +1028,10 @@ bool LocalFrame::CanNavigate(const Frame& target_frame,
// Top navigation in sandbox with or w/o 'allow-top-navigation'. // Top navigation in sandbox with or w/o 'allow-top-navigation'.
if (target_frame != this && sandboxed && target_frame == Tree().Top()) { if (target_frame != this && sandboxed && target_frame == Tree().Top()) {
UseCounter::Count(this, WebFeature::kTopNavInSandbox); UseCounter::Count(GetDocument(), WebFeature::kTopNavInSandbox);
if (!has_user_gesture) { if (!has_user_gesture) {
UseCounter::Count(this, WebFeature::kTopNavInSandboxWithoutGesture); UseCounter::Count(GetDocument(),
WebFeature::kTopNavInSandboxWithoutGesture);
} }
} }
...@@ -1051,11 +1052,11 @@ bool LocalFrame::CanNavigate(const Frame& target_frame, ...@@ -1051,11 +1052,11 @@ bool LocalFrame::CanNavigate(const Frame& target_frame,
if (IsAdSubframe()) if (IsAdSubframe())
framebust_params |= kAdBit; framebust_params |= kAdBit;
UseCounter::Count(this, WebFeature::kTopNavigationFromSubFrame); UseCounter::Count(GetDocument(), WebFeature::kTopNavigationFromSubFrame);
if (sandboxed) { // Sandboxed with 'allow-top-navigation'. if (sandboxed) { // Sandboxed with 'allow-top-navigation'.
UseCounter::Count(this, WebFeature::kTopNavInSandboxWithPerm); UseCounter::Count(GetDocument(), WebFeature::kTopNavInSandboxWithPerm);
if (!has_user_gesture) { if (!has_user_gesture) {
UseCounter::Count(this, UseCounter::Count(GetDocument(),
WebFeature::kTopNavInSandboxWithPermButNoGesture); WebFeature::kTopNavInSandboxWithPermButNoGesture);
} }
} }
...@@ -1131,7 +1132,8 @@ bool LocalFrame::CanNavigate(const Frame& target_frame, ...@@ -1131,7 +1132,8 @@ bool LocalFrame::CanNavigate(const Frame& target_frame,
!HasTransientUserActivation(this, false /* check_if_main_thread */) && !HasTransientUserActivation(this, false /* check_if_main_thread */) &&
!target_frame.GetSecurityContext()->GetSecurityOrigin()->CanAccess( !target_frame.GetSecurityContext()->GetSecurityOrigin()->CanAccess(
SecurityOrigin::Create(destination_url).get())) { SecurityOrigin::Create(destination_url).get())) {
UseCounter::Count(this, WebFeature::kOpenerNavigationWithoutGesture); UseCounter::Count(GetDocument(),
WebFeature::kOpenerNavigationWithoutGesture);
} }
if (!is_allowed_navigation && !error_reason.IsNull()) if (!is_allowed_navigation && !error_reason.IsNull())
......
...@@ -187,11 +187,11 @@ void LogCursorSizeCounter(LocalFrame* frame, const Cursor& cursor) { ...@@ -187,11 +187,11 @@ void LogCursorSizeCounter(LocalFrame* frame, const Cursor& cursor) {
IntSize scaled_size = image->Size(); IntSize scaled_size = image->Size();
scaled_size.Scale(1 / cursor.ImageScaleFactor()); scaled_size.Scale(1 / cursor.ImageScaleFactor());
if (scaled_size.Width() > 64 || scaled_size.Height() > 64) { if (scaled_size.Width() > 64 || scaled_size.Height() > 64) {
UseCounter::Count(frame, WebFeature::kCursorImageGT64x64); UseCounter::Count(frame->GetDocument(), WebFeature::kCursorImageGT64x64);
} else if (scaled_size.Width() > 32 || scaled_size.Height() > 32) { } else if (scaled_size.Width() > 32 || scaled_size.Height() > 32) {
UseCounter::Count(frame, WebFeature::kCursorImageGT32x32); UseCounter::Count(frame->GetDocument(), WebFeature::kCursorImageGT32x32);
} else { } else {
UseCounter::Count(frame, WebFeature::kCursorImageLE32x32); UseCounter::Count(frame->GetDocument(), WebFeature::kCursorImageLE32x32);
} }
} }
......
...@@ -1320,7 +1320,7 @@ void UseCounter::CountIfFeatureWouldBeBlockedByFeaturePolicy( ...@@ -1320,7 +1320,7 @@ void UseCounter::CountIfFeatureWouldBeBlockedByFeaturePolicy(
if (!frame.GetSecurityContext()->GetSecurityOrigin()->CanAccess(topOrigin)) { if (!frame.GetSecurityContext()->GetSecurityOrigin()->CanAccess(topOrigin)) {
// This frame is cross-origin with the top-level frame, and so would be // This frame is cross-origin with the top-level frame, and so would be
// blocked without a feature policy. // blocked without a feature policy.
UseCounter::Count(&frame, blocked_cross_origin); UseCounter::Count(frame.GetDocument(), blocked_cross_origin);
return; return;
} }
...@@ -1330,7 +1330,7 @@ void UseCounter::CountIfFeatureWouldBeBlockedByFeaturePolicy( ...@@ -1330,7 +1330,7 @@ void UseCounter::CountIfFeatureWouldBeBlockedByFeaturePolicy(
const Frame* f = &frame; const Frame* f = &frame;
while (!f->IsMainFrame()) { while (!f->IsMainFrame()) {
if (!f->GetSecurityContext()->GetSecurityOrigin()->CanAccess(topOrigin)) { if (!f->GetSecurityContext()->GetSecurityOrigin()->CanAccess(topOrigin)) {
UseCounter::Count(&frame, blocked_same_origin); UseCounter::Count(frame.GetDocument(), blocked_same_origin);
return; return;
} }
f = f->Tree().Parent(); f = f->Tree().Parent();
......
...@@ -2216,7 +2216,8 @@ void WebLocalFrameImpl::BlinkFeatureUsageReport(const std::set<int>& features) { ...@@ -2216,7 +2216,8 @@ void WebLocalFrameImpl::BlinkFeatureUsageReport(const std::set<int>& features) {
DCHECK(!features.empty()); DCHECK(!features.empty());
// Assimilate all features used/performed by the browser into UseCounter. // Assimilate all features used/performed by the browser into UseCounter.
for (int feature : features) { for (int feature : features) {
UseCounter::Count(GetFrame(), static_cast<WebFeature>(feature)); UseCounter::Count(GetFrame()->GetDocument(),
static_cast<WebFeature>(feature));
} }
} }
...@@ -2272,11 +2273,13 @@ void WebLocalFrameImpl::SendOrientationChangeEvent() { ...@@ -2272,11 +2273,13 @@ void WebLocalFrameImpl::SendOrientationChangeEvent() {
} }
void WebLocalFrameImpl::DidCallAddSearchProvider() { void WebLocalFrameImpl::DidCallAddSearchProvider() {
UseCounter::Count(GetFrame(), WebFeature::kExternalAddSearchProvider); UseCounter::Count(GetFrame()->GetDocument(),
WebFeature::kExternalAddSearchProvider);
} }
void WebLocalFrameImpl::DidCallIsSearchProviderInstalled() { void WebLocalFrameImpl::DidCallIsSearchProviderInstalled() {
UseCounter::Count(GetFrame(), WebFeature::kExternalIsSearchProviderInstalled); UseCounter::Count(GetFrame()->GetDocument(),
WebFeature::kExternalIsSearchProviderInstalled);
} }
void WebLocalFrameImpl::DispatchMessageEventWithOriginCheck( void WebLocalFrameImpl::DispatchMessageEventWithOriginCheck(
......
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