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

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: Moved command implementation to C++. 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 22 matching lines...) Expand all
33 33
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/platform/Pasteboard.h" 41 #include "core/platform/Pasteboard.h"
42 42
43 #include <wtf/RefPtr.h> 43 #include "wtf/RefPtr.h"
44 #include <wtf/StdLibExtras.h> 44 #include "wtf/StdLibExtras.h"
45 #include "wtf/text/StringBuilder.h"
45 46
46 using namespace std; 47 using namespace std;
47 48
48 namespace WebCore { 49 namespace WebCore {
49 50
50 PassRefPtr<InjectedScriptHost> InjectedScriptHost::create() 51 PassRefPtr<InjectedScriptHost> InjectedScriptHost::create()
51 { 52 {
52 return adoptRef(new InjectedScriptHost()); 53 return adoptRef(new InjectedScriptHost());
53 } 54 }
54 55
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 return String(); 137 return String();
137 } 138 }
138 139
139 String InjectedScriptHost::storageIdImpl(Storage* storage) 140 String InjectedScriptHost::storageIdImpl(Storage* storage)
140 { 141 {
141 if (m_domStorageAgent) 142 if (m_domStorageAgent)
142 return m_domStorageAgent->storageId(storage); 143 return m_domStorageAgent->storageId(storage);
143 return String(); 144 return String();
144 } 145 }
145 146
146 void InjectedScriptHost::setBreakpoint(const String& scriptId, int lineNumber, i nt columnNumber) 147 void InjectedScriptHost::debugFunction(const String& scriptId, int lineNumber, i nt columnNumber)
147 { 148 {
148 m_debuggerAgent->setBreakpoint(scriptId, lineNumber, columnNumber, Inspector DebuggerAgent::DebugCommandBreakpointSource); 149 m_debuggerAgent->setBreakpoint(scriptId, lineNumber, columnNumber, Inspector DebuggerAgent::DebugCommandBreakpointSource);
149 } 150 }
150 151
151 void InjectedScriptHost::removeBreakpoint(const String& scriptId, int lineNumber , int columnNumber) 152 void InjectedScriptHost::undebugFunction(const String& scriptId, int lineNumber, int columnNumber)
152 { 153 {
153 m_debuggerAgent->removeBreakpoint(scriptId, lineNumber, columnNumber, Inspec torDebuggerAgent::DebugCommandBreakpointSource); 154 m_debuggerAgent->removeBreakpoint(scriptId, lineNumber, columnNumber, Inspec torDebuggerAgent::DebugCommandBreakpointSource);
154 } 155 }
155 156
157 void InjectedScriptHost::monitorFunction(const String& scriptId, int lineNumber, int columnNumber, const String& functionName)
158 {
159 StringBuilder builder;
160 builder.appendLiteral("console.log(\"function ");
161 if (functionName.isEmpty())
162 builder.appendLiteral("(anonymous function)");
163 else
164 builder.append(functionName);
165 builder.appendLiteral(" called\" + (arguments.length > 0 ? \" with arguments : \" + Array.prototype.join.call(arguments, \", \") : \"\")) && false");
yurys 2013/06/17 12:06:14 This still calls Array.prototype.join that may be
Peter.Rybin 2013/06/17 14:38:14 It looks that breakpoint conditions are processed
SeRya 2013/06/17 15:08:57 It evaluates in v8/src/debug-debugger.js: var mirr
166 m_debuggerAgent->setBreakpoint(scriptId, lineNumber, columnNumber, Inspector DebuggerAgent::MonitorCommandBreakpointSource, builder.toString());
167 }
168
169 void InjectedScriptHost::unmonitorFunction(const String& scriptId, int lineNumbe r, int columnNumber)
170 {
171 m_debuggerAgent->removeBreakpoint(scriptId, lineNumber, columnNumber, Inspec torDebuggerAgent::MonitorCommandBreakpointSource);
172 }
173
156 } // namespace WebCore 174 } // namespace WebCore
157 175
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698