Changeset 230624 in webkit


Ignore:
Timestamp:
Apr 13, 2018 12:26:59 AM (6 years ago)
Author:
Carlos Garcia Campos
Message:

[GLIB] Tests WTF_RefPtr.ReleaseInNonMainThread and WTF_RefPtr.ReleaseInNonMainThreadDestroyInMainThread are crashing since they were added
https://bugs.webkit.org/show_bug.cgi?id=184531

Reviewed by Michael Catanzaro.

It's not a bug in WebKit, but in the tests. The problem is that those tests are using RunLoop::main() but main
run loop hasn't been initialized. ReleaseInNonMainThread doesn't really need to initialize the main run loop if
we change Util::run() to always use RunLop::current() instead of RunLoop::main(). But
ReleaseInNonMainThreadDestroyInMainThread ends up scheduling a task to the main thread, and the generic
implementation fo that uses RunLoop::main(), so we need to initialize the main loop in this case.

  • TestWebKitAPI/Tests/WTF/RefPtr.cpp:

(TestWebKitAPI::TEST): Call RunLoop::initializeMainRunLoop().

  • TestWebKitAPI/glib/UtilitiesGLib.cpp:

(TestWebKitAPI::Util::run): Use RunLop::current() to stop the current run loop.
(TestWebKitAPI::Util::sleep): Ditto.

Location:
trunk/Tools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r230622 r230624  
     12018-04-13  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [GLIB] Tests WTF_RefPtr.ReleaseInNonMainThread and WTF_RefPtr.ReleaseInNonMainThreadDestroyInMainThread are crashing since they were added
     4        https://bugs.webkit.org/show_bug.cgi?id=184531
     5
     6        Reviewed by Michael Catanzaro.
     7
     8        It's not a bug in WebKit, but in the tests. The problem is that those tests are using RunLoop::main() but main
     9        run loop hasn't been initialized. ReleaseInNonMainThread doesn't really need to initialize the main run loop if
     10        we change Util::run() to always use RunLop::current() instead of RunLoop::main(). But
     11        ReleaseInNonMainThreadDestroyInMainThread ends up scheduling a task to the main thread, and the generic
     12        implementation fo that uses RunLoop::main(), so we need to initialize the main loop in this case.
     13
     14        * TestWebKitAPI/Tests/WTF/RefPtr.cpp:
     15        (TestWebKitAPI::TEST): Call RunLoop::initializeMainRunLoop().
     16        * TestWebKitAPI/glib/UtilitiesGLib.cpp:
     17        (TestWebKitAPI::Util::run): Use RunLop::current() to stop the current run loop.
     18        (TestWebKitAPI::Util::sleep): Ditto.
     19
    1202018-04-12  Zalan Bujtas  <zalan@apple.com>
    221
  • trunk/Tools/TestWebKitAPI/Tests/WTF/RefPtr.cpp

    r230259 r230624  
    3434#include <wtf/RefCounted.h>
    3535#include <wtf/RefPtr.h>
     36#include <wtf/RunLoop.h>
    3637#include <wtf/ThreadSafeRefCounted.h>
    3738#include <wtf/Threading.h>
     
    578579TEST(WTF_RefPtr, ReleaseInNonMainThreadDestroyInMainThread)
    579580{
     581    RunLoop::initializeMainRunLoop();
    580582    done = false;
    581583    Thread::create("", [object = MainThreadSafeRefCountedObject::create()] { });
  • trunk/Tools/TestWebKitAPI/glib/UtilitiesGLib.cpp

    r222962 r230624  
    3838        bool* done = static_cast<bool*>(userData);
    3939        if (*done)
    40             RunLoop::main().stop();
     40            RunLoop::current().stop();
    4141
    4242        return !*done;
     
    5959        return G_SOURCE_REMOVE;
    6060    }, nullptr);
    61     RunLoop::main().stop();
     61    RunLoop::current().stop();
    6262}
    6363
Note: See TracChangeset for help on using the changeset viewer.