Skip to content
Permalink
Browse files
Web Inspector: tighten up lifetimes for InspectorController-owned obj…
…ects; add brace initializers to agents

https://bugs.webkit.org/show_bug.cgi?id=148612

Reviewed by Joseph Pecoraro.

Both InjectedScriptManager and AgentRegistry (thus all agents) are
Source/JavaScriptCore:

owned by JSGlobalObjectInspectorController. So, use references.

Add brace initalizers for scalar and pointer members in agent classes.

* inspector/ConsoleMessage.cpp:
(Inspector::ConsoleMessage::addToFrontend):
(Inspector::ConsoleMessage::updateRepeatCountInConsole):
(Inspector::ConsoleMessage::ConsoleMessage):
* inspector/ConsoleMessage.h:
* inspector/JSGlobalObjectInspectorController.cpp:
(Inspector::JSGlobalObjectInspectorController::JSGlobalObjectInspectorController):
* inspector/agents/InspectorAgent.cpp:
(Inspector::InspectorAgent::InspectorAgent):
* inspector/agents/InspectorAgent.h:
* inspector/agents/InspectorConsoleAgent.cpp:
(Inspector::InspectorConsoleAgent::InspectorConsoleAgent):
(Inspector::InspectorConsoleAgent::enable):
(Inspector::InspectorConsoleAgent::clearMessages):
(Inspector::InspectorConsoleAgent::addMessageToConsole):
(Inspector::InspectorConsoleAgent::addConsoleMessage):
* inspector/agents/InspectorConsoleAgent.h:
* inspector/agents/InspectorDebuggerAgent.cpp:
(Inspector::InspectorDebuggerAgent::InspectorDebuggerAgent):
(Inspector::InspectorDebuggerAgent::removeBreakpoint):
(Inspector::InspectorDebuggerAgent::getFunctionDetails):
(Inspector::InspectorDebuggerAgent::evaluateOnCallFrame):
(Inspector::InspectorDebuggerAgent::didPause):
(Inspector::InspectorDebuggerAgent::breakpointActionProbe):
(Inspector::InspectorDebuggerAgent::didContinue):
(Inspector::InspectorDebuggerAgent::clearExceptionValue):
* inspector/agents/InspectorDebuggerAgent.h:
* inspector/agents/InspectorRuntimeAgent.cpp:
(Inspector::InspectorRuntimeAgent::InspectorRuntimeAgent):
(Inspector::InspectorRuntimeAgent::callFunctionOn):
(Inspector::InspectorRuntimeAgent::getProperties):
(Inspector::InspectorRuntimeAgent::getDisplayableProperties):
(Inspector::InspectorRuntimeAgent::getCollectionEntries):
(Inspector::InspectorRuntimeAgent::saveResult):
(Inspector::InspectorRuntimeAgent::releaseObject):
(Inspector::InspectorRuntimeAgent::releaseObjectGroup):
* inspector/agents/InspectorRuntimeAgent.h:
* inspector/agents/JSGlobalObjectConsoleAgent.cpp:
(Inspector::JSGlobalObjectConsoleAgent::JSGlobalObjectConsoleAgent):
* inspector/agents/JSGlobalObjectConsoleAgent.h:
* inspector/agents/JSGlobalObjectDebuggerAgent.cpp:
(Inspector::JSGlobalObjectDebuggerAgent::JSGlobalObjectDebuggerAgent):
(Inspector::JSGlobalObjectDebuggerAgent::injectedScriptForEval):
* inspector/agents/JSGlobalObjectDebuggerAgent.h:
* inspector/agents/JSGlobalObjectRuntimeAgent.cpp:
(Inspector::JSGlobalObjectRuntimeAgent::JSGlobalObjectRuntimeAgent):
(Inspector::JSGlobalObjectRuntimeAgent::injectedScriptForEval):
* inspector/agents/JSGlobalObjectRuntimeAgent.h:

Source/WebCore:

owned by [Worker]InspectorController. So, use references.

