| 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 class RenderObject; | 74 class RenderObject; |
| 75 class ResourceError; | 75 class ResourceError; |
| 76 class ResourceLoader; | 76 class ResourceLoader; |
| 77 class ResourceRequest; | 77 class ResourceRequest; |
| 78 class ResourceResponse; | 78 class ResourceResponse; |
| 79 class ScriptArguments; | 79 class ScriptArguments; |
| 80 class ScriptCallStack; | 80 class ScriptCallStack; |
| 81 class TimelineRecordStack; | 81 class TimelineRecordStack; |
| 82 class ExecutionContext; | 82 class ExecutionContext; |
| 83 class ScriptState; | 83 class ScriptState; |
| 84 class TimelineTraceEventProcessor; | |
| 85 class WebSocketHandshakeRequest; | 84 class WebSocketHandshakeRequest; |
| 86 class WebSocketHandshakeResponse; | 85 class WebSocketHandshakeResponse; |
| 87 class XMLHttpRequest; | 86 class XMLHttpRequest; |
| 88 | 87 |
| 89 typedef String ErrorString; | 88 typedef String ErrorString; |
| 90 | 89 |
| 91 namespace TimelineRecordType { | 90 namespace TimelineRecordType { |
| 91 extern const char ActivateLayerTree[]; |
| 92 extern const char BeginFrame[]; |
| 92 extern const char DecodeImage[]; | 93 extern const char DecodeImage[]; |
| 94 extern const char GPUTask[]; |
| 95 extern const char PaintSetup[]; |
| 93 extern const char Rasterize[]; | 96 extern const char Rasterize[]; |
| 94 extern const char PaintSetup[]; | |
| 95 extern const char GPUTask[]; | |
| 96 }; | 97 }; |
| 97 | 98 |
| 98 class TimelineTimeConverter { | 99 class TimelineTimeConverter { |
| 99 public: | 100 public: |
| 100 TimelineTimeConverter() | 101 TimelineTimeConverter() |
| 101 : m_startOffset(0) | 102 : m_startOffset(0) |
| 102 { | 103 { |
| 103 } | 104 } |
| 104 double fromMonotonicallyIncreasingTime(double time) const { return (time -
m_startOffset) * 1000.0; } | 105 double fromMonotonicallyIncreasingTime(double time) const { return (time -
m_startOffset) * 1000.0; } |
| 105 void reset(); | 106 void reset(); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 virtual void setFrontend(InspectorFrontend*); | 141 virtual void setFrontend(InspectorFrontend*); |
| 141 virtual void clearFrontend(); | 142 virtual void clearFrontend(); |
| 142 virtual void restore(); | 143 virtual void restore(); |
| 143 | 144 |
| 144 virtual void enable(ErrorString*); | 145 virtual void enable(ErrorString*); |
| 145 virtual void disable(ErrorString*); | 146 virtual void disable(ErrorString*); |
| 146 virtual void start(ErrorString*, const int* maxCallStackDepth, const bool* b
ufferEvents, const bool* includeDomCounters, const bool* includeGPUEvents); | 147 virtual void start(ErrorString*, const int* maxCallStackDepth, const bool* b
ufferEvents, const bool* includeDomCounters, const bool* includeGPUEvents); |
| 147 virtual void stop(ErrorString*, RefPtr<TypeBuilder::Array<TypeBuilder::Timel
ine::TimelineEvent> >& events); | 148 virtual void stop(ErrorString*, RefPtr<TypeBuilder::Array<TypeBuilder::Timel
ine::TimelineEvent> >& events); |
| 148 | 149 |
| 149 void setLayerTreeId(int layerTreeId) { m_layerTreeId = layerTreeId; } | 150 void setLayerTreeId(int layerTreeId) { m_layerTreeId = layerTreeId; } |
| 150 int layerTreeId() const { return m_layerTreeId; } | |
| 151 int id() const { return m_id; } | 151 int id() const { return m_id; } |
| 152 | 152 |
| 153 void didCommitLoad(); | 153 void didCommitLoad(); |
| 154 | 154 |
| 155 // Methods called from WebCore. | 155 // Methods called from WebCore. |
| 156 bool willCallFunction(ExecutionContext*, const String& scriptName, int scrip
tLine); | 156 bool willCallFunction(ExecutionContext*, const String& scriptName, int scrip
tLine); |
| 157 void didCallFunction(); | 157 void didCallFunction(); |
| 158 | 158 |
| 159 bool willDispatchEvent(Document* document, const Event& event, DOMWindow* wi
ndow, Node* node, const EventPath& eventPath); | 159 bool willDispatchEvent(Document* document, const Event& event, DOMWindow* wi
ndow, Node* node, const EventPath& eventPath); |
| 160 bool willDispatchEventOnWindow(const Event& event, DOMWindow* window); | 160 bool willDispatchEventOnWindow(const Event& event, DOMWindow* window); |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 virtual void willResizeImage(bool shouldCache) OVERRIDE; | 246 virtual void willResizeImage(bool shouldCache) OVERRIDE; |
| 247 virtual void didResizeImage() OVERRIDE; | 247 virtual void didResizeImage() OVERRIDE; |
| 248 | 248 |
| 249 private: | 249 private: |
| 250 | 250 |
| 251 friend class TimelineRecordStack; | 251 friend class TimelineRecordStack; |
| 252 | 252 |
| 253 InspectorTimelineAgent(InstrumentingAgents*, InspectorPageAgent*, InspectorM
emoryAgent*, InspectorDOMAgent*, InspectorOverlay*, InspectorCompositeState*, In
spectorType, InspectorClient*); | 253 InspectorTimelineAgent(InstrumentingAgents*, InspectorPageAgent*, InspectorM
emoryAgent*, InspectorDOMAgent*, InspectorOverlay*, InspectorCompositeState*, In
spectorType, InspectorClient*); |
| 254 | 254 |
| 255 // Trace event handlers | 255 // Trace event handlers |
| 256 void onBeginImplSideFrame(const TraceEventDispatcher::TraceEvent&); |
| 256 void onPaintSetupBegin(const TraceEventDispatcher::TraceEvent&); | 257 void onPaintSetupBegin(const TraceEventDispatcher::TraceEvent&); |
| 257 void onPaintSetupEnd(const TraceEventDispatcher::TraceEvent&); | 258 void onPaintSetupEnd(const TraceEventDispatcher::TraceEvent&); |
| 258 void onRasterTaskBegin(const TraceEventDispatcher::TraceEvent&); | 259 void onRasterTaskBegin(const TraceEventDispatcher::TraceEvent&); |
| 259 void onRasterTaskEnd(const TraceEventDispatcher::TraceEvent&); | 260 void onRasterTaskEnd(const TraceEventDispatcher::TraceEvent&); |
| 260 void onImageDecodeBegin(const TraceEventDispatcher::TraceEvent&); | 261 void onImageDecodeBegin(const TraceEventDispatcher::TraceEvent&); |
| 261 void onImageDecodeEnd(const TraceEventDispatcher::TraceEvent&); | 262 void onImageDecodeEnd(const TraceEventDispatcher::TraceEvent&); |
| 262 void onLayerDeleted(const TraceEventDispatcher::TraceEvent&); | 263 void onLayerDeleted(const TraceEventDispatcher::TraceEvent&); |
| 263 void onDrawLazyPixelRef(const TraceEventDispatcher::TraceEvent&); | 264 void onDrawLazyPixelRef(const TraceEventDispatcher::TraceEvent&); |
| 264 void onDecodeLazyPixelRefBegin(const TraceEventDispatcher::TraceEvent&); | 265 void onDecodeLazyPixelRefBegin(const TraceEventDispatcher::TraceEvent&); |
| 265 void onDecodeLazyPixelRefEnd(const TraceEventDispatcher::TraceEvent&); | 266 void onDecodeLazyPixelRefEnd(const TraceEventDispatcher::TraceEvent&); |
| 267 void onActivateLayerTree(const TraceEventDispatcher::TraceEvent&); |
| 266 void onLazyPixelRefDeleted(const TraceEventDispatcher::TraceEvent&); | 268 void onLazyPixelRefDeleted(const TraceEventDispatcher::TraceEvent&); |
| 267 | 269 |
| 268 void didFinishLoadingResource(unsigned long, bool didFail, double finishTime
, Frame*); | 270 void didFinishLoadingResource(unsigned long, bool didFail, double finishTime
, Frame*); |
| 269 | 271 |
| 270 void sendEvent(PassRefPtr<JSONObject>); | 272 void sendEvent(PassRefPtr<JSONObject>); |
| 271 void appendRecord(PassRefPtr<JSONObject> data, const String& type, bool capt
ureCallStack, Frame*); | 273 void appendRecord(PassRefPtr<JSONObject> data, const String& type, bool capt
ureCallStack, Frame*); |
| 272 void pushCurrentRecord(PassRefPtr<JSONObject>, const String& type, bool capt
ureCallStack, Frame*, bool hasLowLevelDetails = false); | 274 void pushCurrentRecord(PassRefPtr<JSONObject>, const String& type, bool capt
ureCallStack, Frame*, bool hasLowLevelDetails = false); |
| 273 TimelineThreadState& threadState(ThreadIdentifier); | 275 TimelineThreadState& threadState(ThreadIdentifier); |
| 274 | 276 |
| 275 void setDOMCounters(TypeBuilder::Timeline::TimelineEvent*); | 277 void setDOMCounters(TypeBuilder::Timeline::TimelineEvent*); |
| 276 void setFrameIdentifier(JSONObject* record, Frame*); | 278 void setFrameIdentifier(JSONObject* record, Frame*); |
| 277 void populateImageDetails(JSONObject* data, const RenderImage&); | 279 void populateImageDetails(JSONObject* data, const RenderImage&); |
| 278 | 280 |
| 279 void pushGCEventRecords(); | 281 void pushGCEventRecords(); |
| 280 | 282 |
| 281 void didCompleteCurrentRecord(const String& type); | 283 void didCompleteCurrentRecord(const String& type); |
| 282 void unwindRecordStack(); | 284 void unwindRecordStack(); |
| 283 | 285 |
| 284 void commitFrameRecord(); | 286 void commitFrameRecord(); |
| 285 | 287 |
| 286 void addRecordToTimeline(PassRefPtr<JSONObject>); | 288 void addRecordToTimeline(PassRefPtr<JSONObject>); |
| 287 void innerAddRecordToTimeline(PassRefPtr<JSONObject>); | 289 void innerAddRecordToTimeline(PassRefPtr<JSONObject>); |
| 288 void clearRecordStack(); | 290 void clearRecordStack(); |
| 291 PassRefPtr<JSONObject> createRecordForEvent(const TraceEventDispatcher::Trac
eEvent&, const String& type, PassRefPtr<JSONObject> data = 0); |
| 289 | 292 |
| 290 void localToPageQuad(const RenderObject& renderer, const LayoutRect&, FloatQ
uad*); | 293 void localToPageQuad(const RenderObject& renderer, const LayoutRect&, FloatQ
uad*); |
| 291 long long nodeId(Node*); | 294 long long nodeId(Node*); |
| 292 long long nodeId(RenderObject*); | 295 long long nodeId(RenderObject*); |
| 293 void releaseNodeIds(); | 296 void releaseNodeIds(); |
| 294 | 297 |
| 295 double timestamp(); | 298 double timestamp(); |
| 296 Page* page(); | 299 Page* page(); |
| 297 | 300 |
| 298 bool isStarted(); | 301 bool isStarted(); |
| 299 void innerStart(); | 302 void innerStart(); |
| 300 void innerStop(bool fromConsole); | 303 void innerStop(bool fromConsole); |
| 301 | 304 |
| 302 InspectorPageAgent* m_pageAgent; | 305 InspectorPageAgent* m_pageAgent; |
| 303 InspectorMemoryAgent* m_memoryAgent; | 306 InspectorMemoryAgent* m_memoryAgent; |
| 304 InspectorDOMAgent* m_domAgent; | 307 InspectorDOMAgent* m_domAgent; |
| 305 InspectorFrontend::Timeline* m_frontend; | 308 InspectorFrontend::Timeline* m_frontend; |
| 306 InspectorClient* m_client; | 309 InspectorClient* m_client; |
| 307 InspectorOverlay* m_overlay; | 310 InspectorOverlay* m_overlay; |
| 308 InspectorType m_inspectorType; | 311 InspectorType m_inspectorType; |
| 309 | 312 |
| 310 int m_id; | 313 int m_id; |
| 311 int m_layerTreeId; | 314 unsigned long long m_layerTreeId; |
| 312 | 315 |
| 313 TimelineTimeConverter m_timeConverter; | 316 TimelineTimeConverter m_timeConverter; |
| 314 int m_maxCallStackDepth; | 317 int m_maxCallStackDepth; |
| 315 | 318 |
| 316 Vector<TimelineRecordEntry> m_recordStack; | 319 Vector<TimelineRecordEntry> m_recordStack; |
| 317 RefPtr<TypeBuilder::Array<TypeBuilder::Timeline::TimelineEvent> > m_buffered
Events; | 320 RefPtr<TypeBuilder::Array<TypeBuilder::Timeline::TimelineEvent> > m_buffered
Events; |
| 318 Vector<String> m_consoleTimelines; | 321 Vector<String> m_consoleTimelines; |
| 319 | 322 |
| 320 typedef Vector<TimelineGCEvent> GCEvents; | 323 typedef Vector<TimelineGCEvent> GCEvents; |
| 321 GCEvents m_gcEvents; | 324 GCEvents m_gcEvents; |
| 322 unsigned m_platformInstrumentationClientInstalledAtStackDepth; | 325 unsigned m_platformInstrumentationClientInstalledAtStackDepth; |
| 323 RefPtr<JSONObject> m_pendingFrameRecord; | 326 RefPtr<JSONObject> m_pendingFrameRecord; |
| 324 RefPtr<JSONObject> m_pendingGPURecord; | 327 RefPtr<JSONObject> m_pendingGPURecord; |
| 325 typedef HashMap<unsigned long long, TimelineImageInfo> PixelRefToImageInfoMa
p; | 328 typedef HashMap<unsigned long long, TimelineImageInfo> PixelRefToImageInfoMa
p; |
| 326 PixelRefToImageInfoMap m_pixelRefToImageInfo; | 329 PixelRefToImageInfoMap m_pixelRefToImageInfo; |
| 327 RenderImage* m_imageBeingPainted; | 330 RenderImage* m_imageBeingPainted; |
| 328 HashMap<unsigned long long, long long> m_layerToNodeMap; | 331 HashMap<unsigned long long, long long> m_layerToNodeMap; |
| 329 double m_paintSetupStart; | 332 double m_paintSetupStart; |
| 330 double m_paintSetupEnd; | 333 double m_paintSetupEnd; |
| 331 RefPtr<JSONObject> m_gpuTask; | 334 RefPtr<JSONObject> m_gpuTask; |
| 332 unsigned m_styleRecalcElementCounter; | 335 unsigned m_styleRecalcElementCounter; |
| 333 typedef HashMap<ThreadIdentifier, TimelineThreadState> ThreadStateMap; | 336 typedef HashMap<ThreadIdentifier, TimelineThreadState> ThreadStateMap; |
| 334 ThreadStateMap m_threadStates; | 337 ThreadStateMap m_threadStates; |
| 335 }; | 338 }; |
| 336 | 339 |
| 337 } // namespace WebCore | 340 } // namespace WebCore |
| 338 | 341 |
| 339 #endif // !defined(InspectorTimelineAgent_h) | 342 #endif // !defined(InspectorTimelineAgent_h) |
| OLD | NEW |