Commit 5807dc6e authored by haraken's avatar haraken Committed by Commit bot

Remove ScriptController::namedItemAdded/Removed

They are unnecessary indirection to WindowProxy::namedItemAdded/Removed.

Also this CL updates a dcheck in WindowProxy::namedItemAdded/Removed to verify
that those methods are called after the window proxy is initialized.

(The check will be replaced with a better lifecycle model in a follow-up CL.)

BUG=677253

Review-Url: https://codereview.chromium.org/2616903002
Cr-Commit-Position: refs/heads/master@{#441803}
parent e46baf31
...@@ -312,16 +312,6 @@ void ScriptController::updateDocument() { ...@@ -312,16 +312,6 @@ void ScriptController::updateDocument() {
windowProxy(DOMWrapperWorld::mainWorld())->updateDocument(); windowProxy(DOMWrapperWorld::mainWorld())->updateDocument();
} }
void ScriptController::namedItemAdded(HTMLDocument* doc,
const AtomicString& name) {
windowProxy(DOMWrapperWorld::mainWorld())->namedItemAdded(doc, name);
}
void ScriptController::namedItemRemoved(HTMLDocument* doc,
const AtomicString& name) {
windowProxy(DOMWrapperWorld::mainWorld())->namedItemRemoved(doc, name);
}
bool ScriptController::canExecuteScripts( bool ScriptController::canExecuteScripts(
ReasonForCallingCanExecuteScripts reason) { ReasonForCallingCanExecuteScripts reason) {
......
...@@ -49,7 +49,6 @@ namespace blink { ...@@ -49,7 +49,6 @@ namespace blink {
class CompiledScript; class CompiledScript;
class DOMWrapperWorld; class DOMWrapperWorld;
class Element; class Element;
class HTMLDocument;
class KURL; class KURL;
class ScriptSourceCode; class ScriptSourceCode;
class SecurityOrigin; class SecurityOrigin;
...@@ -136,9 +135,6 @@ class CORE_EXPORT ScriptController final ...@@ -136,9 +135,6 @@ class CORE_EXPORT ScriptController final
void clearWindowProxy(); void clearWindowProxy();
void updateDocument(); void updateDocument();
void namedItemAdded(HTMLDocument*, const AtomicString&);
void namedItemRemoved(HTMLDocument*, const AtomicString&);
void updateSecurityOrigin(SecurityOrigin*); void updateSecurityOrigin(SecurityOrigin*);
void clearForClose(); void clearForClose();
......
...@@ -518,7 +518,7 @@ static void getter(v8::Local<v8::Name> property, ...@@ -518,7 +518,7 @@ static void getter(v8::Local<v8::Name> property,
void WindowProxy::namedItemAdded(HTMLDocument* document, void WindowProxy::namedItemAdded(HTMLDocument* document,
const AtomicString& name) { const AtomicString& name) {
DCHECK(m_world->isMainWorld()); DCHECK(m_world->isMainWorld());
DCHECK(m_scriptState);
if (!isContextInitialized()) if (!isContextInitialized())
return; return;
...@@ -535,10 +535,9 @@ void WindowProxy::namedItemAdded(HTMLDocument* document, ...@@ -535,10 +535,9 @@ void WindowProxy::namedItemAdded(HTMLDocument* document,
void WindowProxy::namedItemRemoved(HTMLDocument* document, void WindowProxy::namedItemRemoved(HTMLDocument* document,
const AtomicString& name) { const AtomicString& name) {
DCHECK(m_world->isMainWorld()); DCHECK(m_world->isMainWorld());
DCHECK(m_scriptState);
if (!isContextInitialized()) if (!isContextInitialized())
return; return;
if (document->hasNamedItem(name) || document->hasExtraNamedItem(name)) if (document->hasNamedItem(name) || document->hasExtraNamedItem(name))
return; return;
......
...@@ -54,6 +54,7 @@ ...@@ -54,6 +54,7 @@
#include "core/html/HTMLDocument.h" #include "core/html/HTMLDocument.h"
#include "bindings/core/v8/ScriptController.h" #include "bindings/core/v8/ScriptController.h"
#include "bindings/core/v8/WindowProxy.h"
#include "core/HTMLNames.h" #include "core/HTMLNames.h"
#include "core/frame/LocalFrame.h" #include "core/frame/LocalFrame.h"
#include "core/html/HTMLBodyElement.h" #include "core/html/HTMLBodyElement.h"
...@@ -152,8 +153,11 @@ void HTMLDocument::addItemToMap(HashCountedSet<AtomicString>& map, ...@@ -152,8 +153,11 @@ void HTMLDocument::addItemToMap(HashCountedSet<AtomicString>& map,
if (name.isEmpty()) if (name.isEmpty())
return; return;
map.add(name); map.add(name);
if (LocalFrame* f = frame()) if (LocalFrame* f = frame()) {
f->script().namedItemAdded(this, name); f->script()
.windowProxy(DOMWrapperWorld::mainWorld())
->namedItemAdded(this, name);
}
} }
void HTMLDocument::removeItemFromMap(HashCountedSet<AtomicString>& map, void HTMLDocument::removeItemFromMap(HashCountedSet<AtomicString>& map,
...@@ -161,8 +165,11 @@ void HTMLDocument::removeItemFromMap(HashCountedSet<AtomicString>& map, ...@@ -161,8 +165,11 @@ void HTMLDocument::removeItemFromMap(HashCountedSet<AtomicString>& map,
if (name.isEmpty()) if (name.isEmpty())
return; return;
map.remove(name); map.remove(name);
if (LocalFrame* f = frame()) if (LocalFrame* f = frame()) {
f->script().namedItemRemoved(this, name); f->script()
.windowProxy(DOMWrapperWorld::mainWorld())
->namedItemRemoved(this, name);
}
} }
void HTMLDocument::addNamedItem(const AtomicString& name) { void HTMLDocument::addNamedItem(const AtomicString& name) {
......
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