InstrumentingAgents is morally owned by InspectorController as well, but
must be a Ref for now since instrumentation cookies take a strong reference.

Add brace initalizers for scalar and pointer members in agent classes.

No new tests, no behavior change.

* inspector/InspectorApplicationCacheAgent.cpp:
(WebCore::InspectorApplicationCacheAgent::InspectorApplicationCacheAgent):
(WebCore::InspectorApplicationCacheAgent::willDestroyFrontendAndBackend):
(WebCore::InspectorApplicationCacheAgent::enable):
* inspector/InspectorApplicationCacheAgent.h:
* inspector/InspectorCSSAgent.cpp:
(WebCore::InspectorCSSAgent::InspectorCSSAgent):
(WebCore::InspectorCSSAgent::enable):
(WebCore::InspectorCSSAgent::disable):
* inspector/InspectorCSSAgent.h:
* inspector/InspectorConsoleInstrumentation.h:
(WebCore::InspectorInstrumentation::addMessageToConsole):
(WebCore::InspectorInstrumentation::consoleCount):
(WebCore::InspectorInstrumentation::startProfiling):
(WebCore::InspectorInstrumentation::stopProfiling):
* inspector/InspectorController.cpp:
(WebCore::InspectorController::InspectorController):
(WebCore::InspectorController::connectFrontend):
(WebCore::InspectorController::disconnectFrontend):
(WebCore::InspectorController::disconnectAllFrontends):
* inspector/InspectorController.h:
* inspector/InspectorDOMAgent.cpp:
(WebCore::InspectorDOMAgent::InspectorDOMAgent):
(WebCore::InspectorDOMAgent::didCreateFrontendAndBackend):
(WebCore::InspectorDOMAgent::willDestroyFrontendAndBackend):
(WebCore::InspectorDOMAgent::focusNode):
(WebCore::InspectorDOMAgent::buildObjectForEventListener):
(WebCore::InspectorDOMAgent::nodeForObjectId):
(WebCore::InspectorDOMAgent::resolveNode):
* inspector/InspectorDOMAgent.h:
* inspector/InspectorDOMDebuggerAgent.cpp:
(WebCore::InspectorDOMDebuggerAgent::InspectorDOMDebuggerAgent):
(WebCore::InspectorDOMDebuggerAgent::~InspectorDOMDebuggerAgent):
(WebCore::InspectorDOMDebuggerAgent::debuggerWasEnabled):
(WebCore::InspectorDOMDebuggerAgent::disable):
* inspector/InspectorDOMDebuggerAgent.h:
* inspector/InspectorDOMStorageAgent.cpp:
(WebCore::InspectorDOMStorageAgent::InspectorDOMStorageAgent):
(WebCore::InspectorDOMStorageAgent::~InspectorDOMStorageAgent):
* inspector/InspectorDOMStorageAgent.h:
* inspector/InspectorDatabaseAgent.cpp:
(WebCore::InspectorDatabaseAgent::InspectorDatabaseAgent):
(WebCore::InspectorDatabaseAgent::~InspectorDatabaseAgent):
* inspector/InspectorDatabaseAgent.h:
* inspector/InspectorIndexedDBAgent.cpp:
(WebCore::InspectorIndexedDBAgent::InspectorIndexedDBAgent):
(WebCore::InspectorIndexedDBAgent::requestData):
* inspector/InspectorIndexedDBAgent.h:
* inspector/InspectorInstrumentation.cpp:
(WebCore::InspectorInstrumentation::instrumentingAgentsForPage):
(WebCore::InspectorInstrumentation::instrumentingAgentsForWorkerGlobalScope):
* inspector/InspectorInstrumentation.h:
(WebCore::InspectorInstrumentation::mouseDidMoveOverElement):
(WebCore::InspectorInstrumentation::scriptsEnabled):
(WebCore::InspectorInstrumentation::didScroll):
(WebCore::InspectorInstrumentation::markResourceAsCached):
(WebCore::InspectorInstrumentation::didLoadResourceFromMemoryCache):
(WebCore::InspectorInstrumentation::willRunJavaScriptDialog):
(WebCore::InspectorInstrumentation::sessionCreated):
(WebCore::InspectorInstrumentation::sessionLoaded):
(WebCore::InspectorInstrumentation::sessionModified):
(WebCore::InspectorInstrumentation::segmentCreated):
(WebCore::InspectorInstrumentation::segmentCompleted):
(WebCore::InspectorInstrumentation::segmentLoaded):
(WebCore::InspectorInstrumentation::segmentUnloaded):
(WebCore::InspectorInstrumentation::captureStarted):
(WebCore::InspectorInstrumentation::captureStopped):
(WebCore::InspectorInstrumentation::playbackStarted):
(WebCore::InspectorInstrumentation::playbackPaused):
(WebCore::InspectorInstrumentation::playbackFinished):
(WebCore::InspectorInstrumentation::playbackHitPosition):
* inspector/InspectorLayerTreeAgent.cpp:
(WebCore::InspectorLayerTreeAgent::InspectorLayerTreeAgent):
(WebCore::InspectorLayerTreeAgent::enable):
(WebCore::InspectorLayerTreeAgent::disable):
(WebCore::InspectorLayerTreeAgent::layersForNode):
(WebCore::InspectorLayerTreeAgent::idForNode):
* inspector/InspectorLayerTreeAgent.h:
* inspector/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::InspectorPageAgent):
(WebCore::InspectorPageAgent::timestamp):
(WebCore::InspectorPageAgent::enable):
(WebCore::InspectorPageAgent::disable):
(WebCore::InspectorPageAgent::frameStartedLoading):
(WebCore::InspectorPageAgent::snapshotNode):
* inspector/InspectorPageAgent.h:
* inspector/InspectorReplayAgent.cpp:
(WebCore::InspectorReplayAgent::InspectorReplayAgent):
(WebCore::InspectorReplayAgent::didCreateFrontendAndBackend):
(WebCore::InspectorReplayAgent::willDestroyFrontendAndBackend):
* inspector/InspectorReplayAgent.h:
* inspector/InspectorResourceAgent.cpp:
(WebCore::InspectorResourceAgent::InspectorResourceAgent):
(WebCore::InspectorResourceAgent::~InspectorResourceAgent):
(WebCore::InspectorResourceAgent::timestamp):
(WebCore::InspectorResourceAgent::enable):
(WebCore::InspectorResourceAgent::disable):
* inspector/InspectorResourceAgent.h:
* inspector/InspectorTimelineAgent.cpp:
(WebCore::InspectorTimelineAgent::didCreateFrontendAndBackend):
(WebCore::InspectorTimelineAgent::willDestroyFrontendAndBackend):
(WebCore::InspectorTimelineAgent::internalStart):
(WebCore::InspectorTimelineAgent::internalStop):
(WebCore::InspectorTimelineAgent::timestamp):
(WebCore::InspectorTimelineAgent::startFromConsole):
(WebCore::InspectorTimelineAgent::willCallFunction):
(WebCore::InspectorTimelineAgent::willEvaluateScript):
(WebCore::InspectorTimelineAgent::InspectorTimelineAgent):
* inspector/InspectorTimelineAgent.h:
* inspector/InspectorWebAgentBase.h:
(WebCore::InspectorAgentBase::InspectorAgentBase):
* inspector/InspectorWorkerAgent.cpp:
(WebCore::InspectorWorkerAgent::InspectorWorkerAgent):
(WebCore::InspectorWorkerAgent::~InspectorWorkerAgent):
* inspector/InspectorWorkerAgent.h:
* inspector/InstrumentingAgents.cpp:
(WebCore::InstrumentingAgents::InstrumentingAgents): Deleted.
* inspector/InstrumentingAgents.h:
(WebCore::InstrumentingAgents::create):
* inspector/PageConsoleAgent.cpp:
(WebCore::PageConsoleAgent::PageConsoleAgent):
(WebCore::PageConsoleAgent::addInspectedNode):
* inspector/PageConsoleAgent.h:
* inspector/PageDebuggerAgent.cpp:
(WebCore::PageDebuggerAgent::PageDebuggerAgent):
(WebCore::PageDebuggerAgent::enable):
(WebCore::PageDebuggerAgent::disable):
(WebCore::PageDebuggerAgent::injectedScriptForEval):
* inspector/PageDebuggerAgent.h:
* inspector/PageRuntimeAgent.cpp:
(WebCore::PageRuntimeAgent::PageRuntimeAgent):
(WebCore::PageRuntimeAgent::injectedScriptForEval):
(WebCore::PageRuntimeAgent::notifyContextCreated):
* inspector/PageRuntimeAgent.h:
* inspector/WebConsoleAgent.cpp:
(WebCore::WebConsoleAgent::WebConsoleAgent):
(WebCore::WebConsoleAgent::frameWindowDiscarded):
(WebCore::WebConsoleAgent::didFinishXHRLoading):
(WebCore::WebConsoleAgent::didReceiveResponse):
(WebCore::WebConsoleAgent::didFailLoading):
* inspector/WebConsoleAgent.h:
* inspector/WebDebuggerAgent.cpp:
(WebCore::WebDebuggerAgent::WebDebuggerAgent):
(WebCore::WebDebuggerAgent::enable):
(WebCore::WebDebuggerAgent::disable):
* inspector/WebDebuggerAgent.h:
* inspector/WorkerConsoleAgent.cpp:
(WebCore::WorkerConsoleAgent::WorkerConsoleAgent):
* inspector/WorkerConsoleAgent.h:
* inspector/WorkerDebuggerAgent.cpp:
(WebCore::WorkerDebuggerAgent::WorkerDebuggerAgent):
(WebCore::WorkerDebuggerAgent::injectedScriptForEval):
* inspector/WorkerDebuggerAgent.h:
* inspector/WorkerInspectorController.cpp:
(WebCore::WorkerInspectorController::WorkerInspectorController):
* inspector/WorkerInspectorController.h:
* inspector/WorkerRuntimeAgent.cpp:
(WebCore::WorkerRuntimeAgent::WorkerRuntimeAgent):
(WebCore::WorkerRuntimeAgent::injectedScriptForEval):
* inspector/WorkerRuntimeAgent.h:

