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

Side by Side Diff: Source/core/inspector/InjectedScriptHost.cpp

Issue 16143005: monitor console command implemented. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 6 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 | Annotate | Revision Log
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) 2010 Google Inc. All rights reserved. 4 * Copyright (C) 2010 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 23 matching lines...) Expand all
34 #include "core/inspector/InspectorAgent.h" 34 #include "core/inspector/InspectorAgent.h"
35 #include "core/inspector/InspectorConsoleAgent.h" 35 #include "core/inspector/InspectorConsoleAgent.h"
36 #include "core/inspector/InspectorDOMAgent.h" 36 #include "core/inspector/InspectorDOMAgent.h"
37 #include "core/inspector/InspectorDOMStorageAgent.h" 37 #include "core/inspector/InspectorDOMStorageAgent.h"
38 #include "core/inspector/InspectorDatabaseAgent.h" 38 #include "core/inspector/InspectorDatabaseAgent.h"
39 #include "core/inspector/InspectorDebuggerAgent.h" 39 #include "core/inspector/InspectorDebuggerAgent.h"
40 #include "core/inspector/InspectorValues.h" 40 #include "core/inspector/InspectorValues.h"
41 #include "core/inspector/InstrumentingAgents.h" 41 #include "core/inspector/InstrumentingAgents.h"
42 #include "core/platform/Pasteboard.h" 42 #include "core/platform/Pasteboard.h"
43 43
44 #include <wtf/RefPtr.h> 44 #include "wtf/RefPtr.h"
45 #include <wtf/StdLibExtras.h> 45 #include "wtf/StdLibExtras.h"
46 #include "wtf/text/StringBuilder.h"
46 47
47 using namespace std; 48 using namespace std;
48 49
49 namespace WebCore { 50 namespace WebCore {
50 51
51 PassRefPtr<InjectedScriptHost> InjectedScriptHost::create() 52 PassRefPtr<InjectedScriptHost> InjectedScriptHost::create()
52 { 53 {
53 return adoptRef(new InjectedScriptHost()); 54 return adoptRef(new InjectedScriptHost());
54 } 55 }
55 56
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 return String(); 129 return String();
129 } 130 }
130 131
131 String InjectedScriptHost::storageIdImpl(Storage* storage) 132 String InjectedScriptHost::storageIdImpl(Storage* storage)
132 { 133 {
133 if (InspectorDOMStorageAgent* domStorageAgent = m_instrumentingAgents ? m_in strumentingAgents->inspectorDOMStorageAgent() : 0) 134 if (InspectorDOMStorageAgent* domStorageAgent = m_instrumentingAgents ? m_in strumentingAgents->inspectorDOMStorageAgent() : 0)
134 return domStorageAgent->storageId(storage); 135 return domStorageAgent->storageId(storage);
135 return String(); 136 return String();
136 } 137 }
137 138
138 void InjectedScriptHost::setBreakpoint(const String& scriptId, int lineNumber, i nt columnNumber) 139 void InjectedScriptHost::debugFunction(const String& scriptId, int lineNumber, i nt columnNumber)
139 { 140 {
140 if (InspectorDebuggerAgent* debuggerAgent = m_instrumentingAgents ? m_instru mentingAgents->inspectorDebuggerAgent() : 0) 141 if (InspectorDebuggerAgent* debuggerAgent = m_instrumentingAgents ? m_instru mentingAgents->inspectorDebuggerAgent() : 0)
141 debuggerAgent->setBreakpoint(scriptId, lineNumber, columnNumber, Inspect orDebuggerAgent::DebugCommandBreakpointSource); 142 debuggerAgent->setBreakpoint(scriptId, lineNumber, columnNumber, Inspect orDebuggerAgent::DebugCommandBreakpointSource);
142 } 143 }
143 144
144 void InjectedScriptHost::removeBreakpoint(const String& scriptId, int lineNumber , int columnNumber) 145 void InjectedScriptHost::undebugFunction(const String& scriptId, int lineNumber, int columnNumber)
145 { 146 {
146 if (InspectorDebuggerAgent* debuggerAgent = m_instrumentingAgents ? m_instru mentingAgents->inspectorDebuggerAgent() : 0) 147 if (InspectorDebuggerAgent* debuggerAgent = m_instrumentingAgents ? m_instru mentingAgents->inspectorDebuggerAgent() : 0)
147 debuggerAgent->removeBreakpoint(scriptId, lineNumber, columnNumber, Insp ectorDebuggerAgent::DebugCommandBreakpointSource); 148 debuggerAgent->removeBreakpoint(scriptId, lineNumber, columnNumber, Insp ectorDebuggerAgent::DebugCommandBreakpointSource);
148 } 149 }
149 150
151 void InjectedScriptHost::monitorFunction(const String& scriptId, int lineNumber, int columnNumber, const String& functionName)
152 {
153 StringBuilder builder;
154 builder.appendLiteral("console.log(\"function ");
155 if (functionName.isEmpty())
156 builder.appendLiteral("(anonymous function)");
157 else
158 builder.append(functionName);
159 builder.appendLiteral(" called\" + (arguments.length > 0 ? \" with arguments : \" + Array.prototype.join.call(arguments, \", \") : \"\")) && false");
160 if (InspectorDebuggerAgent* debuggerAgent = m_instrumentingAgents ? m_instru mentingAgents->inspectorDebuggerAgent() : 0)
161 debuggerAgent->setBreakpoint(scriptId, lineNumber, columnNumber, Inspect orDebuggerAgent::MonitorCommandBreakpointSource, builder.toString());
162 }
163
164 void InjectedScriptHost::unmonitorFunction(const String& scriptId, int lineNumbe r, int columnNumber)
165 {
166 if (InspectorDebuggerAgent* debuggerAgent = m_instrumentingAgents ? m_instru mentingAgents->inspectorDebuggerAgent() : 0)
167 debuggerAgent->removeBreakpoint(scriptId, lineNumber, columnNumber, Insp ectorDebuggerAgent::MonitorCommandBreakpointSource);
168 }
169
150 } // namespace WebCore 170 } // namespace WebCore
151 171
OLDNEW
« no previous file with comments | « Source/core/inspector/InjectedScriptHost.h ('k') | Source/core/inspector/InjectedScriptHost.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698