OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | |
3 * | |
4 * Redistribution and use in source and binary forms, with or without | |
5 * modification, are permitted provided that the following conditions are | |
6 * met: | |
7 * | |
8 * * Redistributions of source code must retain the above copyright | |
9 * notice, this list of conditions and the following disclaimer. | |
10 * * Redistributions in binary form must reproduce the above | |
11 * copyright notice, this list of conditions and the following disclaimer | |
12 * in the documentation and/or other materials provided with the | |
13 * distribution. | |
14 * * Neither the name of Google Inc. nor the names of its | |
15 * contributors may be used to endorse or promote products derived from | |
16 * this software without specific prior written permission. | |
17 * | |
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
29 */ | |
30 | |
31 #ifndef InspectorCanvasAgent_h | |
32 #define InspectorCanvasAgent_h | |
33 | |
34 | |
35 #include "bindings/core/v8/ScriptState.h" | |
36 #include "core/InspectorFrontend.h" | |
37 #include "core/InspectorTypeBuilder.h" | |
38 #include "core/inspector/InspectorBaseAgent.h" | |
39 #include "wtf/HashMap.h" | |
40 #include "wtf/PassOwnPtr.h" | |
41 #include "wtf/text/WTFString.h" | |
42 | |
43 namespace blink { | |
44 | |
45 class LocalFrame; | |
46 class DocumentLoader; | |
47 class InjectedScriptCanvasModule; | |
48 class InjectedScriptManager; | |
49 class InspectorPageAgent; | |
50 class ScriptValue; | |
51 | |
52 typedef String ErrorString; | |
53 | |
54 class InspectorCanvasAgent final : public InspectorBaseAgent<InspectorCanvasAgen
t, InspectorFrontend::Canvas>, public InspectorBackendDispatcher::CanvasCommandH
andler { | |
55 public: | |
56 static PassOwnPtrWillBeRawPtr<InspectorCanvasAgent> create(InspectorPageAgen
t* pageAgent, InjectedScriptManager* injectedScriptManager) | |
57 { | |
58 return adoptPtrWillBeNoop(new InspectorCanvasAgent(pageAgent, injectedSc
riptManager)); | |
59 } | |
60 virtual ~InspectorCanvasAgent(); | |
61 DECLARE_VIRTUAL_TRACE(); | |
62 | |
63 void restore() override; | |
64 void disable(ErrorString*) override; | |
65 | |
66 void didCommitLoad(LocalFrame*, DocumentLoader*); | |
67 void frameDetachedFromParent(LocalFrame*); | |
68 void didProcessTask(); | |
69 | |
70 // Called from InspectorCanvasInstrumentation. | |
71 ScriptValue wrapCanvas2DRenderingContextForInstrumentation(const ScriptValue
&); | |
72 ScriptValue wrapWebGLRenderingContextForInstrumentation(const ScriptValue&); | |
73 | |
74 // Called from the front-end. | |
75 virtual void enable(ErrorString*) override; | |
76 virtual void dropTraceLog(ErrorString*, const TypeBuilder::Canvas::TraceLogI
d&) override; | |
77 virtual void hasUninstrumentedCanvases(ErrorString*, bool*) override; | |
78 virtual void captureFrame(ErrorString*, const TypeBuilder::Page::FrameId*, T
ypeBuilder::Canvas::TraceLogId*) override; | |
79 virtual void startCapturing(ErrorString*, const TypeBuilder::Page::FrameId*,
TypeBuilder::Canvas::TraceLogId*) override; | |
80 virtual void stopCapturing(ErrorString*, const TypeBuilder::Canvas::TraceLog
Id&) override; | |
81 virtual void getTraceLog(ErrorString*, const TypeBuilder::Canvas::TraceLogId
&, const int*, const int*, RefPtr<TypeBuilder::Canvas::TraceLog>&) override; | |
82 virtual void replayTraceLog(ErrorString*, const TypeBuilder::Canvas::TraceLo
gId&, int, RefPtr<TypeBuilder::Canvas::ResourceState>&, double*) override; | |
83 virtual void getResourceState(ErrorString*, const TypeBuilder::Canvas::Trace
LogId&, const TypeBuilder::Canvas::ResourceId&, RefPtr<TypeBuilder::Canvas::Reso
urceState>&) override; | |
84 virtual void evaluateTraceLogCallArgument(ErrorString*, const TypeBuilder::C
anvas::TraceLogId&, int, int, const String*, RefPtr<TypeBuilder::Runtime::Remote
Object>&, RefPtr<TypeBuilder::Canvas::ResourceState>&) override; | |
85 private: | |
86 InspectorCanvasAgent(InspectorPageAgent*, InjectedScriptManager*); | |
87 | |
88 InjectedScriptCanvasModule injectedScriptCanvasModule(ErrorString*, ScriptSt
ate*); | |
89 InjectedScriptCanvasModule injectedScriptCanvasModule(ErrorString*, const Sc
riptValue&); | |
90 InjectedScriptCanvasModule injectedScriptCanvasModule(ErrorString*, const St
ring&); | |
91 | |
92 void findFramesWithUninstrumentedCanvases(); | |
93 bool checkIsEnabled(ErrorString*) const; | |
94 ScriptValue notifyRenderingContextWasWrapped(const ScriptValue&); | |
95 | |
96 RawPtrWillBeMember<InspectorPageAgent> m_pageAgent; | |
97 RawPtrWillBeMember<InjectedScriptManager> m_injectedScriptManager; | |
98 bool m_enabled; | |
99 // Contains all frames with canvases, value is true only for frames that hav
e an uninstrumented canvas. | |
100 typedef HashMap<LocalFrame*, bool> FramesWithUninstrumentedCanvases; | |
101 FramesWithUninstrumentedCanvases m_framesWithUninstrumentedCanvases; | |
102 }; | |
103 | |
104 } // namespace blink | |
105 | |
106 | |
107 #endif // !defined(InspectorCanvasAgent_h) | |
OLD | NEW |