Changeset 71409 in webkit


Ignore:
Timestamp:
Nov 5, 2010 5:03:50 AM (13 years ago)
Author:
kbalazs@webkit.org
Message:

[Qt][WK2] Left over files and shared memory segments
https://bugs.webkit.org/show_bug.cgi?id=48985

Reviewed by Andreas Kling.

  • Platform/qt/SharedMemoryQt.cpp:

(WebKit::SharedMemory::create): Force deletion of the QSharedMemory
object on terminate by connecting QCoreApplication::aboutToQuit with
deleteLater. Add the object to the CrashHandler as well to release the
shared memory segment even on crash.
(WebKit::SharedMemory::~SharedMemory):

  • Shared/qt/CrashHandler.cpp: Added.

CrashHandler has a container for QObjects that we want to
destroy on crash. When we got a signal that we interpret as
a crash then it destroys those objects.
(WebKit::CrashHandler::CrashHandler):
(WebKit::CrashHandler::signalHandler):
(WebKit::CrashHandler::deleteObjects):

  • Shared/qt/CrashHandler.h: Added.

(WebKit::CrashHandler::instance):
(WebKit::CrashHandler::didDelete):
(WebKit::CrashHandler::markForDeletionOnCrash):

  • UIProcess/Launcher/qt/ProcessLauncherQt.cpp:

(WebKit::ProcessLauncherHelper::ProcessLauncherHelper):
Add the object itself to the CrashHandler to close the QLocalServer
even on crash. Without that the QLocalServer leaves over socket files on the disk.
(WebKit::ProcessLauncherHelper::~ProcessLauncherHelper):

  • WebKit2.pro:
Location:
trunk/WebKit2
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit2/ChangeLog

    r71385 r71409  
     12010-11-05  Balazs Kelemen  <kbalazs@webkit.org>
     2
     3        Reviewed by Andreas Kling.
     4
     5        [Qt][WK2] Left over files and shared memory segments
     6        https://bugs.webkit.org/show_bug.cgi?id=48985
     7
     8        * Platform/qt/SharedMemoryQt.cpp:
     9        (WebKit::SharedMemory::create): Force deletion of the QSharedMemory
     10        object on terminate by connecting QCoreApplication::aboutToQuit with
     11        deleteLater. Add the object to the CrashHandler as well to release the
     12        shared memory segment even on crash.
     13        (WebKit::SharedMemory::~SharedMemory):
     14        * Shared/qt/CrashHandler.cpp: Added.
     15        CrashHandler has a container for QObjects that we want to
     16        destroy on crash. When we got a signal that we interpret as
     17        a crash then it destroys those objects.
     18        (WebKit::CrashHandler::CrashHandler):
     19        (WebKit::CrashHandler::signalHandler):
     20        (WebKit::CrashHandler::deleteObjects):
     21        * Shared/qt/CrashHandler.h: Added.
     22        (WebKit::CrashHandler::instance):
     23        (WebKit::CrashHandler::didDelete):
     24        (WebKit::CrashHandler::markForDeletionOnCrash):
     25        * UIProcess/Launcher/qt/ProcessLauncherQt.cpp:
     26        (WebKit::ProcessLauncherHelper::ProcessLauncherHelper):
     27        Add the object itself to the CrashHandler to close the QLocalServer
     28        even on crash. Without that the QLocalServer leaves over socket files on the disk.
     29        (WebKit::ProcessLauncherHelper::~ProcessLauncherHelper):
     30        * WebKit2.pro:
     31
    1322010-11-04  Jia Pu  <jpu@apple.com>
    233
  • trunk/WebKit2/Platform/qt/SharedMemoryQt.cpp

    r71118 r71409  
    3030#include "ArgumentDecoder.h"
    3131#include "ArgumentEncoder.h"
     32#include "CrashHandler.h"
    3233#include "WebCoreArgumentCoders.h"
    3334#include <unistd.h>
     35#include <QCoreApplication>
    3436#include <QLatin1String>
    3537#include <QSharedMemory>
     
    9395    bool created = impl->create(size);
    9496    ASSERT_UNUSED(created, created);
     97
    9598    sharedMemory->m_impl = impl;
    9699    sharedMemory->m_size = size;
    97100    sharedMemory->m_data = impl->data();
     101
     102    impl->connect(QCoreApplication::instance(), SIGNAL(aboutToQuit()), SLOT(deleteLater()));
     103
     104    // Release the shared memory segment even on crash!
     105    CrashHandler::instance()->markForDeletionOnCrash(impl);
    98106
    99107    return sharedMemory.release();
     
    122130    bool attached = impl->attach(accessMode(protection));
    123131    ASSERT_UNUSED(attached, attached);
     132
    124133    sharedMemory->m_impl = impl;
    125134    ASSERT(handle.m_size == impl->size());
    126135    sharedMemory->m_size = handle.m_size;
    127136    sharedMemory->m_data = impl->data();
     137
     138    impl->connect(QCoreApplication::instance(), SIGNAL(aboutToQuit()), SLOT(deleteLater()));
     139
     140    // Release the shared memory segment even on crash!
     141    CrashHandler::instance()->markForDeletionOnCrash(impl);
    128142
    129143    return sharedMemory.release();
     
    135149    ASSERT(qobject_cast<QSharedMemory*>(m_impl));
    136150    delete m_impl;
     151    CrashHandler::instance()->didDelete(m_impl);
    137152}
    138153
  • trunk/WebKit2/UIProcess/Launcher/qt/ProcessLauncherQt.cpp

    r68515 r71409  
    3030#include "NotImplemented.h"
    3131#include "RunLoop.h"
     32#include "CrashHandler.h"
    3233#include "WebProcess.h"
    3334#include <runtime/InitializeThreading.h>
     
    103104{
    104105    m_server.close();
     106    CrashHandler::instance()->didDelete(this);
    105107}
    106108
     
    114116    connect(&m_server, SIGNAL(newConnection()), this, SLOT(newConnection()));
    115117    connect(QCoreApplication::instance(), SIGNAL(aboutToQuit()), SLOT(deleteLater()), Qt::QueuedConnection);
     118
     119    // Do not leave socket files on the disk even on crash!
     120    CrashHandler::instance()->markForDeletionOnCrash(this);
    116121}
    117122
  • trunk/WebKit2/WebKit2.pro

    r71343 r71409  
    214214    Shared/NotImplemented.h \
    215215    Shared/StringPairVector.h \
     216    Shared/qt/CrashHandler.h \
    216217    Shared/qt/PlatformCertificateInfo.h \
    217218    Shared/qt/UpdateChunk.h \
     
    380381    Shared/MutableDictionary.cpp \
    381382    Shared/qt/BackingStoreQt.cpp \
     383    Shared/qt/CrashHandler.cpp \
    382384    Shared/qt/NativeWebKeyboardEventQt.cpp \
    383385    Shared/qt/UpdateChunk.cpp \
Note: See TracChangeset for help on using the changeset viewer.