Commit 2d3dc6c7 authored by pmarch@chromium.org's avatar pmarch@chromium.org

Cleaning WebDOMActivityLogger interface. Deprecating old methods. Fixing...

Cleaning WebDOMActivityLogger interface. Deprecating old methods. Fixing assignment of ActivityLogger to V8PerContextData.

BUG=366916

Review URL: https://codereview.chromium.org/315373002

git-svn-id: svn://svn.chromium.org/blink/trunk@175678 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 65e4261b
......@@ -32,28 +32,14 @@ static DOMActivityLoggerMapForIsolatedWorld& domActivityLoggersForIsolatedWorld(
void V8DOMActivityLogger::setActivityLogger(int worldId, const String& extensionId, PassOwnPtr<V8DOMActivityLogger> logger)
{
// FIXME: The following line is a stub to allow appropriate modifications to
// chromium code base. When the modifications are done, remove this line.
domActivityLoggersForIsolatedWorld().set(worldId, logger);
return;
if (worldId) {
if (worldId)
domActivityLoggersForIsolatedWorld().set(worldId, logger);
} else {
else
domActivityLoggersForMainWorld().set(extensionId, logger);
}
}
V8DOMActivityLogger* V8DOMActivityLogger::activityLogger(int worldId, const String& extensionId)
{
{
// FIXME: The following lines are a stub to allow appropriate modifications to
// chromium code base. When the modifications are done, remove these lines.
DOMActivityLoggerMapForIsolatedWorld& loggers = domActivityLoggersForIsolatedWorld();
DOMActivityLoggerMapForIsolatedWorld::iterator it = loggers.find(worldId);
return it == loggers.end() ? 0 : it->value.get();
}
if (worldId) {
DOMActivityLoggerMapForIsolatedWorld& loggers = domActivityLoggersForIsolatedWorld();
DOMActivityLoggerMapForIsolatedWorld::iterator it = loggers.find(worldId);
......@@ -70,10 +56,6 @@ V8DOMActivityLogger* V8DOMActivityLogger::activityLogger(int worldId, const Stri
V8DOMActivityLogger* V8DOMActivityLogger::activityLogger(int worldId, const KURL& url)
{
// FIXME: The following line is a stub to allow appropriate modifications to
// chromium code base. When the modifications are done, remove this line.
return activityLogger(worldId, String());
// extension ID is ignored for worldId != 0.
if (worldId)
return activityLogger(worldId, String());
......
......@@ -216,14 +216,13 @@ bool V8WindowShell::initialize()
setInjectedScriptContextDebugId(context, m_frame->script().contextDebugId(mainWindow->context()));
}
m_scriptState->perContextData()->setActivityLogger(V8DOMActivityLogger::activityLogger(
m_world->worldId(), m_frame->document() ? m_frame->document()->baseURI() : KURL()));
if (!installDOMWindow()) {
disposeContext(DoNotDetachGlobal);
return false;
}
if (m_world->isMainWorld()) {
// ActivityLogger for main world is updated within updateDocument().
updateDocument();
if (m_frame->document()) {
setSecurityToken(m_frame->document()->securityOrigin());
......@@ -232,6 +231,7 @@ bool V8WindowShell::initialize()
context->SetErrorMessageForCodeGenerationFromStrings(v8String(m_isolate, csp->evalDisabledErrorMessage()));
}
} else {
updateActivityLogger();
SecurityOrigin* origin = m_world->isolatedWorldSecurityOrigin();
setSecurityToken(origin);
if (origin && InspectorInstrumentation::hasFrontends()) {
......@@ -369,6 +369,12 @@ void V8WindowShell::clearDocumentProperty()
m_scriptState->context()->Global()->ForceDelete(v8AtomicString(m_isolate, "document"));
}
void V8WindowShell::updateActivityLogger()
{
m_scriptState->perContextData()->setActivityLogger(V8DOMActivityLogger::activityLogger(
m_world->worldId(), m_frame->document() ? m_frame->document()->baseURI() : KURL()));
}
void V8WindowShell::setSecurityToken(SecurityOrigin* origin)
{
// If two tokens are equal, then the SecurityOrigins canAccess each other.
......@@ -410,6 +416,7 @@ void V8WindowShell::updateDocument()
return;
if (!isContextInitialized())
return;
updateActivityLogger();
updateDocumentProperty();
updateSecurityOrigin(m_frame->document()->securityOrigin());
}
......
......@@ -100,6 +100,9 @@ private:
void updateDocumentProperty();
void clearDocumentProperty();
// Updates Activity Logger for the current context.
void updateActivityLogger();
void createContext();
bool installDOMWindow();
......
......@@ -98,17 +98,4 @@ void setDOMActivityLogger(int worldId, const WebString& extensionId, WebDOMActiv
V8DOMActivityLogger::setActivityLogger(worldId, extensionId, adoptPtr(new DOMActivityLoggerContainer(adoptPtr(logger))));
}
// FIXME: remove the following two methods after modifying Chrome to use the
// above ones.
bool hasDOMActivityLogger(int worldId)
{
return V8DOMActivityLogger::activityLogger(worldId, WebString());
}
void setDOMActivityLogger(int worldId, WebDOMActivityLogger* logger)
{
ASSERT(logger);
V8DOMActivityLogger::setActivityLogger(worldId, WebString(), adoptPtr(new DOMActivityLoggerContainer(adoptPtr(logger))));
}
} // namespace blink
......@@ -59,11 +59,6 @@ BLINK_EXPORT bool hasDOMActivityLogger(int worldId, const WebString& extensionId
// one.
BLINK_EXPORT void setDOMActivityLogger(int worldId, const WebString& extensionId, WebDOMActivityLogger*);
// FIXME: remove the following two methods after modifying Chrome to use the
// above ones.
BLINK_EXPORT bool hasDOMActivityLogger(int worldId);
BLINK_EXPORT void setDOMActivityLogger(int worldId, WebDOMActivityLogger*);
} // namespace blink
#endif
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