Changeset 86756 in webkit
- Timestamp:
- May 18, 2011 6:50:56 AM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r86754 r86756 1 2011-05-16 Pavel Podivilov <podivilov@chromium.org> 2 3 Reviewed by Yury Semikhatsky. 4 5 Web Inspector: refactoring: ScriptDebugListener::didParseSource has too many parameters. 6 https://bugs.webkit.org/show_bug.cgi?id=60900 7 8 * bindings/js/ScriptDebugServer.cpp: 9 (WebCore::ScriptDebugServer::dispatchDidParseSource): 10 * bindings/v8/ScriptDebugServer.cpp: 11 (WebCore::ScriptDebugServer::dispatchDidParseSource): 12 * inspector/InspectorDebuggerAgent.cpp: 13 (WebCore::InspectorDebuggerAgent::getScriptSource): 14 (WebCore::InspectorDebuggerAgent::didParseSource): 15 * inspector/InspectorDebuggerAgent.h: 16 * inspector/ScriptDebugListener.h: 17 (WebCore::ScriptDebugListener::Script::Script): 18 1 19 2011-05-18 Alexander Pavlov <apavlov@chromium.org> 2 20 -
trunk/Source/WebCore/bindings/js/ScriptDebugServer.cpp
r86542 r86756 222 222 { 223 223 String sourceID = ustringToString(JSC::UString::number(sourceProvider->asID())); 224 String url = ustringToString(sourceProvider->url()); 225 String data = ustringToString(JSC::UString(sourceProvider->data(), sourceProvider->length())); 226 int lineOffset = sourceProvider->startPosition().m_line.convertAsZeroBasedInt(); 227 int columnOffset = sourceProvider->startPosition().m_column.convertAsZeroBasedInt(); 228 224 225 ScriptDebugListener::Script script; 226 script.url = ustringToString(sourceProvider->url()); 227 script.source = ustringToString(JSC::UString(sourceProvider->data(), sourceProvider->length())); 228 script.startLine = sourceProvider->startPosition().m_line.convertAsZeroBasedInt(); 229 script.startColumn = sourceProvider->startPosition().m_column.convertAsZeroBasedInt(); 230 script.isContentScript = isContentScript; 231 232 int sourceLength = script.source.length(); 229 233 int lineCount = 1; 230 234 int lastLineStart = 0; 231 for ( size_t i = 0; i < data.length()- 1; ++i) {232 if ( data[i] == '\n') {235 for (int i = 0; i < sourceLength - 1; ++i) { 236 if (script.source[i] == '\n') { 233 237 lineCount += 1; 234 238 lastLineStart = i + 1; … … 236 240 } 237 241 238 int endLine = lineOffset + lineCount - 1; 239 int endColumn; 242 script.endLine = script.startLine + lineCount - 1; 240 243 if (lineCount == 1) 241 endColumn = data.length() + columnOffset;244 script.endColumn = script.startColumn + sourceLength; 242 245 else 243 endColumn = data.length()- lastLineStart;246 script.endColumn = sourceLength - lastLineStart; 244 247 245 248 Vector<ScriptDebugListener*> copy; 246 249 copyToVector(listeners, copy); 247 250 for (size_t i = 0; i < copy.size(); ++i) 248 copy[i]->didParseSource(sourceID, url, data, lineOffset, columnOffset, endLine, endColumn, isContentScript);251 copy[i]->didParseSource(sourceID, script); 249 252 } 250 253 -
trunk/Source/WebCore/bindings/v8/ScriptDebugServer.cpp
r85320 r86756 353 353 void ScriptDebugServer::dispatchDidParseSource(ScriptDebugListener* listener, v8::Handle<v8::Object> object) 354 354 { 355 listener->didParseSource( 356 toWebCoreStringWithNullOrUndefinedCheck(object->Get(v8::String::New("id"))), 357 toWebCoreStringWithNullOrUndefinedCheck(object->Get(v8::String::New("name"))), 358 toWebCoreStringWithNullOrUndefinedCheck(object->Get(v8::String::New("source"))), 359 object->Get(v8::String::New("startLine"))->ToInteger()->Value(), 360 object->Get(v8::String::New("startColumn"))->ToInteger()->Value(), 361 object->Get(v8::String::New("endLine"))->ToInteger()->Value(), 362 object->Get(v8::String::New("endColumn"))->ToInteger()->Value(), 363 object->Get(v8::String::New("isContentScript"))->ToBoolean()->Value()); 355 String sourceID = toWebCoreStringWithNullOrUndefinedCheck(object->Get(v8::String::New("id"))); 356 357 ScriptDebugListener::Script script; 358 script.url = toWebCoreStringWithNullOrUndefinedCheck(object->Get(v8::String::New("name"))); 359 script.source = toWebCoreStringWithNullOrUndefinedCheck(object->Get(v8::String::New("source"))); 360 script.sourceMappingURL = toWebCoreStringWithNullOrUndefinedCheck(object->Get(v8::String::New("sourceMappingURL"))); 361 script.startLine = object->Get(v8::String::New("startLine"))->ToInteger()->Value(); 362 script.startColumn = object->Get(v8::String::New("startColumn"))->ToInteger()->Value(); 363 script.endLine = object->Get(v8::String::New("endLine"))->ToInteger()->Value(); 364 script.endColumn = object->Get(v8::String::New("endColumn"))->ToInteger()->Value(); 365 script.isContentScript = object->Get(v8::String::New("isContentScript"))->ToBoolean()->Value(); 366 367 listener->didParseSource(sourceID, script); 364 368 } 365 369 -
trunk/Source/WebCore/inspector/InspectorDebuggerAgent.cpp
r86752 r86756 294 294 void InspectorDebuggerAgent::getScriptSource(ErrorString*, const String& sourceId, String* scriptSource) 295 295 { 296 *scriptSource = m_scripts.get(sourceId). data;296 *scriptSource = m_scripts.get(sourceId).source; 297 297 } 298 298 … … 384 384 // JavaScriptDebugListener functions 385 385 386 void InspectorDebuggerAgent::didParseSource(const String& sourceId, const S tring& url, const String& data, int startLine, int startColumn, int endLine, int endColumn, bool isContentScript)386 void InspectorDebuggerAgent::didParseSource(const String& sourceId, const Script& script) 387 387 { 388 388 // Don't send script content to the front end until it's really needed. 389 m_frontend->scriptParsed(sourceId, url, startLine, startColumn, endLine, endColumn,isContentScript);390 391 m_scripts.set(sourceId, Script(url, data, startLine, startColumn, endLine, endColumn));392 393 if ( url.isEmpty())389 m_frontend->scriptParsed(sourceId, script.url, script.startLine, script.startColumn, script.endLine, script.endColumn, script.isContentScript); 390 391 m_scripts.set(sourceId, script); 392 393 if (script.url.isEmpty()) 394 394 return; 395 395 … … 399 399 String breakpointURL; 400 400 breakpointObject->getString("url", &breakpointURL); 401 if (breakpointURL != url)401 if (breakpointURL != script.url) 402 402 continue; 403 403 ScriptBreakpoint breakpoint; -
trunk/Source/WebCore/inspector/InspectorDebuggerAgent.h
r86752 r86756 121 121 PassRefPtr<InspectorArray> currentCallFrames(); 122 122 123 virtual void didParseSource(const String& sourceId, const S tring& url, const String& data, int startLine, int startColumn, int endLine, int endColumn, bool isContentScript);123 virtual void didParseSource(const String& sourceId, const Script&); 124 124 virtual void failedToParseSource(const String& url, const String& data, int firstLine, int errorLine, const String& errorMessage); 125 125 virtual void didPause(ScriptState*, const ScriptValue& callFrames, const ScriptValue& exception); … … 128 128 PassRefPtr<InspectorObject> resolveBreakpoint(const String& breakpointId, const String& sourceId, const ScriptBreakpoint&); 129 129 void clear(); 130 131 class Script {132 public:133 Script()134 : startLine(0)135 , startColumn(0)136 , endLine(0)137 , endColumn(0)138 {139 }140 141 Script(const String& url, const String& data, int startLine, int startColumn, int endLine, int endColumn)142 : url(url)143 , data(data)144 , startLine(startLine)145 , startColumn(startColumn)146 , endLine(endLine)147 , endColumn(endColumn)148 {149 }150 151 String url;152 String data;153 int startLine;154 int startColumn;155 int endLine;156 int endColumn;157 int linesCount;158 };159 130 160 131 typedef HashMap<String, Script> ScriptsMap; -
trunk/Source/WebCore/inspector/ScriptDebugListener.h
r86752 r86756 33 33 #if ENABLE(JAVASCRIPT_DEBUGGER) 34 34 35 #include "PlatformString.h" 35 36 #include "ScriptState.h" 36 37 #include <wtf/Forward.h> … … 41 42 class ScriptDebugListener { 42 43 public: 44 class Script { 45 public: 46 Script() 47 : startLine(0) 48 , startColumn(0) 49 , endLine(0) 50 , endColumn(0) 51 , isContentScript(false) 52 { 53 } 54 55 String url; 56 String source; 57 String sourceMappingURL; 58 int startLine; 59 int startColumn; 60 int endLine; 61 int endColumn; 62 bool isContentScript; 63 }; 64 43 65 virtual ~ScriptDebugListener() { } 44 66 45 virtual void didParseSource(const String& sourceId, const String& url, const String& data, int startLine, int startColumn, int endLine, int endColumn, bool isContentScript) = 0;67 virtual void didParseSource(const String& sourceId, const Script&) = 0; 46 68 virtual void failedToParseSource(const String& url, const String& data, int firstLine, int errorLine, const String& errorMessage) = 0; 47 69 virtual void didPause(ScriptState*, const ScriptValue& callFrames, const ScriptValue& exception) = 0;
Note: See TracChangeset
for help on using the changeset viewer.