Web Inspector: tighten up lifetimes for InspectorController-owned objects; add brace...
authorbburg@apple.com <bburg@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 1 Sep 2015 17:52:15 +0000 (17:52 +0000)
committerbburg@apple.com <bburg@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 1 Sep 2015 17:52:15 +0000 (17:52 +0000)
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:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@189218 268f45cc-cd09-0410-ab3c-d52691b4dbfc

71 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/inspector/ConsoleMessage.cpp
Source/JavaScriptCore/inspector/ConsoleMessage.h
Source/JavaScriptCore/inspector/JSGlobalObjectInspectorController.cpp
Source/JavaScriptCore/inspector/agents/InspectorAgent.cpp
Source/JavaScriptCore/inspector/agents/InspectorAgent.h
Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.cpp
Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.h
Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.cpp
Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.h
Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.cpp
Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.h
Source/JavaScriptCore/inspector/agents/JSGlobalObjectConsoleAgent.cpp
Source/JavaScriptCore/inspector/agents/JSGlobalObjectConsoleAgent.h
Source/JavaScriptCore/inspector/agents/JSGlobalObjectDebuggerAgent.cpp
Source/JavaScriptCore/inspector/agents/JSGlobalObjectDebuggerAgent.h
Source/JavaScriptCore/inspector/agents/JSGlobalObjectRuntimeAgent.cpp
Source/JavaScriptCore/inspector/agents/JSGlobalObjectRuntimeAgent.h
Source/WebCore/ChangeLog
Source/WebCore/inspector/InspectorApplicationCacheAgent.cpp
Source/WebCore/inspector/InspectorApplicationCacheAgent.h
Source/WebCore/inspector/InspectorCSSAgent.cpp
Source/WebCore/inspector/InspectorCSSAgent.h
Source/WebCore/inspector/InspectorConsoleInstrumentation.h
Source/WebCore/inspector/InspectorController.cpp
Source/WebCore/inspector/InspectorController.h
Source/WebCore/inspector/InspectorDOMAgent.cpp
Source/WebCore/inspector/InspectorDOMAgent.h
Source/WebCore/inspector/InspectorDOMDebuggerAgent.cpp
Source/WebCore/inspector/InspectorDOMDebuggerAgent.h
Source/WebCore/inspector/InspectorDOMStorageAgent.cpp
Source/WebCore/inspector/InspectorDOMStorageAgent.h
Source/WebCore/inspector/InspectorDatabaseAgent.cpp
Source/WebCore/inspector/InspectorDatabaseAgent.h
Source/WebCore/inspector/InspectorIndexedDBAgent.cpp
Source/WebCore/inspector/InspectorIndexedDBAgent.h
Source/WebCore/inspector/InspectorInstrumentation.cpp
Source/WebCore/inspector/InspectorInstrumentation.h
Source/WebCore/inspector/InspectorLayerTreeAgent.cpp
Source/WebCore/inspector/InspectorLayerTreeAgent.h
Source/WebCore/inspector/InspectorPageAgent.cpp
Source/WebCore/inspector/InspectorPageAgent.h
Source/WebCore/inspector/InspectorReplayAgent.cpp
Source/WebCore/inspector/InspectorReplayAgent.h
Source/WebCore/inspector/InspectorResourceAgent.cpp
Source/WebCore/inspector/InspectorResourceAgent.h
Source/WebCore/inspector/InspectorTimelineAgent.cpp
Source/WebCore/inspector/InspectorTimelineAgent.h
Source/WebCore/inspector/InspectorWebAgentBase.h
Source/WebCore/inspector/InspectorWorkerAgent.cpp
Source/WebCore/inspector/InspectorWorkerAgent.h
Source/WebCore/inspector/InstrumentingAgents.cpp
Source/WebCore/inspector/InstrumentingAgents.h
Source/WebCore/inspector/PageConsoleAgent.cpp
Source/WebCore/inspector/PageConsoleAgent.h
Source/WebCore/inspector/PageDebuggerAgent.cpp
Source/WebCore/inspector/PageDebuggerAgent.h
Source/WebCore/inspector/PageRuntimeAgent.cpp
Source/WebCore/inspector/PageRuntimeAgent.h
Source/WebCore/inspector/WebConsoleAgent.cpp
Source/WebCore/inspector/WebConsoleAgent.h
Source/WebCore/inspector/WebDebuggerAgent.cpp
Source/WebCore/inspector/WebDebuggerAgent.h
Source/WebCore/inspector/WorkerConsoleAgent.cpp
Source/WebCore/inspector/WorkerConsoleAgent.h
Source/WebCore/inspector/WorkerDebuggerAgent.cpp
Source/WebCore/inspector/WorkerDebuggerAgent.h
Source/WebCore/inspector/WorkerInspectorController.cpp
Source/WebCore/inspector/WorkerInspectorController.h
Source/WebCore/inspector/WorkerRuntimeAgent.cpp
Source/WebCore/inspector/WorkerRuntimeAgent.h

index 60d2e5c..460c997 100644 (file)
@@ -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
index 9ac0dde..6ef67ca 100644 (file)
@@ -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
index a73e286..2296f1c 100644 (file)
@@ -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 @@ public:
     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 @@ private:
     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;
 };
 
index 11d86ed..143d7f1 100644 (file)
@@ -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();
index 0538690..7b2f3cf 100644 (file)
@@ -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)
 {
 }
 
index 4c6ef78..b71f1ce 100644 (file)
@@ -75,7 +75,7 @@ private:
 #if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
     RefPtr<Inspector::Protocol::Array<String>> m_pendingExtraDomainsData;
 #endif
-    bool m_enabled;
+    bool m_enabled { false };
 };
 
 } // namespace Inspector
