Changeset 96417 in webkit


Ignore:
Timestamp:
Sep 30, 2011 1:05:20 PM (13 years ago)
Author:
vestbo@webkit.org
Message:

[Qt] Prevent qDebug() output from DRT and WTR unless --verbose

For DRT we didn't install the message handler early enough to
catch output while constructing the QApplication. For WTR we
didn't even install a message handler.

Since the UI process will forward any output from the web process
we set an environment variable QT_WEBKIT_SUPPRESS_WEB_PROCESS_OUTPUT
in WTR before the web process is started. This is picked up by the
web process which installs its own message handler.

The environment variable can be overriden on the command line if you
want to see output from the web process, or you can pass --verbose to
WTR to see output from both processes.

https://bugs.webkit.org/show_bug.cgi?id=69132

Reviewed by Andreas Kling.

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r96413 r96417  
     12011-09-30  Tor Arne Vestbø  <tor.arne.vestbo@nokia.com>
     2
     3        [Qt] Prevent qDebug() output from DRT and WTR unless --verbose
     4
     5        For DRT we didn't install the message handler early enough to
     6        catch output while constructing the QApplication. For WTR we
     7        didn't even install a message handler.
     8
     9        Since the UI process will forward any output from the web process
     10        we set an environment variable QT_WEBKIT_SUPPRESS_WEB_PROCESS_OUTPUT
     11        in WTR before the web process is started. This is picked up by the
     12        web process which installs its own message handler.
     13
     14        The environment variable can be overriden on the command line if you
     15        want to see output from the web process, or you can pass --verbose to
     16        WTR to see output from both processes.
     17
     18        https://bugs.webkit.org/show_bug.cgi?id=69132
     19
     20        Reviewed by Andreas Kling.
     21
     22        * WebProcess/qt/WebProcessMainQt.cpp:
     23
    1242011-09-30  Anders Carlsson  <andersca@apple.com>
    225
  • trunk/Source/WebKit2/WebProcess/qt/WebProcessMainQt.cpp

    r95901 r96417  
    131131}
    132132
     133void messageHandler(QtMsgType type, const char* message)
     134{
     135    if (type == QtCriticalMsg) {
     136        fprintf(stderr, "%s\n", message);
     137        return;
     138    }
     139
     140    // Do nothing
     141}
     142
    133143Q_DECL_EXPORT int WebProcessMainQt(int argc, char** argv)
    134144{
     145    // Has to be done before QApplication is constructed in case
     146    // QApplication itself produces debug output.
     147    QByteArray suppressOutput = qgetenv("QT_WEBKIT_SUPPRESS_WEB_PROCESS_OUTPUT");
     148    if (!suppressOutput.isEmpty() && suppressOutput != "0")
     149        qInstallMsgHandler(messageHandler);
     150
    135151    QApplication::setGraphicsSystem(QLatin1String("raster"));
    136152    QApplication* app = new QApplication(argc, argv);
  • trunk/Tools/ChangeLog

    r96416 r96417  
     12011-09-30  Tor Arne Vestbø  <tor.arne.vestbo@nokia.com>
     2
     3        [Qt] Prevent qDebug() output from DRT and WTR unless --verbose
     4
     5        For DRT we didn't install the message handler early enough to
     6        catch output while constructing the QApplication. For WTR we
     7        didn't even install a message handler.
     8
     9        Since the UI process will forward any output from the web process
     10        we set an environment variable QT_WEBKIT_SUPPRESS_WEB_PROCESS_OUTPUT
     11        in WTR before the web process is started. This is picked up by the
     12        web process which installs its own message handler.
     13
     14        The environment variable can be overriden on the command line if you
     15        want to see output from the web process, or you can pass --verbose to
     16        WTR to see output from both processes.
     17
     18        https://bugs.webkit.org/show_bug.cgi?id=69132
     19
     20        Reviewed by Andreas Kling.
     21
     22        * DumpRenderTree/qt/main.cpp:
     23        * WebKitTestRunner/qt/main.cpp:
     24
    1252011-09-30  Tor Arne Vestbø  <tor.arne.vestbo@nokia.com>
    226
  • trunk/Tools/DumpRenderTree/qt/main.cpp

    r95729 r96417  
    137137#endif
    138138
     139    // Suppress debug output from Qt if not started with -v
     140    bool suppressQtDebugOutput = true;
     141    for (int i = 1; i < argc; ++i) {
     142        if (!qstrcmp(argv[i], "-v")) {
     143            suppressQtDebugOutput = false;
     144            break;
     145        }
     146    }
     147
     148    // Has to be done before QApplication is constructed in case
     149    // QApplication itself produces debug output.
     150    if (suppressQtDebugOutput)
     151        qInstallMsgHandler(messageHandler);
     152
    139153#ifdef Q_WS_X11
    140154    FcInit();
     
    178192
    179193    QStringList args = app.arguments();
    180     if (args.count() < 2) {
     194    if (args.count() < (!suppressQtDebugOutput ? 3 : 2)) {
    181195        printUsage();
    182196        exit(1);
     
    186200    args.removeAt(0);
    187201
    188     // Suppress debug output from Qt if not started with -v
    189     int index = args.indexOf(QLatin1String("-v"));
    190     if (index == -1)
    191         qInstallMsgHandler(messageHandler);
    192     else
    193         args.removeAt(index);
    194 
    195202    WebCore::DumpRenderTree dumper;
    196203
    197     index = args.indexOf(QLatin1String("--pixel-tests"));
     204    int index = args.indexOf(QLatin1String("--pixel-tests"));
    198205    if (index != -1) {
    199206        dumper.setDumpPixels(true);
  • trunk/Tools/WebKitTestRunner/qt/main.cpp

    r81135 r96417  
    6161};
    6262
     63void messageHandler(QtMsgType type, const char* message)
     64{
     65    if (type == QtCriticalMsg) {
     66        fprintf(stderr, "%s\n", message);
     67        return;
     68    }
     69
     70    // Do nothing
     71}
     72
    6373int main(int argc, char** argv)
    6474{
     75    // Suppress debug output from Qt if not started with --verbose
     76    bool suppressQtDebugOutput = true;
     77    for (int i = 1; i < argc; ++i) {
     78        if (!qstrcmp(argv[i], "--verbose")) {
     79            suppressQtDebugOutput = false;
     80            break;
     81        }
     82    }
     83
     84    // Has to be done before QApplication is constructed in case
     85    // QApplication itself produces debug output.
     86    if (suppressQtDebugOutput) {
     87        qInstallMsgHandler(messageHandler);
     88        if (qgetenv("QT_WEBKIT_SUPPRESS_WEB_PROCESS_OUTPUT").isEmpty())
     89            qputenv("QT_WEBKIT_SUPPRESS_WEB_PROCESS_OUTPUT", "1");
     90    }
     91
    6592    QApplication app(argc, argv);
    6693    Launcher launcher(argc, argv);
Note: See TracChangeset for help on using the changeset viewer.