OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 27 matching lines...) Expand all Loading... |
38 namespace WebCore { | 38 namespace WebCore { |
39 class InspectorFrontend; | 39 class InspectorFrontend; |
40 class InspectorObject; | 40 class InspectorObject; |
41 class InspectorState; | 41 class InspectorState; |
42 class InstrumentingAgents; | 42 class InstrumentingAgents; |
43 class KURL; | 43 class KURL; |
44 class WorkerContextProxy; | 44 class WorkerContextProxy; |
45 | 45 |
46 typedef String ErrorString; | 46 typedef String ErrorString; |
47 | 47 |
48 class InspectorWorkerAgent : public InspectorBaseAgent<InspectorWorkerAgent>, pu
blic InspectorBackendDispatcher::WorkerCommandHandler { | 48 class InspectorWorkerAgent : public InspectorBaseAgent, public InspectorBackendD
ispatcher::WorkerCommandHandler { |
49 public: | 49 public: |
50 static PassOwnPtr<InspectorWorkerAgent> create(InstrumentingAgents*, Inspect
orCompositeState*); | 50 static PassRefPtr<InspectorWorkerAgent> create(InstrumentingAgents*, Inspect
orState*); |
51 ~InspectorWorkerAgent(); | 51 virtual ~InspectorWorkerAgent(); |
52 | 52 |
53 virtual void setFrontend(InspectorFrontend*); | 53 virtual void setFrontend(InspectorFrontend*); |
54 virtual void restore(); | 54 virtual void restore(); |
55 virtual void clearFrontend(); | 55 virtual void clearFrontend(); |
56 | 56 |
57 // Called from InspectorInstrumentation | 57 // Called from InspectorInstrumentation |
58 bool shouldPauseDedicatedWorkerOnStart(); | 58 bool shouldPauseDedicatedWorkerOnStart(); |
59 void didStartWorkerContext(WorkerContextProxy*, const KURL&); | 59 void didStartWorkerContext(WorkerContextProxy*, const KURL&); |
60 void workerContextTerminated(WorkerContextProxy*); | 60 void workerContextTerminated(WorkerContextProxy*); |
61 | 61 |
62 // Called from InspectorBackendDispatcher | 62 // Called from InspectorBackendDispatcher |
63 virtual void enable(ErrorString*); | 63 virtual void enable(ErrorString*); |
64 virtual void disable(ErrorString*); | 64 virtual void disable(ErrorString*); |
65 virtual void canInspectWorkers(ErrorString*, bool*); | 65 virtual void canInspectWorkers(ErrorString*, bool*); |
66 virtual void connectToWorker(ErrorString*, int workerId); | 66 virtual void connectToWorker(ErrorString*, int workerId); |
67 virtual void disconnectFromWorker(ErrorString*, int workerId); | 67 virtual void disconnectFromWorker(ErrorString*, int workerId); |
68 virtual void sendMessageToWorker(ErrorString*, int workerId, const RefPtr<In
spectorObject>& message); | 68 virtual void sendMessageToWorker(ErrorString*, int workerId, const RefPtr<In
spectorObject>& message); |
69 virtual void setAutoconnectToWorkers(ErrorString*, bool value); | 69 virtual void setAutoconnectToWorkers(ErrorString*, bool value); |
70 | 70 |
71 private: | 71 private: |
72 InspectorWorkerAgent(InstrumentingAgents*, InspectorCompositeState*); | 72 InspectorWorkerAgent(InstrumentingAgents*, InspectorState*); |
73 void createWorkerFrontendChannelsForExistingWorkers(); | 73 void createWorkerFrontendChannelsForExistingWorkers(); |
74 void createWorkerFrontendChannel(WorkerContextProxy*, const String& url); | 74 void createWorkerFrontendChannel(WorkerContextProxy*, const String& url); |
75 void destroyWorkerFrontendChannels(); | 75 void destroyWorkerFrontendChannels(); |
76 | 76 |
77 InspectorFrontend* m_inspectorFrontend; | 77 InspectorFrontend* m_inspectorFrontend; |
78 | 78 |
79 class WorkerFrontendChannel; | 79 class WorkerFrontendChannel; |
80 typedef HashMap<int, WorkerFrontendChannel*> WorkerChannels; | 80 typedef HashMap<int, WorkerFrontendChannel*> WorkerChannels; |
81 WorkerChannels m_idToChannel; | 81 WorkerChannels m_idToChannel; |
82 typedef HashMap<WorkerContextProxy*, String> DedicatedWorkers; | 82 typedef HashMap<WorkerContextProxy*, String> DedicatedWorkers; |
83 DedicatedWorkers m_dedicatedWorkers; | 83 DedicatedWorkers m_dedicatedWorkers; |
84 }; | 84 }; |
85 | 85 |
| 86 class InspectorWorkerFactory : public InspectorBaseFactory<InspectorWorkerFactor
y, InspectorWorkerAgent> { |
| 87 public: |
| 88 |
| 89 static PassOwnPtr<InspectorWorkerFactory> create(InstrumentingAgents* instru
mentingAgents, InspectorCompositeState* compositeState) |
| 90 { |
| 91 return adoptPtr(new InspectorWorkerFactory(instrumentingAgents, composit
eState)); |
| 92 } |
| 93 |
| 94 protected: |
| 95 InspectorWorkerFactory(InstrumentingAgents* instrumentingAgents, InspectorCo
mpositeState* compositeState) |
| 96 : InspectorBaseFactory<InspectorWorkerFactory, InspectorWorkerAgent>("Wo
rker", instrumentingAgents, compositeState) |
| 97 { |
| 98 setAgent(InspectorWorkerAgent::create(m_instrumentingAgents, m_state)); |
| 99 } |
| 100 }; |
| 101 |
86 } // namespace WebCore | 102 } // namespace WebCore |
87 | 103 |
88 #endif // !defined(InspectorWorkerAgent_h) | 104 #endif // !defined(InspectorWorkerAgent_h) |
OLD | NEW |