Commit a172727c authored by Nate Chapin's avatar Nate Chapin Committed by Commit Bot

Misc core/ cleanup of ExecutionContextClient frame-variant usage

Change-Id: I212fd68b99ac07343dafc2ae65ca2a6e24b6ccac
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2487697
Commit-Queue: Kentaro Hara <haraken@chromium.org>
Auto-Submit: Nate Chapin <japhet@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#819174}
parent 52cbd3b6
......@@ -34,31 +34,28 @@
namespace blink {
StyleMedia::StyleMedia(LocalFrame* frame) : ExecutionContextClient(frame) {}
StyleMedia::StyleMedia(LocalDOMWindow* window)
: ExecutionContextClient(window) {}
AtomicString StyleMedia::type() const {
LocalFrameView* view = GetFrame() ? GetFrame()->View() : nullptr;
if (view)
return view->MediaType();
return g_null_atom;
if (!DomWindow())
return g_null_atom;
return DomWindow()->GetFrame()->View()->MediaType();
}
bool StyleMedia::matchMedium(const String& query) const {
if (!GetFrame())
if (!DomWindow())
return false;
Document* document = GetFrame()->GetDocument();
DCHECK(document);
Element* document_element = document->documentElement();
Element* document_element = DomWindow()->document()->documentElement();
if (!document_element)
return false;
scoped_refptr<MediaQuerySet> media = MediaQuerySet::Create();
if (!media->Set(query, GetFrame()->DomWindow()))
if (!media->Set(query, DomWindow()))
return false;
MediaQueryEvaluator screen_eval(GetFrame());
MediaQueryEvaluator screen_eval(DomWindow()->GetFrame());
return screen_eval.Eval(*media);
}
......
......@@ -34,13 +34,13 @@
namespace blink {
class LocalFrame;
class LocalDOMWindow;
class StyleMedia final : public ScriptWrappable, public ExecutionContextClient {
DEFINE_WRAPPERTYPEINFO();
public:
explicit StyleMedia(LocalFrame*);
explicit StyleMedia(LocalDOMWindow*);
AtomicString type() const;
bool matchMedium(const String&) const;
......
......@@ -819,7 +819,6 @@ bool WebPluginContainerImpl::WantsWheelEvents() const {
WebPluginContainerImpl::WebPluginContainerImpl(HTMLPlugInElement& element,
WebPlugin* web_plugin)
: EmbeddedContentView(IntRect()),
ExecutionContextClient(element.GetDocument().GetFrame()),
element_(element),
web_plugin_(web_plugin),
layer_(nullptr),
......@@ -875,7 +874,6 @@ void WebPluginContainerImpl::SetFrameRect(const IntRect& rect) {
void WebPluginContainerImpl::Trace(Visitor* visitor) const {
visitor->Trace(element_);
visitor->Trace(mouse_lock_lost_listener_);
ExecutionContextClient::Trace(visitor);
}
void WebPluginContainerImpl::HandleMouseEvent(MouseEvent& event) {
......
......@@ -71,8 +71,7 @@ struct WebPrintPresetOptions;
class CORE_EXPORT WebPluginContainerImpl final
: public GarbageCollected<WebPluginContainerImpl>,
public EmbeddedContentView,
public WebPluginContainer,
public ExecutionContextClient {
public WebPluginContainer {
USING_PRE_FINALIZER(WebPluginContainerImpl, PreFinalize);
public:
......
......@@ -925,7 +925,7 @@ ApplicationCache* LocalDOMWindow::applicationCache() {
this, WebFeature::kApplicationCacheAPIInsecureOrigin);
}
if (!application_cache_)
application_cache_ = MakeGarbageCollected<ApplicationCache>(GetFrame());
application_cache_ = MakeGarbageCollected<ApplicationCache>(this);
return application_cache_.Get();
}
......@@ -1447,9 +1447,9 @@ Document* LocalDOMWindow::document() const {
return document_.Get();
}
StyleMedia* LocalDOMWindow::styleMedia() const {
StyleMedia* LocalDOMWindow::styleMedia() {
if (!media_)
media_ = MakeGarbageCollected<StyleMedia>(GetFrame());
media_ = MakeGarbageCollected<StyleMedia>(this);
return media_.Get();
}
......
......@@ -238,7 +238,7 @@ class CORE_EXPORT LocalDOMWindow final : public DOMWindow,
Document* document() const;
// CSSOM View Module
StyleMedia* styleMedia() const;
StyleMedia* styleMedia();
// WebKit extensions
double devicePixelRatio() const;
......
......@@ -156,7 +156,7 @@ Screen::Screen(display::mojom::blink::DisplayPtr display,
bool internal,
bool primary,
const String& id)
: ExecutionContextClient(static_cast<LocalFrame*>(nullptr)),
: ExecutionContextClient(static_cast<ExecutionContext*>(nullptr)),
display_(std::move(display)),
internal_(internal),
primary_(primary),
......
......@@ -30,18 +30,16 @@
#include "third_party/blink/renderer/core/dom/events/event_listener.h"
#include "third_party/blink/renderer/core/frame/deprecation.h"
#include "third_party/blink/renderer/core/frame/local_dom_window.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/loader/appcache/application_cache_host_for_frame.h"
#include "third_party/blink/renderer/core/loader/document_loader.h"
#include "third_party/blink/renderer/core/loader/frame_loader.h"
#include "third_party/blink/renderer/platform/bindings/exception_state.h"
#include "third_party/blink/renderer/platform/instrumentation/use_counter.h"
namespace blink {
ApplicationCache::ApplicationCache(LocalFrame* frame)
: ExecutionContextClient(frame) {
DCHECK(RuntimeEnabledFeatures::AppCacheEnabled(frame->DomWindow()));
ApplicationCache::ApplicationCache(LocalDOMWindow* window)
: ExecutionContextClient(window) {
DCHECK(RuntimeEnabledFeatures::AppCacheEnabled(window));
ApplicationCacheHostForFrame* cache_host = GetApplicationCacheHost();
if (cache_host)
cache_host->SetApplicationCache(this);
......@@ -54,9 +52,9 @@ void ApplicationCache::Trace(Visitor* visitor) const {
ApplicationCacheHostForFrame* ApplicationCache::GetApplicationCacheHost()
const {
if (!GetFrame() || !GetFrame()->Loader().GetDocumentLoader())
if (!DomWindow())
return nullptr;
return GetFrame()->Loader().GetDocumentLoader()->GetApplicationCacheHost();
return DomWindow()->document()->Loader()->GetApplicationCacheHost();
}
uint16_t ApplicationCache::status() const {
......@@ -120,7 +118,7 @@ const AtomicString& ApplicationCache::InterfaceName() const {
}
ExecutionContext* ApplicationCache::GetExecutionContext() const {
return GetFrame() ? GetFrame()->DomWindow() : nullptr;
return ExecutionContextClient::GetExecutionContext();
}
const AtomicString& ApplicationCache::ToEventType(mojom::AppCacheEventID id) {
......@@ -147,11 +145,10 @@ const AtomicString& ApplicationCache::ToEventType(mojom::AppCacheEventID id) {
}
void ApplicationCache::RecordAPIUseType() const {
if (!GetFrame())
if (!DomWindow())
return;
LocalDOMWindow* window = GetFrame()->DomWindow();
CHECK(GetFrame()->DomWindow()->IsSecureContext());
Deprecation::CountDeprecation(window,
CHECK(DomWindow()->IsSecureContext());
Deprecation::CountDeprecation(DomWindow(),
WebFeature::kApplicationCacheAPISecureOrigin);
}
......
......@@ -36,14 +36,14 @@ namespace blink {
class ApplicationCacheHostForFrame;
class ExceptionState;
class LocalFrame;
class LocalDOMWindow;
class ApplicationCache final : public EventTargetWithInlineData,
public ExecutionContextClient {
DEFINE_WRAPPERTYPEINFO();
public:
explicit ApplicationCache(LocalFrame*);
explicit ApplicationCache(LocalDOMWindow*);
~ApplicationCache() override = default;
uint16_t status() const;
......
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