Changeset 73142 in webkit


Ignore:
Timestamp:
Dec 2, 2010 9:34:02 AM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2010-11-30 Amruth Raj <amruthraj@motorola.com> and Ravi Kasibhatla <ravi.kasibhatla@motorola.com>

Reviewed by Martin Robinson.

[GTK] Implement RunLoop, WorkQueue, Connection classes for WebKit2
https://bugs.webkit.org/show_bug.cgi?id=48507

  • Platform/CoreIPC/Connection.h: UNIX_X11 specific changes for GTK port. (CoreIPC::Connection::messageProcessingCompleted):
  • Platform/CoreIPC/gtk: Added.
  • Platform/CoreIPC/gtk/ConnectionGtk.cpp: Added. Connection class implementation for GTK port (UNIX_X11 specific). (CoreIPC::readBytesFromSocket): (CoreIPC::writeBytesToSocket): (CoreIPC::Connection::platformInitialize): (CoreIPC::Connection::platformInvalidate): (CoreIPC::Connection::processCompletedMessage): (CoreIPC::Connection::readEventHandler): (CoreIPC::Connection::open): (CoreIPC::Connection::platformCanSendOutgoingMessages): (CoreIPC::Connection::sendOutgoingMessage):
  • Platform/PlatformProcessIdentifier.h: UNIX_X11 specific changes for GTK port.
  • Platform/RunLoop.h: GTK port specific changes.
  • Platform/WorkQueue.h: GTK port specific changes.
  • Platform/gtk/RunLoopGtk.cpp: Added. Runs an event loop using GMainLoop and handles the incoming messages. (RunLoop::RunLoop): (RunLoop::~RunLoop): (RunLoop::run): (RunLoop::mainLoop): (RunLoop::stop): (RunLoop::queueWork): (RunLoop::wakeUp): (RunLoop::TimerBase::TimerBase): (RunLoop::TimerBase::~TimerBase): (RunLoop::TimerBase::resetTimerSource): (RunLoop::TimerBase::oneShotTimerFired): (RunLoop::TimerBase::repeatingTimerFired): (RunLoop::TimerBase::start): (RunLoop::TimerBase::stop): (RunLoop::TimerBase::isActive):
  • Platform/gtk/WorkQueueGtk.cpp: Added. Creates a thread and polls on a given fd using GIOChannel. Dispatches the obtained messages to RunLoop's GMainLoop. (WorkQueue::EventSource::EventSource): (WorkQueue::EventSource::dispatchSource): (WorkQueue::EventSource::performWorkOnce): (WorkQueue::EventSource::performWork): (WorkQueue::EventSource::deleteEventSource): (WorkQueue::platformInitialize): (WorkQueue::platformInvalidate): (WorkQueue::startWorkQueueThread): (WorkQueue::workQueueThreadBody): (WorkQueue::registerEventSourceHandler): (WorkQueue::unregisterEventSourceHandler): (WorkQueue::scheduleWork):
