Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(445)

Side by Side Diff: Source/core/inspector/InspectorWorkerAgent.h

Issue 17030009: Inspector: wrapped inspector agent instances into factory-like wrappers (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Made InspectorBaseAgent RefCounted Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 ~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 InspectorWorkerController: public InspectorBaseController<InspectorWorkerC ontroller, InspectorWorkerAgent> {
pfeldman 2013/06/18 15:36:06 Space before :
Vladislav Kaznacheev 2013/06/19 12:58:43 Done.
87 public:
88
89 static PassOwnPtr<InspectorWorkerController> create(InstrumentingAgents* ins trumentingAgents, InspectorCompositeState* compositeState)
90 {
91 return adoptPtr(new InspectorWorkerController(instrumentingAgents, compo siteState));
92 }
93
94 protected:
95 InspectorWorkerController(InstrumentingAgents* instrumentingAgents, Inspecto rCompositeState* compositeState)
96 : InspectorBaseController<InspectorWorkerController, InspectorWorkerAgen t>("Worker", 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)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698