Title: [148459] branches/safari-536.30-branch/Source/WebCore

Diff

Modified: branches/safari-536.30-branch/Source/WebCore/ChangeLog (148458 => 148459)


--- branches/safari-536.30-branch/Source/WebCore/ChangeLog	2013-04-15 19:46:28 UTC (rev 148458)
+++ branches/safari-536.30-branch/Source/WebCore/ChangeLog	2013-04-15 20:05:18 UTC (rev 148459)
@@ -1,3 +1,73 @@
+2013-04-15  Timothy Hatcher  <timo...@apple.com>
+
+        Merge r140127.
+
+    2013-01-18  Yury Semikhatsky  <yu...@chromium.org>
+
+        Web Inspector: make sure InspectorInstrumentationCookie is invalidated if inspected page was destroyed
+        https://bugs.webkit.org/show_bug.cgi?id=107232
+
+        Reviewed by Pavel Feldman.
+
+        Made InstrumentingAgents reference counted to make sure it is not deleted while there is
+        InspectorInstrumentationCookie with reference to it.
+
+        Introduced InstrumentingAgents::reset that is called from inspector controller destructor
+        to double check that references to all deleted agents are cleared.
+
+        InspectorInstrumentationCookie turned from std::pair into a custom class so that
+        we can avoid inclusion of InstrumentingAgents.h into InspectorInstrumentation.h
+
+        * inspector/InspectorController.cpp:
+        (WebCore::InspectorController::InspectorController):
+        (WebCore::InspectorController::~InspectorController):
+        * inspector/InspectorController.h:
+        (InspectorController):
+        * inspector/InspectorInstrumentation.cpp:
+        (WebCore):
+        (WebCore::InspectorInstrumentationCookie::InspectorInstrumentationCookie):
+        (WebCore::InspectorInstrumentationCookie::operator=):
+        (WebCore::InspectorInstrumentationCookie::~InspectorInstrumentationCookie):
+        (WebCore::InspectorInstrumentation::didHandleEventImpl):
+        (WebCore::InspectorInstrumentation::didFireTimerImpl):
+        (WebCore::InspectorInstrumentation::didLayoutImpl):
+        (WebCore::InspectorInstrumentation::didPaintImpl):
+        (WebCore::InspectorInstrumentation::didRecalculateStyleImpl):
+        (WebCore::InspectorInstrumentation::didMatchRuleImpl):
+        (WebCore::InspectorInstrumentation::didProcessRuleImpl):
+        (WebCore::InspectorInstrumentation::didReceiveResourceResponseImpl):
+        (WebCore::InspectorInstrumentation::retrieveTimelineAgent):
+        * inspector/InspectorInstrumentation.h:
+        (InspectorInstrumentationCookie):
+        (WebCore::InspectorInstrumentation::didCallFunction):
+        (WebCore::InspectorInstrumentation::didDispatchXHRReadyStateChangeEvent):
+        (WebCore::InspectorInstrumentation::didDispatchEvent):
+        (WebCore::InspectorInstrumentation::didHandleEvent):
+        (WebCore::InspectorInstrumentation::didDispatchEventOnWindow):
+        (WebCore::InspectorInstrumentation::didEvaluateScript):
+        (WebCore::InspectorInstrumentation::didFireTimer):
+        (WebCore::InspectorInstrumentation::didLayout):
+        (WebCore::InspectorInstrumentation::didDispatchXHRLoadEvent):
+        (WebCore::InspectorInstrumentation::didPaint):
+        (WebCore::InspectorInstrumentation::didRecalculateStyle):
+        (WebCore::InspectorInstrumentation::didMatchRule):
+        (WebCore::InspectorInstrumentation::didProcessRule):
+        (WebCore::InspectorInstrumentation::didReceiveResourceData):
+        (WebCore::InspectorInstrumentation::didWriteHTML):
+        (WebCore::InspectorInstrumentation::didFireAnimationFrame):
+        * inspector/InstrumentingAgents.cpp:
+        (WebCore::InstrumentingAgents::InstrumentingAgents):
+        (WebCore):
+        (WebCore::InstrumentingAgents::reset):
+        * inspector/InstrumentingAgents.h:
+        (WebCore::InstrumentingAgents::create):
+        (InstrumentingAgents):
+        * inspector/WorkerInspectorController.cpp:
+        (WebCore::WorkerInspectorController::WorkerInspectorController):
+        (WebCore::WorkerInspectorController::~WorkerInspectorController):
+        * inspector/WorkerInspectorController.h:
+        (WorkerInspectorController):
+
 2013-04-15  Roger Fong  <roger_f...@apple.com>
 
         Merged r138213.

Modified: branches/safari-536.30-branch/Source/WebCore/inspector/InspectorController.cpp (148458 => 148459)


