Diff
Modified: branches/chromium/1364/Source/WebCore/inspector/InspectorController.cpp (141144 => 141145)
--- branches/chromium/1364/Source/WebCore/inspector/InspectorController.cpp 2013-01-29 20:40:37 UTC (rev 141144)
+++ branches/chromium/1364/Source/WebCore/inspector/InspectorController.cpp 2013-01-29 20:48:15 UTC (rev 141145)
@@ -80,7 +80,7 @@
namespace WebCore {
InspectorController::InspectorController(Page* page, InspectorClient* inspectorClient)
- : m_instrumentingAgents(adoptPtr(new InstrumentingAgents()))
+ : m_instrumentingAgents(InstrumentingAgents::create())
, m_injectedScriptManager(InjectedScriptManager::createForPage())
, m_state(adoptPtr(new InspectorState(inspectorClient)))
, m_overlay(InspectorOverlay::create(page, inspectorClient))
@@ -179,6 +179,7 @@
InspectorController::~InspectorController()
{
+ m_instrumentingAgents->reset();
m_agents.discardAgents();
ASSERT(!m_inspectorClient);
}
Modified: branches/chromium/1364/Source/WebCore/inspector/InspectorController.h (141144 => 141145)
--- branches/chromium/1364/Source/WebCore/inspector/InspectorController.h 2013-01-29 20:40:37 UTC (rev 141144)
+++ branches/chromium/1364/Source/WebCore/inspector/InspectorController.h 2013-01-29 20:48:15 UTC (rev 141145)
@@ -128,7 +128,7 @@
friend class PostWorkerNotificationToFrontendTask;
friend InstrumentingAgents* instrumentationForPage(Page*);
- OwnPtr<InstrumentingAgents> m_instrumentingAgents;
+ RefPtr<InstrumentingAgents> m_instrumentingAgents;
OwnPtr<InjectedScriptManager> m_injectedScriptManager;
OwnPtr<InspectorState> m_state;
OwnPtr<InspectorOverlay> m_overlay;
Modified: branches/chromium/1364/Source/WebCore/inspector/InspectorInstrumentation.cpp (141144 => 141145)
--- branches/chromium/1364/Source/WebCore/inspector/InspectorInstrumentation.cpp 2013-01-29 20:40:37 UTC (rev 141144)
+++ branches/chromium/1364/Source/WebCore/inspector/InspectorInstrumentation.cpp 2013-01-29 20:48:15 UTC (rev 141145)
@@ -117,6 +117,37 @@
return frame;
}
+InspectorInstrumentationCookie::InspectorInstrumentationCookie()
+ : m_instrumentingAgents(0)
+ , m_timelineAgentId(0)
+{
+}
+
+InspectorInstrumentationCookie::InspectorInstrumentationCookie(InstrumentingAgents* agents, int timelineAgentId)
+ : m_instrumentingAgents(agents)
+ , m_timelineAgentId(timelineAgentId)
+{
+}
+
+InspectorInstrumentationCookie::InspectorInstrumentationCookie(const InspectorInstrumentationCookie& other)
+ : m_instrumentingAgents(other.m_instrumentingAgents)
+ , m_timelineAgentId(other.m_timelineAgentId)
+{
+}
+
+InspectorInstrumentationCookie& InspectorInstrumentationCookie::operator=(const InspectorInstrumentationCookie& other)
+{
+ if (this != &other) {
+ m_instrumentingAgents = other.m_instrumentingAgents;
+ m_timelineAgentId = other.m_timelineAgentId;
+ }
+ return *this;
+}
+
+InspectorInstrumentationCookie::~InspectorInstrumentationCookie()
+{
+}
+
void InspectorInstrumentation::didClearWindowObjectInWorldImpl(InstrumentingAgents* instrumentingAgents, Frame* frame, DOMWrapperWorld* world)
{
InspectorPageAgent* pageAgent = instrumentingAgents->inspectorPageAgent();
@@ -374,7 +405,7 @@
void InspectorInstrumentation::didHandleEventImpl(const InspectorInstrumentationCookie& cookie)
{
- cancelPauseOnNativeEvent(cookie.first);
+ cancelPauseOnNativeEvent(cookie.instrumentingAgents());
}
void InspectorInstrumentation::didDispatchEventImpl(const InspectorInstrumentationCookie& cookie)
@@ -436,7 +467,7 @@
void InspectorInstrumentation::didFireTimerImpl(const InspectorInstrumentationCookie& cookie)
{
- cancelPauseOnNativeEvent(cookie.first);
+ cancelPauseOnNativeEvent(cookie.instrumentingAgents());
if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(cookie))
timelineAgent->didFireTimer();
@@ -472,13 +503,10 @@
void InspectorInstrumentation::didLayoutImpl(const InspectorInstrumentationCookie& cookie, RenderObject* root)
{
- if (!cookie.first)
- return;
-
if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(cookie))
timelineAgent->didLayout(root);
- if (InspectorPageAgent* pageAgent = cookie.first->inspectorPageAgent())
+ if (InspectorPageAgent* pageAgent = cookie.instrumentingAgents()->inspectorPageAgent())
pageAgent->didLayout();
}
@@ -513,7 +541,7 @@
{
if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(cookie))
timelineAgent->didPaint(rect);
- if (InspectorPageAgent* pageAgent = cookie.first ? cookie.first->inspectorPageAgent() : 0)
+ if (InspectorPageAgent* pageAgent = cookie.instrumentingAgents()->inspectorPageAgent())
pageAgent->didPaint(context, rect);
}
@@ -557,9 +585,7 @@
{
if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(cookie))
timelineAgent->didRecalculateStyle();
- InstrumentingAgents* instrumentingAgents = cookie.first;
- if (!instrumentingAgents)
- return;
+ InstrumentingAgents* instrumentingAgents = cookie.instrumentingAgents();
if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
resourceAgent->didRecalculateStyle();
if (InspectorPageAgent* pageAgent = instrumentingAgents->inspectorPageAgent())
@@ -587,7 +613,7 @@
void InspectorInstrumentation::didMatchRuleImpl(const InspectorInstrumentationCookie& cookie, bool matched)
{
- InspectorCSSAgent* cssAgent = cookie.first->inspectorCSSAgent();
+ InspectorCSSAgent* cssAgent = cookie.instrumentingAgents()->inspectorCSSAgent();
if (cssAgent)
cssAgent->didMatchRule(matched);
}
@@ -605,7 +631,7 @@
void InspectorInstrumentation::didProcessRuleImpl(const InspectorInstrumentationCookie& cookie)
{
- InspectorCSSAgent* cssAgent = cookie.first->inspectorCSSAgent();
+ InspectorCSSAgent* cssAgent = cookie.instrumentingAgents()->inspectorCSSAgent();
if (cssAgent)
cssAgent->didProcessRule();
}
@@ -715,9 +741,7 @@
timelineAgent->didReceiveResourceResponse();
if (!loader)
return;
- InstrumentingAgents* instrumentingAgents = cookie.first;
- if (!instrumentingAgents)
- return;
+ InstrumentingAgents* instrumentingAgents = cookie.instrumentingAgents();
if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
resourceAgent->didReceiveResponse(identifier, loader, response, resourceLoader);
if (InspectorConsoleAgent* consoleAgent = instrumentingAgents->inspectorConsoleAgent())
@@ -1253,10 +1277,10 @@
InspectorTimelineAgent* InspectorInstrumentation::retrieveTimelineAgent(const InspectorInstrumentationCookie& cookie)
{
- if (!cookie.first)
+ if (!cookie.instrumentingAgents())
return 0;
- InspectorTimelineAgent* timelineAgent = cookie.first->inspectorTimelineAgent();
- if (timelineAgent && timelineAgent->id() == cookie.second)
+ InspectorTimelineAgent* timelineAgent = cookie.instrumentingAgents()->inspectorTimelineAgent();
+ if (timelineAgent && cookie.hasMatchingTimelineAgentId(timelineAgent->id()))
return timelineAgent;
return 0;
}
Modified: branches/chromium/1364/Source/WebCore/inspector/InspectorInstrumentation.h (141144 => 141145)
--- branches/chromium/1364/Source/WebCore/inspector/InspectorInstrumentation.h 2013-01-29 20:40:37 UTC (rev 141144)
+++ branches/chromium/1364/Source/WebCore/inspector/InspectorInstrumentation.h 2013-01-29 20:48:15 UTC (rev 141145)
@@ -40,6 +40,7 @@
#include "ScriptExecutionContext.h"
#include "ScriptState.h"
#include "StorageArea.h"
+#include <wtf/RefPtr.h>
#include <wtf/UnusedParam.h>
namespace WebCore {
@@ -58,6 +59,7 @@
class GraphicsContext;
class HitTestResult;
class InspectorCSSAgent;
+class InspectorInstrumentation;
class InspectorTimelineAgent;
class InstrumentingAgents;
class KURL;
@@ -89,8 +91,24 @@
#define FAST_RETURN_IF_NO_FRONTENDS(value) if (!hasFrontends()) return value;
-typedef pair<InstrumentingAgents*, int> InspectorInstrumentationCookie;
+class InspectorInstrumentationCookie {
+public:
+ InspectorInstrumentationCookie();
+ InspectorInstrumentationCookie(InstrumentingAgents*, int);
+ InspectorInstrumentationCookie(const InspectorInstrumentationCookie&);
+ InspectorInstrumentationCookie& operator=(const InspectorInstrumentationCookie&);
+ ~InspectorInstrumentationCookie();
+private:
+ friend class InspectorInstrumentation;
+ InstrumentingAgents* instrumentingAgents() const { return m_instrumentingAgents.get(); }
+ bool isValid() const { return !!m_instrumentingAgents; }
+ bool hasMatchingTimelineAgentId(int id) const { return m_timelineAgentId == id; }
+
+ RefPtr<InstrumentingAgents> m_instrumentingAgents;
+ int m_timelineAgentId;
+};
+
class InspectorInstrumentation {
public:
static void didClearWindowObjectInWorld(Frame*, DOMWrapperWorld*);
@@ -804,7 +822,7 @@
{
#if ENABLE(INSPECTOR)
FAST_RETURN_IF_NO_FRONTENDS(void());
- if (cookie.first)
+ if (cookie.isValid())
didCallFunctionImpl(cookie);
#else
UNUSED_PARAM(cookie);
@@ -828,7 +846,7 @@
{
#if ENABLE(INSPECTOR)
FAST_RETURN_IF_NO_FRONTENDS(void());
- if (cookie.first)
+ if (cookie.isValid())
didDispatchXHRReadyStateChangeEventImpl(cookie);
#else
UNUSED_PARAM(cookie);
@@ -855,7 +873,7 @@
{
#if ENABLE(INSPECTOR)
FAST_RETURN_IF_NO_FRONTENDS(void());
- if (cookie.first)
+ if (cookie.isValid())
didDispatchEventImpl(cookie);
#else
UNUSED_PARAM(cookie);
@@ -879,7 +897,7 @@
{
#if ENABLE(INSPECTOR)
FAST_RETURN_IF_NO_FRONTENDS(void());
- if (cookie.first)
+ if (cookie.isValid())
didHandleEventImpl(cookie);
#else
UNUSED_PARAM(cookie);
@@ -904,7 +922,7 @@
{
#if ENABLE(INSPECTOR)
FAST_RETURN_IF_NO_FRONTENDS(void());
- if (cookie.first)
+ if (cookie.isValid())
didDispatchEventOnWindowImpl(cookie);
#else
UNUSED_PARAM(cookie);
@@ -929,7 +947,7 @@
{
#if ENABLE(INSPECTOR)
FAST_RETURN_IF_NO_FRONTENDS(void());
- if (cookie.first)
+ if (cookie.isValid())
didEvaluateScriptImpl(cookie);
#else
UNUSED_PARAM(cookie);
@@ -966,7 +984,7 @@
{
#if ENABLE(INSPECTOR)
FAST_RETURN_IF_NO_FRONTENDS(void());
- if (cookie.first)
+ if (cookie.isValid())
didFireTimerImpl(cookie);
#else
UNUSED_PARAM(cookie);
@@ -1022,7 +1040,7 @@
{
#if ENABLE(INSPECTOR)
FAST_RETURN_IF_NO_FRONTENDS(void());
- if (cookie.first)
+ if (cookie.isValid())
didLayoutImpl(cookie, root);
#else
UNUSED_PARAM(cookie);
@@ -1058,7 +1076,7 @@
{
#if ENABLE(INSPECTOR)
FAST_RETURN_IF_NO_FRONTENDS(void());
- if (cookie.first)
+ if (cookie.isValid())
didDispatchXHRLoadEventImpl(cookie);
#else
UNUSED_PARAM(cookie);
@@ -1081,7 +1099,7 @@
{
#if ENABLE(INSPECTOR)
FAST_RETURN_IF_NO_FRONTENDS(void());
- if (cookie.first)
+ if (cookie.isValid())
didPaintImpl(cookie, context, rect);
#else
UNUSED_PARAM(cookie);
@@ -1150,7 +1168,7 @@
{
#if ENABLE(INSPECTOR)
FAST_RETURN_IF_NO_FRONTENDS(void());
- if (cookie.first)
+ if (cookie.isValid())
didRecalculateStyleImpl(cookie);
#else
UNUSED_PARAM(cookie);
@@ -1186,7 +1204,7 @@
{
#if ENABLE(INSPECTOR)
FAST_RETURN_IF_NO_FRONTENDS(void());
- if (cookie.first)
+ if (cookie.isValid())
didMatchRuleImpl(cookie, matched);
#else
UNUSED_PARAM(cookie);
@@ -1214,7 +1232,7 @@
{
#if ENABLE(INSPECTOR)
FAST_RETURN_IF_NO_FRONTENDS(void());
- if (cookie.first)
+ if (cookie.isValid())
didProcessRuleImpl(cookie);
#else
UNUSED_PARAM(cookie);
@@ -1362,7 +1380,7 @@
{
#if ENABLE(INSPECTOR)
FAST_RETURN_IF_NO_FRONTENDS(void());
- if (cookie.first)
+ if (cookie.isValid())
didReceiveResourceDataImpl(cookie);
#else
UNUSED_PARAM(cookie);
@@ -1386,7 +1404,8 @@
{
#if ENABLE(INSPECTOR)
// Call this unconditionally so that we're able to log to console with no front-end attached.
- didReceiveResourceResponseImpl(cookie, identifier, loader, response, resourceLoader);
+ if (cookie.isValid())
+ didReceiveResourceResponseImpl(cookie, identifier, loader, response, resourceLoader);
#else
UNUSED_PARAM(cookie);
UNUSED_PARAM(identifier);
@@ -1682,7 +1701,7 @@
{
#if ENABLE(INSPECTOR)
FAST_RETURN_IF_NO_FRONTENDS(void());
- if (cookie.first)
+ if (cookie.isValid())
didWriteHTMLImpl(cookie, endLine);
#else
UNUSED_PARAM(cookie);
@@ -1901,7 +1920,7 @@
{
#if ENABLE(INSPECTOR)
FAST_RETURN_IF_NO_FRONTENDS(void());
- if (cookie.first)
+ if (cookie.isValid())
didFireAnimationFrameImpl(cookie);
#else
UNUSED_PARAM(cookie);
Modified: branches/chromium/1364/Source/WebCore/inspector/InstrumentingAgents.cpp (141144 => 141145)
--- branches/chromium/1364/Source/WebCore/inspector/InstrumentingAgents.cpp 2013-01-29 20:40:37 UTC (rev 141144)
+++ branches/chromium/1364/Source/WebCore/inspector/InstrumentingAgents.cpp 2013-01-29 20:48:15 UTC (rev 141145)
@@ -42,6 +42,74 @@
namespace WebCore {
+InstrumentingAgents::InstrumentingAgents()
+ : m_inspectorAgent(0)
+ , m_inspectorPageAgent(0)
+ , m_inspectorCSSAgent(0)
+#if USE(ACCELERATED_COMPOSITING)
+ , m_inspectorLayerTreeAgent(0)
+#endif
+ , m_inspectorConsoleAgent(0)
+ , m_inspectorDOMAgent(0)
+ , m_inspectorResourceAgent(0)
+ , m_pageRuntimeAgent(0)
+ , m_workerRuntimeAgent(0)
+ , m_inspectorTimelineAgent(0)
+ , m_inspectorDOMStorageAgent(0)
+#if ENABLE(SQL_DATABASE)
+ , m_inspectorDatabaseAgent(0)
+#endif
+#if ENABLE(FILE_SYSTEM)
+ , m_inspectorFileSystemAgent(0)
+#endif
+ , m_inspectorApplicationCacheAgent(0)
+#if ENABLE(_javascript__DEBUGGER)
+ , m_inspectorDebuggerAgent(0)
+ , m_pageDebuggerAgent(0)
+ , m_inspectorDOMDebuggerAgent(0)
+ , m_inspectorProfilerAgent(0)
+#endif
+#if ENABLE(WORKERS)
+ , m_inspectorWorkerAgent(0)
+#endif
+ , m_inspectorCanvasAgent(0)
+{
+}
+
+void InstrumentingAgents::reset()
+{
+ m_inspectorAgent = 0;
+ m_inspectorPageAgent = 0;
+ m_inspectorCSSAgent = 0;
+#if USE(ACCELERATED_COMPOSITING)
+ m_inspectorLayerTreeAgent = 0;
+#endif
+ m_inspectorConsoleAgent = 0;
+ m_inspectorDOMAgent = 0;
+ m_inspectorResourceAgent = 0;
+ m_pageRuntimeAgent = 0;
+ m_workerRuntimeAgent = 0;
+ m_inspectorTimelineAgent = 0;
+ m_inspectorDOMStorageAgent = 0;
+#if ENABLE(SQL_DATABASE)
+ m_inspectorDatabaseAgent = 0;
+#endif
+#if ENABLE(FILE_SYSTEM)
+ m_inspectorFileSystemAgent = 0;
+#endif
+ m_inspectorApplicationCacheAgent = 0;
+#if ENABLE(_javascript__DEBUGGER)
+ m_inspectorDebuggerAgent = 0;
+ m_pageDebuggerAgent = 0;
+ m_inspectorDOMDebuggerAgent = 0;
+ m_inspectorProfilerAgent = 0;
+#endif
+#if ENABLE(WORKERS)
+ m_inspectorWorkerAgent = 0;
+#endif
+ m_inspectorCanvasAgent = 0;
+}
+
InstrumentingAgents* instrumentationForPage(Page* page)
{
ASSERT(isMainThread());
Modified: branches/chromium/1364/Source/WebCore/inspector/InstrumentingAgents.h (141144 => 141145)
--- branches/chromium/1364/Source/WebCore/inspector/InstrumentingAgents.h 2013-01-29 20:40:37 UTC (rev 141144)
+++ branches/chromium/1364/Source/WebCore/inspector/InstrumentingAgents.h 2013-01-29 20:48:15 UTC (rev 141145)
@@ -33,6 +33,8 @@
#include <wtf/FastAllocBase.h>
#include <wtf/Noncopyable.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
namespace WebCore {
@@ -59,43 +61,16 @@
class WorkerContext;
class WorkerRuntimeAgent;
-class InstrumentingAgents {
+class InstrumentingAgents : public RefCounted<InstrumentingAgents> {
WTF_MAKE_NONCOPYABLE(InstrumentingAgents);
WTF_MAKE_FAST_ALLOCATED;
public:
- InstrumentingAgents()
- : m_inspectorAgent(0)
- , m_inspectorPageAgent(0)
- , m_inspectorCSSAgent(0)
-#if USE(ACCELERATED_COMPOSITING)
- , m_inspectorLayerTreeAgent(0)
-#endif
- , m_inspectorConsoleAgent(0)
- , m_inspectorDOMAgent(0)
- , m_inspectorResourceAgent(0)
- , m_pageRuntimeAgent(0)
- , m_workerRuntimeAgent(0)
- , m_inspectorTimelineAgent(0)
- , m_inspectorDOMStorageAgent(0)
-#if ENABLE(SQL_DATABASE)
- , m_inspectorDatabaseAgent(0)
-#endif
-#if ENABLE(FILE_SYSTEM)
- , m_inspectorFileSystemAgent(0)
-#endif
- , m_inspectorApplicationCacheAgent(0)
-#if ENABLE(_javascript__DEBUGGER)
- , m_inspectorDebuggerAgent(0)
- , m_pageDebuggerAgent(0)
- , m_inspectorDOMDebuggerAgent(0)
- , m_inspectorProfilerAgent(0)
-#endif
-#if ENABLE(WORKERS)
- , m_inspectorWorkerAgent(0)
-#endif
- , m_inspectorCanvasAgent(0)
- { }
+ static PassRefPtr<InstrumentingAgents> create()
+ {
+ return adoptRef(new InstrumentingAgents());
+ }
~InstrumentingAgents() { }
+ void reset();
InspectorAgent* inspectorAgent() const { return m_inspectorAgent; }
void setInspectorAgent(InspectorAgent* agent) { m_inspectorAgent = agent; }
@@ -168,6 +143,8 @@
#endif
private:
+ InstrumentingAgents();
+
InspectorAgent* m_inspectorAgent;
InspectorPageAgent* m_inspectorPageAgent;
InspectorCSSAgent* m_inspectorCSSAgent;
Modified: branches/chromium/1364/Source/WebCore/inspector/WorkerInspectorController.cpp (141144 => 141145)
--- branches/chromium/1364/Source/WebCore/inspector/WorkerInspectorController.cpp 2013-01-29 20:40:37 UTC (rev 141144)
+++ branches/chromium/1364/Source/WebCore/inspector/WorkerInspectorController.cpp 2013-01-29 20:48:15 UTC (rev 141145)
@@ -94,7 +94,7 @@
: m_workerContext(workerContext)
, m_stateClient(adoptPtr(new WorkerStateClient(workerContext)))
, m_state(adoptPtr(new InspectorState(m_stateClient.get())))
- , m_instrumentingAgents(adoptPtr(new InstrumentingAgents()))
+ , m_instrumentingAgents(InstrumentingAgents::create())
, m_injectedScriptManager(InjectedScriptManager::createForWorker())
, m_runtimeAgent(0)
{
@@ -129,6 +129,7 @@
WorkerInspectorController::~WorkerInspectorController()
{
+ m_instrumentingAgents->reset();
disconnectFrontend();
}
Modified: branches/chromium/1364/Source/WebCore/inspector/WorkerInspectorController.h (141144 => 141145)
--- branches/chromium/1364/Source/WebCore/inspector/WorkerInspectorController.h 2013-01-29 20:40:37 UTC (rev 141144)
+++ branches/chromium/1364/Source/WebCore/inspector/WorkerInspectorController.h 2013-01-29 20:48:15 UTC (rev 141145)
@@ -75,7 +75,7 @@
WorkerContext* m_workerContext;
OwnPtr<InspectorStateClient> m_stateClient;
OwnPtr<InspectorState> m_state;
- OwnPtr<InstrumentingAgents> m_instrumentingAgents;
+ RefPtr<InstrumentingAgents> m_instrumentingAgents;
OwnPtr<InjectedScriptManager> m_injectedScriptManager;
InspectorRuntimeAgent* m_runtimeAgent;
InspectorAgentRegistry m_agents;