Changeset 92677 in webkit


Ignore:
Timestamp:
Aug 9, 2011 6:03:20 AM (13 years ago)
Author:
yurys@chromium.org
Message:

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:
Location:
trunk/Source/WebCore
Files:
13 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/CMakeLists.txt

    r92538 r92677  
    885885    inspector/InspectorValues.cpp
    886886    inspector/InspectorWorkerAgent.cpp
     887    inspector/InstrumentingAgents.cpp
    887888    inspector/NetworkResourcesData.cpp
    888889    inspector/PageDebuggerAgent.cpp
  • trunk/Source/WebCore/ChangeLog

    r92674 r92677  
     12011-08-09  Yury Semikhatsky  <yurys@chromium.org>
     2
     3        Web Inspector: get rid of InspectorInstrumentation::inspectorAgents() map
     4        https://bugs.webkit.org/show_bug.cgi?id=54678
     5
     6        Added two functions for retrieving InstrumentingAgents from Page and WorkerContext.
     7
     8        Reviewed by Pavel Feldman.
     9
     10        * CMakeLists.txt:
     11        * GNUmakefile.list.am:
     12        * WebCore.gypi:
     13        * WebCore.pro:
     14        * WebCore.vcproj/WebCore.vcproj:
     15        * WebCore.xcodeproj/project.pbxproj:
     16        * inspector/InspectorController.cpp:
     17        (WebCore::InspectorController::InspectorController):
     18        (WebCore::InspectorController::inspectedPageDestroyed):
     19        * inspector/InspectorController.h:
     20        * inspector/InspectorInstrumentation.cpp:
     21        (WebCore::InspectorInstrumentation::instrumentingAgentsForPage):
     22        * inspector/InspectorInstrumentation.h:
     23        * inspector/InstrumentingAgents.cpp: Copied from Source/WebCore/inspector/WorkerInspectorController.h.
     24        (WebCore::instrumentationForPage):
     25        (WebCore::instrumentationForWorkerContext):
     26        * inspector/InstrumentingAgents.h:
     27        * inspector/WorkerInspectorController.h:
     28
    1292011-08-09  Vsevolod Vlasov  <vsevik@chromium.org>
    230
  • trunk/Source/WebCore/GNUmakefile.list.am

    r92573 r92677  
    20282028        Source/WebCore/inspector/InspectorWorkerAgent.h \
    20292029        Source/WebCore/inspector/InspectorWorkerResource.h \
     2030        Source/WebCore/inspector/InstrumentingAgents.cpp \
    20302031        Source/WebCore/inspector/InstrumentingAgents.h \
    20312032        Source/WebCore/inspector/NetworkResourcesData.cpp \
  • trunk/Source/WebCore/WebCore.gypi

    r92659 r92677  
    27142714            'inspector/InspectorWorkerAgent.cpp',
    27152715            'inspector/InspectorWorkerAgent.h',
     2716            'inspector/InstrumentingAgents.cpp',
    27162717            'inspector/InstrumentingAgents.h',
    27172718            'inspector/NetworkResourcesData.cpp',
  • trunk/Source/WebCore/WebCore.pro

    r92599 r92677  
    844844    inspector/InspectorValues.cpp \
    845845    inspector/InspectorWorkerAgent.cpp \
     846    inspector/InstrumentingAgents.cpp \
    846847    inspector/NetworkResourcesData.cpp \
    847848    inspector/PageDebuggerAgent.cpp \
  • trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj

    r92572 r92677  
    6847968479                        </File>
    6848068480                        <File
     68481                                RelativePath="..\inspector\InstrumentingAgents.cpp"
     68482                                >
     68483                        </File>
     68484                        <File
    6848168485                                RelativePath="..\inspector\InstrumentingAgents.h"
    6848268486                                >
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r92626 r92677  
    56785678                F34742E81343635000531BC2 /* WorkerScriptDebugServer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F34742E61343635000531BC2 /* WorkerScriptDebugServer.cpp */; };
    56795679                F34742E91343635000531BC2 /* WorkerScriptDebugServer.h in Headers */ = {isa = PBXBuildFile; fileRef = F34742E71343635000531BC2 /* WorkerScriptDebugServer.h */; };
     5680                F350B73513F1377D00880C43 /* InstrumentingAgents.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F350B73413F1377D00880C43 /* InstrumentingAgents.cpp */; };
    56805681                F3644AFF1119805900E0D537 /* InjectedScript.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F3644AFD1119805900E0D537 /* InjectedScript.cpp */; };
    56815682                F3644B001119805900E0D537 /* InjectedScript.h in Headers */ = {isa = PBXBuildFile; fileRef = F3644AFE1119805900E0D537 /* InjectedScript.h */; };
     
    1242012421                F34742E61343635000531BC2 /* WorkerScriptDebugServer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WorkerScriptDebugServer.cpp; sourceTree = "<group>"; };
    1242112422                F34742E71343635000531BC2 /* WorkerScriptDebugServer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WorkerScriptDebugServer.h; sourceTree = "<group>"; };
     12423                F350B73413F1377D00880C43 /* InstrumentingAgents.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InstrumentingAgents.cpp; sourceTree = "<group>"; };
    1242212424                F3644AFD1119805900E0D537 /* InjectedScript.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedScript.cpp; sourceTree = "<group>"; };
    1242312425                F3644AFE1119805900E0D537 /* InjectedScript.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedScript.h; sourceTree = "<group>"; };
     
    1359013592                                F3810C1A1365A49600ED6E33 /* InspectorWorkerAgent.h */,
    1359113593                                F375CC061150D300008DDB81 /* InspectorWorkerResource.h */,
     13594                                F350B73413F1377D00880C43 /* InstrumentingAgents.cpp */,
    1359213595                                F3ABFE0B130E9DA000E7F7D1 /* InstrumentingAgents.h */,
    1359313596                                1C81BA050E97348300266E07 /* JavaScriptCallFrame.idl */,
     
    2465324656                                4F3289B511A42AAB005ABE7E /* InspectorValues.cpp in Sources */,
    2465424657                                F3810C1B1365A49600ED6E33 /* InspectorWorkerAgent.cpp in Sources */,
     24658                                F350B73513F1377D00880C43 /* InstrumentingAgents.cpp in Sources */,
    2465524659                                49EECDEB10503C2400099FAB /* Int16Array.cpp in Sources */,
    2465624660                                49EECDE810503C2400099FAB /* Int32Array.cpp in Sources */,
  • trunk/Source/WebCore/inspector/InspectorController.cpp

    r92587 r92677  
    142142    m_runtimeAgent->setScriptDebugServer(&m_debuggerAgent->scriptDebugServer());
    143143#endif
    144 
    145     InspectorInstrumentation::bindInstrumentingAgents(m_page, m_instrumentingAgents.get());
    146144}
    147145
     
    153151void InspectorController::inspectedPageDestroyed()
    154152{
    155     InspectorInstrumentation::unbindInstrumentingAgents(m_page);
    156153    disconnectFrontend();
    157154#if ENABLE(JAVASCRIPT_DEBUGGER)
  • trunk/Source/WebCore/inspector/InspectorController.h

    r92587 r92677  
    125125private:
    126126    friend class PostWorkerNotificationToFrontendTask;
     127    friend InstrumentingAgents* instrumentationForPage(Page*);
    127128
    128129    OwnPtr<InstrumentingAgents> m_instrumentingAgents;
  • trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp

    r92369 r92677  
    7070static const char* const timerFiredEventName = "timerFired";
    7171
    72 InspectorInstrumentation::InstrumentingAgentsMap& InspectorInstrumentation::instrumentingAgents()
    73 {
    74     DEFINE_STATIC_LOCAL(InstrumentingAgentsMap, agents, ());
    75     return agents;
    76 }
    77 
    7872int InspectorInstrumentation::s_frontendCounter = 0;
    7973
     
    875869}
    876870
     871InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForPage(Page* page)
     872{
     873    if (!page)
     874        return 0;
     875    return instrumentationForPage(page);
     876}
     877
    877878} // namespace WebCore
    878879
  • trunk/Source/WebCore/inspector/InspectorInstrumentation.h

    r92369 r92677  
    3737#include "Page.h"
    3838#include "ScriptExecutionContext.h"
    39 #include <wtf/HashMap.h>
    4039
    4140namespace WebCore {
     
    189188
    190189#if ENABLE(INSPECTOR)
    191     static void bindInstrumentingAgents(Page* page, InstrumentingAgents* agents) { instrumentingAgents().set(page, agents); }
    192     static void unbindInstrumentingAgents(Page* page) { instrumentingAgents().remove(page); }
    193190    static void frontendCreated() { s_frontendCounter += 1; }
    194191    static void frontendDeleted() { s_frontendCounter -= 1; }
     
    327324    static InspectorTimelineAgent* retrieveTimelineAgent(const InspectorInstrumentationCookie&);
    328325
    329     typedef HashMap<Page*, InstrumentingAgents*> InstrumentingAgentsMap;
    330     static InstrumentingAgentsMap& instrumentingAgents();
    331326    static int s_frontendCounter;
    332327#endif
     
    10331028}
    10341029
    1035 inline InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForPage(Page* page)
    1036 {
    1037     if (!page)
    1038         return 0;
    1039     return instrumentingAgents().get(page);
    1040 }
    1041 
    10421030inline InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForFrame(Frame* frame)
    10431031{
  • trunk/Source/WebCore/inspector/InstrumentingAgents.cpp

    r92676 r92677  
    2929 */
    3030
    31 #ifndef WorkerInspectorController_h
    32 #define WorkerInspectorController_h
     31#include "config.h"
     32#include "InstrumentingAgents.h"
    3333
    34 #if ENABLE(INSPECTOR) && ENABLE(WORKERS)
     34#if ENABLE(INSPECTOR)
    3535
    36 #include <wtf/FastAllocBase.h>
    37 #include <wtf/Forward.h>
    38 #include <wtf/Noncopyable.h>
    39 #include <wtf/OwnPtr.h>
    40 #include <wtf/RefPtr.h>
     36#include "InspectorController.h"
     37#include "Page.h"
     38#include "WorkerContext.h"
     39#include "WorkerInspectorController.h"
    4140
    4241namespace WebCore {
    4342
    44 class InjectedScriptManager;
    45 #if ENABLE(JAVASCRIPT_DEBUGGER)
    46 class InspectorDebuggerAgent;
    47 #endif
    48 class InspectorBackendDispatcher;
    49 class InspectorFrontend;
    50 class InspectorFrontendChannel;
    51 class InspectorInstrumentation;
    52 class InspectorRuntimeAgent;
    53 class InspectorState;
    54 class InstrumentingAgents;
    55 class WorkerContext;
    56 
    57 class WorkerInspectorController {
    58     WTF_MAKE_NONCOPYABLE(WorkerInspectorController);
    59     WTF_MAKE_FAST_ALLOCATED;
    60 public:
    61     WorkerInspectorController(WorkerContext*);
    62     ~WorkerInspectorController();
    63 
    64     void connectFrontend();
    65     void disconnectFrontend();
    66     void dispatchMessageFromFrontend(const String&);
    67 
    68 private:
    69     WorkerContext* m_workerContext;
    70     OwnPtr<InspectorState> m_state;
    71     OwnPtr<InstrumentingAgents> m_instrumentingAgents;
    72     OwnPtr<InjectedScriptManager> m_injectedScriptManager;
    73 #if ENABLE(JAVASCRIPT_DEBUGGER)
    74     OwnPtr<InspectorDebuggerAgent> m_debuggerAgent;
    75 #endif
    76     OwnPtr<InspectorRuntimeAgent> m_runtimeAgent;
    77 
    78     OwnPtr<InspectorFrontendChannel> m_frontendChannel;
    79     OwnPtr<InspectorFrontend> m_frontend;
    80     RefPtr<InspectorBackendDispatcher> m_backendDispatcher;
    81 };
    82 
     43InstrumentingAgents* instrumentationForPage(Page* page)
     44{
     45    if (InspectorController* controller = page->inspectorController())
     46        return controller->m_instrumentingAgents.get();
     47    return 0;
    8348}
    8449
    85 #endif // ENABLE(WORKERS)
     50#if ENABLE(WORKERS)
     51InstrumentingAgents* instrumentationForWorkerContext(WorkerContext* workerContext)
     52{
     53    if (WorkerInspectorController* controller = workerContext->workerInspectorController())
     54        return controller->m_instrumentingAgents.get();
     55    return 0;
     56}
     57#endif
    8658
    87 #endif // !defined(WorkerInspectorController_h)
     59} // namespace WebCore
     60
     61#endif // ENABLE(INSPECTOR)
  • trunk/Source/WebCore/inspector/InstrumentingAgents.h

    r85850 r92677  
    5252class InspectorTimelineAgent;
    5353class InspectorWorkerAgent;
     54class Page;
     55class WorkerContext;
    5456
    5557class InstrumentingAgents {
     
    165167};
    166168
     169InstrumentingAgents* instrumentationForPage(Page*);
     170#if ENABLE(WORKERS)
     171InstrumentingAgents* instrumentationForWorkerContext(WorkerContext*);
     172#endif
     173
    167174}
    168175
  • trunk/Source/WebCore/inspector/WorkerInspectorController.h

    r87507 r92677  
    6767
    6868private:
     69    friend InstrumentingAgents* instrumentationForWorkerContext(WorkerContext*);
     70
    6971    WorkerContext* m_workerContext;
    7072    OwnPtr<InspectorState> m_state;
Note: See TracChangeset for help on using the changeset viewer.