--- branches/safari-536.30-branch/Source/WebCore/inspector/InspectorController.cpp	2013-04-15 19:46:28 UTC (rev 148458)
+++ branches/safari-536.30-branch/Source/WebCore/inspector/InspectorController.cpp	2013-04-15 20:05:18 UTC (rev 148459)
@@ -74,7 +74,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_page(page)
@@ -160,6 +160,8 @@
 
 InspectorController::~InspectorController()
 {
+    m_instrumentingAgents->reset();
+
     for (Agents::iterator it = m_agents.begin(); it != m_agents.end(); ++it)
         (*it)->discardAgent();
 

Modified: branches/safari-536.30-branch/Source/WebCore/inspector/InspectorController.h (148458 => 148459)


--- branches/safari-536.30-branch/Source/WebCore/inspector/InspectorController.h	2013-04-15 19:46:28 UTC (rev 148458)
+++ branches/safari-536.30-branch/Source/WebCore/inspector/InspectorController.h	2013-04-15 20:05:18 UTC (rev 148459)
@@ -117,7 +117,7 @@
     friend class PostWorkerNotificationToFrontendTask;
     friend InstrumentingAgents* instrumentationForPage(Page*);
 
-    OwnPtr<InstrumentingAgents> m_instrumentingAgents;
+    RefPtr<InstrumentingAgents> m_instrumentingAgents;
     OwnPtr<InjectedScriptManager> m_injectedScriptManager;
     OwnPtr<InspectorState> m_state;
 

Modified: branches/safari-536.30-branch/Source/WebCore/inspector/InspectorInstrumentation.cpp (148458 => 148459)


--- branches/safari-536.30-branch/Source/WebCore/inspector/InspectorInstrumentation.cpp	2013-04-15 19:46:28 UTC (rev 148458)
+++ branches/safari-536.30-branch/Source/WebCore/inspector/InspectorInstrumentation.cpp	2013-04-15 20:05:18 UTC (rev 148459)
@@ -99,6 +99,37 @@
     return false;
 }
 
+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();
@@ -321,7 +352,7 @@
 
 void InspectorInstrumentation::didHandleEventImpl(const InspectorInstrumentationCookie& cookie)
 {
-    cancelPauseOnNativeEvent(cookie.first);
+    cancelPauseOnNativeEvent(cookie.instrumentingAgents());
 }
 
 void InspectorInstrumentation::didDispatchEventImpl(const InspectorInstrumentationCookie& cookie)
@@ -377,7 +408,7 @@
 
 void InspectorInstrumentation::didFireTimerImpl(const InspectorInstrumentationCookie& cookie)
 {
-    cancelPauseOnNativeEvent(cookie.first);
+    cancelPauseOnNativeEvent(cookie.instrumentingAgents());
 
     if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(cookie))
         timelineAgent->didFireTimer();
@@ -407,13 +438,10 @@
 
 void InspectorInstrumentation::didLayoutImpl(const InspectorInstrumentationCookie& cookie)
 {
-    if (!cookie.first)
-        return;
-
     if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(cookie))
         timelineAgent->didLayout();
 
-    if (InspectorPageAgent* pageAgent = cookie.first->inspectorPageAgent())
+    if (InspectorPageAgent* pageAgent = cookie.instrumentingAgents()->inspectorPageAgent())
         pageAgent->didLayout();
 }
 
@@ -451,7 +479,7 @@
 {
     if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(cookie))
         timelineAgent->didPaint();
-    if (InspectorPageAgent* pageAgent = cookie.first ? cookie.first->inspectorPageAgent() : 0)
+    if (InspectorPageAgent* pageAgent = cookie.instrumentingAgents()->inspectorPageAgent())
         pageAgent->didPaint();
 }
 
@@ -471,9 +499,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();
 }
@@ -498,7 +524,7 @@
 
 void InspectorInstrumentation::didMatchRuleImpl(const InspectorInstrumentationCookie& cookie, bool matched)
 {
-    InspectorCSSAgent* cssAgent = cookie.first->inspectorCSSAgent();
+    InspectorCSSAgent* cssAgent = cookie.instrumentingAgents()->inspectorCSSAgent();
     if (cssAgent)
         cssAgent->didMatchRule(matched);
 }
@@ -517,7 +543,7 @@
 
 void InspectorInstrumentation::didProcessRuleImpl(const InspectorInstrumentationCookie& cookie)
 {
-    InspectorCSSAgent* cssAgent = cookie.first->inspectorCSSAgent();
+    InspectorCSSAgent* cssAgent = cookie.instrumentingAgents()->inspectorCSSAgent();
     if (cssAgent)
         cssAgent->didProcessRule();
 }
@@ -621,9 +647,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);
     if (InspectorConsoleAgent* consoleAgent = instrumentingAgents->inspectorConsoleAgent())
