-
mkwst@chromium.org authored
https://bugs.webkit.org/show_bug.cgi?id=101331 Reviewed by Yury Semikhatsky. Currently, we generate stack traces for console messages at each call site. Bug 100650 has the end goal of moving all stack trace generation inside of the Inspector in order to ensure that we never send a console message without a stack trace if it's possible to generate one. This also ensures that we never generate unused call stacks. This patch is the first step in that direction, moving stack trace generation out of the Console bindings, and into either Console or InspectorConsoleAgent. No visible change in behavior should result; this refactoring should continue to pass all existing inspector tests. * bindings/js/JSConsoleCustom.cpp: (WebCore::JSConsole::profile): (WebCore::JSConsole::profileEnd): Adjust custom JSC Console bindings to drop call stack generation. * bindings/scripts/CodeGeneratorJS.pm: (GenerateCallWith): * bindings/scripts/CodeGeneratorV8.pm: (GenerateCallWith): Drop call stack generation from JSC and V8 bindings. * bindings/scripts/CodeGeneratorGObject.pm: Skip timeEnd explicitly in these bindings; it used to include ScriptArguments, which autoskipped it. Now it doesn't, so it needs to be called out on its own. * bindings/v8/ScriptCallStackFactory.cpp: (WebCore::createScriptCallStackForConsole): (WebCore::createScriptCallStack): (WebCore): * bindings/v8/ScriptCallStackFactory.h: (WebCore): Add 'createScriptCallStack(ScriptState*, size_t)' to V8's ScriptCallStackFactory in order to match JCS' implementation. It simply delegates to 'createScriptCallStackForConsole', which now also accepts a 'maxStackSize' parameter. * bindings/v8/custom/V8ConsoleCustom.cpp: (WebCore::V8Console::traceCallback): (WebCore::V8Console::assertCallback): (WebCore::V8Console::profileCallback): (WebCore::V8Console::profileEndCallback): Adjust custom V8 bindings to drop call stack generation. * inspector/InspectorConsoleAgent.cpp: (WebCore::InspectorConsoleAgent::addMessageToConsole): With the eventual goal of getting rid of the call stack parameter entirely, this patch drops it from one version of 'addMessageToConsole' (replacing it with ScriptState*), and creates a new version that only accepts a call stack. We should be able to migrate most (all?) external call sites over to the arguments version in future patches. (WebCore): (WebCore::InspectorConsoleAgent::count): Count takes 'ScriptState*' instead of a call stack, and generates the stack as needed. * inspector/InspectorConsoleAgent.h: (InspectorConsoleAgent): * inspector/InspectorConsoleInstrumentation.h: (WebCore::InspectorInstrumentation::addMessageToConsole): (WebCore): (WebCore::InspectorInstrumentation::consoleCount): * inspector/InspectorInstrumentation.cpp: (WebCore): (WebCore::InspectorInstrumentation::addMessageToConsoleImpl): (WebCore::InspectorInstrumentation::consoleCountImpl): * inspector/InspectorInstrumentation.h: (InspectorInstrumentation): Changes the InspectorInstrumentation pipeline to match the InspectorConsoleAgent changes. * page/Console.cpp: (WebCore::Console::addMessage): We now (always) generate one frame of a stack trace in order to populate line numbers and caller URLs. If we need to print the whole trace here, we generate a full stack. (WebCore::Console::debug): (WebCore::Console::error): (WebCore::Console::info): (WebCore::Console::log): (WebCore::Console::warn): (WebCore::Console::dir): (WebCore::Console::dirxml): (WebCore::Console::clear): (WebCore::Console::trace): (WebCore::Console::assertCondition): (WebCore::Console::count): (WebCore::Console::markTimeline): (WebCore::Console::timeEnd): (WebCore::Console::timeStamp): (WebCore::Console::group): (WebCore::Console::groupCollapsed): (WebCore::Console::profile): (WebCore::Console::profileEnd): s/ScriptCallStack/ScriptState*/g. Also, printing the stack trace has been moved out of 'trace' and into 'addMessage'. * page/Console.h: (Console): * page/Console.idl: Drop the call stack, add the script state. * workers/WorkerContext.cpp: (WebCore::WorkerContext::addMessageToWorkerConsole): Use the new, explicitly call stacked addMessageToConsole. We'll kill this in a future patch. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@134931 268f45cc-cd09-0410-ab3c-d52691b4dbfc
d643a8e1