| 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 30 matching lines...) Expand all Loading... |
| 41 #include <wtf/PassRefPtr.h> | 41 #include <wtf/PassRefPtr.h> |
| 42 #include <wtf/text/WTFString.h> | 42 #include <wtf/text/WTFString.h> |
| 43 | 43 |
| 44 namespace WebCore { | 44 namespace WebCore { |
| 45 | 45 |
| 46 class Frame; | 46 class Frame; |
| 47 class DocumentLoader; | 47 class DocumentLoader; |
| 48 class InjectedScriptCanvasModule; | 48 class InjectedScriptCanvasModule; |
| 49 class InjectedScriptManager; | 49 class InjectedScriptManager; |
| 50 class InspectorPageAgent; | 50 class InspectorPageAgent; |
| 51 class InspectorPageFactory; |
| 51 class InspectorState; | 52 class InspectorState; |
| 52 class InstrumentingAgents; | 53 class InstrumentingAgents; |
| 53 class ScriptObject; | 54 class ScriptObject; |
| 54 | 55 |
| 55 typedef String ErrorString; | 56 typedef String ErrorString; |
| 56 | 57 |
| 57 class InspectorCanvasAgent : public InspectorBaseAgent<InspectorCanvasAgent>, pu
blic InspectorBackendDispatcher::CanvasCommandHandler { | 58 class InspectorCanvasAgent : public InspectorBaseAgent, public InspectorBackendD
ispatcher::CanvasCommandHandler { |
| 58 public: | 59 public: |
| 59 static PassOwnPtr<InspectorCanvasAgent> create(InstrumentingAgents* instrume
ntingAgents, InspectorCompositeState* state, InspectorPageAgent* pageAgent, Inje
ctedScriptManager* injectedScriptManager) | 60 static PassRefPtr<InspectorCanvasAgent> create(InstrumentingAgents*, Inspect
orState*, PassRefPtr<InspectorPageAgent>, InjectedScriptManager*); |
| 60 { | 61 virtual ~InspectorCanvasAgent(); |
| 61 return adoptPtr(new InspectorCanvasAgent(instrumentingAgents, state, pag
eAgent, injectedScriptManager)); | |
| 62 } | |
| 63 ~InspectorCanvasAgent(); | |
| 64 | 62 |
| 65 virtual void setFrontend(InspectorFrontend*); | 63 virtual void setFrontend(InspectorFrontend*); |
| 66 virtual void clearFrontend(); | 64 virtual void clearFrontend(); |
| 67 virtual void restore(); | 65 virtual void restore(); |
| 68 | 66 |
| 69 void didCommitLoad(Frame*, DocumentLoader*); | 67 void didCommitLoad(Frame*, DocumentLoader*); |
| 70 void frameDetachedFromParent(Frame*); | 68 void frameDetachedFromParent(Frame*); |
| 71 void didBeginFrame(); | 69 void didBeginFrame(); |
| 72 | 70 |
| 73 // Called from InspectorCanvasInstrumentation. | 71 // Called from InspectorCanvasInstrumentation. |
| 74 ScriptObject wrapCanvas2DRenderingContextForInstrumentation(const ScriptObje
ct&); | 72 ScriptObject wrapCanvas2DRenderingContextForInstrumentation(const ScriptObje
ct&); |
| 75 ScriptObject wrapWebGLRenderingContextForInstrumentation(const ScriptObject&
); | 73 ScriptObject wrapWebGLRenderingContextForInstrumentation(const ScriptObject&
); |
| 76 | 74 |
| 77 // Called from the front-end. | 75 // Called from the front-end. |
| 78 virtual void enable(ErrorString*); | 76 virtual void enable(ErrorString*); |
| 79 virtual void disable(ErrorString*); | 77 virtual void disable(ErrorString*); |
| 80 virtual void dropTraceLog(ErrorString*, const TypeBuilder::Canvas::TraceLogI
d&); | 78 virtual void dropTraceLog(ErrorString*, const TypeBuilder::Canvas::TraceLogI
d&); |
| 81 virtual void hasUninstrumentedCanvases(ErrorString*, bool*); | 79 virtual void hasUninstrumentedCanvases(ErrorString*, bool*); |
| 82 virtual void captureFrame(ErrorString*, const TypeBuilder::Network::FrameId*
, TypeBuilder::Canvas::TraceLogId*); | 80 virtual void captureFrame(ErrorString*, const TypeBuilder::Network::FrameId*
, TypeBuilder::Canvas::TraceLogId*); |
| 83 virtual void startCapturing(ErrorString*, const TypeBuilder::Network::FrameI
d*, TypeBuilder::Canvas::TraceLogId*); | 81 virtual void startCapturing(ErrorString*, const TypeBuilder::Network::FrameI
d*, TypeBuilder::Canvas::TraceLogId*); |
| 84 virtual void stopCapturing(ErrorString*, const TypeBuilder::Canvas::TraceLog
Id&); | 82 virtual void stopCapturing(ErrorString*, const TypeBuilder::Canvas::TraceLog
Id&); |
| 85 virtual void getTraceLog(ErrorString*, const TypeBuilder::Canvas::TraceLogId
&, const int*, const int*, RefPtr<TypeBuilder::Canvas::TraceLog>&); | 83 virtual void getTraceLog(ErrorString*, const TypeBuilder::Canvas::TraceLogId
&, const int*, const int*, RefPtr<TypeBuilder::Canvas::TraceLog>&); |
| 86 virtual void replayTraceLog(ErrorString*, const TypeBuilder::Canvas::TraceLo
gId&, int, RefPtr<TypeBuilder::Canvas::ResourceState>&); | 84 virtual void replayTraceLog(ErrorString*, const TypeBuilder::Canvas::TraceLo
gId&, int, RefPtr<TypeBuilder::Canvas::ResourceState>&); |
| 87 virtual void getResourceInfo(ErrorString*, const TypeBuilder::Canvas::Resour
ceId&, RefPtr<TypeBuilder::Canvas::ResourceInfo>&); | 85 virtual void getResourceInfo(ErrorString*, const TypeBuilder::Canvas::Resour
ceId&, RefPtr<TypeBuilder::Canvas::ResourceInfo>&); |
| 88 virtual void getResourceState(ErrorString*, const TypeBuilder::Canvas::Trace
LogId&, const TypeBuilder::Canvas::ResourceId&, RefPtr<TypeBuilder::Canvas::Reso
urceState>&); | 86 virtual void getResourceState(ErrorString*, const TypeBuilder::Canvas::Trace
LogId&, const TypeBuilder::Canvas::ResourceId&, RefPtr<TypeBuilder::Canvas::Reso
urceState>&); |
| 89 | 87 |
| 90 private: | 88 private: |
| 91 InspectorCanvasAgent(InstrumentingAgents*, InspectorCompositeState*, Inspect
orPageAgent*, InjectedScriptManager*); | 89 InspectorCanvasAgent(InstrumentingAgents*, InspectorState*, PassRefPtr<Inspe
ctorPageAgent>, InjectedScriptManager*); |
| 92 | 90 |
| 93 InjectedScriptCanvasModule injectedScriptCanvasModule(ErrorString*, ScriptSt
ate*); | 91 InjectedScriptCanvasModule injectedScriptCanvasModule(ErrorString*, ScriptSt
ate*); |
| 94 InjectedScriptCanvasModule injectedScriptCanvasModule(ErrorString*, const Sc
riptObject&); | 92 InjectedScriptCanvasModule injectedScriptCanvasModule(ErrorString*, const Sc
riptObject&); |
| 95 InjectedScriptCanvasModule injectedScriptCanvasModule(ErrorString*, const St
ring&); | 93 InjectedScriptCanvasModule injectedScriptCanvasModule(ErrorString*, const St
ring&); |
| 96 | 94 |
| 97 void findFramesWithUninstrumentedCanvases(); | 95 void findFramesWithUninstrumentedCanvases(); |
| 98 bool checkIsEnabled(ErrorString*) const; | 96 bool checkIsEnabled(ErrorString*) const; |
| 99 ScriptObject notifyRenderingContextWasWrapped(const ScriptObject&); | 97 ScriptObject notifyRenderingContextWasWrapped(const ScriptObject&); |
| 100 | 98 |
| 101 InspectorPageAgent* m_pageAgent; | 99 RefPtr<InspectorPageAgent> m_pageAgent; |
| 102 InjectedScriptManager* m_injectedScriptManager; | 100 InjectedScriptManager* m_injectedScriptManager; |
| 103 InspectorFrontend::Canvas* m_frontend; | 101 InspectorFrontend::Canvas* m_frontend; |
| 104 bool m_enabled; | 102 bool m_enabled; |
| 105 // Contains all frames with canvases, value is true only for frames that hav
e an uninstrumented canvas. | 103 // Contains all frames with canvases, value is true only for frames that hav
e an uninstrumented canvas. |
| 106 typedef HashMap<Frame*, bool> FramesWithUninstrumentedCanvases; | 104 typedef HashMap<Frame*, bool> FramesWithUninstrumentedCanvases; |
| 107 FramesWithUninstrumentedCanvases m_framesWithUninstrumentedCanvases; | 105 FramesWithUninstrumentedCanvases m_framesWithUninstrumentedCanvases; |
| 108 }; | 106 }; |
| 109 | 107 |
| 108 class InspectorCanvasFactory : public InspectorBaseFactory<InspectorCanvasFactor
y, InspectorCanvasAgent> { |
| 109 public: |
| 110 |
| 111 static PassOwnPtr<InspectorCanvasFactory> create(InstrumentingAgents* instru
mentingAgents, InspectorCompositeState* compositeState, InspectorPageFactory* pa
geFactory, InjectedScriptManager* injectedScriptManager) |
| 112 { |
| 113 return adoptPtr(new InspectorCanvasFactory(instrumentingAgents, composit
eState, pageFactory, injectedScriptManager)); |
| 114 } |
| 115 |
| 116 protected: |
| 117 InspectorCanvasFactory(InstrumentingAgents*, InspectorCompositeState*, Inspe
ctorPageFactory*, InjectedScriptManager*); |
| 118 }; |
| 119 |
| 110 } // namespace WebCore | 120 } // namespace WebCore |
| 111 | 121 |
| 112 | 122 |
| 113 #endif // !defined(InspectorCanvasAgent_h) | 123 #endif // !defined(InspectorCanvasAgent_h) |
| OLD | NEW |