]>
git.saurik.com Git - iphone-api.git/blob - WebCore/Console.h
2 * Copyright (C) 2007 Apple 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
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
14 * its contributors may be used to endorse or promote products derived
15 * from this software without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
18 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 #include "PlatformString.h"
35 #include <profiler/Profile.h>
38 #include <wtf/RefCounted.h>
39 #include <wtf/PassRefPtr.h>
44 typedef Vector
<RefPtr
<JSC::Profile
> > ProfilesArray
;
50 class ScriptCallStack
;
52 // Keep in sync with inspector/front-end/Console.js
70 StartGroupMessageLevel
,
74 class Console
: public RefCounted
<Console
> {
76 static PassRefPtr
<Console
> create(Frame
* frame
) { return adoptRef(new Console(frame
)); }
78 void disconnectFrame();
80 void addMessage(MessageSource
, MessageLevel
, const String
& message
, unsigned lineNumber
, const String
& sourceURL
);
82 void debug(ScriptCallStack
*);
83 void error(ScriptCallStack
*);
84 void info(ScriptCallStack
*);
85 void log(ScriptCallStack
*);
86 void warn(ScriptCallStack
*);
87 void dir(ScriptCallStack
*);
88 void dirxml(ScriptCallStack
*);
89 void trace(ScriptCallStack
*);
90 void assertCondition(bool condition
, ScriptCallStack
*);
91 void count(ScriptCallStack
*);
93 void profile(const JSC::UString
&, ScriptCallStack
*);
94 void profileEnd(const JSC::UString
&, ScriptCallStack
*);
96 void time(const String
&);
97 void timeEnd(const String
&, ScriptCallStack
*);
98 void group(ScriptCallStack
*);
101 static bool shouldPrintExceptions();
102 static void setShouldPrintExceptions(bool);
105 const ProfilesArray
& profiles() const { return m_profiles
; }
109 inline Page
* page() const;
110 void addMessage(MessageLevel
, ScriptCallStack
*, bool acceptNoArguments
= false);
116 ProfilesArray m_profiles
;
120 } // namespace WebCore