Changeset 102171 in webkit


Ignore:
Timestamp:
Dec 6, 2011 1:06:22 PM (12 years ago)
Author:
adamk@chromium.org
Message:

[chromium] Guard access to WebKitPlatformSupport::currentThread with a null check
https://bugs.webkit.org/show_bug.cgi?id=73937

Reviewed by Adam Barth.

Though |currentThread| is never null in production code, it is null in
unit tests (such as Chromium's unit_tests) that call WebKit::initialize()
without first constructing a MessageLoop.

  • src/WebKit.cpp:

(WebKit::initialize):
(WebKit::shutdown):

Location:
trunk/Source/WebKit/chromium
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/chromium/ChangeLog

    r102170 r102171  
     12011-12-06  Adam Klein  <adamk@chromium.org>
     2
     3        [chromium] Guard access to WebKitPlatformSupport::currentThread with a null check
     4        https://bugs.webkit.org/show_bug.cgi?id=73937
     5
     6        Reviewed by Adam Barth.
     7
     8        Though |currentThread| is never null in production code, it is null in
     9        unit tests (such as Chromium's unit_tests) that call WebKit::initialize()
     10        without first constructing a MessageLoop.
     11
     12        * src/WebKit.cpp:
     13        (WebKit::initialize):
     14        (WebKit::shutdown):
     15
    1162011-12-06  Alexandre Elias  <aelias@google.com>
    217
  • trunk/Source/WebKit/chromium/src/WebKit.cpp

    r102044 r102171  
    9494
    9595#if ENABLE(MUTATION_OBSERVERS)
    96     ASSERT(!s_endOfTaskRunner);
    97     s_endOfTaskRunner = new EndOfTaskRunner;
    98     webKitPlatformSupport->currentThread()->addTaskObserver(s_endOfTaskRunner);
     96    // currentThread will always be non-null in production, but can be null in Chromium unit tests.
     97    if (WebThread* currentThread = webKitPlatformSupport->currentThread()) {
     98        ASSERT(!s_endOfTaskRunner);
     99        s_endOfTaskRunner = new EndOfTaskRunner;
     100        currentThread->addTaskObserver(s_endOfTaskRunner);
     101    }
    99102#endif
    100103}
     
    128131#if ENABLE(MUTATION_OBSERVERS)
    129132    if (s_endOfTaskRunner) {
     133        ASSERT(s_webKitPlatformSupport->currentThread());
    130134        s_webKitPlatformSupport->currentThread()->removeTaskObserver(s_endOfTaskRunner);
    131135        delete s_endOfTaskRunner;
Note: See TracChangeset for help on using the changeset viewer.