OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 struct CachedResourceInitiatorInfo; | 48 struct CachedResourceInitiatorInfo; |
49 class DOMWindow; | 49 class DOMWindow; |
50 class Document; | 50 class Document; |
51 class DocumentLoader; | 51 class DocumentLoader; |
52 class Event; | 52 class Event; |
53 class FloatQuad; | 53 class FloatQuad; |
54 class Frame; | 54 class Frame; |
55 class GraphicsContext; | 55 class GraphicsContext; |
56 class InspectorClient; | 56 class InspectorClient; |
57 class InspectorDOMAgent; | 57 class InspectorDOMAgent; |
| 58 class InspectorDOMController; |
58 class InspectorFrontend; | 59 class InspectorFrontend; |
59 class InspectorMemoryAgent; | 60 class InspectorMemoryAgent; |
| 61 class InspectorMemoryController; |
60 class InspectorPageAgent; | 62 class InspectorPageAgent; |
| 63 class InspectorPageController; |
61 class InspectorState; | 64 class InspectorState; |
62 class InstrumentingAgents; | 65 class InstrumentingAgents; |
63 class IntRect; | 66 class IntRect; |
64 class KURL; | 67 class KURL; |
65 class Node; | 68 class Node; |
66 class Page; | 69 class Page; |
67 class RenderObject; | 70 class RenderObject; |
68 class ResourceError; | 71 class ResourceError; |
69 class ResourceLoader; | 72 class ResourceLoader; |
70 class ResourceRequest; | 73 class ResourceRequest; |
(...skipping 21 matching lines...) Expand all Loading... |
92 { | 95 { |
93 } | 96 } |
94 double fromMonotonicallyIncreasingTime(double time) const { return (time -
m_startOffset) * 1000.0; } | 97 double fromMonotonicallyIncreasingTime(double time) const { return (time -
m_startOffset) * 1000.0; } |
95 void reset(); | 98 void reset(); |
96 | 99 |
97 private: | 100 private: |
98 double m_startOffset; | 101 double m_startOffset; |
99 }; | 102 }; |
100 | 103 |
101 class InspectorTimelineAgent | 104 class InspectorTimelineAgent |
102 : public InspectorBaseAgent<InspectorTimelineAgent>, | 105 : public InspectorBaseAgent, |
103 public ScriptGCEventListener, | 106 public ScriptGCEventListener, |
104 public InspectorBackendDispatcher::TimelineCommandHandler, | 107 public InspectorBackendDispatcher::TimelineCommandHandler, |
105 public PlatformInstrumentationClient { | 108 public PlatformInstrumentationClient { |
106 WTF_MAKE_NONCOPYABLE(InspectorTimelineAgent); | 109 WTF_MAKE_NONCOPYABLE(InspectorTimelineAgent); |
107 public: | 110 public: |
108 enum InspectorType { PageInspector, WorkerInspector }; | 111 enum InspectorType { PageInspector, WorkerInspector }; |
109 | 112 |
110 static PassOwnPtr<InspectorTimelineAgent> create(InstrumentingAgents* instru
mentingAgents, InspectorPageAgent* pageAgent, InspectorMemoryAgent* memoryAgent,
InspectorDOMAgent* domAgent, InspectorCompositeState* state, InspectorType type
, InspectorClient* client) | 113 static PassRefPtr<InspectorTimelineAgent> create(InstrumentingAgents*, Inspe
ctorState*, PassRefPtr<InspectorPageAgent>, PassRefPtr<InspectorMemoryAgent>, Pa
ssRefPtr<InspectorDOMAgent>, InspectorType, InspectorClient*); |
111 { | |
112 return adoptPtr(new InspectorTimelineAgent(instrumentingAgents, pageAgen
t, memoryAgent, domAgent, state, type, client)); | |
113 } | |
114 | 114 |
115 ~InspectorTimelineAgent(); | 115 ~InspectorTimelineAgent(); |
116 | 116 |
117 virtual void setFrontend(InspectorFrontend*); | 117 virtual void setFrontend(InspectorFrontend*); |
118 virtual void clearFrontend(); | 118 virtual void clearFrontend(); |
119 virtual void restore(); | 119 virtual void restore(); |
120 | 120 |
121 virtual void start(ErrorString*, const int* maxCallStackDepth, const bool* i
ncludeDomCounters, const bool* includeNativeMemoryStatistics); | 121 virtual void start(ErrorString*, const int* maxCallStackDepth, const bool* i
ncludeDomCounters, const bool* includeNativeMemoryStatistics); |
122 virtual void stop(ErrorString*); | 122 virtual void stop(ErrorString*); |
123 | 123 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 : record(record), data(data), children(children), type(type), usedHe
apSizeAtStart(usedHeapSizeAtStart) | 218 : record(record), data(data), children(children), type(type), usedHe
apSizeAtStart(usedHeapSizeAtStart) |
219 { | 219 { |
220 } | 220 } |
221 RefPtr<InspectorObject> record; | 221 RefPtr<InspectorObject> record; |
222 RefPtr<InspectorObject> data; | 222 RefPtr<InspectorObject> data; |
223 RefPtr<InspectorArray> children; | 223 RefPtr<InspectorArray> children; |
224 String type; | 224 String type; |
225 size_t usedHeapSizeAtStart; | 225 size_t usedHeapSizeAtStart; |
226 }; | 226 }; |
227 | 227 |
228 InspectorTimelineAgent(InstrumentingAgents*, InspectorPageAgent*, InspectorM
emoryAgent*, InspectorDOMAgent*, InspectorCompositeState*, InspectorType, Inspec
torClient*); | 228 InspectorTimelineAgent(InstrumentingAgents*, InspectorState*, PassRefPtr<Ins
pectorPageAgent>, PassRefPtr<InspectorMemoryAgent>, PassRefPtr<InspectorDOMAgent
>, InspectorType, InspectorClient*); |
229 | 229 |
230 void didFinishLoadingResource(unsigned long, bool didFail, double finishTime
, Frame*); | 230 void didFinishLoadingResource(unsigned long, bool didFail, double finishTime
, Frame*); |
231 | 231 |
232 void sendEvent(PassRefPtr<InspectorObject>); | 232 void sendEvent(PassRefPtr<InspectorObject>); |
233 void appendRecord(PassRefPtr<InspectorObject> data, const String& type, bool
captureCallStack, Frame*); | 233 void appendRecord(PassRefPtr<InspectorObject> data, const String& type, bool
captureCallStack, Frame*); |
234 void pushCurrentRecord(PassRefPtr<InspectorObject>, const String& type, bool
captureCallStack, Frame*, bool hasLowLevelDetails = false); | 234 void pushCurrentRecord(PassRefPtr<InspectorObject>, const String& type, bool
captureCallStack, Frame*, bool hasLowLevelDetails = false); |
235 | 235 |
236 void setDOMCounters(TypeBuilder::Timeline::TimelineEvent* record); | 236 void setDOMCounters(TypeBuilder::Timeline::TimelineEvent* record); |
237 void setNativeHeapStatistics(TypeBuilder::Timeline::TimelineEvent* record); | 237 void setNativeHeapStatistics(TypeBuilder::Timeline::TimelineEvent* record); |
238 void setFrameIdentifier(InspectorObject* record, Frame*); | 238 void setFrameIdentifier(InspectorObject* record, Frame*); |
239 void pushGCEventRecords(); | 239 void pushGCEventRecords(); |
240 | 240 |
241 void didCompleteCurrentRecord(const String& type); | 241 void didCompleteCurrentRecord(const String& type); |
242 | 242 |
243 void setHeapSizeStatistics(InspectorObject* record); | 243 void setHeapSizeStatistics(InspectorObject* record); |
244 void commitFrameRecord(); | 244 void commitFrameRecord(); |
245 | 245 |
246 void addRecordToTimeline(PassRefPtr<InspectorObject>); | 246 void addRecordToTimeline(PassRefPtr<InspectorObject>); |
247 void innerAddRecordToTimeline(PassRefPtr<InspectorObject>); | 247 void innerAddRecordToTimeline(PassRefPtr<InspectorObject>); |
248 void clearRecordStack(); | 248 void clearRecordStack(); |
249 | 249 |
250 void localToPageQuad(const RenderObject& renderer, const LayoutRect&, FloatQ
uad*); | 250 void localToPageQuad(const RenderObject& renderer, const LayoutRect&, FloatQ
uad*); |
251 const TimelineTimeConverter& timeConverter() const { return m_timeConverter;
} | 251 const TimelineTimeConverter& timeConverter() const { return m_timeConverter;
} |
252 long long idForNode(Node*); | 252 long long idForNode(Node*); |
253 void releaseNodeIds(); | 253 void releaseNodeIds(); |
254 | 254 |
255 double timestamp(); | 255 double timestamp(); |
256 Page* page(); | 256 Page* page(); |
257 | 257 |
258 InspectorPageAgent* m_pageAgent; | 258 RefPtr<InspectorPageAgent> m_pageAgent; |
259 InspectorMemoryAgent* m_memoryAgent; | 259 RefPtr<InspectorMemoryAgent> m_memoryAgent; |
260 InspectorDOMAgent* m_domAgent; | 260 RefPtr<InspectorDOMAgent> m_domAgent; |
261 TimelineTimeConverter m_timeConverter; | 261 TimelineTimeConverter m_timeConverter; |
262 | 262 |
263 InspectorFrontend::Timeline* m_frontend; | 263 InspectorFrontend::Timeline* m_frontend; |
264 double m_timestampOffset; | 264 double m_timestampOffset; |
265 | 265 |
266 Vector<TimelineRecordEntry> m_recordStack; | 266 Vector<TimelineRecordEntry> m_recordStack; |
267 | 267 |
268 int m_id; | 268 int m_id; |
269 struct GCEvent { | 269 struct GCEvent { |
270 GCEvent(double startTime, double endTime, size_t collectedBytes) | 270 GCEvent(double startTime, double endTime, size_t collectedBytes) |
271 : startTime(startTime), endTime(endTime), collectedBytes(collectedBy
tes) | 271 : startTime(startTime), endTime(endTime), collectedBytes(collectedBy
tes) |
272 { | 272 { |
273 } | 273 } |
274 double startTime; | 274 double startTime; |
275 double endTime; | 275 double endTime; |
276 size_t collectedBytes; | 276 size_t collectedBytes; |
277 }; | 277 }; |
278 typedef Vector<GCEvent> GCEvents; | 278 typedef Vector<GCEvent> GCEvents; |
279 GCEvents m_gcEvents; | 279 GCEvents m_gcEvents; |
280 int m_maxCallStackDepth; | 280 int m_maxCallStackDepth; |
281 unsigned m_platformInstrumentationClientInstalledAtStackDepth; | 281 unsigned m_platformInstrumentationClientInstalledAtStackDepth; |
282 RefPtr<InspectorObject> m_pendingFrameRecord; | 282 RefPtr<InspectorObject> m_pendingFrameRecord; |
283 InspectorType m_inspectorType; | 283 InspectorType m_inspectorType; |
284 InspectorClient* m_client; | 284 InspectorClient* m_client; |
285 WeakPtrFactory<InspectorTimelineAgent> m_weakFactory; | 285 WeakPtrFactory<InspectorTimelineAgent> m_weakFactory; |
286 RefPtr<TimelineTraceEventProcessor> m_traceEventProcessor; | 286 RefPtr<TimelineTraceEventProcessor> m_traceEventProcessor; |
287 unsigned m_styleRecalcElementCounter; | 287 unsigned m_styleRecalcElementCounter; |
288 }; | 288 }; |
289 | 289 |
| 290 class InspectorTimelineController: public InspectorBaseController<InspectorTimel
ineController, InspectorTimelineAgent> { |
| 291 public: |
| 292 |
| 293 static PassOwnPtr<InspectorTimelineController> create(InstrumentingAgents* i
nstrumentingAgents, InspectorCompositeState* compositeState, InspectorPageContro
ller* pageController, InspectorMemoryController* memoryController, InspectorDOMC
ontroller* domController, InspectorTimelineAgent::InspectorType type, InspectorC
lient* client) |
| 294 { |
| 295 return adoptPtr(new InspectorTimelineController(instrumentingAgents, com
positeState, pageController, memoryController, domController, type, client)); |
| 296 } |
| 297 |
| 298 protected: |
| 299 InspectorTimelineController(InstrumentingAgents*, InspectorCompositeState*,
InspectorPageController*, InspectorMemoryController*, InspectorDOMController*, I
nspectorTimelineAgent::InspectorType, InspectorClient*); |
| 300 }; |
| 301 |
290 } // namespace WebCore | 302 } // namespace WebCore |
291 | 303 |
292 #endif // !defined(InspectorTimelineAgent_h) | 304 #endif // !defined(InspectorTimelineAgent_h) |
OLD | NEW |