Changeset 84773 in webkit


Ignore:
Timestamp:
Apr 25, 2011 6:27:49 AM (13 years ago)
Author:
yurys@chromium.org
Message:

2011-04-25 Yury Semikhatsky <yurys@chromium.org>

Reviewed by Pavel Feldman.

Web Inspector: introduce InspectorWorkerAgent
https://bugs.webkit.org/show_bug.cgi?id=59320

InspectorWorkerAgent is responsible for routing inspector messages
between worker context inspector agents and corresponding worker
inspector front-end.

  • CMakeLists.txt:
  • GNUmakefile.list.am:
  • WebCore.gypi:
  • WebCore.pro:
  • WebCore.vcproj/WebCore.vcproj:
  • WebCore.xcodeproj/project.pbxproj:
  • inspector/CodeGeneratorInspector.pm:
  • inspector/Inspector.json:
  • inspector/InspectorAgent.cpp: (WebCore::InspectorAgent::InspectorAgent): (WebCore::InspectorAgent::setFrontend): (WebCore::InspectorAgent::disconnectFrontend):
  • inspector/InspectorAgent.h: (WebCore::InspectorAgent::workerAgent):
  • inspector/InspectorController.cpp: (WebCore::InspectorController::connectFrontend): (WebCore::InspectorController::disconnectFrontend):
  • inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::didStartWorkerContextImpl):
  • inspector/InspectorInstrumentation.h: (WebCore::InspectorInstrumentation::willStartWorkerContext): (WebCore::InspectorInstrumentation::didStartWorkerContext):
  • inspector/InspectorWorkerAgent.cpp: Added. (WebCore::InspectorWorkerAgent::WorkerFrontendChannel::WorkerFrontendChannel): (WebCore::InspectorWorkerAgent::WorkerFrontendChannel::~WorkerFrontendChannel): (WebCore::InspectorWorkerAgent::WorkerFrontendChannel::id): (WebCore::InspectorWorkerAgent::WorkerFrontendChannel::inspectorProxy): (WebCore::InspectorWorkerAgent::WorkerFrontendChannel::sendMessageToFrontend): (WebCore::InspectorWorkerAgent::create): (WebCore::InspectorWorkerAgent::InspectorWorkerAgent): (WebCore::InspectorWorkerAgent::~InspectorWorkerAgent): (WebCore::InspectorWorkerAgent::setFrontend): (WebCore::InspectorWorkerAgent::clearFrontend): (WebCore::InspectorWorkerAgent::dispatchMessageOnWorkerInspector): (WebCore::InspectorWorkerAgent::didStartWorkerContext):
  • inspector/InspectorWorkerAgent.h: Added.
  • inspector/InstrumentingAgents.h: (WebCore::InstrumentingAgents::InstrumentingAgents): (WebCore::InstrumentingAgents::inspectorWorkerAgent): (WebCore::InstrumentingAgents::setInspectorWorkerAgent):
  • inspector/WorkerInspectorController.cpp: (WebCore::WorkerInspectorController::connectFrontend):
  • inspector/generate-inspector-idl:
  • workers/Worker.cpp: (WebCore::Worker::notifyFinished):
  • workers/WorkerContextInspectorProxy.h: Added. Platform-specific transport for inspector messages sent from the inspected page worker agent to the worker context inspector agents. (WebCore::WorkerContextInspectorProxy::connectFrontend): (WebCore::WorkerContextInspectorProxy::disconnectFrontend): (WebCore::WorkerContextInspectorProxy::sendMessageToWorkerContextInspector): (WebCore::WorkerContextInspectorProxy::~WorkerContextInspectorProxy):
  • workers/WorkerContextProxy.h: (WebCore::WorkerContextProxy::inspectorProxy):
Location:
trunk/Source/WebCore
Files:
1 added
19 edited
2 copied

