Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / inspector / ConsoleMessage.h
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef ConsoleMessage_h
6 #define ConsoleMessage_h
7
8 #include "bindings/core/v8/ScriptState.h"
9 #include "core/frame/ConsoleTypes.h"
10 #include "core/inspector/ConsoleAPITypes.h"
11 #include "core/inspector/ScriptCallStack.h"
12 #include "platform/heap/Handle.h"
13 #include "wtf/Forward.h"
14 #include "wtf/PassRefPtr.h"
15 #include "wtf/RefCounted.h"
16 #include "wtf/text/WTFString.h"
17
18 namespace blink {
19
20 class ScriptArguments;
21 class ScriptCallStack;
22 class ScriptState;
23 class WorkerGlobalScopeProxy;
24
25 class ConsoleMessage final: public RefCountedWillBeGarbageCollectedFinalized<ConsoleMessage> {
26 public:
27     static PassRefPtrWillBeRawPtr<ConsoleMessage> create(MessageSource source, MessageLevel level, const String& message, const String& url = String(), unsigned lineNumber = 0, unsigned columnNumber = 0)
28     {
29         return adoptRefWillBeNoop(new ConsoleMessage(source, level, message, url, lineNumber, columnNumber));
30     }
31     ~ConsoleMessage();
32
33     MessageType type() const;
34     void setType(MessageType);
35     int scriptId() const;
36     void setScriptId(int);
37     const String& url() const;
38     void setURL(const String&);
39     unsigned lineNumber() const;
40     void setLineNumber(unsigned);
41     PassRefPtrWillBeRawPtr<ScriptCallStack> callStack() const;
42     void setCallStack(PassRefPtrWillBeRawPtr<ScriptCallStack>);
43     ScriptState* scriptState() const;
44     void setScriptState(ScriptState*);
45     PassRefPtrWillBeRawPtr<ScriptArguments> scriptArguments() const;
46     void setScriptArguments(PassRefPtrWillBeRawPtr<ScriptArguments>);
47     unsigned long requestIdentifier() const;
48     void setRequestIdentifier(unsigned long);
49     double timestamp() const;
50     void setTimestamp(double);
51     WorkerGlobalScopeProxy* workerGlobalScopeProxy() { return m_workerProxy; }
52     void setWorkerGlobalScopeProxy(WorkerGlobalScopeProxy* proxy) { m_workerProxy = proxy; }
53
54     MessageSource source() const;
55     MessageLevel level() const;
56     const String& message() const;
57     unsigned columnNumber() const;
58
59     void frameWindowDiscarded(LocalDOMWindow*);
60     unsigned argumentCount();
61
62     void collectCallStack();
63
64     void trace(Visitor*);
65
66 private:
67     ConsoleMessage(MessageSource, MessageLevel, const String& message, const String& url = String(), unsigned lineNumber = 0, unsigned columnNumber = 0);
68
69     MessageSource m_source;
70     MessageLevel m_level;
71     MessageType m_type;
72     String m_message;
73     int m_scriptId;
74     String m_url;
75     unsigned m_lineNumber;
76     unsigned m_columnNumber;
77     RefPtrWillBeMember<ScriptCallStack> m_callStack;
78     OwnPtr<ScriptStateProtectingContext> m_scriptState;
79     RefPtrWillBeMember<ScriptArguments> m_scriptArguments;
80     unsigned long m_requestIdentifier;
81     double m_timestamp;
82     WorkerGlobalScopeProxy* m_workerProxy;
83 };
84
85 } // namespace blink
86
87 #endif // ConsoleMessage_h