2 * Copyright (C) 2013 Google Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
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
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.
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.
31 #ifndef InspectorInstrumentationCustom_inl_h
32 #define InspectorInstrumentationCustom_inl_h
36 namespace InspectorInstrumentation {
38 bool profilerEnabledImpl(InstrumentingAgents*);
39 bool isDebuggerPausedImpl(InstrumentingAgents*);
40 bool collectingHTMLParseErrorsImpl(InstrumentingAgents*);
41 PassOwnPtr<ScriptSourceCode> preprocessImpl(InstrumentingAgents*, Frame*, const ScriptSourceCode&);
42 String preprocessEventListenerImpl(InstrumentingAgents*, Frame*, const String& source, const String& url, const String& functionName);
44 bool canvasAgentEnabled(ExecutionContext*);
45 bool consoleAgentEnabled(ExecutionContext*);
46 bool timelineAgentEnabled(ExecutionContext*);
48 inline bool profilerEnabled(WorkerGlobalScope* scope)
50 if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsFor(scope))
51 return profilerEnabledImpl(instrumentingAgents);
55 inline bool profilerEnabled(Page* page)
57 if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsFor(page))
58 return profilerEnabledImpl(instrumentingAgents);
62 inline bool isDebuggerPaused(Frame* frame)
64 FAST_RETURN_IF_NO_FRONTENDS(false);
65 if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsFor(frame))
66 return isDebuggerPausedImpl(instrumentingAgents);
70 inline bool collectingHTMLParseErrors(Page* page)
72 FAST_RETURN_IF_NO_FRONTENDS(false);
73 if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsFor(page))
74 return collectingHTMLParseErrorsImpl(instrumentingAgents);
78 inline String preprocessEventListener(Frame* frame, const String& source, const String& url, const String& functionName)
80 FAST_RETURN_IF_NO_FRONTENDS(source);
81 if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsFor(frame))
82 return preprocessEventListenerImpl(instrumentingAgents, frame, source, url, functionName);
86 inline PassOwnPtr<ScriptSourceCode> preprocess(Frame* frame, const ScriptSourceCode& sourceCode)
88 FAST_RETURN_IF_NO_FRONTENDS(PassOwnPtr<ScriptSourceCode>());
89 if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsFor(frame))
90 return preprocessImpl(instrumentingAgents, frame, sourceCode);
91 return PassOwnPtr<ScriptSourceCode>();
94 } // namespace InspectorInstrumentation
96 } // namespace WebCore
98 #endif // !defined(InspectorInstrumentationCustom_inl_h)