Legend:

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

    r84522 r84773  
    924924    inspector/InspectorTimelineAgent.cpp
    925925    inspector/InspectorValues.cpp
     926    inspector/InspectorWorkerAgent.cpp
    926927    inspector/PageDebuggerAgent.cpp
    927928    inspector/ScriptArguments.cpp
  • trunk/Source/WebCore/ChangeLog

    r84772 r84773  
     12011-04-25  Yury Semikhatsky  <yurys@chromium.org>
     2
     3        Reviewed by Pavel Feldman.
     4
     5        Web Inspector: introduce InspectorWorkerAgent
     6        https://bugs.webkit.org/show_bug.cgi?id=59320
     7
     8        InspectorWorkerAgent is responsible for routing inspector messages
     9        between worker context inspector agents and corresponding worker
     10        inspector front-end.
     11
     12        * CMakeLists.txt:
     13        * GNUmakefile.list.am:
     14        * WebCore.gypi:
     15        * WebCore.pro:
     16        * WebCore.vcproj/WebCore.vcproj:
     17        * WebCore.xcodeproj/project.pbxproj:
     18        * inspector/CodeGeneratorInspector.pm:
     19        * inspector/Inspector.json:
     20        * inspector/InspectorAgent.cpp:
     21        (WebCore::InspectorAgent::InspectorAgent):
     22        (WebCore::InspectorAgent::setFrontend):
     23        (WebCore::InspectorAgent::disconnectFrontend):
     24        * inspector/InspectorAgent.h:
     25        (WebCore::InspectorAgent::workerAgent):
     26        * inspector/InspectorController.cpp:
     27        (WebCore::InspectorController::connectFrontend):
     28        (WebCore::InspectorController::disconnectFrontend):
     29        * inspector/InspectorInstrumentation.cpp:
     30        (WebCore::InspectorInstrumentation::didStartWorkerContextImpl):
     31        * inspector/InspectorInstrumentation.h:
     32        (WebCore::InspectorInstrumentation::willStartWorkerContext):
     33        (WebCore::InspectorInstrumentation::didStartWorkerContext):
     34        * inspector/InspectorWorkerAgent.cpp: Added.
     35        (WebCore::InspectorWorkerAgent::WorkerFrontendChannel::WorkerFrontendChannel):
     36        (WebCore::InspectorWorkerAgent::WorkerFrontendChannel::~WorkerFrontendChannel):
     37        (WebCore::InspectorWorkerAgent::WorkerFrontendChannel::id):
     38        (WebCore::InspectorWorkerAgent::WorkerFrontendChannel::inspectorProxy):
     39        (WebCore::InspectorWorkerAgent::WorkerFrontendChannel::sendMessageToFrontend):
     40        (WebCore::InspectorWorkerAgent::create):
     41        (WebCore::InspectorWorkerAgent::InspectorWorkerAgent):
     42        (WebCore::InspectorWorkerAgent::~InspectorWorkerAgent):
     43        (WebCore::InspectorWorkerAgent::setFrontend):
     44        (WebCore::InspectorWorkerAgent::clearFrontend):
     45        (WebCore::InspectorWorkerAgent::dispatchMessageOnWorkerInspector):
     46        (WebCore::InspectorWorkerAgent::didStartWorkerContext):
     47        * inspector/InspectorWorkerAgent.h: Added.
     48        * inspector/InstrumentingAgents.h:
     49        (WebCore::InstrumentingAgents::InstrumentingAgents):
     50        (WebCore::InstrumentingAgents::inspectorWorkerAgent):
     51        (WebCore::InstrumentingAgents::setInspectorWorkerAgent):
     52        * inspector/WorkerInspectorController.cpp:
     53        (WebCore::WorkerInspectorController::connectFrontend):
     54        * inspector/generate-inspector-idl:
     55        * workers/Worker.cpp:
     56        (WebCore::Worker::notifyFinished):
     57        * workers/WorkerContextInspectorProxy.h: Added. Platform-specific transport for inspector
     58        messages sent from the inspected page worker agent to the worker context inspector agents.
     59        (WebCore::WorkerContextInspectorProxy::connectFrontend):
     60        (WebCore::WorkerContextInspectorProxy::disconnectFrontend):
     61        (WebCore::WorkerContextInspectorProxy::sendMessageToWorkerContextInspector):
     62        (WebCore::WorkerContextInspectorProxy::~WorkerContextInspectorProxy):
     63        * workers/WorkerContextProxy.h:
     64        (WebCore::WorkerContextProxy::inspectorProxy):
     65
    1662011-04-25  Pavel Feldman  <pfeldman@google.com>
    267
  • trunk/Source/WebCore/GNUmakefile.list.am

    r84665 r84773  
    19941994        Source/WebCore/inspector/InspectorValues.cpp \
    19951995        Source/WebCore/inspector/InspectorValues.h \
     1996        Source/WebCore/inspector/InspectorWorkerAgent.cpp \
     1997        Source/WebCore/inspector/InspectorWorkerAgent.h \
    19961998        Source/WebCore/inspector/InspectorWorkerResource.h \
    19971999        Source/WebCore/inspector/InstrumentingAgents.h \
     
    36333635        Source/WebCore/workers/WorkerContext.cpp \
    36343636        Source/WebCore/workers/WorkerContext.h \
     3637        Source/WebCore/workers/WorkerContextInspectorProxy.h \
    36353638        Source/WebCore/workers/WorkerContextProxy.h \
    36363639        Source/WebCore/workers/Worker.cpp \
  • trunk/Source/WebCore/WebCore.gypi

    r84665 r84773  
    32903290            'inspector/InspectorValues.cpp',
    32913291            'inspector/InspectorWorkerResource.h',
     3292            'inspector/InspectorWorkerAgent.cpp',
     3293            'inspector/InspectorWorkerAgent.h',
    32923294            'inspector/InstrumentingAgents.h',
    32933295            'inspector/PageDebuggerAgent.cpp',
     
    60676069            'workers/WorkerContext.cpp',
    60686070            'workers/WorkerContext.h',
     6071            'workers/WorkerContextInspectorProxy.h',
    60696072            'workers/WorkerContextProxy.h',
    60706073            'workers/WorkerLoaderProxy.h',
  • trunk/Source/WebCore/WebCore.pro

    r84668 r84773  
    844844    inspector/InspectorTimelineAgent.cpp \
    845845    inspector/InspectorValues.cpp \
     846    inspector/InspectorWorkerAgent.cpp \
    846847    inspector/PageDebuggerAgent.cpp \
    847848    inspector/ScriptArguments.cpp \
     
    17911792    inspector/InspectorStyleSheet.h \
    17921793    inspector/InspectorTimelineAgent.h \
     1794    inspector/InspectorWorkerAgent.h \
    17931795    inspector/InstrumentingAgents.h \
    17941796    inspector/PageDebuggerAgent.h \
  • trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj

    r84665 r84773  
    4826748267                        </File>
    4826848268                        <File
     48269                                RelativePath="..\workers\WorkerContextInspectorProxy.h"
     48270                                >
     48271                        </File>
     48272                        <File
    4826948273                                RelativePath="..\workers\WorkerContextProxy.h"
    4827048274                                >
     
    6720467208                        <File
    6720567209                                RelativePath="..\inspector\InspectorValues.h"
     67210                                >
     67211                        </File>
     67212                        <File
     67213                                RelativePath="..\inspector\InspectorWorkerAgent.cpp"
     67214                                >
     67215                        </File>
     67216                        <File
     67217                                RelativePath="..\inspector\InspectorWorkerAgent.h"
    6720667218                                >
    6720767219                        </File>
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r84764 r84773  
    57305730                F36E07A51358A8BE00AACBC9 /* WorkerInspectorController.h in Headers */ = {isa = PBXBuildFile; fileRef = F36E07A31358A8BE00AACBC9 /* WorkerInspectorController.h */; };
    57315731                F375CC071150D300008DDB81 /* InspectorWorkerResource.h in Headers */ = {isa = PBXBuildFile; fileRef = F375CC061150D300008DDB81 /* InspectorWorkerResource.h */; };
     5732                F3810C1B1365A49600ED6E33 /* InspectorWorkerAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F3810C191365A49600ED6E33 /* InspectorWorkerAgent.cpp */; };
     5733                F3810C1C1365A49600ED6E33 /* InspectorWorkerAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = F3810C1A1365A49600ED6E33 /* InspectorWorkerAgent.h */; };
     5734                F3810C1E1365A4D400ED6E33 /* WorkerContextInspectorProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = F3810C1D1365A4D400ED6E33 /* WorkerContextInspectorProxy.h */; };
    57325735                F392249C126F11AE00A926D9 /* ScriptCallStackFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F392249A126F11AE00A926D9 /* ScriptCallStackFactory.cpp */; };
    57335736                F392249D126F11AE00A926D9 /* ScriptCallStackFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = F392249B126F11AE00A926D9 /* ScriptCallStackFactory.h */; };
     
    1229612299                F36E07A31358A8BE00AACBC9 /* WorkerInspectorController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WorkerInspectorController.h; sourceTree = "<group>"; };
    1229712300                F375CC061150D300008DDB81 /* InspectorWorkerResource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorWorkerResource.h; sourceTree = "<group>"; };
     12301                F3810C191365A49600ED6E33 /* InspectorWorkerAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorWorkerAgent.cpp; sourceTree = "<group>"; };
     12302                F3810C1A1365A49600ED6E33 /* InspectorWorkerAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorWorkerAgent.h; sourceTree = "<group>"; };
     12303                F3810C1D1365A4D400ED6E33 /* WorkerContextInspectorProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WorkerContextInspectorProxy.h; path = workers/WorkerContextInspectorProxy.h; sourceTree = "<group>"; };
    1229812304                F392249A126F11AE00A926D9 /* ScriptCallStackFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptCallStackFactory.cpp; sourceTree = "<group>"; };
    1229912305                F392249B126F11AE00A926D9 /* ScriptCallStackFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptCallStackFactory.h; sourceTree = "<group>"; };
     
    1337313379                                4F3289B311A42AAB005ABE7E /* InspectorValues.cpp */,
    1337413380                                4F3289B411A42AAB005ABE7E /* InspectorValues.h */,
     13381                                F3810C191365A49600ED6E33 /* InspectorWorkerAgent.cpp */,
     13382                                F3810C1A1365A49600ED6E33 /* InspectorWorkerAgent.h */,
    1337513383                                F375CC061150D300008DDB81 /* InspectorWorkerResource.h */,
    1337613384                                F3ABFE0B130E9DA000E7F7D1 /* InstrumentingAgents.h */,
     
    1350913517                                2E4346370F546A8200B0F1BA /* WorkerContext.h */,
    1351013518                                2E4346380F546A8200B0F1BA /* WorkerContext.idl */,
     13519                                F3810C1D1365A4D400ED6E33 /* WorkerContextInspectorProxy.h */,
    1351113520                                2E4346390F546A8200B0F1BA /* WorkerContextProxy.h */,
    1351213521                                18F831B70FD48C7800D8C56B /* WorkerLoaderProxy.h */,
     
    2306923078                                4358E8811360A31700E4748C /* FEDropShadow.h in Headers */,
    2307023079                                4358E8861360A33B00E4748C /* SVGFEDropShadowElement.h in Headers */,
     23080                                F3810C1C1365A49600ED6E33 /* InspectorWorkerAgent.h in Headers */,
     23081                                F3810C1E1365A4D400ED6E33 /* WorkerContextInspectorProxy.h in Headers */,
    2307123082                        );
    2307223083                        runOnlyForDeploymentPostprocessing = 0;
     
    2578525796                                4358E8851360A33B00E4748C /* SVGFEDropShadowElement.cpp in Sources */,
    2578625797                                14E0BC56136148A8002AD12E /* JSDOMTokenListCustom.cpp in Sources */,
     25798                                F3810C1B1365A49600ED6E33 /* InspectorWorkerAgent.cpp in Sources */,
    2578725799                        );
    2578825800                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/Source/WebCore/inspector/CodeGeneratorInspector.pm

    r83739 r84773  
    8585    "header" => "InspectorTimelineAgent.h",
    8686    "domainAccessor" => "m_timelineAgent",
     87};
     88$typeTransform{"Worker"} = {
     89    "forward" => "InspectorWorkerAgent",
     90    "header" => "InspectorWorkerAgent.h",
     91    "domainAccessor" => "m_workerAgent",
    8792};
    8893
  • trunk/Source/WebCore/inspector/Inspector.json

    r84772 r84773  
    16751675            }
    16761676        ]
    1677     }
     1677    },
     1678    {
     1679        "domain": "Worker",
     1680        "types": [],
     1681        "commands": [
     1682            {
     1683                "name": "sendMessageToWorker",
     1684                "parameters": [
     1685                    { "name": "workerId", "type": "integer" },
     1686                    { "name": "message", "type": "object" }
     1687                ]
     1688            }
     1689        ],
     1690        "events": [
     1691            {
     1692                "name": "workerCreated",
     1693                "parameters": [
     1694                    { "name": "workerId", "type": "integer" }
     1695                ]
     1696            },
     1697            {
     1698                "name": "dispatchMessageFromWorker",
     1699                "parameters": [
     1700                    { "name": "workerId", "type": "integer" },
     1701                    { "name": "message", "type": "object" }
     1702                ]
     1703            }
     1704        ]
     1705    },
    16781706]
  • trunk/Source/WebCore/inspector/InspectorAgent.cpp

    r84134 r84773  
    5555#include "InspectorTimelineAgent.h"
    5656#include "InspectorValues.h"
     57#include "InspectorWorkerAgent.h"
    5758#include "InspectorWorkerResource.h"
    5859#include "InstrumentingAgents.h"
     
    134135    , m_profilerAgent(InspectorProfilerAgent::create(m_instrumentingAgents.get(), m_consoleAgent.get(), page, m_state.get()))
    135136#endif
     137#if ENABLE(WORKERS)
     138    , m_workerAgent(InspectorWorkerAgent::create(m_instrumentingAgents.get()))
     139#endif
    136140    , m_canIssueEvaluateForTestInFrontend(false)
    137141{
     
    253257    }
    254258#endif
     259#if ENABLE(WORKERS)
     260    m_workerAgent->setFrontend(m_frontend);
     261#endif
     262
    255263    // Dispatch pending frontend commands
    256264    issueEvaluateForTestCommands();
     
    292300#endif
    293301    m_pageAgent->clearFrontend();
     302#if ENABLE(WORKERS)
     303    m_workerAgent->clearFrontend();
     304#endif
    294305}
    295306
  • trunk/Source/WebCore/inspector/InspectorAgent.h

    r83599 r84773  
    7171class InspectorTimelineAgent;
    7272class InspectorValue;
     73class InspectorWorkerAgent;
    7374class InspectorWorkerResource;
    7475class InstrumentingAgents;
     
    140141    InspectorApplicationCacheAgent* applicationCacheAgent() { return m_applicationCacheAgent.get(); }
    141142#endif
     143#if ENABLE(WORKERS)
     144    InspectorWorkerAgent* workerAgent() { return m_workerAgent.get(); }
     145#endif
    142146
    143147    void didClearWindowObjectInWorld(Frame*, DOMWrapperWorld*);
     
    223227    typedef HashMap<intptr_t, RefPtr<InspectorWorkerResource> > WorkersMap;
    224228    WorkersMap m_workers;
     229    OwnPtr<InspectorWorkerAgent> m_workerAgent;
    225230#endif
    226231    bool m_canIssueEvaluateForTestInFrontend;
  • trunk/Source/WebCore/inspector/InspectorController.cpp

    r83892 r84773  
    4949#include "InspectorProfilerAgent.h"
    5050#include "InspectorTimelineAgent.h"
     51#include "InspectorWorkerAgent.h"
    5152#include "Page.h"
    5253#include "ScriptObject.h"
    5354#include "Settings.h"
     55#include <wtf/UnusedParam.h>
    5456
    5557namespace WebCore {
     
    139141#endif
    140142        m_inspectorAgent->runtimeAgent(),
    141         m_inspectorAgent->timelineAgent());
     143        m_inspectorAgent->timelineAgent()
     144#if ENABLE(WORKERS)
     145        , m_inspectorAgent->workerAgent()
     146#endif
     147    );
    142148
    143149    if (m_startUserInitiatedDebuggingWhenFrontedIsConnected) {
     
    161167    if (!InspectorInstrumentation::hasFrontends())
    162168        ScriptController::setCaptureCallStackForUncaughtExceptions(false);
    163 
    164169}
    165170
  • trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp

    r84772 r84773  
    5252#include "InspectorResourceAgent.h"
    5353#include "InspectorTimelineAgent.h"
     54#include "InspectorWorkerAgent.h"
    5455#include "InstrumentingAgents.h"
    5556#include "ScriptArguments.h"
     
    711712
    712713#if ENABLE(WORKERS)
     714void InspectorInstrumentation::didStartWorkerContextImpl(InspectorAgent* inspectorAgent, WorkerContextProxy* workerContextProxy)
     715{
     716    if (InspectorWorkerAgent* workerAgent = inspectorAgent->instrumentingAgents()->inspectorWorkerAgent())
     717        workerAgent->didStartWorkerContext(workerContextProxy);
     718}
     719
    713720void InspectorInstrumentation::didCreateWorkerImpl(InspectorAgent* inspectorAgent, intptr_t id, const String& url, bool isSharedWorker)
    714721{
  • trunk/Source/WebCore/inspector/InspectorInstrumentation.h

    r84260 r84773  
    6060class ScriptExecutionContext;
    6161class StorageArea;
     62class WorkerContextProxy;
    6263class XMLHttpRequest;
    6364
     
    158159
    159160#if ENABLE(WORKERS)
     161    static bool willStartWorkerContext(ScriptExecutionContext*, WorkerContextProxy*);
     162    static void didStartWorkerContext(ScriptExecutionContext*, WorkerContextProxy*, bool paused);
    160163    static void didCreateWorker(ScriptExecutionContext*, intptr_t id, const String& url, bool isSharedWorker);
    161164    static void didDestroyWorker(ScriptExecutionContext*, intptr_t id);
     
    278281
    279282#if ENABLE(WORKERS)
     283    static void didStartWorkerContextImpl(InspectorAgent*, WorkerContextProxy*);
    280284    static void didCreateWorkerImpl(InspectorAgent*, intptr_t id, const String& url, bool isSharedWorker);
    281285    static void didDestroyWorkerImpl(InspectorAgent*, intptr_t id);
     
    802806
    803807#if ENABLE(WORKERS)
     808inline bool InspectorInstrumentation::willStartWorkerContext(ScriptExecutionContext* context, WorkerContextProxy*)
     809{
     810#if ENABLE(INSPECTOR)
     811    return inspectorAgentWithFrontendForContext(context);
     812#else
     813    return false;
     814#endif
     815}
     816
     817inline void InspectorInstrumentation::didStartWorkerContext(ScriptExecutionContext* context, WorkerContextProxy* proxy, bool paused)
     818{
     819#if ENABLE(INSPECTOR)
     820    if (!paused)
     821        return;
     822    if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForContext(context))
     823        didStartWorkerContextImpl(inspectorAgent, proxy);
     824#endif
     825}
     826
    804827inline void InspectorInstrumentation::didCreateWorker(ScriptExecutionContext* context, intptr_t id, const String& url, bool isSharedWorker)
    805828{
  • trunk/Source/WebCore/inspector/InspectorWorkerAgent.h

    r84772 r84773  
    11/*
    2  * Copyright (C) 2009 Google Inc. All rights reserved.
     2 * Copyright (C) 2011 Google Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2929 */
    3030
    31 #ifndef WorkerContextProxy_h
    32 #define WorkerContextProxy_h
     31#ifndef InspectorWorkerAgent_h
     32#define InspectorWorkerAgent_h
    3333
    3434#if ENABLE(WORKERS)
    3535
    36 #include "MessagePort.h"
    3736#include <wtf/Forward.h>
    38 #include <wtf/PassOwnPtr.h>
     37#include <wtf/HashMap.h>
    3938
    4039namespace WebCore {
     40class InspectorFrontend;
     41class InspectorObject;
     42class InstrumentingAgents;
     43class WorkerContextProxy;
     44class WorkerContextInspectorProxy;
    4145
    42     class KURL;
    43     class Worker;
     46typedef String ErrorString;
    4447
    45     // A proxy to talk to the worker context.
    46     class WorkerContextProxy {
    47     public:
    48         static WorkerContextProxy* create(Worker*);
     48class InspectorWorkerAgent {
     49public:
     50    static PassOwnPtr<InspectorWorkerAgent> create(InstrumentingAgents*);
     51    ~InspectorWorkerAgent();
    4952
    50         virtual ~WorkerContextProxy() {}
     53    void setFrontend(InspectorFrontend*);
     54    void clearFrontend();
    5155
    52         virtual void startWorkerContext(const KURL& scriptURL, const String& userAgent, const String& sourceCode) = 0;
     56    // Called from InspectorInstrumentation
     57    void didStartWorkerContext(WorkerContextProxy*);
    5358
    54         virtual void terminateWorkerContext() = 0;
     59    // Called from InspectorBackendDispatcher
     60    void sendMessageToWorker(ErrorString*, int workerId, PassRefPtr<InspectorObject> message);
    5561
    56         virtual void postMessageToWorkerContext(PassRefPtr<SerializedScriptValue>, PassOwnPtr<MessagePortChannelArray>) = 0;
     62private:
     63    explicit InspectorWorkerAgent(InstrumentingAgents*);
    5764
    58         virtual bool hasPendingActivity() const = 0;
     65    InstrumentingAgents* m_instrumentingAgents;
     66    InspectorFrontend* m_inspectorFrontend;
    5967
    60         virtual void workerObjectDestroyed() = 0;
    61     };
     68    class WorkerFrontendChannel;
     69    HashMap<int, WorkerFrontendChannel*> m_idToChannel;
     70};
    6271
    6372} // namespace WebCore
    6473
     74#endif // !defined(InspectorWorkerAgent_h)
     75
    6576#endif // ENABLE(WORKERS)
    66 
    67 #endif // WorkerContextProxy_h
  • trunk/Source/WebCore/inspector/InstrumentingAgents.h

    r82281 r84773  
    5151class InspectorRuntimeAgent;
    5252class InspectorTimelineAgent;
     53class InspectorWorkerAgent;
    5354
    5455class InstrumentingAgents {
     
    7879        , m_inspectorBrowserDebuggerAgent(0)
    7980        , m_inspectorProfilerAgent(0)
     81#endif
     82#if ENABLE(WORKERS)
     83        , m_inspectorWorkerAgent(0)
    8084#endif
    8185    { }
     
    128132    void setInspectorProfilerAgent(InspectorProfilerAgent* agent) { m_inspectorProfilerAgent = agent; }
    129133#endif
     134#if ENABLE(WORKERS)
     135    InspectorWorkerAgent* inspectorWorkerAgent() const { return m_inspectorWorkerAgent; }
     136    void setInspectorWorkerAgent(InspectorWorkerAgent* agent) { m_inspectorWorkerAgent = agent; }
     137#endif
    130138
    131139private:
     
    152160    InspectorProfilerAgent* m_inspectorProfilerAgent;
    153161#endif
     162#if ENABLE(WORKERS)
     163    InspectorWorkerAgent* m_inspectorWorkerAgent;
     164#endif
    154165};
    155166
  • trunk/Source/WebCore/inspector/WorkerInspectorController.cpp

    r84125 r84773  
    128128#endif
    129129        m_runtimeAgent.get(),
    130         0 // InspectorTimelineAgent
     130        0, // InspectorTimelineAgent
     131        0 // InspectorWorkerAgent
    131132    );
    132133
  • trunk/Source/WebCore/inspector/generate-inspector-idl

    r83575 r84773  
    9090    "Debugger": "JAVASCRIPT_DEBUGGER",
    9191    "BrowserDebugger": "JAVASCRIPT_DEBUGGER",
    92     "Profiler": "JAVASCRIPT_DEBUGGER"
     92    "Profiler": "JAVASCRIPT_DEBUGGER",
     93    "Worker": "WORKERS"
    9394}
    9495
  • trunk/Source/WebCore/workers/Worker.cpp

    r75932 r84773  
    132132        dispatchEvent(Event::create(eventNames().errorEvent, false, true));
    133133    else {
     134        bool shouldStartPaused = InspectorInstrumentation::willStartWorkerContext(scriptExecutionContext(), m_contextProxy);
    134135        m_contextProxy->startWorkerContext(m_scriptLoader->url(), scriptExecutionContext()->userAgent(m_scriptLoader->url()), m_scriptLoader->script());
     136        InspectorInstrumentation::didStartWorkerContext(scriptExecutionContext(), m_contextProxy, shouldStartPaused);
    135137        InspectorInstrumentation::scriptImported(scriptExecutionContext(), m_scriptLoader->identifier(), m_scriptLoader->script());
    136138    }
  • trunk/Source/WebCore/workers/WorkerContextInspectorProxy.h

    r84772 r84773  
    11/*
    2  * Copyright (C) 2009 Google Inc. All rights reserved.
     2 * Copyright (C) 2011 Google Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2929 */
    3030
    31 #ifndef WorkerContextProxy_h
    32 #define WorkerContextProxy_h
     31#ifndef WorkerContextInspectorProxy_h
     32#define WorkerContextInspectorProxy_h
    3333
    34 #if ENABLE(WORKERS)
     34#if ENABLE(WORKERS) && ENABLE(INSPECTOR)
    3535
    36 #include "MessagePort.h"
    3736#include <wtf/Forward.h>
    38 #include <wtf/PassOwnPtr.h>
    3937
    4038namespace WebCore {
    4139
    42     class KURL;
    43     class Worker;
     40class InspectorFrontendChannel;
    4441
    45     // A proxy to talk to the worker context.
    46     class WorkerContextProxy {
    47     public:
    48         static WorkerContextProxy* create(Worker*);
    49 
    50         virtual ~WorkerContextProxy() {}
    51 
    52         virtual void startWorkerContext(const KURL& scriptURL, const String& userAgent, const String& sourceCode) = 0;
    53 
    54         virtual void terminateWorkerContext() = 0;
    55 
    56         virtual void postMessageToWorkerContext(PassRefPtr<SerializedScriptValue>, PassOwnPtr<MessagePortChannelArray>) = 0;
    57 
    58         virtual bool hasPendingActivity() const = 0;
    59 
    60         virtual void workerObjectDestroyed() = 0;
    61     };
     42class WorkerContextInspectorProxy {
     43public:
     44    virtual void connectFrontend(InspectorFrontendChannel*) { }
     45    virtual void disconnectFrontend() { }
     46    virtual void sendMessageToWorkerContextInspector(const String&) { }
     47protected:
     48    virtual ~WorkerContextInspectorProxy() { }
     49};
    6250
    6351} // namespace WebCore
     
    6553#endif // ENABLE(WORKERS)
    6654
    67 #endif // WorkerContextProxy_h
     55#endif // WorkerContextInspectorProxy_h
  • trunk/Source/WebCore/workers/WorkerContextProxy.h

    r65021 r84773  
    4242    class KURL;
    4343    class Worker;
     44    class WorkerContextInspectorProxy;
    4445
    4546    // A proxy to talk to the worker context.
     
    5960
    6061        virtual void workerObjectDestroyed() = 0;
     62
     63#if ENABLE(INSPECTOR)
     64        virtual WorkerContextInspectorProxy* inspectorProxy() { return 0; }
     65#endif
    6166    };
    6267
Note: See TracChangeset for help on using the changeset viewer.