@@ -1095,10 +1119,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/safari-536.30-branch/Source/WebCore/inspector/InspectorInstrumentation.h (148458 => 148459)


--- branches/safari-536.30-branch/Source/WebCore/inspector/InspectorInstrumentation.h	2013-04-15 19:46:28 UTC (rev 148458)
+++ branches/safari-536.30-branch/Source/WebCore/inspector/InspectorInstrumentation.h	2013-04-15 20:05:18 UTC (rev 148459)
@@ -38,6 +38,7 @@
 #include "Frame.h"
 #include "Page.h"
 #include "ScriptExecutionContext.h"
+#include <wtf/RefPtr.h>
 
 namespace WebCore {
 
@@ -53,6 +54,7 @@
 class GraphicsContext;
 class HitTestResult;
 class InspectorCSSAgent;
+class InspectorInstrumentation;
 class InspectorTimelineAgent;
 class InstrumentingAgents;
 class KURL;
@@ -78,8 +80,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*);
@@ -606,7 +624,7 @@
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
-    if (cookie.first)
+    if (cookie.isValid())
         didCallFunctionImpl(cookie);
 #endif
 }
@@ -625,7 +643,7 @@
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
-    if (cookie.first)
+    if (cookie.isValid())
         didChangeXHRReadyStateImpl(cookie);
 #endif
 }
@@ -644,7 +662,7 @@
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
-    if (cookie.first)
+    if (cookie.isValid())
         didDispatchEventImpl(cookie);
 #endif
 }
@@ -663,7 +681,7 @@
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
-    if (cookie.first)
+    if (cookie.isValid())
         didHandleEventImpl(cookie);
 #endif
 }
@@ -682,7 +700,7 @@
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
-    if (cookie.first)
+    if (cookie.isValid())
         didDispatchEventOnWindowImpl(cookie);
 #endif
 }
@@ -701,7 +719,7 @@
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
-    if (cookie.first)
+    if (cookie.isValid())
         didEvaluateScriptImpl(cookie);
 #endif
 }
@@ -720,7 +738,7 @@
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
-    if (cookie.first)
+    if (cookie.isValid())
         didFireTimerImpl(cookie);
 #endif
 }
@@ -757,7 +775,7 @@
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
-    if (cookie.first)
+    if (cookie.isValid())
         didLayoutImpl(cookie);
 #endif
 }
@@ -776,7 +794,7 @@
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
-    if (cookie.first)
+    if (cookie.isValid())
         didLoadXHRImpl(cookie);
 #endif
 }
@@ -795,7 +813,7 @@
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
-    if (cookie.first)
+    if (cookie.isValid())
         didPaintImpl(cookie);
 #endif
 }
@@ -814,7 +832,7 @@
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
-    if (cookie.first)
+    if (cookie.isValid())
         didRecalculateStyleImpl(cookie);
 #endif
 }
@@ -842,7 +860,7 @@
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
-    if (cookie.first)
+    if (cookie.isValid())
         didMatchRuleImpl(cookie, matched);
 #endif
 }
@@ -863,7 +881,7 @@
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
-    if (cookie.first)
+    if (cookie.isValid())
         didProcessRuleImpl(cookie);
 #endif
 }
@@ -961,7 +979,7 @@
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
-    if (cookie.first)
+    if (cookie.isValid())
         didReceiveResourceDataImpl(cookie);
 #endif
 }
@@ -979,7 +997,13 @@
 {
 #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);
+    if (cookie.isValid())
+        didReceiveResourceResponseImpl(cookie, identifier, loader, response);
+#else
+    UNUSED_PARAM(cookie);
+    UNUSED_PARAM(identifier);
+    UNUSED_PARAM(loader);
+    UNUSED_PARAM(response);
 #endif
 }
 
@@ -1138,7 +1162,7 @@
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
-    if (cookie.first)
+    if (cookie.isValid())
         didWriteHTMLImpl(cookie, endLine);
 #endif
 }
@@ -1301,7 +1325,7 @@
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
-    if (cookie.first)
+    if (cookie.isValid())
         didFireAnimationFrameImpl(cookie);
 #endif
 }

Modified: branches/safari-536.30-branch/Source/WebCore/inspector/InstrumentingAgents.cpp (148458 => 148459)