Canonical link: https://commits.webkit.org/166796@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@189218 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
burg committed Sep 1, 2015
1 parent 274167f commit c30af787df60f280a699128aac95908e71008a40
Showing 71 changed files with 592 additions and 417 deletions.
@@ -1,3 +1,64 @@
2015-09-01 Brian Burg <bburg@apple.com>

Web Inspector: tighten up lifetimes for InspectorController-owned objects; add brace initializers to agents
https://bugs.webkit.org/show_bug.cgi?id=148612

Reviewed by Joseph Pecoraro.

Both InjectedScriptManager and AgentRegistry (thus all agents) are
owned by JSGlobalObjectInspectorController. So, use references.

Add brace initalizers for scalar and pointer members in agent classes.

* inspector/ConsoleMessage.cpp:
(Inspector::ConsoleMessage::addToFrontend):
(Inspector::ConsoleMessage::updateRepeatCountInConsole):
(Inspector::ConsoleMessage::ConsoleMessage):
* inspector/ConsoleMessage.h:
* inspector/JSGlobalObjectInspectorController.cpp:
(Inspector::JSGlobalObjectInspectorController::JSGlobalObjectInspectorController):
* inspector/agents/InspectorAgent.cpp:
(Inspector::InspectorAgent::InspectorAgent):
* inspector/agents/InspectorAgent.h:
* inspector/agents/InspectorConsoleAgent.cpp:
(Inspector::InspectorConsoleAgent::InspectorConsoleAgent):
(Inspector::InspectorConsoleAgent::enable):
(Inspector::InspectorConsoleAgent::clearMessages):
(Inspector::InspectorConsoleAgent::addMessageToConsole):
(Inspector::InspectorConsoleAgent::addConsoleMessage):
* inspector/agents/InspectorConsoleAgent.h:
* inspector/agents/InspectorDebuggerAgent.cpp:
(Inspector::InspectorDebuggerAgent::InspectorDebuggerAgent):
(Inspector::InspectorDebuggerAgent::removeBreakpoint):
(Inspector::InspectorDebuggerAgent::getFunctionDetails):
(Inspector::InspectorDebuggerAgent::evaluateOnCallFrame):
(Inspector::InspectorDebuggerAgent::didPause):
(Inspector::InspectorDebuggerAgent::breakpointActionProbe):
(Inspector::InspectorDebuggerAgent::didContinue):
(Inspector::InspectorDebuggerAgent::clearExceptionValue):
* inspector/agents/InspectorDebuggerAgent.h:
* inspector/agents/InspectorRuntimeAgent.cpp:
(Inspector::InspectorRuntimeAgent::InspectorRuntimeAgent):
(Inspector::InspectorRuntimeAgent::callFunctionOn):
(Inspector::InspectorRuntimeAgent::getProperties):
(Inspector::InspectorRuntimeAgent::getDisplayableProperties):
(Inspector::InspectorRuntimeAgent::getCollectionEntries):
(Inspector::InspectorRuntimeAgent::saveResult):
(Inspector::InspectorRuntimeAgent::releaseObject):
(Inspector::InspectorRuntimeAgent::releaseObjectGroup):
* inspector/agents/InspectorRuntimeAgent.h:
* inspector/agents/JSGlobalObjectConsoleAgent.cpp:
(Inspector::JSGlobalObjectConsoleAgent::JSGlobalObjectConsoleAgent):
* inspector/agents/JSGlobalObjectConsoleAgent.h:
* inspector/agents/JSGlobalObjectDebuggerAgent.cpp:
(Inspector::JSGlobalObjectDebuggerAgent::JSGlobalObjectDebuggerAgent):
(Inspector::JSGlobalObjectDebuggerAgent::injectedScriptForEval):
* inspector/agents/JSGlobalObjectDebuggerAgent.h:
* inspector/agents/JSGlobalObjectRuntimeAgent.cpp:
(Inspector::JSGlobalObjectRuntimeAgent::JSGlobalObjectRuntimeAgent):
(Inspector::JSGlobalObjectRuntimeAgent::injectedScriptForEval):
* inspector/agents/JSGlobalObjectRuntimeAgent.h:

