Chromium Code Reviews| Index: Source/core/inspector/InjectedScriptManager.cpp |
| diff --git a/Source/core/inspector/InjectedScriptManager.cpp b/Source/core/inspector/InjectedScriptManager.cpp |
| index c402941d615f59f898c69993e0686d9447713869..61f3b7950cd47c4a72ba250c6142ad9629d5599a 100644 |
| --- a/Source/core/inspector/InjectedScriptManager.cpp |
| +++ b/Source/core/inspector/InjectedScriptManager.cpp |
| @@ -119,30 +119,14 @@ void InjectedScriptManager::discardInjectedScripts() |
| m_scriptStateToId.clear(); |
| } |
| -void InjectedScriptManager::discardInjectedScriptsFor(LocalDOMWindow* window) |
| +void InjectedScriptManager::discardInjectedScriptFor(ScriptState* scriptState) |
| { |
| - if (m_scriptStateToId.isEmpty()) |
| + ScriptStateToId::iterator it = m_scriptStateToId.find(scriptState); |
| + if (it == m_scriptStateToId.end()) |
| return; |
| - Vector<long> idsToRemove; |
| - IdToInjectedScriptMap::iterator end = m_idToInjectedScript.end(); |
| - for (IdToInjectedScriptMap::iterator it = m_idToInjectedScript.begin(); it != end; ++it) { |
| - ScriptState* scriptState = it->value.scriptState(); |
| - if (window != scriptState->domWindow()) |
| - continue; |
| - m_scriptStateToId.remove(scriptState); |
| - idsToRemove.append(it->key); |
| - } |
| - m_idToInjectedScript.removeAll(idsToRemove); |
| - |
| - // Now remove script states that have id but no injected script. |
| - Vector<ScriptState*> scriptStatesToRemove; |
| - for (ScriptStateToId::iterator it = m_scriptStateToId.begin(); it != m_scriptStateToId.end(); ++it) { |
| - ScriptState* scriptState = it->key.get(); |
| - if (window == scriptState->domWindow()) |
| - scriptStatesToRemove.append(scriptState); |
| - } |
| - m_scriptStateToId.removeAll(scriptStatesToRemove); |
| + m_idToInjectedScript.remove(it->value); |
| + m_scriptStateToId.remove(scriptState); |
|
yurys
2014/11/13 13:58:30
m_scriptStateToId.remove(it);
eustas
2014/12/05 10:01:36
Done.
|
| } |
| bool InjectedScriptManager::canAccessInspectedWorkerGlobalScope(ScriptState*) |