--- branches/safari-536.30-branch/Source/WebCore/inspector/InstrumentingAgents.cpp	2013-04-15 19:46:28 UTC (rev 148458)
+++ branches/safari-536.30-branch/Source/WebCore/inspector/InstrumentingAgents.cpp	2013-04-15 20:05:18 UTC (rev 148459)
@@ -42,6 +42,62 @@
 
 namespace WebCore {
 
+InstrumentingAgents::InstrumentingAgents()
+    : m_inspectorAgent(0)
+    , m_inspectorPageAgent(0)
+    , m_inspectorCSSAgent(0)
+    , m_inspectorConsoleAgent(0)
+    , m_inspectorDOMAgent(0)
+    , m_inspectorResourceAgent(0)
+    , m_inspectorRuntimeAgent(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_inspectorDOMDebuggerAgent(0)
+    , m_inspectorProfilerAgent(0)
+#endif
+#if ENABLE(WORKERS)
+    , m_inspectorWorkerAgent(0)
+#endif
+{
+}
+
+void InstrumentingAgents::reset()
+{
+    m_inspectorAgent = 0;
+    m_inspectorPageAgent = 0;
+    m_inspectorCSSAgent = 0;
+    m_inspectorConsoleAgent = 0;
+    m_inspectorDOMAgent = 0;
+    m_inspectorResourceAgent = 0;
+    m_inspectorRuntimeAgent = 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_inspectorDOMDebuggerAgent = 0;
+    m_inspectorProfilerAgent = 0;
+#endif
+#if ENABLE(WORKERS)
+    m_inspectorWorkerAgent = 0;
+#endif
+}
+
 InstrumentingAgents* instrumentationForPage(Page* page)
 {
     ASSERT(isMainThread());

Modified: branches/safari-536.30-branch/Source/WebCore/inspector/InstrumentingAgents.h (148458 => 148459)


--- branches/safari-536.30-branch/Source/WebCore/inspector/InstrumentingAgents.h	2013-04-15 19:46:28 UTC (rev 148458)
+++ branches/safari-536.30-branch/Source/WebCore/inspector/InstrumentingAgents.h	2013-04-15 20:05:18 UTC (rev 148459)
@@ -33,6 +33,8 @@
 
 #include <wtf/FastAllocBase.h>
 #include <wtf/Noncopyable.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
 
 namespace WebCore {
 
@@ -55,37 +57,16 @@
 class Page;
 class WorkerContext;
 
-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)
-        , m_inspectorConsoleAgent(0)
-        , m_inspectorDOMAgent(0)
-        , m_inspectorResourceAgent(0)
-        , m_inspectorRuntimeAgent(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_inspectorDOMDebuggerAgent(0)
-        , m_inspectorProfilerAgent(0)
-#endif
-#if ENABLE(WORKERS)
-        , m_inspectorWorkerAgent(0)
-#endif
-    { }
+    static PassRefPtr<InstrumentingAgents> create()
+    {
+        return adoptRef(new InstrumentingAgents());
+    }
     ~InstrumentingAgents() { }
+    void reset();
 
     InspectorAgent* inspectorAgent() const { return m_inspectorAgent; }
     void setInspectorAgent(InspectorAgent* agent) { m_inspectorAgent = agent; }
@@ -143,6 +124,8 @@
 #endif
 
 private:
+    InstrumentingAgents();
+
     InspectorAgent* m_inspectorAgent;
     InspectorPageAgent* m_inspectorPageAgent;
     InspectorCSSAgent* m_inspectorCSSAgent;

Modified: branches/safari-536.30-branch/Source/WebCore/inspector/WorkerInspectorController.cpp (148458 => 148459)


--- branches/safari-536.30-branch/Source/WebCore/inspector/WorkerInspectorController.cpp	2013-04-15 19:46:28 UTC (rev 148458)
+++ branches/safari-536.30-branch/Source/WebCore/inspector/WorkerInspectorController.cpp	2013-04-15 20:05:18 UTC (rev 148459)
@@ -91,7 +91,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())
 {
 
@@ -120,6 +120,7 @@
  
 WorkerInspectorController::~WorkerInspectorController()
 {
+    m_instrumentingAgents->reset();
     disconnectFrontend();
 }
 

Modified: branches/safari-536.30-branch/Source/WebCore/inspector/WorkerInspectorController.h (148458 => 148459)


--- branches/safari-536.30-branch/Source/WebCore/inspector/WorkerInspectorController.h	2013-04-15 19:46:28 UTC (rev 148458)
+++ branches/safari-536.30-branch/Source/WebCore/inspector/WorkerInspectorController.h	2013-04-15 20:05:18 UTC (rev 148459)
@@ -81,7 +81,7 @@
     WorkerContext* m_workerContext;
     OwnPtr<InspectorStateClient> m_stateClient;
     OwnPtr<InspectorState> m_state;
-    OwnPtr<InstrumentingAgents> m_instrumentingAgents;
+    RefPtr<InstrumentingAgents> m_instrumentingAgents;
     OwnPtr<InjectedScriptManager> m_injectedScriptManager;
 #if ENABLE(_javascript__DEBUGGER)
     OwnPtr<InspectorDebuggerAgent> m_debuggerAgent;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to