index 9ffd048..88d8151 100644 (file)
@@ -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) {
index b9da99d..b23d6f4 100644 (file)
@@ -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 @@ public:
 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
index f0f0b48..c2f63ce 100644 (file)
@@ -55,7 +55,7 @@ static String objectGroupForBreakpointAction(const ScriptBreakpointAction& actio
     return makeString(objectGroup, String::number(action.identifier));
 }
 
-InspectorDebuggerAgent::InspectorDebuggerAgent(InjectedScriptManager* injectedScriptManager)
+InspectorDebuggerAgent::InspectorDebuggerAgent(InjectedScriptManager& injectedScriptManager)
     : InspectorAgentBase(ASCIILiteral("Debugger"))
     , m_injectedScriptManager(injectedScriptManager)
     , m_continueToLocationBreakpointID(JSC::noBreakpointID)
@@ -382,7 +382,7 @@ void InspectorDebuggerAgent::removeBreakpoint(ErrorString&, const String& breakp
 
         const BreakpointActions& breakpointActions = scriptDebugServer().getActionsForBreakpoint(breakpointID);
         for (auto& action : breakpointActions)
-            m_injectedScriptManager->releaseObjectGroup(objectGroupForBreakpointAction(action));
+            m_injectedScriptManager.releaseObjectGroup(objectGroupForBreakpointAction(action));
 
         scriptDebugServer().removeBreakpoint(breakpointID);
     }
@@ -462,7 +462,7 @@ void InspectorDebuggerAgent::getScriptSource(ErrorString& error, const String& s
 
 void InspectorDebuggerAgent::getFunctionDetails(ErrorString& errorString, const String& functionId, RefPtr<Inspector::Protocol::Debugger::FunctionDetails>& details)
 {
-    InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForObjectId(functionId);
+    InjectedScript injectedScript = m_injectedScriptManager.injectedScriptForObjectId(functionId);
     if (injectedScript.hasNoValue()) {
         errorString = ASCIILiteral("Function object id is obsolete");
         return;
@@ -553,7 +553,7 @@ void InspectorDebuggerAgent::setPauseOnExceptions(ErrorString& errorString, cons
 
 void InspectorDebuggerAgent::evaluateOnCallFrame(ErrorString& errorString, const String& callFrameId, const String& expression, const String* const objectGroup, const bool* const includeCommandLineAPI, const bool* const doNotPauseOnExceptionsAndMuteConsole, const bool* const returnByValue, const bool* generatePreview, const bool* saveResult, RefPtr<Inspector::Protocol::Runtime::RemoteObject>& result, Inspector::Protocol::OptOutput<bool>* wasThrown, Inspector::Protocol::OptOutput<int>* savedResultIndex)
 {
-    InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForObjectId(callFrameId);
+    InjectedScript injectedScript = m_injectedScriptManager.injectedScriptForObjectId(callFrameId);
     if (injectedScript.hasNoValue()) {
         errorString = ASCIILiteral("Inspected frame has gone");
         return;
@@ -661,7 +661,7 @@ void InspectorDebuggerAgent::didPause(JSC::ExecState* scriptState, const Depreca
     m_pausedScriptState = scriptState;
     m_currentCallStack = callFrames;
 
-    InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(scriptState);
+    InjectedScript injectedScript = m_injectedScriptManager.injectedScriptFor(scriptState);
 
     // If a high level pause pause reason is not already set, try to infer a reason from the debugger.
     if (m_breakReason == DebuggerFrontendDispatcher::Reason::Other) {
@@ -712,7 +712,7 @@ void InspectorDebuggerAgent::didPause(JSC::ExecState* scriptState, const Depreca
     if (m_listener)
         m_listener->didPause();
 
-    RefPtr<Stopwatch> stopwatch = m_injectedScriptManager->inspectorEnvironment().executionStopwatch();
+    RefPtr<Stopwatch> stopwatch = m_injectedScriptManager.inspectorEnvironment().executionStopwatch();
     if (stopwatch && stopwatch->isActive()) {
         stopwatch->stop();
         m_didPauseStopwatch = true;
@@ -726,13 +726,13 @@ void InspectorDebuggerAgent::breakpointActionSound(int breakpointActionIdentifie
 
 void InspectorDebuggerAgent::breakpointActionProbe(JSC::ExecState* scriptState, const ScriptBreakpointAction& action, unsigned batchId, unsigned sampleId, const Deprecated::ScriptValue& sample)
 {
-    InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(scriptState);
+    InjectedScript injectedScript = m_injectedScriptManager.injectedScriptFor(scriptState);
     RefPtr<Protocol::Runtime::RemoteObject> payload = injectedScript.wrapObject(sample, objectGroupForBreakpointAction(action), true);
     auto result = Protocol::Debugger::ProbeSample::create()
         .setProbeId(action.identifier)
         .setBatchId(batchId)
         .setSampleId(sampleId)
-        .setTimestamp(m_injectedScriptManager->inspectorEnvironment().executionStopwatch()->elapsedTime())
+        .setTimestamp(m_injectedScriptManager.inspectorEnvironment().executionStopwatch()->elapsedTime())
         .setPayload(payload.release())
         .release();
 
@@ -743,12 +743,12 @@ void InspectorDebuggerAgent::didContinue()
 {
     if (m_didPauseStopwatch) {
         m_didPauseStopwatch = false;
-        m_injectedScriptManager->inspectorEnvironment().executionStopwatch()->start();
+        m_injectedScriptManager.inspectorEnvironment().executionStopwatch()->start();
     }
 
     m_pausedScriptState = nullptr;
     m_currentCallStack = Deprecated::ScriptValue();
-    m_injectedScriptManager->releaseObjectGroup(InspectorDebuggerAgent::backtraceObjectGroup);
+    m_injectedScriptManager.releaseObjectGroup(InspectorDebuggerAgent::backtraceObjectGroup);
     clearBreakDetails();
     clearExceptionValue();
 
@@ -821,7 +821,7 @@ void InspectorDebuggerAgent::clearBreakDetails()
 void InspectorDebuggerAgent::clearExceptionValue()
 {
     if (m_hasExceptionValue) {
-        m_injectedScriptManager->clearExceptionValue();
+        m_injectedScriptManager.clearExceptionValue();
         m_hasExceptionValue = false;
     }
 }
index 28249e2..00b62c8 100644 (file)
@@ -109,9 +109,9 @@ public:
     virtual ScriptDebugServer& scriptDebugServer() = 0;
 
 protected:
-    InspectorDebuggerAgent(InjectedScriptManager*);
+    InspectorDebuggerAgent(InjectedScriptManager&);
 
-    InjectedScriptManager* injectedScriptManager() const { return m_injectedScriptManager; }
+    InjectedScriptManager& injectedScriptManager() const { return m_injectedScriptManager; }
     virtual InjectedScript injectedScriptForEval(ErrorString&, const int* executionContextId) = 0;
 
     virtual void startListeningScriptDebugServer() = 0;
@@ -154,11 +154,11 @@ private:
     typedef HashMap<String, RefPtr<InspectorObject>> BreakpointIdentifierToBreakpointMap;
     typedef HashMap<JSC::BreakpointID, String> DebugServerBreakpointIDToBreakpointIdentifier;
 
-    InjectedScriptManager* m_injectedScriptManager;
+    InjectedScriptManager& m_injectedScriptManager;
     std::unique_ptr<DebuggerFrontendDispatcher> m_frontendDispatcher;
     RefPtr<DebuggerBackendDispatcher> m_backendDispatcher;
-    Listener* m_listener {nullptr};
-    JSC::ExecState* m_pausedScriptState {nullptr};
+    Listener* m_listener { nullptr };
+    JSC::ExecState* m_pausedScriptState { nullptr };
     Deprecated::ScriptValue m_currentCallStack;
     ScriptsMap m_scripts;
     BreakpointIdentifierToDebugServerBreakpointIDsMap m_breakpointIdentifierToDebugServerBreakpointIDs;
@@ -167,10 +167,10 @@ private:
     JSC::BreakpointID m_continueToLocationBreakpointID;
     DebuggerFrontendDispatcher::Reason m_breakReason;
     RefPtr<InspectorObject> m_breakAuxData;
-    bool m_enabled {false};
-    bool m_javaScriptPauseScheduled {false};
-    bool m_hasExceptionValue {false};
-    bool m_didPauseStopwatch {false};
+    bool m_enabled { false };
+    bool m_javaScriptPauseScheduled { false };
+    bool m_hasExceptionValue { false };
+    bool m_didPauseStopwatch { false };
     RefPtr<WTF::Stopwatch> m_stopwatch;
 };
 
index ae18afc..32104a2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2013-2015 Apple Inc. All rights reserved.
  * Copyright (C) 2011 Google Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -56,12 +56,9 @@ static bool asBool(const bool* const b)
     return b ? *b : false;
 }
 
-InspectorRuntimeAgent::InspectorRuntimeAgent(InjectedScriptManager* injectedScriptManager)
+InspectorRuntimeAgent::InspectorRuntimeAgent(InjectedScriptManager& injectedScriptManager)
     : InspectorAgentBase(ASCIILiteral("Runtime"))
     , m_injectedScriptManager(injectedScriptManager)
-    , m_scriptDebugServer(nullptr)
-    , m_enabled(false)
-    , m_isTypeProfilingEnabled(false)
 {
 }
 
@@ -137,7 +134,7 @@ void InspectorRuntimeAgent::evaluate(ErrorString& errorString, const String& exp
 
 void InspectorRuntimeAgent::callFunctionOn(ErrorString& errorString, const String& objectId, const String& expression, const InspectorArray* optionalArguments, const bool* const doNotPauseOnExceptionsAndMuteConsole, const bool* const returnByValue, const bool* generatePreview, RefPtr<Inspector::Protocol::Runtime::RemoteObject>& result, Inspector::Protocol::OptOutput<bool>* wasThrown)
 {
-    InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForObjectId(objectId);
+    InjectedScript injectedScript = m_injectedScriptManager.injectedScriptForObjectId(objectId);
     if (injectedScript.hasNoValue()) {
         errorString = ASCIILiteral("Inspected frame has gone");
         return;
@@ -163,7 +160,7 @@ void InspectorRuntimeAgent::callFunctionOn(ErrorString& errorString, const Strin
 
 void InspectorRuntimeAgent::getProperties(ErrorString& errorString, const String& objectId, const bool* const ownProperties, const bool* const generatePreview, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Runtime::PropertyDescriptor>>& result, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Runtime::InternalPropertyDescriptor>>& internalProperties)
 {
-    InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForObjectId(objectId);
+    InjectedScript injectedScript = m_injectedScriptManager.injectedScriptForObjectId(objectId);
     if (injectedScript.hasNoValue()) {
         errorString = ASCIILiteral("Inspected frame has gone");
         return;
@@ -181,7 +178,7 @@ void InspectorRuntimeAgent::getProperties(ErrorString& errorString, const String
 
 void InspectorRuntimeAgent::getDisplayableProperties(ErrorString& errorString, const String& objectId, const bool* const generatePreview, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Runtime::PropertyDescriptor>>& result, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Runtime::InternalPropertyDescriptor>>& internalProperties)
 {
-    InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForObjectId(objectId);
+    InjectedScript injectedScript = m_injectedScriptManager.injectedScriptForObjectId(objectId);
     if (injectedScript.hasNoValue()) {
         errorString = ASCIILiteral("Inspected frame has gone");
         return;
@@ -199,7 +196,7 @@ void InspectorRuntimeAgent::getDisplayableProperties(ErrorString& errorString, c
 
 void InspectorRuntimeAgent::getCollectionEntries(ErrorString& errorString, const String& objectId, const String* objectGroup, const int* startIndex, const int* numberToFetch, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Runtime::CollectionEntry>>& entries)
 {
-    InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForObjectId(objectId);
+    InjectedScript injectedScript = m_injectedScriptManager.injectedScriptForObjectId(objectId);
     if (injectedScript.hasNoValue()) {
         errorString = ASCIILiteral("Inspected frame has gone");
         return;
@@ -217,7 +214,7 @@ void InspectorRuntimeAgent::saveResult(ErrorString& errorString, const Inspector
 
     String objectId;
     if (callArgument.getString(ASCIILiteral("objectId"), objectId)) {
-        injectedScript = m_injectedScriptManager->injectedScriptForObjectId(objectId);
+        injectedScript = m_injectedScriptManager.injectedScriptForObjectId(objectId);
         if (injectedScript.hasNoValue()) {
             errorString = ASCIILiteral("Inspected frame has gone");
             return;
@@ -233,14 +230,14 @@ void InspectorRuntimeAgent::saveResult(ErrorString& errorString, const Inspector
 
 void InspectorRuntimeAgent::releaseObject(ErrorString&, const String& objectId)
 {
-    InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForObjectId(objectId);
+    InjectedScript injectedScript = m_injectedScriptManager.injectedScriptForObjectId(objectId);
     if (!injectedScript.hasNoValue())
         injectedScript.releaseObject(objectId);
 }
 
 void InspectorRuntimeAgent::releaseObjectGroup(ErrorString&, const String& objectGroup)
 {
-    m_injectedScriptManager->releaseObjectGroup(objectGroup);
+    m_injectedScriptManager.releaseObjectGroup(objectGroup);
 }
 
 void InspectorRuntimeAgent::run(ErrorString&)
index 25f3d7c..2e2d794 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013, 2015 Apple Inc. All rights reserved.
  * Copyright (C) 2011 Google Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -79,9 +79,9 @@ public:
     bool enabled() const { return m_enabled; }
 
 protected:
-    InspectorRuntimeAgent(InjectedScriptManager*);
+    InspectorRuntimeAgent(InjectedScriptManager&);
 
-    InjectedScriptManager* injectedScriptManager() { return m_injectedScriptManager; }
+    InjectedScriptManager& injectedScriptManager() { return m_injectedScriptManager; }
 
     virtual JSC::VM& globalVM() = 0;
     virtual InjectedScript injectedScriptForEval(ErrorString&, const int* executionContextId) = 0;
@@ -92,10 +92,10 @@ protected:
 private:
     void setTypeProfilerEnabledState(bool);
 
-    InjectedScriptManager* m_injectedScriptManager;
-    ScriptDebugServer* m_scriptDebugServer;
-    bool m_enabled;
-    bool m_isTypeProfilingEnabled;
+    InjectedScriptManager& m_injectedScriptManager;
+    ScriptDebugServer* m_scriptDebugServer { nullptr };
+    bool m_enabled { false };
+    bool m_isTypeProfilingEnabled { false };
 };
 
 } // namespace Inspector
index fe112dd..96e1a49 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014, 2015 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -28,7 +28,7 @@
 
 namespace Inspector {
 
-JSGlobalObjectConsoleAgent::JSGlobalObjectConsoleAgent(InjectedScriptManager* injectedScriptManager)
+JSGlobalObjectConsoleAgent::JSGlobalObjectConsoleAgent(InjectedScriptManager& injectedScriptManager)
     : InspectorConsoleAgent(injectedScriptManager)
 {
 }
index 0d79c5d..9c285e2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014, 2015 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -35,7 +35,7 @@ class JSGlobalObjectConsoleAgent final : public InspectorConsoleAgent {
     WTF_MAKE_NONCOPYABLE(JSGlobalObjectConsoleAgent);
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    JSGlobalObjectConsoleAgent(InjectedScriptManager*);
+    JSGlobalObjectConsoleAgent(InjectedScriptManager&);
     virtual ~JSGlobalObjectConsoleAgent() { }
 
     // FIXME: XHRs and Nodes only makes sense debugging a Web context. Can this be moved to a different agent?
index 9ae76c6..4d38307 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014, 2015 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -38,7 +38,7 @@ using namespace JSC;
 
 namespace Inspector {
 
-JSGlobalObjectDebuggerAgent::JSGlobalObjectDebuggerAgent(InjectedScriptManager* injectedScriptManager, JSC::JSGlobalObject& globalObject, InspectorConsoleAgent* consoleAgent)
+JSGlobalObjectDebuggerAgent::JSGlobalObjectDebuggerAgent(InjectedScriptManager& injectedScriptManager, JSC::JSGlobalObject& globalObject, InspectorConsoleAgent* consoleAgent)
     : InspectorDebuggerAgent(injectedScriptManager)
     , m_scriptDebugServer(globalObject)
     , m_consoleAgent(consoleAgent)
@@ -63,7 +63,7 @@ InjectedScript JSGlobalObjectDebuggerAgent::injectedScriptForEval(ErrorString& e
     }
 
     ExecState* exec = m_scriptDebugServer.globalObject().globalExec();
-    return injectedScriptManager()->injectedScriptFor(exec);
+    return injectedScriptManager().injectedScriptFor(exec);
 }
 
 void JSGlobalObjectDebuggerAgent::breakpointActionLog(JSC::ExecState* exec, const String& message)
index ac6b871..d21efa0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014, 2015 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -37,7 +37,7 @@ class JSGlobalObjectDebuggerAgent final : public InspectorDebuggerAgent {
     WTF_MAKE_NONCOPYABLE(JSGlobalObjectDebuggerAgent);
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    JSGlobalObjectDebuggerAgent(InjectedScriptManager*, JSC::JSGlobalObject&, InspectorConsoleAgent*);
+    JSGlobalObjectDebuggerAgent(InjectedScriptManager&, JSC::JSGlobalObject&, InspectorConsoleAgent*);
     virtual ~JSGlobalObjectDebuggerAgent() { }
 
     virtual JSGlobalObjectScriptDebugServer& scriptDebugServer() override { return m_scriptDebugServer; }
@@ -55,7 +55,7 @@ public:
 
 private:
     JSGlobalObjectScriptDebugServer m_scriptDebugServer;
-    InspectorConsoleAgent* m_consoleAgent;
+    InspectorConsoleAgent* m_consoleAgent { nullptr };
 };
 
 } // namespace Inspector
index 46049f5..edabbe2 100644 (file)
@@ -34,7 +34,7 @@ using namespace JSC;
 
 namespace Inspector {
 
-JSGlobalObjectRuntimeAgent::JSGlobalObjectRuntimeAgent(InjectedScriptManager* injectedScriptManager, JSGlobalObject& globalObject)
+JSGlobalObjectRuntimeAgent::JSGlobalObjectRuntimeAgent(InjectedScriptManager& injectedScriptManager, JSGlobalObject& globalObject)
     : InspectorRuntimeAgent(injectedScriptManager)
     , m_globalObject(globalObject)
 {
@@ -64,7 +64,7 @@ InjectedScript JSGlobalObjectRuntimeAgent::injectedScriptForEval(ErrorString& er
     ASSERT_UNUSED(executionContextId, !executionContextId);
 
     JSC::ExecState* scriptState = m_globalObject.globalExec();
-    InjectedScript injectedScript = injectedScriptManager()->injectedScriptFor(scriptState);
+    InjectedScript injectedScript = injectedScriptManager().injectedScriptFor(scriptState);
     if (injectedScript.hasNoValue())
         errorString = ASCIILiteral("Internal error: main world execution context not found.");
 
index 631baec..ee0a45d 100644 (file)
@@ -36,7 +36,7 @@ namespace Inspector {
 
 class JSGlobalObjectRuntimeAgent final : public InspectorRuntimeAgent {
 public:
-    JSGlobalObjectRuntimeAgent(InjectedScriptManager*, JSC::JSGlobalObject&);
+    JSGlobalObjectRuntimeAgent(InjectedScriptManager&, JSC::JSGlobalObject&);
 
     virtual void didCreateFrontendAndBackend(FrontendChannel*, BackendDispatcher*) override;
     virtual void willDestroyFrontendAndBackend(DisconnectReason) override;
index 62e3b2e..12258c2 100644 (file)
@@ -1,3 +1,181 @@
+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 [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:
+
 2015-09-01  Jinyoung Hur  <hur.ims@navercorp.com>
 
         [Cairo][WebGL] Upload the accelerated canvas as a texture by copying via GPU directly
index 2dcd26e..296a07d 100644 (file)
@@ -43,7 +43,7 @@ using namespace Inspector;
 
 namespace WebCore {
 
-InspectorApplicationCacheAgent::InspectorApplicationCacheAgent(InstrumentingAgents* instrumentingAgents, InspectorPageAgent* pageAgent)
+InspectorApplicationCacheAgent::InspectorApplicationCacheAgent(InstrumentingAgents& instrumentingAgents, InspectorPageAgent* pageAgent)
     : InspectorAgentBase(ASCIILiteral("ApplicationCache"), instrumentingAgents)
     , m_pageAgent(pageAgent)
 {
@@ -60,12 +60,12 @@ void InspectorApplicationCacheAgent::willDestroyFrontendAndBackend(Inspector::Di
     m_frontendDispatcher = nullptr;
     m_backendDispatcher = nullptr;
 
-    m_instrumentingAgents->setInspectorApplicationCacheAgent(nullptr);
+    m_instrumentingAgents.setInspectorApplicationCacheAgent(nullptr);
 }
 
 void InspectorApplicationCacheAgent::enable(ErrorString&)
 {
-    m_instrumentingAgents->setInspectorApplicationCacheAgent(this);
+    m_instrumentingAgents.setInspectorApplicationCacheAgent(this);
 
     // We need to pass initial navigator.onOnline.
     networkStateChanged();
index 2d6218d..117c85e 100644 (file)
@@ -50,7 +50,7 @@ typedef String ErrorString;
 class InspectorApplicationCacheAgent final : public InspectorAgentBase, public Inspector::ApplicationCacheBackendDispatcherHandler {
     WTF_MAKE_NONCOPYABLE(InspectorApplicationCacheAgent); WTF_MAKE_FAST_ALLOCATED;
 public:
-    InspectorApplicationCacheAgent(InstrumentingAgents*, InspectorPageAgent*);
+    InspectorApplicationCacheAgent(InstrumentingAgents&, InspectorPageAgent*);
     virtual ~InspectorApplicationCacheAgent() { }
 
     virtual void didCreateFrontendAndBackend(Inspector::FrontendChannel*, Inspector::BackendDispatcher*) override;
@@ -71,9 +71,9 @@ private:
 
     DocumentLoader* assertFrameWithDocumentLoader(ErrorString&, const String& frameId);
 
-    InspectorPageAgent* m_pageAgent;
     std::unique_ptr<Inspector::ApplicationCacheFrontendDispatcher> m_frontendDispatcher;
     RefPtr<Inspector::ApplicationCacheBackendDispatcher> m_backendDispatcher;
+    InspectorPageAgent* m_pageAgent { nullptr };
 };
 
 } // namespace WebCore
index d9b5089..a792444 100644 (file)
@@ -1,5 +1,6 @@
 /*
- * Copyright (C) 2010, Google Inc. All rights reserved.
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -340,10 +341,9 @@ CSSStyleRule* InspectorCSSAgent::asCSSStyleRule(CSSRule& rule)
     return downcast<CSSStyleRule>(&rule);
 }
 
-InspectorCSSAgent::InspectorCSSAgent(InstrumentingAgents* instrumentingAgents, InspectorDOMAgent* domAgent)
+InspectorCSSAgent::InspectorCSSAgent(InstrumentingAgents& instrumentingAgents, InspectorDOMAgent* domAgent)
     : InspectorAgentBase(ASCIILiteral("CSS"), instrumentingAgents)
     , m_domAgent(domAgent)
-    , m_lastStyleSheetId(1)
 {
     m_domAgent->setDOMListener(this);
 }
@@ -395,7 +395,7 @@ void InspectorCSSAgent::resetNonPersistentData()
 
 void InspectorCSSAgent::enable(ErrorString&)
 {
-    m_instrumentingAgents->setInspectorCSSAgent(this);
+    m_instrumentingAgents.setInspectorCSSAgent(this);
 
     for (auto* document : m_domAgent->documents())
         activeStyleSheetsUpdated(*document);
@@ -403,7 +403,7 @@ void InspectorCSSAgent::enable(ErrorString&)
 
 void InspectorCSSAgent::disable(ErrorString&)
 {
-    m_instrumentingAgents->setInspectorCSSAgent(nullptr);
+    m_instrumentingAgents.setInspectorCSSAgent(nullptr);
 }
 
 void InspectorCSSAgent::documentDetached(Document& document)
index 3e9b41e..dbd294e 100644 (file)
@@ -1,5 +1,6 @@
 /*
- * Copyright (C) 2010, Google Inc. All rights reserved.
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -81,7 +82,7 @@ public:
         ContentSecurityPolicy* m_contentSecurityPolicy;
     };
 
-    InspectorCSSAgent(InstrumentingAgents*, InspectorDOMAgent*);
+    InspectorCSSAgent(InstrumentingAgents&, InspectorDOMAgent*);
     virtual ~InspectorCSSAgent();
 
     static CSSStyleRule* asCSSStyleRule(CSSRule&);
@@ -169,7 +170,7 @@ private:
 
     std::unique_ptr<Inspector::CSSFrontendDispatcher> m_frontendDispatcher;
     RefPtr<Inspector::CSSBackendDispatcher> m_backendDispatcher;
-    InspectorDOMAgent* m_domAgent;
+    InspectorDOMAgent* m_domAgent { nullptr };
 
     IdToInspectorStyleSheet m_idToInspectorStyleSheet;
     CSSStyleSheetToInspectorStyleSheet m_cssStyleSheetToInspectorStyleSheet;
@@ -180,7 +181,7 @@ private:
     HashSet<int> m_namedFlowCollectionsRequested;
     std::unique_ptr<ChangeRegionOversetTask> m_changeRegionOversetTask;
 
-    int m_lastStyleSheetId;
+    int m_lastStyleSheetId { 1 };
     bool m_creatingViaInspectorStyleSheet { false };
 };
 
index aa4f535..27737e3 100644 (file)
@@ -1,5 +1,6 @@
 /*
 * Copyright (C) 2011 Google Inc. All rights reserved.
+* Copyright (C) 2015 Apple Inc. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are
@@ -40,8 +41,7 @@ namespace WebCore {
 
 inline void InspectorInstrumentation::addMessageToConsole(Page& page, std::unique_ptr<Inspector::ConsoleMessage> message)
 {
-    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
-        addMessageToConsoleImpl(*instrumentingAgents, WTF::move(message));
+    addMessageToConsoleImpl(instrumentingAgentsForPage(page), WTF::move(message));
 }
 
 inline void InspectorInstrumentation::addMessageToConsole(WorkerGlobalScope* workerGlobalScope, std::unique_ptr<Inspector::ConsoleMessage> message)
@@ -52,8 +52,7 @@ inline void InspectorInstrumentation::addMessageToConsole(WorkerGlobalScope* wor
 
 inline void InspectorInstrumentation::consoleCount(Page& page, JSC::ExecState* state, RefPtr<Inspector::ScriptArguments>&& arguments)
 {
-    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
-        consoleCountImpl(*instrumentingAgents, state, WTF::move(arguments));
+    consoleCountImpl(instrumentingAgentsForPage(page), state, WTF::move(arguments));
 }
 
 inline void InspectorInstrumentation::startConsoleTiming(Frame& frame, const String& title)
@@ -77,15 +76,12 @@ inline void InspectorInstrumentation::consoleTimeStamp(Frame& frame, RefPtr<Insp
 
 inline void InspectorInstrumentation::startProfiling(Page& page, JSC::ExecState* exec, const String &title)
 {
-    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
-        startProfilingImpl(*instrumentingAgents, exec, title);
+    startProfilingImpl(instrumentingAgentsForPage(page), exec, title);
 }
 
 inline RefPtr<JSC::Profile> InspectorInstrumentation::stopProfiling(Page& page, JSC::ExecState* exec, const String &title)
 {
-    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
-        return stopProfilingImpl(*instrumentingAgents, exec, title);
-    return nullptr;
+    return stopProfilingImpl(instrumentingAgentsForPage(page), exec, title);
 }
 
 } // namespace WebCore
index 3b0123d..277f16b 100644 (file)
@@ -102,12 +102,12 @@ InspectorController::InspectorController(Page& page, InspectorClient* inspectorC
     m_pageAgent = pageAgentPtr.get();
     m_agents.append(WTF::move(pageAgentPtr));
 
-    auto runtimeAgentPtr = std::make_unique<PageRuntimeAgent>(m_injectedScriptManager.get(), &page, pageAgent);
+    auto runtimeAgentPtr = std::make_unique<PageRuntimeAgent>(*m_injectedScriptManager, &page, pageAgent);
     PageRuntimeAgent* runtimeAgent = runtimeAgentPtr.get();
     m_instrumentingAgents->setPageRuntimeAgent(runtimeAgent);
     m_agents.append(WTF::move(runtimeAgentPtr));
 
-    auto domAgentPtr = std::make_unique<InspectorDOMAgent>(m_instrumentingAgents.get(), pageAgent, m_injectedScriptManager.get(), m_overlay.get());
+    auto domAgentPtr = std::make_unique<InspectorDOMAgent>(m_instrumentingAgents.get(), pageAgent, *m_injectedScriptManager, m_overlay.get());
     m_domAgent = domAgentPtr.get();
     m_agents.append(WTF::move(domAgentPtr));
 
@@ -118,7 +118,7 @@ InspectorController::InspectorController(Page& page, InspectorClient* inspectorC
     m_agents.append(WTF::move(databaseAgentPtr));
 
 #if ENABLE(INDEXED_DATABASE)
-    m_agents.append(std::make_unique<InspectorIndexedDBAgent>(m_instrumentingAgents.get(), m_injectedScriptManager.get(), pageAgent));
+    m_agents.append(std::make_unique<InspectorIndexedDBAgent>(m_instrumentingAgents.get(), *m_injectedScriptManager, pageAgent));
 #endif
 
 #if ENABLE(WEB_REPLAY)
@@ -137,12 +137,12 @@ InspectorController::InspectorController(Page& page, InspectorClient* inspectorC
     m_resourceAgent = resourceAgentPtr.get();
     m_agents.append(WTF::move(resourceAgentPtr));
 
-    auto consoleAgentPtr = std::make_unique<PageConsoleAgent>(m_injectedScriptManager.get(), m_domAgent);
+    auto consoleAgentPtr = std::make_unique<PageConsoleAgent>(*m_injectedScriptManager, m_domAgent);
     WebConsoleAgent* consoleAgent = consoleAgentPtr.get();
     m_instrumentingAgents->setWebConsoleAgent(consoleAgentPtr.get());
     m_agents.append(WTF::move(consoleAgentPtr));
 
-    auto debuggerAgentPtr = std::make_unique<PageDebuggerAgent>(m_injectedScriptManager.get(), m_instrumentingAgents.get(), pageAgent, m_overlay.get());
+    auto debuggerAgentPtr = std::make_unique<PageDebuggerAgent>(*m_injectedScriptManager, m_instrumentingAgents.get(), pageAgent, m_overlay.get());
     m_debuggerAgent = debuggerAgentPtr.get();
     m_agents.append(WTF::move(debuggerAgentPtr));
 
@@ -231,7 +231,7 @@ void InspectorController::connectFrontend(Inspector::FrontendChannel* frontendCh
 
     m_agents.didCreateFrontendAndBackend(frontendChannel, m_backendDispatcher.get());
 
-    InspectorInstrumentation::registerInstrumentingAgents(*m_instrumentingAgents);
+    InspectorInstrumentation::registerInstrumentingAgents(m_instrumentingAgents.get());
     InspectorInstrumentation::frontendCreated();
 
 #if ENABLE(REMOTE_INSPECTOR)
@@ -261,7 +261,7 @@ void InspectorController::disconnectFrontend(DisconnectReason reason)
     // Release overlay page resources.
     m_overlay->freePage();
     InspectorInstrumentation::frontendDeleted();
-    InspectorInstrumentation::unregisterInstrumentingAgents(*m_instrumentingAgents);
+    InspectorInstrumentation::unregisterInstrumentingAgents(m_instrumentingAgents.get());
 }
 
 void InspectorController::show()
index ceb3de2..dfb7e85 100644 (file)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2011 Google Inc. All rights reserved.
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -137,25 +138,26 @@ public:
 private:
     friend class InspectorInstrumentation;
 
-    RefPtr<InstrumentingAgents> m_instrumentingAgents;
+    Ref<InstrumentingAgents> m_instrumentingAgents;
     std::unique_ptr<WebInjectedScriptManager> m_injectedScriptManager;
-    std::unique_ptr<InspectorOverlay> m_overlay;
-
-    Inspector::InspectorAgent* m_inspectorAgent;
-    InspectorDOMAgent* m_domAgent;
-    InspectorResourceAgent* m_resourceAgent;
-    InspectorPageAgent* m_pageAgent;
-    PageDebuggerAgent* m_debuggerAgent;
-    InspectorDOMDebuggerAgent* m_domDebuggerAgent;
-    InspectorTimelineAgent* m_timelineAgent;
-
     RefPtr<Inspector::BackendDispatcher> m_backendDispatcher;
     Inspector::FrontendChannel* m_frontendChannel { nullptr };
+    std::unique_ptr<InspectorOverlay> m_overlay;
     Ref<WTF::Stopwatch> m_executionStopwatch;
+    Inspector::AgentRegistry m_agents;
+
     Page& m_page;
     InspectorClient* m_inspectorClient;
     InspectorFrontendClient* m_inspectorFrontendClient { nullptr };
-    Inspector::AgentRegistry m_agents;
+
+    Inspector::InspectorAgent* m_inspectorAgent { nullptr };
+    InspectorDOMAgent* m_domAgent { nullptr };
+    InspectorResourceAgent* m_resourceAgent { nullptr };
+    InspectorPageAgent* m_pageAgent { nullptr };
+    PageDebuggerAgent* m_debuggerAgent { nullptr };
+    InspectorDOMDebuggerAgent* m_domDebuggerAgent { nullptr };
+    InspectorTimelineAgent* m_timelineAgent { nullptr };
+
     Vector<InspectorInstrumentationCookie, 2> m_injectedScriptInstrumentationCookies;
     bool m_isUnderTest { false };
     bool m_isAutomaticInspection { false };
index 564829f..94aeeb4 100644 (file)
@@ -201,17 +201,11 @@ String InspectorDOMAgent::toErrorString(const ExceptionCode& ec)
     return "";
 }
 
-InspectorDOMAgent::InspectorDOMAgent(InstrumentingAgents* instrumentingAgents, InspectorPageAgent* pageAgent, InjectedScriptManager* injectedScriptManager, InspectorOverlay* overlay)
+InspectorDOMAgent::InspectorDOMAgent(InstrumentingAgents& instrumentingAgents, InspectorPageAgent* pageAgent, InjectedScriptManager& injectedScriptManager, InspectorOverlay* overlay)
     : InspectorAgentBase(ASCIILiteral("DOM"), instrumentingAgents)
-    , m_pageAgent(pageAgent)
     , m_injectedScriptManager(injectedScriptManager)
+    , m_pageAgent(pageAgent)
     , m_overlay(overlay)
-    , m_domListener(0)
-    , m_lastNodeId(1)
-    , m_lastBackendNodeId(-1)
-    , m_searchingForNode(false)
-    , m_suppressAttributeModifiedEvent(false)
-    , m_documentRequested(false)
 {
 }
 
@@ -229,7 +223,7 @@ void InspectorDOMAgent::didCreateFrontendAndBackend(Inspector::FrontendChannel*
     m_history = std::make_unique<InspectorHistory>();
     m_domEditor = std::make_unique<DOMEditor>(m_history.get());
 
-    m_instrumentingAgents->setInspectorDOMAgent(this);
+    m_instrumentingAgents.setInspectorDOMAgent(this);
     m_document = m_pageAgent->mainFrame()->document();
 
     if (m_nodeToFocus)
@@ -248,7 +242,7 @@ void InspectorDOMAgent::willDestroyFrontendAndBackend(Inspector::DisconnectReaso
     setSearchingForNode(unused, false, 0);
     hideHighlight(unused);
 
-    m_instrumentingAgents->setInspectorDOMAgent(0);
+    m_instrumentingAgents.setInspectorDOMAgent(0);
     m_documentRequested = false;
     reset();
 }
@@ -1006,7 +1000,7 @@ void InspectorDOMAgent::focusNode()
         return;
 
     JSC::ExecState* scriptState = mainWorldExecState(frame);
-    InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(scriptState);
+    InjectedScript injectedScript = m_injectedScriptManager.injectedScriptFor(scriptState);
     if (injectedScript.hasNoValue())
         return;
 
@@ -1482,7 +1476,7 @@ Ref<Inspector::Protocol::DOM::EventListener> InspectorDOMAgent::buildObjectForEv
         .setHandlerBody(body)
         .release();
     if (objectGroupId && handler && state) {
-        InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(state);
+        InjectedScript injectedScript = m_injectedScriptManager.injectedScriptFor(state);
         if (!injectedScript.hasNoValue())
             value->setHandler(injectedScript.wrapObject(Deprecated::ScriptValue(state->vm(), handler), *objectGroupId));
     }
@@ -2072,7 +2066,7 @@ Node* InspectorDOMAgent::nodeForPath(const String& path)
 
 Node* InspectorDOMAgent::nodeForObjectId(const String& objectId)
 {
-    InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForObjectId(objectId);
+    InjectedScript injectedScript = m_injectedScriptManager.injectedScriptForObjectId(objectId);
     if (injectedScript.hasNoValue())
         return nullptr;
 
@@ -2112,7 +2106,7 @@ RefPtr<Inspector::Protocol::Runtime::RemoteObject> InspectorDOMAgent::resolveNod
         return 0;
 
     JSC::ExecState* scriptState = mainWorldExecState(frame);
-    InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(scriptState);
+    InjectedScript injectedScript = m_injectedScriptManager.injectedScriptFor(scriptState);
     if (injectedScript.hasNoValue())
         return 0;
 
index 7dbe24c..7b0d658 100644 (file)
@@ -104,7 +104,7 @@ public:
         virtual void didModifyDOMAttr(Element*) = 0;
     };
 
-    InspectorDOMAgent(InstrumentingAgents*, InspectorPageAgent*, Inspector::InjectedScriptManager*, InspectorOverlay*);
+    InspectorDOMAgent(InstrumentingAgents&, InspectorPageAgent*, Inspector::InjectedScriptManager&, InspectorOverlay*);
     virtual ~InspectorDOMAgent();
 
     static String toErrorString(const ExceptionCode&);
@@ -247,12 +247,13 @@ private:
 
     void innerHighlightQuad(std::unique_ptr<FloatQuad>, const Inspector::InspectorObject* color, const Inspector::InspectorObject* outlineColor, const bool* usePageCoordinates);
 
-    InspectorPageAgent* m_pageAgent;
-    Inspector::InjectedScriptManager* m_injectedScriptManager;
-    InspectorOverlay* m_overlay;
     std::unique_ptr<Inspector::DOMFrontendDispatcher> m_frontendDispatcher;
     RefPtr<Inspector::DOMBackendDispatcher> m_backendDispatcher;
-    DOMListener* m_domListener;
+    Inspector::InjectedScriptManager& m_injectedScriptManager;
+    InspectorPageAgent* m_pageAgent { nullptr };
+
+    InspectorOverlay* m_overlay { nullptr };
+    DOMListener* m_domListener { nullptr };
     NodeToIdMap m_documentNodeToIdMap;
     typedef HashMap<RefPtr<Node>, BackendNodeId> NodeToBackendIdMap;
     HashMap<String, NodeToBackendIdMap> m_nodeGroupToBackendIdMap;
@@ -262,19 +263,19 @@ private:
     HashMap<int, NodeToIdMap*> m_idToNodesMap;
     HashSet<int> m_childrenRequested;
     HashMap<BackendNodeId, std::pair<Node*, String>> m_backendIdToNode;
-    int m_lastNodeId;
-    BackendNodeId m_lastBackendNodeId;
+    int m_lastNodeId { 1 };
+    BackendNodeId m_lastBackendNodeId { -1 };
     RefPtr<Document> m_document;
     typedef HashMap<String, Vector<RefPtr<Node>>> SearchResults;
     SearchResults m_searchResults;
     std::unique_ptr<RevalidateStyleAttributeTask> m_revalidateStyleAttrTask;
     RefPtr<Node> m_nodeToFocus;
-    bool m_searchingForNode;
+    bool m_searchingForNode { false };
     std::unique_ptr<HighlightConfig> m_inspectModeHighlightConfig;
     std::unique_ptr<InspectorHistory> m_history;
     std::unique_ptr<DOMEditor> m_domEditor;
-    bool m_suppressAttributeModifiedEvent;
-    bool m_documentRequested;
+    bool m_suppressAttributeModifiedEvent { false };
+    bool m_documentRequested { false };
 };
 
 } // namespace WebCore
index d51d4be..9392a55 100644 (file)
@@ -59,12 +59,10 @@ using namespace Inspector;
 
 namespace WebCore {
 
-InspectorDOMDebuggerAgent::InspectorDOMDebuggerAgent(InstrumentingAgents* instrumentingAgents, InspectorDOMAgent* domAgent, InspectorDebuggerAgent* debuggerAgent)
+InspectorDOMDebuggerAgent::InspectorDOMDebuggerAgent(InstrumentingAgents& instrumentingAgents, InspectorDOMAgent* domAgent, InspectorDebuggerAgent* debuggerAgent)
     : InspectorAgentBase(ASCIILiteral("DOMDebugger"), instrumentingAgents)
     , m_domAgent(domAgent)
     , m_debuggerAgent(debuggerAgent)
-    , m_pauseInNextEventListener(false)
-    , m_pauseOnAllXHRsEnabled(false)
 {
     m_debuggerAgent->setListener(this);
 }
@@ -72,13 +70,13 @@ InspectorDOMDebuggerAgent::InspectorDOMDebuggerAgent(InstrumentingAgents* instru
 InspectorDOMDebuggerAgent::~InspectorDOMDebuggerAgent()
 {
     ASSERT(!m_debuggerAgent);
-    ASSERT(!m_instrumentingAgents->inspectorDOMDebuggerAgent());
+    ASSERT(!m_instrumentingAgents.inspectorDOMDebuggerAgent());
 }
 
 // Browser debugger agent enabled only when JS debugger is enabled.
 void InspectorDOMDebuggerAgent::debuggerWasEnabled()
 {
-    m_instrumentingAgents->setInspectorDOMDebuggerAgent(this);
+    m_instrumentingAgents.setInspectorDOMDebuggerAgent(this);
 }
 
 void InspectorDOMDebuggerAgent::debuggerWasDisabled()
@@ -98,7 +96,7 @@ void InspectorDOMDebuggerAgent::didPause()
 
 void InspectorDOMDebuggerAgent::disable()
 {
-    m_instrumentingAgents->setInspectorDOMDebuggerAgent(nullptr);
+    m_instrumentingAgents.setInspectorDOMDebuggerAgent(nullptr);
     clear();
 }
 
index afe3cfb..01b3139 100644 (file)
@@ -55,7 +55,7 @@ class InspectorDOMDebuggerAgent final : public InspectorAgentBase, public Inspec
     WTF_MAKE_NONCOPYABLE(InspectorDOMDebuggerAgent);
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    InspectorDOMDebuggerAgent(InstrumentingAgents*, InspectorDOMAgent*, Inspector::InspectorDebuggerAgent*);
+    InspectorDOMDebuggerAgent(InstrumentingAgents&, InspectorDOMAgent*, Inspector::InspectorDebuggerAgent*);
     virtual ~InspectorDOMDebuggerAgent();
 
     // DOMDebugger API
@@ -99,14 +99,15 @@ private:
 
     void clear();
 
-    InspectorDOMAgent* m_domAgent;
-    Inspector::InspectorDebuggerAgent* m_debuggerAgent;
     RefPtr<Inspector::DOMDebuggerBackendDispatcher> m_backendDispatcher;
+    InspectorDOMAgent* m_domAgent { nullptr };
+    Inspector::InspectorDebuggerAgent* m_debuggerAgent { nullptr };
+
     HashMap<Node*, uint32_t> m_domBreakpoints;
     HashSet<String> m_eventListenerBreakpoints;
     HashSet<String> m_xhrBreakpoints;
-    bool m_pauseInNextEventListener;
-    bool m_pauseOnAllXHRsEnabled;
+    bool m_pauseInNextEventListener { false };
+    bool m_pauseOnAllXHRsEnabled { false };
 };
 
 } // namespace WebCore
index 04af88b..2d39975 100644 (file)
@@ -53,18 +53,16 @@ using namespace Inspector;
 
 namespace WebCore {
 
-InspectorDOMStorageAgent::InspectorDOMStorageAgent(InstrumentingAgents* instrumentingAgents, InspectorPageAgent* pageAgent)
+InspectorDOMStorageAgent::InspectorDOMStorageAgent(InstrumentingAgents& instrumentingAgents, InspectorPageAgent* pageAgent)
     : InspectorAgentBase(ASCIILiteral("DOMStorage"), instrumentingAgents)
     , m_pageAgent(pageAgent)
-    , m_enabled(false)
 {
-    m_instrumentingAgents->setInspectorDOMStorageAgent(this);
+    m_instrumentingAgents.setInspectorDOMStorageAgent(this);
 }
 
 InspectorDOMStorageAgent::~InspectorDOMStorageAgent()
 {
-    m_instrumentingAgents->setInspectorDOMStorageAgent(nullptr);
-    m_instrumentingAgents = nullptr;
+    m_instrumentingAgents.setInspectorDOMStorageAgent(nullptr);
 }
 
 void InspectorDOMStorageAgent::didCreateFrontendAndBackend(Inspector::FrontendChannel* frontendChannel, Inspector::BackendDispatcher* backendDispatcher)
index 50a1dd2..78a7a28 100644 (file)
@@ -54,7 +54,7 @@ typedef String ErrorString;
 class InspectorDOMStorageAgent final : public InspectorAgentBase, public Inspector::DOMStorageBackendDispatcherHandler {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    InspectorDOMStorageAgent(InstrumentingAgents*, InspectorPageAgent*);
+    InspectorDOMStorageAgent(InstrumentingAgents&, InspectorPageAgent*);
     virtual ~InspectorDOMStorageAgent();
 
     virtual void didCreateFrontendAndBackend(Inspector::FrontendChannel*, Inspector::BackendDispatcher*) override;
@@ -77,10 +77,11 @@ public:
 private:
     RefPtr<StorageArea> findStorageArea(ErrorString&, const Inspector::InspectorObject&, Frame*&);
 
-    InspectorPageAgent* m_pageAgent;
     std::unique_ptr<Inspector::DOMStorageFrontendDispatcher> m_frontendDispatcher;
     RefPtr<Inspector::DOMStorageBackendDispatcher> m_backendDispatcher;
-    bool m_enabled;
+    InspectorPageAgent* m_pageAgent { nullptr };
+
+    bool m_enabled { false };
 };
 
 } // namespace WebCore
index be27f95..cc473d7 100644 (file)
@@ -210,16 +210,15 @@ void InspectorDatabaseAgent::clearResources()
     m_resources.clear();
 }
 
-InspectorDatabaseAgent::InspectorDatabaseAgent(InstrumentingAgents* instrumentingAgents)
+InspectorDatabaseAgent::InspectorDatabaseAgent(InstrumentingAgents& instrumentingAgents)
     : InspectorAgentBase(ASCIILiteral("Database"), instrumentingAgents)
-    , m_enabled(false)
 {
-    m_instrumentingAgents->setInspectorDatabaseAgent(this);
+    m_instrumentingAgents.setInspectorDatabaseAgent(this);
 }
 
 InspectorDatabaseAgent::~InspectorDatabaseAgent()
 {
-    m_instrumentingAgents->setInspectorDatabaseAgent(nullptr);
+    m_instrumentingAgents.setInspectorDatabaseAgent(nullptr);
 }
 
 void InspectorDatabaseAgent::didCreateFrontendAndBackend(Inspector::FrontendChannel* frontendChannel, Inspector::BackendDispatcher* backendDispatcher)
index 3fdaa2c..1df9494 100644 (file)
@@ -50,7 +50,7 @@ typedef String ErrorString;
 class InspectorDatabaseAgent final : public InspectorAgentBase, public Inspector::DatabaseBackendDispatcherHandler {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    explicit InspectorDatabaseAgent(InstrumentingAgents*);
+    explicit InspectorDatabaseAgent(InstrumentingAgents&);
     virtual ~InspectorDatabaseAgent();
 
     virtual void didCreateFrontendAndBackend(Inspector::FrontendChannel*, Inspector::BackendDispatcher*) override;
@@ -74,9 +74,10 @@ private:
 
     std::unique_ptr<Inspector::DatabaseFrontendDispatcher> m_frontendDispatcher;
     RefPtr<Inspector::DatabaseBackendDispatcher> m_backendDispatcher;
+
     typedef HashMap<String, RefPtr<InspectorDatabaseResource>> DatabaseResourcesMap;
     DatabaseResourcesMap m_resources;
-    bool m_enabled;
+    bool m_enabled { false };
 };
 
 } // namespace WebCore
index 172fb58..ef3b185 100644 (file)
@@ -564,7 +564,7 @@ public:
 
 } // namespace
 
-InspectorIndexedDBAgent::InspectorIndexedDBAgent(InstrumentingAgents* instrumentingAgents, InjectedScriptManager* injectedScriptManager, InspectorPageAgent* pageAgent)
+InspectorIndexedDBAgent::InspectorIndexedDBAgent(InstrumentingAgents& instrumentingAgents, InjectedScriptManager& injectedScriptManager, InspectorPageAgent* pageAgent)
     : InspectorAgentBase(ASCIILiteral("IndexedDB"), instrumentingAgents)
     , m_injectedScriptManager(injectedScriptManager)
     , m_pageAgent(pageAgent)
@@ -666,7 +666,7 @@ void InspectorIndexedDBAgent::requestData(ErrorString& errorString, const String
     if (!idbFactory)
         return;
 
-    InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(mainWorldExecState(frame));
+    InjectedScript injectedScript = m_injectedScriptManager.injectedScriptFor(mainWorldExecState(frame));
 
     RefPtr<IDBKeyRange> idbKeyRange = keyRange ? idbKeyRangeFromKeyRange(keyRange) : nullptr;
     if (keyRange && !idbKeyRange) {
index 110728a..7b8ce98 100644 (file)
@@ -50,7 +50,7 @@ typedef String ErrorString;
 class InspectorIndexedDBAgent final : public InspectorAgentBase, public Inspector::IndexedDBBackendDispatcherHandler {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    InspectorIndexedDBAgent(InstrumentingAgents*, Inspector::InjectedScriptManager*, InspectorPageAgent*);
+    InspectorIndexedDBAgent(InstrumentingAgents&, Inspector::InjectedScriptManager&, InspectorPageAgent*);
     virtual ~InspectorIndexedDBAgent();
 
     virtual void didCreateFrontendAndBackend(Inspector::FrontendChannel*, Inspector::BackendDispatcher*) override;
@@ -65,9 +65,9 @@ public:
     virtual void clearObjectStore(ErrorString&, const String& in_securityOrigin, const String& in_databaseName, const String& in_objectStoreName, Ref<ClearObjectStoreCallback>&&) override;
 
 private:
-    Inspector::InjectedScriptManager* m_injectedScriptManager;
-    InspectorPageAgent* m_pageAgent;
     RefPtr<Inspector::IndexedDBBackendDispatcher> m_backendDispatcher;
+    Inspector::InjectedScriptManager& m_injectedScriptManager;
+    InspectorPageAgent* m_pageAgent { nullptr };
 };
 
 } // namespace WebCore
index e28c1ca..a8c5bad 100644 (file)
@@ -1,6 +1,6 @@
 /*
 * Copyright (C) 2011 Google Inc. All rights reserved.
-* Copyright (C) 2014 Apple Inc. All rights reserved.
+* Copyright (C) 2014, 2015 Apple Inc. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are
@@ -1261,10 +1261,10 @@ InspectorTimelineAgent* InspectorInstrumentation::retrieveTimelineAgent(const In
 
 InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForPage(Page* page)
 {
-    return page ? instrumentingAgentsForPage(*page) : nullptr;
+    return page ? &instrumentingAgentsForPage(*page) : nullptr;
 }
 
-InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForPage(Page& page)
+InstrumentingAgents& InspectorInstrumentation::instrumentingAgentsForPage(Page& page)
 {
     ASSERT(isMainThread());
     return page.inspectorController().m_instrumentingAgents.get();
@@ -1277,7 +1277,7 @@ InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForRenderer(Re
 
 InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForWorkerGlobalScope(WorkerGlobalScope* workerGlobalScope)
 {
-    return workerGlobalScope ? workerGlobalScope->workerInspectorController().m_instrumentingAgents.get() : nullptr;
+    return workerGlobalScope ? &workerGlobalScope->workerInspectorController().m_instrumentingAgents.get() : nullptr;
 }
 
 InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForNonDocumentContext(ScriptExecutionContext* context)
index d17cb63..9f6365e 100644 (file)
@@ -1,6 +1,6 @@
 /*
 * Copyright (C) 2010 Google Inc. All rights reserved.
-* Copyright (C) 2014 Apple Inc. All rights reserved.
+* Copyright (C) 2014, 2015 Apple Inc. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are
@@ -457,7 +457,7 @@ private:
     static void layerTreeDidChangeImpl(InstrumentingAgents&);
     static void renderLayerDestroyedImpl(InstrumentingAgents&, const RenderLayer&);
 
-    static InstrumentingAgents* instrumentingAgentsForPage(Page&);
+    static InstrumentingAgents& instrumentingAgentsForPage(Page&);
     static InstrumentingAgents* instrumentingAgentsForFrame(Frame&);
     static InstrumentingAgents* instrumentingAgentsForFrame(Frame*);
     static InstrumentingAgents* instrumentingAgentsForContext(ScriptExecutionContext*);
@@ -639,8 +639,7 @@ inline void InspectorInstrumentation::didUnregisterNamedFlowContentElement(Docum
 inline void InspectorInstrumentation::mouseDidMoveOverElement(Page& page, const HitTestResult& result, unsigned modifierFlags)
 {
     FAST_RETURN_IF_NO_FRONTENDS(void());
-    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
-        mouseDidMoveOverElementImpl(*instrumentingAgents, result, modifierFlags);
+    mouseDidMoveOverElementImpl(instrumentingAgentsForPage(page), result, modifierFlags);
 }
 
 inline bool InspectorInstrumentation::handleTouchEvent(Frame& frame, Node& node)
@@ -789,8 +788,7 @@ inline void InspectorInstrumentation::didEvaluateScript(const InspectorInstrumen
 inline void InspectorInstrumentation::scriptsEnabled(Page& page, bool isEnabled)
 {
     FAST_RETURN_IF_NO_FRONTENDS(void());
-    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
-        return scriptsEnabledImpl(*instrumentingAgents, isEnabled);
+    return scriptsEnabledImpl(instrumentingAgentsForPage(page), isEnabled);
 }
 
 inline InspectorInstrumentationCookie InspectorInstrumentation::willFireTimer(ScriptExecutionContext* context, int timerId)
@@ -833,8 +831,7 @@ inline void InspectorInstrumentation::didLayout(const InspectorInstrumentationCo
 inline void InspectorInstrumentation::didScroll(Page& page)
 {
     FAST_RETURN_IF_NO_FRONTENDS(void());
-    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
-        didScrollImpl(*instrumentingAgents);
+    didScrollImpl(instrumentingAgentsForPage(page));
 }
 
 inline InspectorInstrumentationCookie InspectorInstrumentation::willDispatchXHRLoadEvent(ScriptExecutionContext* context, XMLHttpRequest& request)
@@ -937,14 +934,12 @@ inline void InspectorInstrumentation::continueAfterPingLoader(Frame& frame, unsi
 
 inline void InspectorInstrumentation::markResourceAsCached(Page& page, unsigned long identifier)
 {
-    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
-        markResourceAsCachedImpl(*instrumentingAgents, identifier);
+    markResourceAsCachedImpl(instrumentingAgentsForPage(page), identifier);
 }
 
 inline void InspectorInstrumentation::didLoadResourceFromMemoryCache(Page& page, DocumentLoader* loader, CachedResource* resource)
 {
-    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
-        didLoadResourceFromMemoryCacheImpl(*instrumentingAgents, loader, resource);
+    didLoadResourceFromMemoryCacheImpl(instrumentingAgentsForPage(page), loader, resource);
 }
 
 inline InspectorInstrumentationCookie InspectorInstrumentation::willReceiveResourceResponse(Frame* frame)
@@ -1103,9 +1098,7 @@ inline void InspectorInstrumentation::frameClearedScheduledNavigation(Frame& fra
 inline InspectorInstrumentationCookie InspectorInstrumentation::willRunJavaScriptDialog(Page& page, const String& message)
 {
     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
-    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
-        return willRunJavaScriptDialogImpl(*instrumentingAgents, message);
-    return InspectorInstrumentationCookie();
+    return willRunJavaScriptDialogImpl(instrumentingAgentsForPage(page), message);
 }
 
 inline void InspectorInstrumentation::didRunJavaScriptDialog(const InspectorInstrumentationCookie& cookie)
@@ -1211,92 +1204,79 @@ inline void InspectorInstrumentation::didSendWebSocketFrame(Document* document,
 inline void InspectorInstrumentation::sessionCreated(Page& page, RefPtr<ReplaySession>&& session)
 {
     FAST_RETURN_IF_NO_FRONTENDS(void());
-    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
-        sessionCreatedImpl(*instrumentingAgents, WTF::move(session));
+    sessionCreatedImpl(instrumentingAgentsForPage(page), WTF::move(session));
 }
 
 inline void InspectorInstrumentation::sessionLoaded(Page& page, RefPtr<ReplaySession>&& session)
 {
     FAST_RETURN_IF_NO_FRONTENDS(void());
-    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
-        sessionLoadedImpl(*instrumentingAgents, WTF::move(session));
+    sessionLoadedImpl(instrumentingAgentsForPage(page), WTF::move(session));
 }
 
 inline void InspectorInstrumentation::sessionModified(Page& page, RefPtr<ReplaySession>&& session)
 {
     FAST_RETURN_IF_NO_FRONTENDS(void());
-    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
-        sessionModifiedImpl(*instrumentingAgents, WTF::move(session));
+    sessionModifiedImpl(instrumentingAgentsForPage(page), WTF::move(session));
 }
 
 inline void InspectorInstrumentation::segmentCreated(Page& page, RefPtr<ReplaySessionSegment>&& segment)
 {
     FAST_RETURN_IF_NO_FRONTENDS(void());
-    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
-        segmentCreatedImpl(*instrumentingAgents, WTF::move(segment));
+    segmentCreatedImpl(instrumentingAgentsForPage(page), WTF::move(segment));
 }
 
 inline void InspectorInstrumentation::segmentCompleted(Page& page, RefPtr<ReplaySessionSegment>&& segment)
 {
     FAST_RETURN_IF_NO_FRONTENDS(void());
-    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
-        segmentCompletedImpl(*instrumentingAgents, WTF::move(segment));
+    segmentCompletedImpl(instrumentingAgentsForPage(page), WTF::move(segment));
 }
 
 inline void InspectorInstrumentation::segmentLoaded(Page& page, RefPtr<ReplaySessionSegment>&& segment)
 {
     FAST_RETURN_IF_NO_FRONTENDS(void());
-    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
-        segmentLoadedImpl(*instrumentingAgents, WTF::move(segment));
+    segmentLoadedImpl(instrumentingAgentsForPage(page), WTF::move(segment));
 }
 
 inline void InspectorInstrumentation::segmentUnloaded(Page& page)
 {
     FAST_RETURN_IF_NO_FRONTENDS(void());
-    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
-        segmentUnloadedImpl(*instrumentingAgents);
+    segmentUnloadedImpl(instrumentingAgentsForPage(page));
 }
 
 inline void InspectorInstrumentation::captureStarted(Page& page)
 {
     FAST_RETURN_IF_NO_FRONTENDS(void());
-    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
-        captureStartedImpl(*instrumentingAgents);
+    captureStartedImpl(instrumentingAgentsForPage(page));
 }
 
 inline void InspectorInstrumentation::captureStopped(Page& page)
 {
     FAST_RETURN_IF_NO_FRONTENDS(void());
-    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
-        captureStoppedImpl(*instrumentingAgents);
+    captureStoppedImpl(instrumentingAgentsForPage(page));
 }
 
 inline void InspectorInstrumentation::playbackStarted(Page& page)
 {
     FAST_RETURN_IF_NO_FRONTENDS(void());
-    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
-        playbackStartedImpl(*instrumentingAgents);
+        playbackStartedImpl(instrumentingAgentsForPage(page));
 }
 
 inline void InspectorInstrumentation::playbackPaused(Page& page, const ReplayPosition& position)
 {
     FAST_RETURN_IF_NO_FRONTENDS(void());
-    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
-        playbackPausedImpl(*instrumentingAgents, position);
+        playbackPausedImpl(instrumentingAgentsForPage(page), position);
 }
 
 inline void InspectorInstrumentation::playbackFinished(Page& page)
 {
     FAST_RETURN_IF_NO_FRONTENDS(void());
-    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
-        playbackFinishedImpl(*instrumentingAgents);
+        playbackFinishedImpl(instrumentingAgentsForPage(page));
 }
 
 inline void InspectorInstrumentation::playbackHitPosition(Page& page, const ReplayPosition& position)
 {
     FAST_RETURN_IF_NO_FRONTENDS(void());
-    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
-        playbackHitPositionImpl(*instrumentingAgents, position);
+        playbackHitPositionImpl(instrumentingAgentsForPage(page), position);
 }
 #endif // ENABLE(WEB_REPLAY)
 
index d43b69c..e66fcf2 100644 (file)
@@ -46,7 +46,7 @@ using namespace Inspector;
 
 namespace WebCore {
 
-InspectorLayerTreeAgent::InspectorLayerTreeAgent(InstrumentingAgents* instrumentingAgents)
+InspectorLayerTreeAgent::InspectorLayerTreeAgent(InstrumentingAgents& instrumentingAgents)
     : InspectorAgentBase(ASCIILiteral("LayerTree"), instrumentingAgents)
 {
 }
@@ -81,12 +81,12 @@ void InspectorLayerTreeAgent::reset()
 
 void InspectorLayerTreeAgent::enable(ErrorString&)
 {
-    m_instrumentingAgents->setInspectorLayerTreeAgent(this);
+    m_instrumentingAgents.setInspectorLayerTreeAgent(this);
 }
 
 void InspectorLayerTreeAgent::disable(ErrorString&)
 {
-    m_instrumentingAgents->setInspectorLayerTreeAgent(nullptr);
+    m_instrumentingAgents.setInspectorLayerTreeAgent(nullptr);
 }
 
 void InspectorLayerTreeAgent::layerTreeDidChange()
@@ -108,7 +108,7 @@ void InspectorLayerTreeAgent::layersForNode(ErrorString& errorString, int nodeId
 {
     layers = Inspector::Protocol::Array<Inspector::Protocol::LayerTree::Layer>::create();
 
-    Node* node = m_instrumentingAgents->inspectorDOMAgent()->nodeForId(nodeId);
+    Node* node = m_instrumentingAgents.inspectorDOMAgent()->nodeForId(nodeId);
     if (!node) {
         errorString = ASCIILiteral("Provided node id doesn't match any known node");
         return;
@@ -207,7 +207,7 @@ int InspectorLayerTreeAgent::idForNode(ErrorString& errorString, Node* node)
     if (!node)
         return 0;
 
-    InspectorDOMAgent* domAgent = m_instrumentingAgents->inspectorDOMAgent();
+    InspectorDOMAgent* domAgent = m_instrumentingAgents.inspectorDOMAgent();
     
     int nodeId = domAgent->boundNodeId(node);
     if (!nodeId)
index 5abc137..4ff5449 100644 (file)
@@ -47,7 +47,7 @@ typedef String ErrorString;
 class InspectorLayerTreeAgent final : public InspectorAgentBase, public Inspector::LayerTreeBackendDispatcherHandler {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    explicit InspectorLayerTreeAgent(InstrumentingAgents*);
+    explicit InspectorLayerTreeAgent(InstrumentingAgents&);
     virtual ~InspectorLayerTreeAgent();
 
     virtual void didCreateFrontendAndBackend(Inspector::FrontendChannel*, Inspector::BackendDispatcher*) override;
index 28b30dd..781b578 100644 (file)
@@ -325,17 +325,11 @@ Inspector::Protocol::Page::ResourceType InspectorPageAgent::cachedResourceTypeJs
     return resourceTypeJson(cachedResourceType(cachedResource));
 }
 
-InspectorPageAgent::InspectorPageAgent(InstrumentingAgents* instrumentingAgents, Page* page, InspectorClient* client, InspectorOverlay* overlay)
+InspectorPageAgent::InspectorPageAgent(InstrumentingAgents& instrumentingAgents, Page* page, InspectorClient* client, InspectorOverlay* overlay)
     : InspectorAgentBase(ASCIILiteral("Page"), instrumentingAgents)
     , m_page(page)
     , m_client(client)
     , m_overlay(overlay)
-    , m_lastScriptIdentifier(0)
-    , m_enabled(false)
-    , m_isFirstLayoutAfterOnLoad(false)
-    , m_originalScriptExecutionDisabled(false)
-    , m_ignoreScriptsEnabledNotification(false)
-    , m_showPaintRects(false)
 {
 }
 
@@ -359,15 +353,15 @@ void InspectorPageAgent::willDestroyFrontendAndBackend(Inspector::DisconnectReas
 
 double InspectorPageAgent::timestamp()
 {
-    return m_instrumentingAgents->inspectorEnvironment().executionStopwatch()->elapsedTime();
+    return m_instrumentingAgents.inspectorEnvironment().executionStopwatch()->elapsedTime();
 }
 
 void InspectorPageAgent::enable(ErrorString&)
 {
     m_enabled = true;
-    m_instrumentingAgents->setInspectorPageAgent(this);
+    m_instrumentingAgents.setInspectorPageAgent(this);
 
-    auto stopwatch = m_instrumentingAgents->inspectorEnvironment().executionStopwatch();
+    auto stopwatch = m_instrumentingAgents.inspectorEnvironment().executionStopwatch();
     stopwatch->reset();
     stopwatch->start();
 
@@ -379,7 +373,7 @@ void InspectorPageAgent::disable(ErrorString&)
 {
     m_enabled = false;
     m_scriptsToEvaluateOnLoad = nullptr;
-    m_instrumentingAgents->setInspectorPageAgent(nullptr);
+    m_instrumentingAgents.setInspectorPageAgent(nullptr);
 
     ErrorString unused;
     setScriptExecutionDisabled(unused, m_originalScriptExecutionDisabled);
@@ -824,7 +818,7 @@ void InspectorPageAgent::loaderDetachedFromFrame(DocumentLoader& loader)
 void InspectorPageAgent::frameStartedLoading(Frame& frame)
 {
     if (frame.isMainFrame()) {
-        auto stopwatch = m_instrumentingAgents->inspectorEnvironment().executionStopwatch();
+        auto stopwatch = m_instrumentingAgents.inspectorEnvironment().executionStopwatch();
         stopwatch->reset();
         stopwatch->start();
     }
@@ -1022,7 +1016,7 @@ void InspectorPageAgent::snapshotNode(ErrorString& errorString, int nodeId, Stri
     Frame* frame = mainFrame();
     ASSERT(frame);
 
-    InspectorDOMAgent* domAgent = m_instrumentingAgents->inspectorDOMAgent();
+    InspectorDOMAgent* domAgent = m_instrumentingAgents.inspectorDOMAgent();
     ASSERT(domAgent);
     Node* node = domAgent->assertNode(errorString, nodeId);
     if (!node)
index cc6e10f..2862e58 100644 (file)
@@ -68,7 +68,7 @@ class InspectorPageAgent final : public InspectorAgentBase, public Inspector::Pa
     WTF_MAKE_NONCOPYABLE(InspectorPageAgent);
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    InspectorPageAgent(InstrumentingAgents*, Page*, InspectorClient*, InspectorOverlay*);
+    InspectorPageAgent(InstrumentingAgents&, Page*, InspectorClient*, InspectorOverlay*);
 
     enum ResourceType {
         DocumentResource,
@@ -166,22 +166,25 @@ private:
 
     Ref<Inspector::Protocol::Page::Frame> buildObjectForFrame(Frame*);
     Ref<Inspector::Protocol::Page::FrameResourceTree> buildObjectForFrameTree(Frame*);
-    Page* m_page;
-    InspectorClient* m_client;
+
     std::unique_ptr<Inspector::PageFrontendDispatcher> m_frontendDispatcher;
     RefPtr<Inspector::PageBackendDispatcher> m_backendDispatcher;
-    InspectorOverlay* m_overlay;
-    long m_lastScriptIdentifier;
+
+    Page* m_page { nullptr };
+    InspectorClient* m_client { nullptr };
+    InspectorOverlay* m_overlay { nullptr };
+
+    long m_lastScriptIdentifier { 0 };
     String m_pendingScriptToEvaluateOnLoadOnce;
     String m_scriptToEvaluateOnLoadOnce;
     HashMap<Frame*, String> m_frameToIdentifier;
     HashMap<String, Frame*> m_identifierToFrame;
     HashMap<DocumentLoader*, String> m_loaderToIdentifier;
-    bool m_enabled;
-    bool m_isFirstLayoutAfterOnLoad;
-    bool m_originalScriptExecutionDisabled;
-    bool m_ignoreScriptsEnabledNotification;
-    bool m_showPaintRects;
+    bool m_enabled { false };
+    bool m_isFirstLayoutAfterOnLoad { false };
+    bool m_originalScriptExecutionDisabled { false };
+    bool m_ignoreScriptsEnabledNotification { false };
+    bool m_showPaintRects { false };
     String m_emulatedMedia;
     RefPtr<Inspector::InspectorObject> m_scriptsToEvaluateOnLoad;
 };
index 181a609..479b710 100644 (file)
@@ -156,7 +156,7 @@ static Ref<Inspector::Protocol::Replay::SessionSegment> buildInspectorObjectForS
         .release();
 }
 
-InspectorReplayAgent::InspectorReplayAgent(InstrumentingAgents* instrumentingAgents, InspectorPageAgent* pageAgent)
+InspectorReplayAgent::InspectorReplayAgent(InstrumentingAgents& instrumentingAgents, InspectorPageAgent* pageAgent)
     : InspectorAgentBase(ASCIILiteral("Replay"), instrumentingAgents)
     , m_page(*pageAgent->page())
 {
@@ -178,7 +178,7 @@ void InspectorReplayAgent::didCreateFrontendAndBackend(Inspector::FrontendChanne
     m_frontendDispatcher = std::make_unique<Inspector::ReplayFrontendDispatcher>(frontendChannel);
     m_backendDispatcher = Inspector::ReplayBackendDispatcher::create(backendDispatcher, this);
 
-    m_instrumentingAgents->setInspectorReplayAgent(this);
+    m_instrumentingAgents.setInspectorReplayAgent(this);
     ASSERT(sessionState() == WebCore::SessionState::Inactive);
 
     // Keep track of the (default) session currently loaded by ReplayController,
@@ -195,7 +195,7 @@ void InspectorReplayAgent::willDestroyFrontendAndBackend(Inspector::DisconnectRe
     m_frontendDispatcher = nullptr;
     m_backendDispatcher = nullptr;
 
-    m_instrumentingAgents->setInspectorReplayAgent(nullptr);
+    m_instrumentingAgents.setInspectorReplayAgent(nullptr);
 
     // Drop references to all sessions and segments.
     m_sessionsMap.clear();
index 3c2bc7c..a7e6cf5 100644 (file)
@@ -62,7 +62,7 @@ class InspectorReplayAgent final
     WTF_MAKE_FAST_ALLOCATED;
     WTF_MAKE_NONCOPYABLE(InspectorReplayAgent);
 public:
-    InspectorReplayAgent(InstrumentingAgents*, InspectorPageAgent*);
+    InspectorReplayAgent(InstrumentingAgents&, InspectorPageAgent*);
     virtual ~InspectorReplayAgent();
 
     virtual void didCreateFrontendAndBackend(Inspector::FrontendChannel*, Inspector::BackendDispatcher*) override;
index 7b56a0f..8579199 100644 (file)
@@ -160,15 +160,11 @@ private:
 
 } // namespace
 
-InspectorResourceAgent::InspectorResourceAgent(InstrumentingAgents* instrumentingAgents, InspectorPageAgent* pageAgent, InspectorClient* client)
+InspectorResourceAgent::InspectorResourceAgent(InstrumentingAgents& instrumentingAgents, InspectorPageAgent* pageAgent, InspectorClient* client)
     : InspectorAgentBase(ASCIILiteral("Network"), instrumentingAgents)
     , m_pageAgent(pageAgent)
     , m_client(client)
     , m_resourcesData(std::make_unique<NetworkResourcesData>())
-    , m_enabled(false)
-    , m_cacheDisabled(false)
-    , m_loadingXHRSynchronously(false)
-    , m_isRecalculatingStyle(false)
 {
 }
 
@@ -268,12 +264,12 @@ InspectorResourceAgent::~InspectorResourceAgent()
         ErrorString unused;
         disable(unused);
     }
-    ASSERT(!m_instrumentingAgents->inspectorResourceAgent());
+    ASSERT(!m_instrumentingAgents.inspectorResourceAgent());
 }
 
 double InspectorResourceAgent::timestamp()
 {
-    return m_instrumentingAgents->inspectorEnvironment().executionStopwatch()->elapsedTime();
+    return m_instrumentingAgents.inspectorEnvironment().executionStopwatch()->elapsedTime();
 }
 
 void InspectorResourceAgent::willSendRequest(unsigned long identifier, DocumentLoader& loader, ResourceRequest& request, const ResourceResponse& redirectResponse)
@@ -607,13 +603,13 @@ void InspectorResourceAgent::enable()
     if (!m_frontendDispatcher)
         return;
     m_enabled = true;
-    m_instrumentingAgents->setInspectorResourceAgent(this);
+    m_instrumentingAgents.setInspectorResourceAgent(this);
 }
 
 void InspectorResourceAgent::disable(ErrorString&)
 {
     m_enabled = false;
-    m_instrumentingAgents->setInspectorResourceAgent(nullptr);
+    m_instrumentingAgents.setInspectorResourceAgent(nullptr);
     m_resourcesData->clear();
     m_extraRequestHeaders.clear();
 }
index e25531c..87f5e3a 100644 (file)
@@ -75,7 +75,7 @@ typedef String ErrorString;
 class InspectorResourceAgent final : public InspectorAgentBase, public Inspector::NetworkBackendDispatcherHandler {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    InspectorResourceAgent(InstrumentingAgents*, InspectorPageAgent*, InspectorClient*);
+    InspectorResourceAgent(InstrumentingAgents&, InspectorPageAgent*, InspectorClient*);
     virtual ~InspectorResourceAgent();
 
     virtual void didCreateFrontendAndBackend(Inspector::FrontendChannel*, Inspector::BackendDispatcher*) override;
@@ -131,21 +131,21 @@ private:
 
     double timestamp();
 
-    InspectorPageAgent* m_pageAgent;
-    InspectorClient* m_client;
     std::unique_ptr<Inspector::NetworkFrontendDispatcher> m_frontendDispatcher;
     RefPtr<Inspector::NetworkBackendDispatcher> m_backendDispatcher;
+    InspectorPageAgent* m_pageAgent { nullptr };
+
+    InspectorClient* m_client { nullptr };
+
     std::unique_ptr<NetworkResourcesData> m_resourcesData;
-    bool m_enabled;
-    bool m_cacheDisabled;
-    bool m_loadingXHRSynchronously;
+    bool m_enabled { false };
+    bool m_cacheDisabled { false };
+    bool m_loadingXHRSynchronously { false };
     HashMap<String, String> m_extraRequestHeaders;
-
     HashSet<unsigned long> m_hiddenRequestIdentifiers;
-
     // FIXME: InspectorResourceAgent should now be aware of style recalculation.
     RefPtr<Inspector::Protocol::Network::Initiator> m_styleRecalculationInitiator;
-    bool m_isRecalculatingStyle;
+    bool m_isRecalculatingStyle { false };
 };
 
 } // namespace WebCore
index e120b94..87ae41f 100644 (file)
@@ -94,7 +94,7 @@ void InspectorTimelineAgent::didCreateFrontendAndBackend(Inspector::FrontendChan
     m_frontendDispatcher = std::make_unique<Inspector::TimelineFrontendDispatcher>(frontendChannel);
     m_backendDispatcher = Inspector::TimelineBackendDispatcher::create(backendDispatcher, this);
 
-    m_instrumentingAgents->setPersistentInspectorTimelineAgent(this);
+    m_instrumentingAgents.setPersistentInspectorTimelineAgent(this);
 
     if (m_scriptDebugServer)
         m_scriptDebugServer->recompileAllJSFunctions();
@@ -105,7 +105,7 @@ void InspectorTimelineAgent::willDestroyFrontendAndBackend(Inspector::Disconnect
     m_frontendDispatcher = nullptr;
     m_backendDispatcher = nullptr;
 
-    m_instrumentingAgents->setPersistentInspectorTimelineAgent(nullptr);
+    m_instrumentingAgents.setPersistentInspectorTimelineAgent(nullptr);
 
     if (reason != Inspector::DisconnectReason::InspectedTargetDestroyed) {
         if (m_scriptDebugServer)
@@ -140,7 +140,7 @@ void InspectorTimelineAgent::internalStart(const int* maxCallStackDepth)
     else
         m_maxCallStackDepth = 5;
 
-    m_instrumentingAgents->setInspectorTimelineAgent(this);
+    m_instrumentingAgents.setInspectorTimelineAgent(this);
 
     if (m_scriptDebugServer)
         m_scriptDebugServer->addListener(this);
@@ -193,7 +193,7 @@ void InspectorTimelineAgent::internalStop()
     if (!m_enabled)
         return;
 
-    m_instrumentingAgents->setInspectorTimelineAgent(nullptr);
+    m_instrumentingAgents.setInspectorTimelineAgent(nullptr);
 
     if (m_scriptDebugServer)
         m_scriptDebugServer->removeListener(this, true);
@@ -219,7 +219,7 @@ void InspectorTimelineAgent::internalStop()
 
 double InspectorTimelineAgent::timestamp()
 {
-    return m_instrumentingAgents->inspectorEnvironment().executionStopwatch()->elapsedTime();
+    return m_instrumentingAgents.inspectorEnvironment().executionStopwatch()->elapsedTime();
 }
 
 void InspectorTimelineAgent::setPageScriptDebugServer(PageScriptDebugServer* scriptDebugServer)
@@ -266,7 +266,7 @@ void InspectorTimelineAgent::startFromConsole(JSC::ExecState* exec, const String
     if (!m_enabled && m_pendingConsoleProfileRecords.isEmpty())
         internalStart();
 
-    startProfiling(exec, title, m_instrumentingAgents->inspectorEnvironment().executionStopwatch());
+    startProfiling(exec, title, m_instrumentingAgents.inspectorEnvironment().executionStopwatch());
 
     m_pendingConsoleProfileRecords.append(createRecordEntry(TimelineRecordFactory::createConsoleProfileData(title), TimelineRecordType::ConsoleProfile, true, frameFromExecState(exec)));
 }
@@ -305,7 +305,7 @@ void InspectorTimelineAgent::willCallFunction(const String& scriptName, int scri
     pushCurrentRecord(TimelineRecordFactory::createFunctionCallData(scriptName, scriptLine), TimelineRecordType::FunctionCall, true, frame);
 
     if (frame && !m_callStackDepth)
-        startProfiling(frame, ASCIILiteral("Timeline FunctionCall"), m_instrumentingAgents->inspectorEnvironment().executionStopwatch());
+        startProfiling(frame, ASCIILiteral("Timeline FunctionCall"), m_instrumentingAgents.inspectorEnvironment().executionStopwatch());
 
     ++m_callStackDepth;
 }
@@ -494,7 +494,7 @@ void InspectorTimelineAgent::willEvaluateScript(const String& url, int lineNumbe
 
     if (!m_callStackDepth) {
         ++m_callStackDepth;
-        startProfiling(&frame, ASCIILiteral("Timeline EvaluateScript"), m_instrumentingAgents->inspectorEnvironment().executionStopwatch());
+        startProfiling(&frame, ASCIILiteral("Timeline EvaluateScript"), m_instrumentingAgents.inspectorEnvironment().executionStopwatch());
     }
 }
 
@@ -729,11 +729,11 @@ void InspectorTimelineAgent::didCompleteCurrentRecord(TimelineRecordType type)
     }
 }
 
-InspectorTimelineAgent::InspectorTimelineAgent(InstrumentingAgents* instrumentingAgents, InspectorPageAgent* pageAgent, InspectorType type, InspectorClient* client)
+InspectorTimelineAgent::InspectorTimelineAgent(InstrumentingAgents& instrumentingAgents, InspectorPageAgent* pageAgent, InspectorType type, InspectorClient* client)
     : InspectorAgentBase(ASCIILiteral("Timeline"), instrumentingAgents)
     , m_pageAgent(pageAgent)
-    , m_inspectorType(type)
     , m_client(client)
+    , m_inspectorType(type)
 {
 }
 
index 6aa584c..32465f3 100644 (file)
@@ -117,7 +117,7 @@ class InspectorTimelineAgent final
 public:
     enum InspectorType { PageInspector, WorkerInspector };
 
-    InspectorTimelineAgent(InstrumentingAgents*, InspectorPageAgent*, InspectorType, InspectorClient*);
+    InspectorTimelineAgent(InstrumentingAgents&, InspectorPageAgent*, InspectorType, InspectorClient*);
     virtual ~InspectorTimelineAgent();
 
     virtual void didCreateFrontendAndBackend(Inspector::FrontendChannel*, Inspector::BackendDispatcher*) override;
@@ -231,19 +231,18 @@ private:
     void localToPageQuad(const RenderObject&, const LayoutRect&, FloatQuad*);
     Page* page();
 
-    InspectorPageAgent* m_pageAgent;
-    PageScriptDebugServer* m_scriptDebugServer { nullptr };
-
     std::unique_ptr<Inspector::TimelineFrontendDispatcher> m_frontendDispatcher;
     RefPtr<Inspector::TimelineBackendDispatcher> m_backendDispatcher;
+    InspectorPageAgent* m_pageAgent;
 
-    Vector<TimelineRecordEntry> m_recordStack;
+    PageScriptDebugServer* m_scriptDebugServer { nullptr };
+    InspectorClient* m_client { nullptr };
 
+    Vector<TimelineRecordEntry> m_recordStack;
     int m_id { 1 };
     int m_callStackDepth { 0 };
     int m_maxCallStackDepth { 5 };
     InspectorType m_inspectorType;
-    InspectorClient* m_client;
 
     Vector<TimelineRecordEntry> m_pendingConsoleProfileRecords;
 
index dfcc4a8..267d1cd 100644 (file)
@@ -37,13 +37,13 @@ class InstrumentingAgents;
 
 class InspectorAgentBase : public Inspector::InspectorAgentBase {
 protected:
-    InspectorAgentBase(const String& name, InstrumentingAgents* instrumentingAgents)
+    InspectorAgentBase(const String& name, InstrumentingAgents& instrumentingAgents)
         : Inspector::InspectorAgentBase(name)
         , m_instrumentingAgents(instrumentingAgents)
     {
     }
 
-    InstrumentingAgents* m_instrumentingAgents;
+    InstrumentingAgents& m_instrumentingAgents;
 };
     
 } // namespace WebCore
index 5e21f35..b7800b1 100644 (file)
@@ -101,17 +101,15 @@ private:
 
 int InspectorWorkerAgent::WorkerFrontendChannel::s_nextId = 1;
 
-InspectorWorkerAgent::InspectorWorkerAgent(InstrumentingAgents* instrumentingAgents)
+InspectorWorkerAgent::InspectorWorkerAgent(InstrumentingAgents& instrumentingAgents)
     : InspectorAgentBase(ASCIILiteral("Worker"), instrumentingAgents)
-    , m_enabled(false)
-    , m_shouldPauseDedicatedWorkerOnStart(false)
 {
-    m_instrumentingAgents->setInspectorWorkerAgent(this);
+    m_instrumentingAgents.setInspectorWorkerAgent(this);
 }
 
 InspectorWorkerAgent::~InspectorWorkerAgent()
 {
-    m_instrumentingAgents->setInspectorWorkerAgent(nullptr);
+    m_instrumentingAgents.setInspectorWorkerAgent(nullptr);
 }
 
 void InspectorWorkerAgent::didCreateFrontendAndBackend(Inspector::FrontendChannel* frontendChannel, Inspector::BackendDispatcher* backendDispatcher)
index 23f6e5c..4542479 100644 (file)
@@ -51,7 +51,7 @@ typedef String ErrorString;
 class InspectorWorkerAgent final : public InspectorAgentBase, public Inspector::WorkerBackendDispatcherHandler {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    explicit InspectorWorkerAgent(InstrumentingAgents*);
+    explicit InspectorWorkerAgent(InstrumentingAgents&);
     virtual ~InspectorWorkerAgent();
 
     virtual void didCreateFrontendAndBackend(Inspector::FrontendChannel*, Inspector::BackendDispatcher*) override;
@@ -76,12 +76,14 @@ private:
     void createWorkerFrontendChannel(WorkerGlobalScopeProxy*, const String& url);
     void destroyWorkerFrontendChannels();
 
+    class WorkerFrontendChannel;
+
     std::unique_ptr<Inspector::WorkerFrontendDispatcher> m_frontendDispatcher;
     RefPtr<Inspector::WorkerBackendDispatcher> m_backendDispatcher;
-    bool m_enabled;
-    bool m_shouldPauseDedicatedWorkerOnStart;
 
-    class WorkerFrontendChannel;
+    bool m_enabled { false };
+    bool m_shouldPauseDedicatedWorkerOnStart { false };
+    
     typedef HashMap<int, WorkerFrontendChannel*> WorkerChannels;
     WorkerChannels m_idToChannel;
     typedef HashMap<WorkerGlobalScopeProxy*, String> DedicatedWorkers;
index ec04642..332ce7a 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2011 Google Inc. All rights reserved.
- * Copyright (C) 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014, 2015 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -44,27 +44,6 @@ namespace WebCore {
 
 InstrumentingAgents::InstrumentingAgents(InspectorEnvironment& environment)
     : m_environment(environment)
-    , m_inspectorAgent(nullptr)
-    , m_inspectorPageAgent(nullptr)
-    , m_inspectorCSSAgent(nullptr)
-    , m_inspectorLayerTreeAgent(nullptr)
-    , m_webConsoleAgent(nullptr)
-    , m_inspectorDOMAgent(nullptr)
-    , m_inspectorResourceAgent(nullptr)
-    , m_pageRuntimeAgent(nullptr)
-    , m_workerRuntimeAgent(nullptr)
-    , m_inspectorTimelineAgent(nullptr)
-    , m_persistentInspectorTimelineAgent(nullptr)
-    , m_inspectorDOMStorageAgent(nullptr)
-#if ENABLE(WEB_REPLAY)
-    , m_inspectorReplayAgent(nullptr)
-#endif
-    , m_inspectorDatabaseAgent(nullptr)
-    , m_inspectorApplicationCacheAgent(nullptr)
-    , m_inspectorDebuggerAgent(nullptr)
-    , m_pageDebuggerAgent(nullptr)
-    , m_inspectorDOMDebuggerAgent(nullptr)
-    , m_inspectorWorkerAgent(nullptr)
 {
 }
 
index f91a685..99ffd92 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2011 Google Inc. All rights reserved.
- * Copyright (C) 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014, 2015 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -68,9 +68,11 @@ class InstrumentingAgents : public RefCounted<InstrumentingAgents> {
     WTF_MAKE_NONCOPYABLE(InstrumentingAgents);
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    static PassRefPtr<InstrumentingAgents> create(Inspector::InspectorEnvironment& environment)
+    // FIXME: InstrumentingAgents could be uniquely owned by InspectorController if instrumentation
+    // cookies kept only a weak reference to InstrumentingAgents. Then, reset() would be unnecessary.
+    static Ref<InstrumentingAgents> create(Inspector::InspectorEnvironment& environment)
     {
-        return adoptRef(new InstrumentingAgents(environment));
+        return adoptRef(*new InstrumentingAgents(environment));
     }
     ~InstrumentingAgents() { }
     void reset();
@@ -141,29 +143,29 @@ private:
 
     Inspector::InspectorEnvironment& m_environment;
 
-    Inspector::InspectorAgent* m_inspectorAgent;
-    InspectorPageAgent* m_inspectorPageAgent;
-    InspectorCSSAgent* m_inspectorCSSAgent;
-    InspectorLayerTreeAgent* m_inspectorLayerTreeAgent;
-    WebConsoleAgent* m_webConsoleAgent;
-    InspectorDOMAgent* m_inspectorDOMAgent;
-    InspectorResourceAgent* m_inspectorResourceAgent;
-    PageRuntimeAgent* m_pageRuntimeAgent;
-    WorkerRuntimeAgent* m_workerRuntimeAgent;
-    InspectorTimelineAgent* m_inspectorTimelineAgent;
-    InspectorTimelineAgent* m_persistentInspectorTimelineAgent;
-    InspectorDOMStorageAgent* m_inspectorDOMStorageAgent;
+    Inspector::InspectorAgent* m_inspectorAgent { nullptr };
+    InspectorPageAgent* m_inspectorPageAgent { nullptr };
+    InspectorCSSAgent* m_inspectorCSSAgent { nullptr };
+    InspectorLayerTreeAgent* m_inspectorLayerTreeAgent { nullptr };
+    WebConsoleAgent* m_webConsoleAgent { nullptr };
+    InspectorDOMAgent* m_inspectorDOMAgent { nullptr };
+    InspectorResourceAgent* m_inspectorResourceAgent { nullptr };
+    PageRuntimeAgent* m_pageRuntimeAgent { nullptr };
+    WorkerRuntimeAgent* m_workerRuntimeAgent { nullptr };
+    InspectorTimelineAgent* m_inspectorTimelineAgent { nullptr };
+    InspectorTimelineAgent* m_persistentInspectorTimelineAgent { nullptr };
+    InspectorDOMStorageAgent* m_inspectorDOMStorageAgent { nullptr };
 #if ENABLE(WEB_REPLAY)
-    InspectorReplayAgent* m_inspectorReplayAgent;
+    InspectorReplayAgent* m_inspectorReplayAgent { nullptr };
 #endif
-    InspectorDatabaseAgent* m_inspectorDatabaseAgent;
-    InspectorApplicationCacheAgent* m_inspectorApplicationCacheAgent;
-    Inspector::InspectorDebuggerAgent* m_inspectorDebuggerAgent;
-    PageDebuggerAgent* m_pageDebuggerAgent;
-    InspectorDOMDebuggerAgent* m_inspectorDOMDebuggerAgent;
-    InspectorWorkerAgent* m_inspectorWorkerAgent;
+    InspectorDatabaseAgent* m_inspectorDatabaseAgent { nullptr };
+    InspectorApplicationCacheAgent* m_inspectorApplicationCacheAgent { nullptr };
+    Inspector::InspectorDebuggerAgent* m_inspectorDebuggerAgent { nullptr };
+    PageDebuggerAgent* m_pageDebuggerAgent { nullptr };
+    InspectorDOMDebuggerAgent* m_inspectorDOMDebuggerAgent { nullptr };
+    InspectorWorkerAgent* m_inspectorWorkerAgent { nullptr };
 };
 
-}
+} // namespace WebCore
 
 #endif // !defined(InstrumentingAgents_h)
index e759aa8..6719747 100644 (file)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2011 Google Inc. All rights reserved.
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -40,7 +41,7 @@ using namespace Inspector;
 
 namespace WebCore {
 
-PageConsoleAgent::PageConsoleAgent(WebInjectedScriptManager* injectedScriptManager, InspectorDOMAgent* domAgent)
+PageConsoleAgent::PageConsoleAgent(WebInjectedScriptManager& injectedScriptManager, InspectorDOMAgent* domAgent)
     : WebConsoleAgent(injectedScriptManager)
     , m_inspectorDOMAgent(domAgent)
 {
@@ -72,7 +73,7 @@ void PageConsoleAgent::addInspectedNode(ErrorString& errorString, int nodeId)
         return;
     }
 
-    if (CommandLineAPIHost* commandLineAPIHost = static_cast<WebInjectedScriptManager*>(m_injectedScriptManager)->commandLineAPIHost())
+    if (CommandLineAPIHost* commandLineAPIHost = static_cast<WebInjectedScriptManager&>(m_injectedScriptManager).commandLineAPIHost())
         commandLineAPIHost->addInspectedObject(std::make_unique<InspectableNode>(node));
 }
 
index 36c30c2..b135404 100644 (file)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2011 Google Inc. All rights reserved.
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -41,7 +42,7 @@ class PageConsoleAgent final : public WebConsoleAgent {
     WTF_MAKE_NONCOPYABLE(PageConsoleAgent);
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    PageConsoleAgent(WebInjectedScriptManager*, InspectorDOMAgent*);
+    PageConsoleAgent(WebInjectedScriptManager&, InspectorDOMAgent*);
     virtual ~PageConsoleAgent() { }
 
 private:
index 00239b7..ae3b145 100644 (file)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2011 Google Inc. All rights reserved.
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -49,7 +50,7 @@ using namespace Inspector;
 
 namespace WebCore {
 
-PageDebuggerAgent::PageDebuggerAgent(InjectedScriptManager* injectedScriptManager, InstrumentingAgents* instrumentingAgents, InspectorPageAgent* pageAgent, InspectorOverlay* overlay)
+PageDebuggerAgent::PageDebuggerAgent(InjectedScriptManager& injectedScriptManager, InstrumentingAgents& instrumentingAgents, InspectorPageAgent* pageAgent, InspectorOverlay* overlay)
     : WebDebuggerAgent(injectedScriptManager, instrumentingAgents)
     , m_pageAgent(pageAgent)
     , m_overlay(overlay)
@@ -60,13 +61,13 @@ PageDebuggerAgent::PageDebuggerAgent(InjectedScriptManager* injectedScriptManage
 void PageDebuggerAgent::enable()
 {
     WebDebuggerAgent::enable();
-    m_instrumentingAgents->setPageDebuggerAgent(this);
+    m_instrumentingAgents.setPageDebuggerAgent(this);
 }
 
 void PageDebuggerAgent::disable(bool isBeingDestroyed)
 {
     WebDebuggerAgent::disable(isBeingDestroyed);
-    m_instrumentingAgents->setPageDebuggerAgent(nullptr);
+    m_instrumentingAgents.setPageDebuggerAgent(nullptr);
 }
 
 String PageDebuggerAgent::sourceMapURLForScript(const Script& script)
@@ -124,10 +125,10 @@ InjectedScript PageDebuggerAgent::injectedScriptForEval(ErrorString& errorString
 {
     if (!executionContextId) {
         JSC::ExecState* scriptState = mainWorldExecState(m_pageAgent->mainFrame());
-        return injectedScriptManager()->injectedScriptFor(scriptState);
+        return injectedScriptManager().injectedScriptFor(scriptState);
     }
 
-    InjectedScript injectedScript = injectedScriptManager()->injectedScriptForId(*executionContextId);
+    InjectedScript injectedScript = injectedScriptManager().injectedScriptForId(*executionContextId);
     if (injectedScript.hasNoValue())
         errorString = ASCIILiteral("Execution context with given id not found.");
 
index 549f7d3..75af28e 100644 (file)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2011 Google Inc. All rights reserved.
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -46,7 +47,7 @@ class PageDebuggerAgent final : public WebDebuggerAgent {
     WTF_MAKE_NONCOPYABLE(PageDebuggerAgent);
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    PageDebuggerAgent(Inspector::InjectedScriptManager*, InstrumentingAgents*, InspectorPageAgent*, InspectorOverlay*);
+    PageDebuggerAgent(Inspector::InjectedScriptManager&, InstrumentingAgents&, InspectorPageAgent*, InspectorOverlay*);
     virtual ~PageDebuggerAgent() { }
 
     void didClearMainFrameWindowObject();
@@ -70,8 +71,9 @@ private:
     virtual Inspector::InjectedScript injectedScriptForEval(ErrorString&, const int* executionContextId) override;
     virtual void setOverlayMessage(ErrorString&, const String*) override;
 
-    InspectorPageAgent* m_pageAgent;
-    InspectorOverlay* m_overlay;
+    InspectorPageAgent* m_pageAgent { nullptr };
+
+    InspectorOverlay* m_overlay { nullptr };
     PageScriptDebugServer m_scriptDebugServer;
 };
 
index e2445ab..1834cc5 100644 (file)
@@ -52,11 +52,10 @@ using namespace Inspector;
 
 namespace WebCore {
 
-PageRuntimeAgent::PageRuntimeAgent(InjectedScriptManager* injectedScriptManager, Page* page, InspectorPageAgent* pageAgent)
+PageRuntimeAgent::PageRuntimeAgent(InjectedScriptManager& injectedScriptManager, Page* page, InspectorPageAgent* pageAgent)
     : InspectorRuntimeAgent(injectedScriptManager)
-    , m_inspectedPage(page)
     , m_pageAgent(pageAgent)
-    , m_mainWorldContextCreated(false)
+    , m_inspectedPage(page)
 {
 }
 
@@ -121,13 +120,13 @@ InjectedScript PageRuntimeAgent::injectedScriptForEval(ErrorString& errorString,
 {
     if (!executionContextId) {
         JSC::ExecState* scriptState = mainWorldExecState(&m_inspectedPage->mainFrame());
-        InjectedScript result = injectedScriptManager()->injectedScriptFor(scriptState);
+        InjectedScript result = injectedScriptManager().injectedScriptFor(scriptState);
         if (result.hasNoValue())
             errorString = ASCIILiteral("Internal error: main world execution context not found.");
         return result;
     }
 
-    InjectedScript injectedScript = injectedScriptManager()->injectedScriptForId(*executionContextId);
+    InjectedScript injectedScript = injectedScriptManager().injectedScriptForId(*executionContextId);
     if (injectedScript.hasNoValue())
         errorString = ASCIILiteral("Execution context with given id not found.");
     return injectedScript;
@@ -166,11 +165,11 @@ void PageRuntimeAgent::notifyContextCreated(const String& frameId, JSC::ExecStat
 {
     ASSERT(securityOrigin || isPageContext);
 
-    InjectedScript result = injectedScriptManager()->injectedScriptFor(scriptState);
+    InjectedScript result = injectedScriptManager().injectedScriptFor(scriptState);
     if (result.hasNoValue())
         return;
 
-    int executionContextId = injectedScriptManager()->injectedScriptIdFor(scriptState);
+    int executionContextId = injectedScriptManager().injectedScriptIdFor(scriptState);
     String name = securityOrigin ? securityOrigin->toRawString() : String();
     m_frontendDispatcher->executionContextCreated(ExecutionContextDescription::create()
         .setId(executionContextId)
index e7b2c24..2787de7 100644 (file)
@@ -53,7 +53,7 @@ typedef String ErrorString;
 class PageRuntimeAgent final : public Inspector::InspectorRuntimeAgent {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    PageRuntimeAgent(Inspector::InjectedScriptManager*, Page*, InspectorPageAgent*);
+    PageRuntimeAgent(Inspector::InjectedScriptManager&, Page*, InspectorPageAgent*);
     virtual ~PageRuntimeAgent() { }
 
     virtual void didCreateFrontendAndBackend(Inspector::FrontendChannel*, Inspector::BackendDispatcher*) override;
@@ -72,11 +72,13 @@ private:
     void reportExecutionContextCreation();
     void notifyContextCreated(const String& frameId, JSC::ExecState*, SecurityOrigin*, bool isPageContext);
 
-    Page* m_inspectedPage;
-    InspectorPageAgent* m_pageAgent;
     std::unique_ptr<Inspector::RuntimeFrontendDispatcher> m_frontendDispatcher;
     RefPtr<Inspector::RuntimeBackendDispatcher> m_backendDispatcher;
-    bool m_mainWorldContextCreated;
+    InspectorPageAgent* m_pageAgent;
+
+    Page* m_inspectedPage;
+
+    bool m_mainWorldContextCreated { false };
 };
 
 } // namespace WebCore
index 470058e..9b00f2f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014, 2015 Apple Inc. All rights reserved.
  * Copyright (C) 2011 Google Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -41,9 +41,8 @@ using namespace Inspector;
 
 namespace WebCore {
 
-WebConsoleAgent::WebConsoleAgent(WebInjectedScriptManager* injectedScriptManager)
+WebConsoleAgent::WebConsoleAgent(WebInjectedScriptManager& injectedScriptManager)
     : InspectorConsoleAgent(injectedScriptManager)
-    , m_monitoringXHREnabled(false)
 {
 }
 
@@ -64,12 +63,12 @@ void WebConsoleAgent::frameWindowDiscarded(DOMWindow* window)
         m_consoleMessages[i]->clear();
     }
 
-    static_cast<WebInjectedScriptManager*>(m_injectedScriptManager)->discardInjectedScriptsFor(window);
+    static_cast<WebInjectedScriptManager&>(m_injectedScriptManager).discardInjectedScriptsFor(window);
 }
 
 void WebConsoleAgent::didFinishXHRLoading(unsigned long requestIdentifier, const String& url, const String& sendURL, unsigned sendLineNumber, unsigned sendColumnNumber)
 {
-    if (!m_injectedScriptManager->inspectorEnvironment().developerExtrasEnabled())
+    if (!m_injectedScriptManager.inspectorEnvironment().developerExtrasEnabled())
         return;
 
     if (m_frontendDispatcher && m_monitoringXHREnabled) {
@@ -80,7 +79,7 @@ void WebConsoleAgent::didFinishXHRLoading(unsigned long requestIdentifier, const
 
 void WebConsoleAgent::didReceiveResponse(unsigned long requestIdentifier, const ResourceResponse& response)
 {
-    if (!m_injectedScriptManager->inspectorEnvironment().developerExtrasEnabled())
+    if (!m_injectedScriptManager.inspectorEnvironment().developerExtrasEnabled())
         return;
 
     if (response.httpStatusCode() >= 400) {
@@ -91,7 +90,7 @@ void WebConsoleAgent::didReceiveResponse(unsigned long requestIdentifier, const
 
 void WebConsoleAgent::didFailLoading(unsigned long requestIdentifier, const ResourceError& error)
 {
-    if (!m_injectedScriptManager->inspectorEnvironment().developerExtrasEnabled())
+    if (!m_injectedScriptManager.inspectorEnvironment().developerExtrasEnabled())
         return;
 
     // Report failures only.
index caf1b1d..292f9d4 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014, 2015 Apple Inc. All rights reserved.
  * Copyright (C) 2011 Google Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -40,7 +40,7 @@ class WebConsoleAgent : public Inspector::InspectorConsoleAgent {
     WTF_MAKE_NONCOPYABLE(WebConsoleAgent);
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    WebConsoleAgent(WebInjectedScriptManager*);
+    WebConsoleAgent(WebInjectedScriptManager&);
     virtual ~WebConsoleAgent() { }
 
     virtual void setMonitoringXHREnabled(ErrorString&, bool enabled) override final;
@@ -52,7 +52,7 @@ public:
     void didFailLoading(unsigned long requestIdentifier, const ResourceError&);
 
 protected:
-    bool m_monitoringXHREnabled;
+    bool m_monitoringXHREnabled { false };
 };
 
 } // namespace WebCore
index dd69e5f..4b6aff8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014, 2015 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -32,7 +32,7 @@ using namespace Inspector;
 
 namespace WebCore {
 
-WebDebuggerAgent::WebDebuggerAgent(InjectedScriptManager* injectedScriptManager, InstrumentingAgents* instrumentingAgents)
+WebDebuggerAgent::WebDebuggerAgent(InjectedScriptManager& injectedScriptManager, InstrumentingAgents& instrumentingAgents)
     : InspectorDebuggerAgent(injectedScriptManager)
     , m_instrumentingAgents(instrumentingAgents)
 {
@@ -41,13 +41,13 @@ WebDebuggerAgent::WebDebuggerAgent(InjectedScriptManager* injectedScriptManager,
 void WebDebuggerAgent::enable()
 {
     InspectorDebuggerAgent::enable();
-    m_instrumentingAgents->setInspectorDebuggerAgent(this);
+    m_instrumentingAgents.setInspectorDebuggerAgent(this);
 }
 
 void WebDebuggerAgent::disable(bool isBeingDestroyed)
 {
     InspectorDebuggerAgent::disable(isBeingDestroyed);
-    m_instrumentingAgents->setInspectorDebuggerAgent(nullptr);
+    m_instrumentingAgents.setInspectorDebuggerAgent(nullptr);
 }
 
 } // namespace WebCore
index 0741662..cc0bbdc 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014, 2015 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -37,14 +37,14 @@ class WebDebuggerAgent : public Inspector::InspectorDebuggerAgent {
     WTF_MAKE_NONCOPYABLE(WebDebuggerAgent);
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    WebDebuggerAgent(Inspector::InjectedScriptManager*, InstrumentingAgents*);
+    WebDebuggerAgent(Inspector::InjectedScriptManager&, InstrumentingAgents&);
     virtual ~WebDebuggerAgent() { }
 
 protected:
     virtual void enable() override;
     virtual void disable(bool isBeingDestroyed) override;
 
-    InstrumentingAgents* m_instrumentingAgents;
+    InstrumentingAgents& m_instrumentingAgents;
 };
 
 } // namespace WebCore
index dc1cb79..4a7c87b 100644 (file)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2011 Google Inc. All rights reserved.
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -35,7 +36,7 @@ using namespace Inspector;
 
 namespace WebCore {
 
-WorkerConsoleAgent::WorkerConsoleAgent(WebInjectedScriptManager* injectedScriptManager)
+WorkerConsoleAgent::WorkerConsoleAgent(WebInjectedScriptManager& injectedScriptManager)
     : WebConsoleAgent(injectedScriptManager)
 {
 }
index 8897b50..22f26d7 100644 (file)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2011 Google Inc. All rights reserved.
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -39,7 +40,7 @@ class WorkerConsoleAgent final : public WebConsoleAgent {
     WTF_MAKE_NONCOPYABLE(WorkerConsoleAgent);
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    WorkerConsoleAgent(WebInjectedScriptManager*);
+    WorkerConsoleAgent(WebInjectedScriptManager&);
     virtual ~WorkerConsoleAgent() { }
 
     virtual bool isWorkerAgent() const override { return true; }
index 730fb03..8d1b95b 100644 (file)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2011 Google Inc. All rights reserved.
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -80,7 +81,7 @@ private:
 
 const char* WorkerDebuggerAgent::debuggerTaskMode = "debugger";
 
-WorkerDebuggerAgent::WorkerDebuggerAgent(InjectedScriptManager* injectedScriptManager, InstrumentingAgents* instrumentingAgents, WorkerGlobalScope* inspectedWorkerGlobalScope)
+WorkerDebuggerAgent::WorkerDebuggerAgent(InjectedScriptManager& injectedScriptManager, InstrumentingAgents& instrumentingAgents, WorkerGlobalScope* inspectedWorkerGlobalScope)
     : WebDebuggerAgent(injectedScriptManager, instrumentingAgents)
     , m_scriptDebugServer(inspectedWorkerGlobalScope, WorkerDebuggerAgent::debuggerTaskMode)
     , m_inspectedWorkerGlobalScope(inspectedWorkerGlobalScope)
@@ -133,7 +134,7 @@ InjectedScript WorkerDebuggerAgent::injectedScriptForEval(ErrorString& error, co
     }
 
     JSC::ExecState* scriptState = execStateFromWorkerGlobalScope(m_inspectedWorkerGlobalScope);
-    return injectedScriptManager()->injectedScriptFor(scriptState);
+    return injectedScriptManager().injectedScriptFor(scriptState);
 }
 
 void WorkerDebuggerAgent::muteConsole()
index d879d18..961dbe1 100644 (file)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2011 Google Inc. All rights reserved.
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -43,7 +44,7 @@ class WorkerDebuggerAgent final : public WebDebuggerAgent {
     WTF_MAKE_NONCOPYABLE(WorkerDebuggerAgent);
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    WorkerDebuggerAgent(Inspector::InjectedScriptManager*, InstrumentingAgents*, WorkerGlobalScope*);
+    WorkerDebuggerAgent(Inspector::InjectedScriptManager&, InstrumentingAgents&, WorkerGlobalScope*);
     virtual ~WorkerDebuggerAgent();
 
     static const char* debuggerTaskMode;
@@ -60,7 +61,7 @@ public:
 
 private:
     WorkerScriptDebugServer m_scriptDebugServer;
-    WorkerGlobalScope* m_inspectedWorkerGlobalScope;
+    WorkerGlobalScope* m_inspectedWorkerGlobalScope { nullptr };
 };
 
 } // namespace WebCore
index 12ced46..22b087e 100644 (file)
@@ -79,18 +79,17 @@ WorkerInspectorController::WorkerInspectorController(WorkerGlobalScope& workerGl
     : m_workerGlobalScope(workerGlobalScope)
     , m_instrumentingAgents(InstrumentingAgents::create(*this))
     , m_injectedScriptManager(std::make_unique<WebInjectedScriptManager>(*this, WebInjectedScriptHost::create()))
-    , m_runtimeAgent(nullptr)
     , m_executionStopwatch(Stopwatch::create())
 {
-    auto runtimeAgent = std::make_unique<WorkerRuntimeAgent>(m_injectedScriptManager.get(), &workerGlobalScope);
+    auto runtimeAgent = std::make_unique<WorkerRuntimeAgent>(*m_injectedScriptManager, &workerGlobalScope);
     m_runtimeAgent = runtimeAgent.get();
     m_instrumentingAgents->setWorkerRuntimeAgent(m_runtimeAgent);
     m_agents.append(WTF::move(runtimeAgent));
 
-    auto consoleAgent = std::make_unique<WorkerConsoleAgent>(m_injectedScriptManager.get());
+    auto consoleAgent = std::make_unique<WorkerConsoleAgent>(*m_injectedScriptManager);
     m_instrumentingAgents->setWebConsoleAgent(consoleAgent.get());
 
-    auto debuggerAgent = std::make_unique<WorkerDebuggerAgent>(m_injectedScriptManager.get(), m_instrumentingAgents.get(), &workerGlobalScope);
+    auto debuggerAgent = std::make_unique<WorkerDebuggerAgent>(*m_injectedScriptManager, m_instrumentingAgents.get(), &workerGlobalScope);
     m_runtimeAgent->setScriptDebugServer(&debuggerAgent->scriptDebugServer());
     m_agents.append(WTF::move(debuggerAgent));
 
index 9674083..de81480 100644 (file)
@@ -74,9 +74,9 @@ private:
     friend class InspectorInstrumentation;
 
     WorkerGlobalScope& m_workerGlobalScope;
-    RefPtr<InstrumentingAgents> m_instrumentingAgents;
+    Ref<InstrumentingAgents> m_instrumentingAgents;
     std::unique_ptr<WebInjectedScriptManager> m_injectedScriptManager;
-    WorkerRuntimeAgent* m_runtimeAgent;
+    WorkerRuntimeAgent* m_runtimeAgent { nullptr };
     Inspector::AgentRegistry m_agents;
     std::unique_ptr<Inspector::FrontendChannel> m_frontendChannel;
     Ref<WTF::Stopwatch> m_executionStopwatch;
index 1222e55..030ec56 100644 (file)
@@ -46,10 +46,9 @@ using namespace Inspector;
 
 namespace WebCore {
 
-WorkerRuntimeAgent::WorkerRuntimeAgent(InjectedScriptManager* injectedScriptManager, WorkerGlobalScope* workerGlobalScope)
+WorkerRuntimeAgent::WorkerRuntimeAgent(InjectedScriptManager& injectedScriptManager, WorkerGlobalScope* workerGlobalScope)
     : InspectorRuntimeAgent(injectedScriptManager)
     , m_workerGlobalScope(workerGlobalScope)
-    , m_paused(false)
 {
 }
 
@@ -73,7 +72,7 @@ InjectedScript WorkerRuntimeAgent::injectedScriptForEval(ErrorString& error, con
     }
 
     JSC::ExecState* scriptState = execStateFromWorkerGlobalScope(m_workerGlobalScope);
-    return injectedScriptManager()->injectedScriptFor(scriptState);
+    return injectedScriptManager().injectedScriptFor(scriptState);
 }
 
 void WorkerRuntimeAgent::muteConsole()
index 878bdd2..dd3e9ab 100644 (file)
@@ -40,7 +40,7 @@ typedef String ErrorString;
 
 class WorkerRuntimeAgent final : public Inspector::InspectorRuntimeAgent {
 public:
-    WorkerRuntimeAgent(Inspector::InjectedScriptManager*, WorkerGlobalScope*);
+    WorkerRuntimeAgent(Inspector::InjectedScriptManager&, WorkerGlobalScope*);
     virtual ~WorkerRuntimeAgent() { }
 
     virtual void didCreateFrontendAndBackend(Inspector::FrontendChannel*, Inspector::BackendDispatcher*) override;
@@ -55,9 +55,10 @@ private:
     virtual Inspector::InjectedScript injectedScriptForEval(ErrorString&, const int* executionContextId) override;
     virtual void muteConsole() override;
     virtual void unmuteConsole() override;
-    WorkerGlobalScope* m_workerGlobalScope;
     RefPtr<Inspector::RuntimeBackendDispatcher> m_backendDispatcher;
-    bool m_paused;
+
+    WorkerGlobalScope* m_workerGlobalScope { nullptr };
+    bool m_paused { false };
 };
 
 } // namespace WebCore