2015-08-31 Yusuke Suzuki <utatane.tea@gmail.com>

[ES6] Introduce ModuleProgramExecutable families and compile Module code to bytecode
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2007, 2008, 2014 Apple Inc. All rights reserved.
* Copyright (C) 2007, 2008, 2014, 2015 Apple Inc. All rights reserved.
* Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com>
* Copyright (C) 2009, 2010 Google Inc. All rights reserved.
*
@@ -49,9 +49,6 @@ ConsoleMessage::ConsoleMessage(MessageSource source, MessageType type, MessageLe
, m_level(level)
, m_message(message)
, m_url()
, m_line(0)
, m_column(0)
, m_repeatCount(1)
, m_requestId(IdentifiersFactory::requestId(requestIdentifier))
{
}
@@ -64,7 +61,6 @@ ConsoleMessage::ConsoleMessage(MessageSource source, MessageType type, MessageLe
, m_url(url)
, m_line(line)
, m_column(column)
, m_repeatCount(1)
, m_requestId(IdentifiersFactory::requestId(requestIdentifier))
{
autogenerateMetadata(state);
@@ -76,9 +72,6 @@ ConsoleMessage::ConsoleMessage(MessageSource source, MessageType type, MessageLe
, m_level(level)
, m_message(message)
, m_url()
, m_line(0)
, m_column(0)
, m_repeatCount(1)
, m_requestId(IdentifiersFactory::requestId(requestIdentifier))
{
m_callStack = callStack;
@@ -98,9 +91,6 @@ ConsoleMessage::ConsoleMessage(MessageSource source, MessageType type, MessageLe
, m_message(message)
, m_arguments(arguments)
, m_url()
, m_line(0)
, m_column(0)
, m_repeatCount(1)
, m_requestId(IdentifiersFactory::requestId(requestIdentifier))
{
autogenerateMetadata(state);
@@ -179,7 +169,7 @@ static Inspector::Protocol::Console::ConsoleMessage::Level messageLevelValue(Mes
return Inspector::Protocol::Console::ConsoleMessage::Level::Log;
}

void ConsoleMessage::addToFrontend(ConsoleFrontendDispatcher* consoleFrontendDispatcher, InjectedScriptManager* injectedScriptManager, bool generatePreview)
void ConsoleMessage::addToFrontend(ConsoleFrontendDispatcher& consoleFrontendDispatcher, InjectedScriptManager& injectedScriptManager, bool generatePreview)
{
Ref<Inspector::Protocol::Console::ConsoleMessage> jsonObj = Inspector::Protocol::Console::ConsoleMessage::create()
.setSource(messageSourceValue(m_source))
@@ -198,7 +188,7 @@ void ConsoleMessage::addToFrontend(ConsoleFrontendDispatcher* consoleFrontendDis
jsonObj->setNetworkRequestId(m_requestId);

if (m_arguments && m_arguments->argumentCount()) {
InjectedScript injectedScript = injectedScriptManager->injectedScriptFor(m_arguments->globalState());
InjectedScript injectedScript = injectedScriptManager.injectedScriptFor(m_arguments->globalState());
if (!injectedScript.hasNoValue()) {
Ref<Inspector::Protocol::Array<Inspector::Protocol::Runtime::RemoteObject>> jsonArgs = Inspector::Protocol::Array<Inspector::Protocol::Runtime::RemoteObject>::create();
if (m_type == MessageType::Table && generatePreview && m_arguments->argumentCount()) {
@@ -229,12 +219,12 @@ void ConsoleMessage::addToFrontend(ConsoleFrontendDispatcher* consoleFrontendDis
if (m_callStack)
jsonObj->setStackTrace(m_callStack->buildInspectorArray());

consoleFrontendDispatcher->messageAdded(WTF::move(jsonObj));
consoleFrontendDispatcher.messageAdded(WTF::move(jsonObj));
}

void ConsoleMessage::updateRepeatCountInConsole(ConsoleFrontendDispatcher* consoleFrontendDispatcher)
void ConsoleMessage::updateRepeatCountInConsole(ConsoleFrontendDispatcher& consoleFrontendDispatcher)
{
consoleFrontendDispatcher->messageRepeatCountUpdated(m_repeatCount);
consoleFrontendDispatcher.messageRepeatCountUpdated(m_repeatCount);
}

bool ConsoleMessage::isEqual(ConsoleMessage* msg) const
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
* Copyright (C) 2007, 2008, 2015 Apple Inc. All rights reserved.
* Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com>
* Copyright (C) 2009, 2010 Google Inc. All rights reserved.
*
@@ -55,8 +55,8 @@ class JS_EXPORT_PRIVATE ConsoleMessage {
ConsoleMessage(MessageSource, MessageType, MessageLevel, const String& message, PassRefPtr<ScriptArguments>, JSC::ExecState*, unsigned long requestIdentifier = 0);
~ConsoleMessage();

void addToFrontend(ConsoleFrontendDispatcher*, InjectedScriptManager*, bool generatePreview);
void updateRepeatCountInConsole(ConsoleFrontendDispatcher*);
void addToFrontend(ConsoleFrontendDispatcher&, InjectedScriptManager&, bool generatePreview);
void updateRepeatCountInConsole(ConsoleFrontendDispatcher&);

MessageSource source() const { return m_source; }
const String& message() const { return m_message; }
@@ -84,9 +84,9 @@ class JS_EXPORT_PRIVATE ConsoleMessage {
RefPtr<ScriptArguments> m_arguments;
RefPtr<ScriptCallStack> m_callStack;
String m_url;
unsigned m_line;
unsigned m_column;
unsigned m_repeatCount;
unsigned m_line { 0 };
unsigned m_column { 0 };
unsigned m_repeatCount { 1 };
String m_requestId;
};

@@ -72,9 +72,9 @@ JSGlobalObjectInspectorController::JSGlobalObjectInspectorController(JSGlobalObj
#endif
{
auto inspectorAgent = std::make_unique<InspectorAgent>(*this);
auto runtimeAgent = std::make_unique<JSGlobalObjectRuntimeAgent>(m_injectedScriptManager.get(), m_globalObject);
auto consoleAgent = std::make_unique<JSGlobalObjectConsoleAgent>(m_injectedScriptManager.get());
auto debuggerAgent = std::make_unique<JSGlobalObjectDebuggerAgent>(m_injectedScriptManager.get(), m_globalObject, consoleAgent.get());
auto runtimeAgent = std::make_unique<JSGlobalObjectRuntimeAgent>(*m_injectedScriptManager, m_globalObject);
auto consoleAgent = std::make_unique<JSGlobalObjectConsoleAgent>(*m_injectedScriptManager);
auto debuggerAgent = std::make_unique<JSGlobalObjectDebuggerAgent>(*m_injectedScriptManager, m_globalObject, consoleAgent.get());

m_inspectorAgent = inspectorAgent.get();
m_debuggerAgent = debuggerAgent.get();
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
* Copyright (C) 2007-2010, 2015 Apple Inc. All rights reserved.
* Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com>
* Copyright (C) 2011 Google Inc. All rights reserved.
*
@@ -40,7 +40,6 @@ namespace Inspector {
InspectorAgent::InspectorAgent(InspectorEnvironment& environment)
: InspectorAgentBase(ASCIILiteral("Inspector"))
, m_environment(environment)
, m_enabled(false)
{
}

@@ -75,7 +75,7 @@ class JS_EXPORT_PRIVATE InspectorAgent final : public InspectorAgentBase, public
#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
RefPtr<Inspector::Protocol::Array<String>> m_pendingExtraDomainsData;
#endif
bool m_enabled;
bool m_enabled { false };
};

} // namespace Inspector
@@ -42,12 +42,9 @@ namespace Inspector {
static const unsigned maximumConsoleMessages = 1000;
static const int expireConsoleMessagesStep = 100;

InspectorConsoleAgent::InspectorConsoleAgent(InjectedScriptManager* injectedScriptManager)
InspectorConsoleAgent::InspectorConsoleAgent(InjectedScriptManager& injectedScriptManager)
: InspectorAgentBase(ASCIILiteral("Console"))
, m_injectedScriptManager(injectedScriptManager)
, m_previousMessage(nullptr)
, m_expiredConsoleMessageCount(0)
, m_enabled(false)
{
}

@@ -79,12 +76,12 @@ void InspectorConsoleAgent::enable(ErrorString&)

if (m_expiredConsoleMessageCount) {
ConsoleMessage expiredMessage(MessageSource::Other, MessageType::Log, MessageLevel::Warning, String::format("%d console messages are not shown.", m_expiredConsoleMessageCount));
expiredMessage.addToFrontend(m_frontendDispatcher.get(), m_injectedScriptManager, false);
expiredMessage.addToFrontend(*m_frontendDispatcher, m_injectedScriptManager, false);
}

size_t messageCount = m_consoleMessages.size();
for (size_t i = 0; i < messageCount; ++i)
m_consoleMessages[i]->addToFrontend(m_frontendDispatcher.get(), m_injectedScriptManager, false);
m_consoleMessages[i]->addToFrontend(*m_frontendDispatcher, m_injectedScriptManager, false);
}

void InspectorConsoleAgent::disable(ErrorString&)
@@ -101,7 +98,7 @@ void InspectorConsoleAgent::clearMessages(ErrorString&)
m_expiredConsoleMessageCount = 0;
m_previousMessage = nullptr;

m_injectedScriptManager->releaseObjectGroup(ASCIILiteral("console"));
m_injectedScriptManager.releaseObjectGroup(ASCIILiteral("console"));

if (m_frontendDispatcher && m_enabled)
m_frontendDispatcher->messagesCleared();
@@ -118,7 +115,7 @@ void InspectorConsoleAgent::reset()

void InspectorConsoleAgent::addMessageToConsole(std::unique_ptr<ConsoleMessage> message)
{
if (!m_injectedScriptManager->inspectorEnvironment().developerExtrasEnabled())
if (!m_injectedScriptManager.inspectorEnvironment().developerExtrasEnabled())
return;

if (message->type() == MessageType::Clear) {
@@ -200,18 +197,18 @@ static bool isGroupMessage(MessageType type)

void InspectorConsoleAgent::addConsoleMessage(std::unique_ptr<ConsoleMessage> consoleMessage)
{
ASSERT(m_injectedScriptManager->inspectorEnvironment().developerExtrasEnabled());
ASSERT(m_injectedScriptManager.inspectorEnvironment().developerExtrasEnabled());
ASSERT_ARG(consoleMessage, consoleMessage);

if (m_previousMessage && !isGroupMessage(m_previousMessage->type()) && m_previousMessage->isEqual(consoleMessage.get())) {
m_previousMessage->incrementCount();
if (m_frontendDispatcher && m_enabled)
m_previousMessage->updateRepeatCountInConsole(m_frontendDispatcher.get());
m_previousMessage->updateRepeatCountInConsole(*m_frontendDispatcher);
} else {
m_previousMessage = consoleMessage.get();
m_consoleMessages.append(WTF::move(consoleMessage));
if (m_frontendDispatcher && m_enabled)
m_previousMessage->addToFrontend(m_frontendDispatcher.get(), m_injectedScriptManager, true);
m_previousMessage->addToFrontend(*m_frontendDispatcher, m_injectedScriptManager, true);
}

if (!m_frontendDispatcher && m_consoleMessages.size() >= maximumConsoleMessages) {
@@ -52,7 +52,7 @@ class JS_EXPORT_PRIVATE InspectorConsoleAgent : public InspectorAgentBase, publi
WTF_MAKE_NONCOPYABLE(InspectorConsoleAgent);
WTF_MAKE_FAST_ALLOCATED;
public:
InspectorConsoleAgent(InjectedScriptManager*);
InspectorConsoleAgent(InjectedScriptManager&);
virtual ~InspectorConsoleAgent();

virtual void didCreateFrontendAndBackend(FrontendChannel*, BackendDispatcher*) override;
@@ -80,15 +80,15 @@ class JS_EXPORT_PRIVATE InspectorConsoleAgent : public InspectorAgentBase, publi
protected:
void addConsoleMessage(std::unique_ptr<ConsoleMessage>);

InjectedScriptManager* m_injectedScriptManager;
InjectedScriptManager& m_injectedScriptManager;
std::unique_ptr<ConsoleFrontendDispatcher> m_frontendDispatcher;
RefPtr<ConsoleBackendDispatcher> m_backendDispatcher;
ConsoleMessage* m_previousMessage;
ConsoleMessage* m_previousMessage { nullptr };
Vector<std::unique_ptr<ConsoleMessage>> m_consoleMessages;
int m_expiredConsoleMessageCount;
int m_expiredConsoleMessageCount { 0 };
HashMap<String, unsigned> m_counts;
HashMap<String, double> m_times;
bool m_enabled;
bool m_enabled { false };
};

} // namespace Inspector

0 comments on commit c30af78

Please sign in to comment.