Diff
Modified: trunk/Source/WebCore/CMakeLists.txt (92676 => 92677)
--- trunk/Source/WebCore/CMakeLists.txt 2011-08-09 12:26:28 UTC (rev 92676)
+++ trunk/Source/WebCore/CMakeLists.txt 2011-08-09 13:03:20 UTC (rev 92677)
@@ -884,6 +884,7 @@
inspector/InspectorTimelineAgent.cpp
inspector/InspectorValues.cpp
inspector/InspectorWorkerAgent.cpp
+ inspector/InstrumentingAgents.cpp
inspector/NetworkResourcesData.cpp
inspector/PageDebuggerAgent.cpp
inspector/ScriptArguments.cpp
Modified: trunk/Source/WebCore/ChangeLog (92676 => 92677)
--- trunk/Source/WebCore/ChangeLog 2011-08-09 12:26:28 UTC (rev 92676)
+++ trunk/Source/WebCore/ChangeLog 2011-08-09 13:03:20 UTC (rev 92677)
@@ -1,3 +1,31 @@
+2011-08-09 Yury Semikhatsky <[email protected]>
+
+ Web Inspector: get rid of InspectorInstrumentation::inspectorAgents() map
+ https://bugs.webkit.org/show_bug.cgi?id=54678
+
+ Added two functions for retrieving InstrumentingAgents from Page and WorkerContext.
+
+ Reviewed by Pavel Feldman.
+
+ * CMakeLists.txt:
+ * GNUmakefile.list.am:
+ * WebCore.gypi:
+ * WebCore.pro:
+ * WebCore.vcproj/WebCore.vcproj:
+ * WebCore.xcodeproj/project.pbxproj:
+ * inspector/InspectorController.cpp:
+ (WebCore::InspectorController::InspectorController):
+ (WebCore::InspectorController::inspectedPageDestroyed):
+ * inspector/InspectorController.h:
+ * inspector/InspectorInstrumentation.cpp:
+ (WebCore::InspectorInstrumentation::instrumentingAgentsForPage):
+ * inspector/InspectorInstrumentation.h:
+ * inspector/InstrumentingAgents.cpp: Copied from Source/WebCore/inspector/WorkerInspectorController.h.
+ (WebCore::instrumentationForPage):
+ (WebCore::instrumentationForWorkerContext):
+ * inspector/InstrumentingAgents.h:
+ * inspector/WorkerInspectorController.h:
+
2011-08-09 Vsevolod Vlasov <[email protected]>
Web Inspector: Add "Refresh" to context menu of resources panel cookies view.
Modified: trunk/Source/WebCore/GNUmakefile.list.am (92676 => 92677)
--- trunk/Source/WebCore/GNUmakefile.list.am 2011-08-09 12:26:28 UTC (rev 92676)
+++ trunk/Source/WebCore/GNUmakefile.list.am 2011-08-09 13:03:20 UTC (rev 92677)
@@ -2027,6 +2027,7 @@
Source/WebCore/inspector/InspectorWorkerAgent.cpp \
Source/WebCore/inspector/InspectorWorkerAgent.h \
Source/WebCore/inspector/InspectorWorkerResource.h \
+ Source/WebCore/inspector/InstrumentingAgents.cpp \
Source/WebCore/inspector/InstrumentingAgents.h \
Source/WebCore/inspector/NetworkResourcesData.cpp \
Source/WebCore/inspector/NetworkResourcesData.h \
Modified: trunk/Source/WebCore/WebCore.gypi (92676 => 92677)
--- trunk/Source/WebCore/WebCore.gypi 2011-08-09 12:26:28 UTC (rev 92676)
+++ trunk/Source/WebCore/WebCore.gypi 2011-08-09 13:03:20 UTC (rev 92677)
@@ -2713,6 +2713,7 @@
'inspector/InspectorWorkerResource.h',
'inspector/InspectorWorkerAgent.cpp',
'inspector/InspectorWorkerAgent.h',
+ 'inspector/InstrumentingAgents.cpp',
'inspector/InstrumentingAgents.h',
'inspector/NetworkResourcesData.cpp',
'inspector/NetworkResourcesData.h',
Modified: trunk/Source/WebCore/WebCore.pro (92676 => 92677)
--- trunk/Source/WebCore/WebCore.pro 2011-08-09 12:26:28 UTC (rev 92676)
+++ trunk/Source/WebCore/WebCore.pro 2011-08-09 13:03:20 UTC (rev 92677)
@@ -843,6 +843,7 @@
inspector/InspectorTimelineAgent.cpp \
inspector/InspectorValues.cpp \
inspector/InspectorWorkerAgent.cpp \
+ inspector/InstrumentingAgents.cpp \
inspector/NetworkResourcesData.cpp \
inspector/PageDebuggerAgent.cpp \
inspector/ScriptArguments.cpp \
Modified: trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj (92676 => 92677)
--- trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj 2011-08-09 12:26:28 UTC (rev 92676)
+++ trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj 2011-08-09 13:03:20 UTC (rev 92677)
@@ -68478,6 +68478,10 @@
>
</File>
<File
+ RelativePath="..\inspector\InstrumentingAgents.cpp"
+ >
+ </File>
+ <File
RelativePath="..\inspector\InstrumentingAgents.h"
>
</File>
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (92676 => 92677)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2011-08-09 12:26:28 UTC (rev 92676)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2011-08-09 13:03:20 UTC (rev 92677)
@@ -5677,6 +5677,7 @@
F34742E51343633C00531BC2 /* PageScriptDebugServer.h in Headers */ = {isa = PBXBuildFile; fileRef = F34742E31343633C00531BC2 /* PageScriptDebugServer.h */; };
F34742E81343635000531BC2 /* WorkerScriptDebugServer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F34742E61343635000531BC2 /* WorkerScriptDebugServer.cpp */; };
F34742E91343635000531BC2 /* WorkerScriptDebugServer.h in Headers */ = {isa = PBXBuildFile; fileRef = F34742E71343635000531BC2 /* WorkerScriptDebugServer.h */; };
+ F350B73513F1377D00880C43 /* InstrumentingAgents.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F350B73413F1377D00880C43 /* InstrumentingAgents.cpp */; };
F3644AFF1119805900E0D537 /* InjectedScript.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F3644AFD1119805900E0D537 /* InjectedScript.cpp */; };
F3644B001119805900E0D537 /* InjectedScript.h in Headers */ = {isa = PBXBuildFile; fileRef = F3644AFE1119805900E0D537 /* InjectedScript.h */; };
F36E07A41358A8BE00AACBC9 /* WorkerInspectorController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F36E07A21358A8BE00AACBC9 /* WorkerInspectorController.cpp */; };
@@ -12419,6 +12420,7 @@
F34742E31343633C00531BC2 /* PageScriptDebugServer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageScriptDebugServer.h; sourceTree = "<group>"; };
F34742E61343635000531BC2 /* WorkerScriptDebugServer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WorkerScriptDebugServer.cpp; sourceTree = "<group>"; };
F34742E71343635000531BC2 /* WorkerScriptDebugServer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WorkerScriptDebugServer.h; sourceTree = "<group>"; };
+ F350B73413F1377D00880C43 /* InstrumentingAgents.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InstrumentingAgents.cpp; sourceTree = "<group>"; };
F3644AFD1119805900E0D537 /* InjectedScript.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedScript.cpp; sourceTree = "<group>"; };
F3644AFE1119805900E0D537 /* InjectedScript.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedScript.h; sourceTree = "<group>"; };
F36E07A21358A8BE00AACBC9 /* WorkerInspectorController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WorkerInspectorController.cpp; sourceTree = "<group>"; };
@@ -13589,6 +13591,7 @@
F3810C191365A49600ED6E33 /* InspectorWorkerAgent.cpp */,
F3810C1A1365A49600ED6E33 /* InspectorWorkerAgent.h */,
F375CC061150D300008DDB81 /* InspectorWorkerResource.h */,
+ F350B73413F1377D00880C43 /* InstrumentingAgents.cpp */,
F3ABFE0B130E9DA000E7F7D1 /* InstrumentingAgents.h */,
1C81BA050E97348300266E07 /* _javascript_CallFrame.idl */,
BCC64F5F0DCFB84E0081EF3B /* localizedStrings.js */,
@@ -24652,6 +24655,7 @@
754133AA102E00F400075D00 /* InspectorTimelineAgent.cpp in Sources */,
4F3289B511A42AAB005ABE7E /* InspectorValues.cpp in Sources */,
F3810C1B1365A49600ED6E33 /* InspectorWorkerAgent.cpp in Sources */,
+ F350B73513F1377D00880C43 /* InstrumentingAgents.cpp in Sources */,
49EECDEB10503C2400099FAB /* Int16Array.cpp in Sources */,
49EECDE810503C2400099FAB /* Int32Array.cpp in Sources */,
49C7B9CB1042D32F0009D447 /* Int8Array.cpp in Sources */,
Modified: trunk/Source/WebCore/inspector/InspectorController.cpp (92676 => 92677)
--- trunk/Source/WebCore/inspector/InspectorController.cpp 2011-08-09 12:26:28 UTC (rev 92676)
+++ trunk/Source/WebCore/inspector/InspectorController.cpp 2011-08-09 13:03:20 UTC (rev 92677)
@@ -141,8 +141,6 @@
#if ENABLE(_javascript__DEBUGGER)
m_runtimeAgent->setScriptDebugServer(&m_debuggerAgent->scriptDebugServer());
#endif
-
- InspectorInstrumentation::bindInstrumentingAgents(m_page, m_instrumentingAgents.get());
}
InspectorController::~InspectorController()
@@ -152,7 +150,6 @@
void InspectorController::inspectedPageDestroyed()
{
- InspectorInstrumentation::unbindInstrumentingAgents(m_page);
disconnectFrontend();
#if ENABLE(_javascript__DEBUGGER)
m_domDebuggerAgent.clear();
Modified: trunk/Source/WebCore/inspector/InspectorController.h (92676 => 92677)
--- trunk/Source/WebCore/inspector/InspectorController.h 2011-08-09 12:26:28 UTC (rev 92676)
+++ trunk/Source/WebCore/inspector/InspectorController.h 2011-08-09 13:03:20 UTC (rev 92677)
@@ -124,6 +124,7 @@
private:
friend class PostWorkerNotificationToFrontendTask;
+ friend InstrumentingAgents* instrumentationForPage(Page*);
OwnPtr<InstrumentingAgents> m_instrumentingAgents;
OwnPtr<InjectedScriptManager> m_injectedScriptManager;
Modified: trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp (92676 => 92677)
--- trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp 2011-08-09 12:26:28 UTC (rev 92676)
+++ trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp 2011-08-09 13:03:20 UTC (rev 92677)
@@ -69,12 +69,6 @@
static const char* const clearTimerEventName = "clearTimer";
static const char* const timerFiredEventName = "timerFired";
-InspectorInstrumentation::InstrumentingAgentsMap& InspectorInstrumentation::instrumentingAgents()
-{
- DEFINE_STATIC_LOCAL(InstrumentingAgentsMap, agents, ());
- return agents;
-}
-
int InspectorInstrumentation::s_frontendCounter = 0;
static bool eventHasListeners(const AtomicString& eventType, DOMWindow* window, Node* node, const Vector<EventContext>& ancestors)
@@ -874,6 +868,13 @@
return 0;
}
+InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForPage(Page* page)
+{
+ if (!page)
+ return 0;
+ return instrumentationForPage(page);
+}
+
} // namespace WebCore
#endif // !ENABLE(INSPECTOR)
Modified: trunk/Source/WebCore/inspector/InspectorInstrumentation.h (92676 => 92677)
--- trunk/Source/WebCore/inspector/InspectorInstrumentation.h 2011-08-09 12:26:28 UTC (rev 92676)
+++ trunk/Source/WebCore/inspector/InspectorInstrumentation.h 2011-08-09 13:03:20 UTC (rev 92677)
@@ -36,7 +36,6 @@
#include "Frame.h"
#include "Page.h"
#include "ScriptExecutionContext.h"
-#include <wtf/HashMap.h>
namespace WebCore {
@@ -188,8 +187,6 @@
#endif
#if ENABLE(INSPECTOR)
- static void bindInstrumentingAgents(Page* page, InstrumentingAgents* agents) { instrumentingAgents().set(page, agents); }
- static void unbindInstrumentingAgents(Page* page) { instrumentingAgents().remove(page); }
static void frontendCreated() { s_frontendCounter += 1; }
static void frontendDeleted() { s_frontendCounter -= 1; }
static bool hasFrontends() { return s_frontendCounter; }
@@ -326,8 +323,6 @@
static void cancelPauseOnNativeEvent(InstrumentingAgents*);
static InspectorTimelineAgent* retrieveTimelineAgent(const InspectorInstrumentationCookie&);
- typedef HashMap<Page*, InstrumentingAgents*> InstrumentingAgentsMap;
- static InstrumentingAgentsMap& instrumentingAgents();
static int s_frontendCounter;
#endif
};
@@ -1032,13 +1027,6 @@
return 0;
}
-inline InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForPage(Page* page)
-{
- if (!page)
- return 0;
- return instrumentingAgents().get(page);
-}
-
inline InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForFrame(Frame* frame)
{
if (frame)
Copied: trunk/Source/WebCore/inspector/InstrumentingAgents.cpp (from rev 92676, trunk/Source/WebCore/inspector/WorkerInspectorController.h) (0 => 92677)
--- trunk/Source/WebCore/inspector/InstrumentingAgents.cpp (rev 0)
+++ trunk/Source/WebCore/inspector/InstrumentingAgents.cpp 2011-08-09 13:03:20 UTC (rev 92677)
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "InstrumentingAgents.h"
+
+#if ENABLE(INSPECTOR)
+
+#include "InspectorController.h"
+#include "Page.h"
+#include "WorkerContext.h"
+#include "WorkerInspectorController.h"
+
+namespace WebCore {
+
+InstrumentingAgents* instrumentationForPage(Page* page)
+{
+ if (InspectorController* controller = page->inspectorController())
+ return controller->m_instrumentingAgents.get();
+ return 0;
+}
+
+#if ENABLE(WORKERS)
+InstrumentingAgents* instrumentationForWorkerContext(WorkerContext* workerContext)
+{
+ if (WorkerInspectorController* controller = workerContext->workerInspectorController())
+ return controller->m_instrumentingAgents.get();
+ return 0;
+}
+#endif
+
+} // namespace WebCore
+
+#endif // ENABLE(INSPECTOR)
Modified: trunk/Source/WebCore/inspector/InstrumentingAgents.h (92676 => 92677)
--- trunk/Source/WebCore/inspector/InstrumentingAgents.h 2011-08-09 12:26:28 UTC (rev 92676)
+++ trunk/Source/WebCore/inspector/InstrumentingAgents.h 2011-08-09 13:03:20 UTC (rev 92677)
@@ -51,6 +51,8 @@
class InspectorRuntimeAgent;
class InspectorTimelineAgent;
class InspectorWorkerAgent;
+class Page;
+class WorkerContext;
class InstrumentingAgents {
WTF_MAKE_NONCOPYABLE(InstrumentingAgents);
@@ -164,6 +166,11 @@
#endif
};
+InstrumentingAgents* instrumentationForPage(Page*);
+#if ENABLE(WORKERS)
+InstrumentingAgents* instrumentationForWorkerContext(WorkerContext*);
+#endif
+
}
#endif // !defined(InstrumentingAgents_h)
Modified: trunk/Source/WebCore/inspector/WorkerInspectorController.h (92676 => 92677)
--- trunk/Source/WebCore/inspector/WorkerInspectorController.h 2011-08-09 12:26:28 UTC (rev 92676)
+++ trunk/Source/WebCore/inspector/WorkerInspectorController.h 2011-08-09 13:03:20 UTC (rev 92677)
@@ -66,6 +66,8 @@
void dispatchMessageFromFrontend(const String&);
private:
+ friend InstrumentingAgents* instrumentationForWorkerContext(WorkerContext*);
+
WorkerContext* m_workerContext;
OwnPtr<InspectorState> m_state;
OwnPtr<InstrumentingAgents> m_instrumentingAgents;