Location:
trunk/WebKit2
Files:
4 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit2/ChangeLog

    r73140 r73142  
     12010-11-30 Amruth Raj  <amruthraj@motorola.com> and Ravi Kasibhatla  <ravi.kasibhatla@motorola.com>
     2
     3        Reviewed by Martin Robinson.
     4
     5        [GTK] Implement RunLoop, WorkQueue, Connection classes for WebKit2
     6        https://bugs.webkit.org/show_bug.cgi?id=48507
     7
     8        * Platform/CoreIPC/Connection.h: UNIX_X11 specific changes for GTK port.
     9        (CoreIPC::Connection::messageProcessingCompleted):
     10        * Platform/CoreIPC/gtk: Added.
     11        * Platform/CoreIPC/gtk/ConnectionGtk.cpp: Added. Connection class implementation for GTK port (UNIX_X11 specific).
     12        (CoreIPC::readBytesFromSocket):
     13        (CoreIPC::writeBytesToSocket):
     14        (CoreIPC::Connection::platformInitialize):
     15        (CoreIPC::Connection::platformInvalidate):
     16        (CoreIPC::Connection::processCompletedMessage):
     17        (CoreIPC::Connection::readEventHandler):
     18        (CoreIPC::Connection::open):
     19        (CoreIPC::Connection::platformCanSendOutgoingMessages):
     20        (CoreIPC::Connection::sendOutgoingMessage):
     21        * Platform/PlatformProcessIdentifier.h: UNIX_X11 specific changes for GTK port.
     22        * Platform/RunLoop.h: GTK port specific changes.
     23        * Platform/WorkQueue.h: GTK port specific changes.
     24        * Platform/gtk/RunLoopGtk.cpp: Added. Runs an event loop using GMainLoop and handles the incoming messages.
     25        (RunLoop::RunLoop):
     26        (RunLoop::~RunLoop):
     27        (RunLoop::run):
     28        (RunLoop::mainLoop):
     29        (RunLoop::stop):
     30        (RunLoop::queueWork):
     31        (RunLoop::wakeUp):
     32        (RunLoop::TimerBase::TimerBase):
     33        (RunLoop::TimerBase::~TimerBase):
     34        (RunLoop::TimerBase::resetTimerSource):
     35        (RunLoop::TimerBase::oneShotTimerFired):
     36        (RunLoop::TimerBase::repeatingTimerFired):
     37        (RunLoop::TimerBase::start):
     38        (RunLoop::TimerBase::stop):
     39        (RunLoop::TimerBase::isActive):
     40        * Platform/gtk/WorkQueueGtk.cpp: Added. Creates a thread and polls on a given fd using GIOChannel.
     41        Dispatches the obtained messages to RunLoop's GMainLoop.
     42        (WorkQueue::EventSource::EventSource):
     43        (WorkQueue::EventSource::dispatchSource):
     44        (WorkQueue::EventSource::performWorkOnce):
     45        (WorkQueue::EventSource::performWork):
     46        (WorkQueue::EventSource::deleteEventSource):
     47        (WorkQueue::platformInitialize):
     48        (WorkQueue::platformInvalidate):
     49        (WorkQueue::startWorkQueueThread):
     50        (WorkQueue::workQueueThreadBody):
     51        (WorkQueue::registerEventSourceHandler):
     52        (WorkQueue::unregisterEventSourceHandler):
     53        (WorkQueue::scheduleWork):
     54
    1552010-12-02  Steve Falkenburg  <sfalken@apple.com>
    256
  • trunk/WebKit2/Platform/CoreIPC/Connection.h

    r71931 r73142  
    22 * Copyright (C) 2010 Apple Inc. All rights reserved.
    33 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
     4 * Portions Copyright (c) 2010 Motorola Mobility, Inc.  All rights reserved.
    45 *
    56 * Redistribution and use in source and binary forms, with or without
     
    9192#elif PLATFORM(QT)
    9293    typedef const QString Identifier;
     94#elif PLATFORM(GTK)
     95    typedef int Identifier;
    9396#endif
    9497
     
    264267    QLocalSocket* m_socket;
    265268    QString m_serverName;
     269#elif PLATFORM(GTK)
     270    void readEventHandler();
     271    void processCompletedMessage();
     272    bool messageProcessingCompleted() { return !m_currentMessageSize; }
     273
     274    int m_socket;
     275    Vector<uint8_t> m_readBuffer;
     276    size_t m_currentMessageSize;
     277    size_t m_pendingBytes;
    266278#endif
    267279};
  • trunk/WebKit2/Platform/PlatformProcessIdentifier.h

    r62790 r73142  
    4040#elif PLATFORM(QT)
    4141typedef QProcess* PlatformProcessIdentifier;
     42#elif PLATFORM(GTK)
     43typedef pid_t PlatformProcessIdentifier;
    4244#endif
    4345
  • trunk/WebKit2/Platform/RunLoop.h

    r72816 r73142  
    22 * Copyright (C) 2010 Apple Inc. All rights reserved.
    33 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
     4 * Portions Copyright (c) 2010 Motorola Mobility, Inc.  All rights reserved.
    45 *
    56 * Redistribution and use in source and binary forms, with or without
     
    3334#include <wtf/Threading.h>
    3435#include <wtf/Vector.h>
     36#if PLATFORM(GTK)
     37typedef struct _GSource GSource;
     38typedef struct _GMainLoop GMainLoop;
     39typedef struct _GMainContext GMainContext;
     40typedef int gboolean;
     41#endif
    3542
    3643class WorkItem;
     
    7986        int m_ID;
    8087        bool m_isRepeating;
     88#elif PLATFORM(GTK)
     89        static gboolean oneShotTimerFired(RunLoop::TimerBase*);
     90        static gboolean repeatingTimerFired(RunLoop::TimerBase*);
     91        void resetTimerSource();
     92        GSource* m_timerSource;
    8193#endif
    8294    };
     
    130142    class TimerObject;
    131143    TimerObject* m_timerObject;
     144#elif PLATFORM(GTK)
     145public:
     146    static gboolean queueWork(RunLoop*);
     147    GMainLoop* mainLoop();
     148private:
     149    GMainContext* m_runLoopContext;
     150    GMainLoop* m_runLoopMain;
    132151#endif
    133152};
  • trunk/WebKit2/Platform/WorkQueue.h

    r71456 r73142  
    11/*
    22 * Copyright (C) 2010 Apple Inc. All rights reserved.
     3 * Portions Copyright (c) 2010 Motorola Mobility, Inc.  All rights reserved.
    34 *
    45 * Redistribution and use in source and binary forms, with or without
     
    4445class QObject;
    4546class QThread;
     47#elif PLATFORM(GTK)
     48typedef struct _GMainContext GMainContext;
     49typedef struct _GMainLoop GMainLoop;
    4650#endif
    4751
     
    8084
    8185    void moveSocketToWorkThread(QLocalSocket*);
     86#elif PLATFORM(GTK)
     87    void registerEventSourceHandler(int, int, PassOwnPtr<WorkItem>);
     88    void unregisterEventSourceHandler(int);
    8289#endif
    8390
     
    152159    QThread* m_workThread;
    153160    friend class WorkItemQt;
     161#elif PLATFORM(GTK)
     162    static void* startWorkQueueThread(WorkQueue*);
     163    void workQueueThreadBody();
     164
     165    ThreadIdentifier m_workQueueThread;
     166    GMainContext* m_eventContext;
     167    Mutex m_eventLoopLock;
     168    GMainLoop* m_eventLoop;
     169    Mutex m_eventSourcesLock;
     170    class EventSource;
     171    HashMap<int, Vector<EventSource*> > m_eventSources;
     172    typedef HashMap<int, Vector<EventSource*> >::iterator EventSourceIterator;
    154173#endif
    155174};
Note: See TracChangeset for help on using the changeset viewer.