Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Side by Side Diff: inspector/ConsoleMessage.cpp

Issue 542055: DevTools: injected script per context(WebCore part) (Closed) Base URL: http://svn.webkit.org/repository/webkit/trunk/WebCore/
Patch Set: '' Created 10 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « inspector/ConsoleMessage.h ('k') | inspector/InjectedScriptHost.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> 3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com>
4 * Copyright (C) 2009 Google Inc. All rights reserved. 4 * Copyright (C) 2009 Google Inc. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 9 *
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 , m_groupLevel(g) 47 , m_groupLevel(g)
48 , m_repeatCount(1) 48 , m_repeatCount(1)
49 { 49 {
50 } 50 }
51 51
52 ConsoleMessage::ConsoleMessage(MessageSource s, MessageType t, MessageLevel l, S criptCallStack* callStack, unsigned g, bool storeTrace) 52 ConsoleMessage::ConsoleMessage(MessageSource s, MessageType t, MessageLevel l, S criptCallStack* callStack, unsigned g, bool storeTrace)
53 : m_source(s) 53 : m_source(s)
54 , m_type(t) 54 , m_type(t)
55 , m_level(l) 55 , m_level(l)
56 #if ENABLE(INSPECTOR) 56 #if ENABLE(INSPECTOR)
57 , m_wrappedArguments(callStack->at(0).argumentCount()) 57 , m_arguments(callStack->at(0).argumentCount())
58 , m_scriptState(callStack->state())
58 #endif 59 #endif
59 , m_frames(storeTrace ? callStack->size() : 0) 60 , m_frames(storeTrace ? callStack->size() : 0)
60 , m_groupLevel(g) 61 , m_groupLevel(g)
61 , m_repeatCount(1) 62 , m_repeatCount(1)
62 { 63 {
63 const ScriptCallFrame& lastCaller = callStack->at(0); 64 const ScriptCallFrame& lastCaller = callStack->at(0);
64 m_line = lastCaller.lineNumber(); 65 m_line = lastCaller.lineNumber();
65 m_url = lastCaller.sourceURL().string(); 66 m_url = lastCaller.sourceURL().string();
66 67
67 // FIXME: For now, just store function names as strings. 68 // FIXME: For now, just store function names as strings.
68 // As ScriptCallStack start storing line number and source URL for all 69 // As ScriptCallStack start storing line number and source URL for all
69 // frames, refactor to use that, as well. 70 // frames, refactor to use that, as well.
70 if (storeTrace) { 71 if (storeTrace) {
71 for (unsigned i = 0; i < callStack->size(); ++i) 72 for (unsigned i = 0; i < callStack->size(); ++i)
72 m_frames[i] = callStack->at(i).functionName(); 73 m_frames[i] = callStack->at(i).functionName();
73 } 74 }
74 75
75 #if ENABLE(INSPECTOR) 76 #if ENABLE(INSPECTOR)
76 for (unsigned i = 0; i < lastCaller.argumentCount(); ++i) 77 for (unsigned i = 0; i < lastCaller.argumentCount(); ++i)
77 m_wrappedArguments[i] = ScriptObject::quarantineValue(callStack->state() , lastCaller.argumentAt(i)); 78 m_arguments[i] = lastCaller.argumentAt(i);
78 #endif 79 #endif
79 } 80 }
80 81
81 #if ENABLE(INSPECTOR) 82 #if ENABLE(INSPECTOR)
82 void ConsoleMessage::addToConsole(InspectorFrontend* frontend) 83 void ConsoleMessage::addToConsole(InspectorFrontend* frontend)
83 { 84 {
84 ScriptObject jsonObj = frontend->newScriptObject(); 85 ScriptObject jsonObj = frontend->newScriptObject();
85 jsonObj.set("source", static_cast<int>(m_source)); 86 jsonObj.set("source", static_cast<int>(m_source));
86 jsonObj.set("type", static_cast<int>(m_type)); 87 jsonObj.set("type", static_cast<int>(m_type));
87 jsonObj.set("level", static_cast<int>(m_level)); 88 jsonObj.set("level", static_cast<int>(m_level));
88 jsonObj.set("line", static_cast<int>(m_line)); 89 jsonObj.set("line", static_cast<int>(m_line));
89 jsonObj.set("url", m_url); 90 jsonObj.set("url", m_url);
90 jsonObj.set("groupLevel", static_cast<int>(m_groupLevel)); 91 jsonObj.set("groupLevel", static_cast<int>(m_groupLevel));
91 jsonObj.set("repeatCount", static_cast<int>(m_repeatCount)); 92 jsonObj.set("repeatCount", static_cast<int>(m_repeatCount));
92 frontend->addConsoleMessage(jsonObj, m_frames, m_wrappedArguments, m_messag e); 93 frontend->addConsoleMessage(jsonObj, m_frames, m_scriptState, m_arguments, m_message);
93 } 94 }
94 95
95 void ConsoleMessage::updateRepeatCountInConsole(InspectorFrontend* frontend) 96 void ConsoleMessage::updateRepeatCountInConsole(InspectorFrontend* frontend)
96 { 97 {
97 frontend->updateConsoleMessageRepeatCount(m_repeatCount); 98 frontend->updateConsoleMessageRepeatCount(m_repeatCount);
98 } 99 }
99 #endif // ENABLE(INSPECTOR) 100 #endif // ENABLE(INSPECTOR)
100 101
101 bool ConsoleMessage::isEqual(ScriptState* state, ConsoleMessage* msg) const 102 bool ConsoleMessage::isEqual(ScriptState* state, ConsoleMessage* msg) const
102 { 103 {
103 #if ENABLE(INSPECTOR) 104 #if ENABLE(INSPECTOR)
104 if (msg->m_wrappedArguments.size() != m_wrappedArguments.size()) 105 if (msg->m_arguments.size() != m_arguments.size())
105 return false; 106 return false;
106 if (!state && msg->m_wrappedArguments.size()) 107 if (!state && msg->m_arguments.size())
107 return false; 108 return false;
108 109
109 ASSERT_ARG(state, state || msg->m_wrappedArguments.isEmpty()); 110 ASSERT_ARG(state, state || msg->m_arguments.isEmpty());
110 111
111 for (size_t i = 0; i < msg->m_wrappedArguments.size(); ++i) { 112 for (size_t i = 0; i < msg->m_arguments.size(); ++i) {
112 if (!m_wrappedArguments[i].isEqual(state, msg->m_wrappedArguments[i])) 113 if (!m_arguments[i].isEqual(state, msg->m_arguments[i]))
113 return false; 114 return false;
114 } 115 }
115 #else 116 #else
116 UNUSED_PARAM(state); 117 UNUSED_PARAM(state);
117 #endif // ENABLE(INSPECTOR) 118 #endif // ENABLE(INSPECTOR)
118 119
119 size_t frameCount = msg->m_frames.size(); 120 size_t frameCount = msg->m_frames.size();
120 if (frameCount != m_frames.size()) 121 if (frameCount != m_frames.size())
121 return false; 122 return false;
122 123
123 for (size_t i = 0; i < frameCount; ++i) { 124 for (size_t i = 0; i < frameCount; ++i) {
124 if (m_frames[i] != msg->m_frames[i]) 125 if (m_frames[i] != msg->m_frames[i])
125 return false; 126 return false;
126 } 127 }
127 128
128 return msg->m_source == m_source 129 return msg->m_source == m_source
129 && msg->m_type == m_type 130 && msg->m_type == m_type
130 && msg->m_level == m_level 131 && msg->m_level == m_level
131 && msg->m_message == m_message 132 && msg->m_message == m_message
132 && msg->m_line == m_line 133 && msg->m_line == m_line
133 && msg->m_url == m_url 134 && msg->m_url == m_url
134 && msg->m_groupLevel == m_groupLevel; 135 && msg->m_groupLevel == m_groupLevel;
135 } 136 }
136 137
137 } // namespace WebCore 138 } // namespace WebCore
OLDNEW
« no previous file with comments | « inspector/ConsoleMessage.h ('k') | inspector/InjectedScriptHost.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698