~ubuntu-branches/ubuntu/raring/qtwebkit-source/raring-proposed

« back to all changes in this revision

Viewing changes to Source/WebCore/inspector/InspectorConsoleInstrumentation.h

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2013-02-18 14:24:18 UTC
  • Revision ID: package-import@ubuntu.com-20130218142418-eon0jmjg3nj438uy
Tags: upstream-2.3
ImportĀ upstreamĀ versionĀ 2.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
* Copyright (C) 2011 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 InspectorConsoleInstrumentation_h
 
32
#define InspectorConsoleInstrumentation_h
 
33
 
 
34
#include "InspectorInstrumentation.h"
 
35
#include "ScriptArguments.h"
 
36
#include "ScriptCallStack.h"
 
37
#include "ScriptProfile.h"
 
38
#include <wtf/PassRefPtr.h>
 
39
 
 
40
namespace WebCore {
 
41
 
 
42
inline void InspectorInstrumentation::addMessageToConsole(Page* page, MessageSource source, MessageType type, MessageLevel level, const String& message, PassRefPtr<ScriptCallStack> callStack, unsigned long requestIdentifier)
 
43
{
 
44
#if ENABLE(INSPECTOR)
 
45
    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
 
46
        addMessageToConsoleImpl(instrumentingAgents, source, type, level, message, callStack, requestIdentifier);
 
47
#endif
 
48
}
 
49
 
 
50
inline void InspectorInstrumentation::addMessageToConsole(Page* page, MessageSource source, MessageType type, MessageLevel level, const String& message, ScriptState* state, PassRefPtr<ScriptArguments> arguments, unsigned long requestIdentifier)
 
51
{
 
52
#if ENABLE(INSPECTOR)
 
53
    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
 
54
        addMessageToConsoleImpl(instrumentingAgents, source, type, level, message, state, arguments, requestIdentifier);
 
55
#endif
 
56
}
 
57
 
 
58
inline void InspectorInstrumentation::addMessageToConsole(Page* page, MessageSource source, MessageType type, MessageLevel level, const String& message, const String& scriptId, unsigned lineNumber, unsigned long requestIdentifier)
 
59
{
 
60
#if ENABLE(INSPECTOR)
 
61
    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
 
62
        addMessageToConsoleImpl(instrumentingAgents, source, type, level, message, scriptId, lineNumber, requestIdentifier);
 
63
#endif
 
64
}
 
65
 
 
66
#if ENABLE(WORKERS)
 
67
inline void InspectorInstrumentation::addMessageToConsole(WorkerContext* workerContext, MessageSource source, MessageType type, MessageLevel level, const String& message, PassRefPtr<ScriptCallStack> callStack, unsigned long requestIdentifier)
 
68
{
 
69
#if ENABLE(INSPECTOR)
 
70
    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForWorkerContext(workerContext))
 
71
        addMessageToConsoleImpl(instrumentingAgents, source, type, level, message, callStack, requestIdentifier);
 
72
#endif
 
73
}
 
74
 
 
75
inline void InspectorInstrumentation::addMessageToConsole(WorkerContext* workerContext, MessageSource source, MessageType type, MessageLevel level, const String& message, const String& scriptId, unsigned lineNumber, unsigned long requestIdentifier)
 
76
{
 
77
#if ENABLE(INSPECTOR)
 
78
    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForWorkerContext(workerContext))
 
79
        addMessageToConsoleImpl(instrumentingAgents, source, type, level, message, scriptId, lineNumber, requestIdentifier);
 
80
#endif
 
81
}
 
82
#endif
 
83
 
 
84
inline void InspectorInstrumentation::consoleCount(Page* page, ScriptState* state, PassRefPtr<ScriptArguments> arguments)
 
85
{
 
86
#if ENABLE(INSPECTOR)
 
87
    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
 
88
        consoleCountImpl(instrumentingAgents, state, arguments);
 
89
#endif
 
90
}
 
91
 
 
92
inline void InspectorInstrumentation::startConsoleTiming(Frame* frame, const String& title)
 
93
{
 
94
#if ENABLE(INSPECTOR)
 
95
    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
 
96
        startConsoleTimingImpl(instrumentingAgents, frame, title);
 
97
#endif
 
98
}
 
99
 
 
100
inline void InspectorInstrumentation::stopConsoleTiming(Frame* frame, const String& title, PassRefPtr<ScriptCallStack> stack)
 
101
{
 
102
#if ENABLE(INSPECTOR)
 
103
    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
 
104
        stopConsoleTimingImpl(instrumentingAgents, frame, title, stack);
 
105
#endif
 
106
}
 
107
 
 
108
inline void InspectorInstrumentation::consoleTimeStamp(Frame* frame, PassRefPtr<ScriptArguments> arguments)
 
109
{
 
110
#if ENABLE(INSPECTOR)
 
111
    FAST_RETURN_IF_NO_FRONTENDS(void());
 
112
    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
 
113
        consoleTimeStampImpl(instrumentingAgents, frame, arguments);
 
114
#endif
 
115
}
 
116
 
 
117
#if ENABLE(JAVASCRIPT_DEBUGGER)
 
118
inline void InspectorInstrumentation::addStartProfilingMessageToConsole(Page* page, const String& title, unsigned lineNumber, const String& sourceURL)
 
119
{
 
120
#if ENABLE(INSPECTOR)
 
121
    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
 
122
        addStartProfilingMessageToConsoleImpl(instrumentingAgents, title, lineNumber, sourceURL);
 
123
#endif
 
124
}
 
125
 
 
126
inline void InspectorInstrumentation::addProfile(Page* page, RefPtr<ScriptProfile> profile, PassRefPtr<ScriptCallStack> callStack)
 
127
{
 
128
#if ENABLE(INSPECTOR)
 
129
    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
 
130
        addProfileImpl(instrumentingAgents, profile, callStack);
 
131
#endif
 
132
}
 
133
 
 
134
inline bool InspectorInstrumentation::profilerEnabled(Page* page)
 
135
{
 
136
#if ENABLE(INSPECTOR)
 
137
    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
 
138
        return profilerEnabledImpl(instrumentingAgents);
 
139
#endif
 
140
    return false;
 
141
}
 
142
 
 
143
inline String InspectorInstrumentation::getCurrentUserInitiatedProfileName(Page* page, bool incrementProfileNumber)
 
144
{
 
145
#if ENABLE(INSPECTOR)
 
146
    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
 
147
        return InspectorInstrumentation::getCurrentUserInitiatedProfileNameImpl(instrumentingAgents, incrementProfileNumber);
 
148
#endif
 
149
    return "";
 
150
}
 
151
#endif
 
152
 
 
153
} // namespace WebCore
 
154
 
 
155
#endif // !defined(InspectorConsoleInstrumentation_h)