• sigbjornf@opera.com's avatar
    Improve CancellableTaskFactory handling and Oilpan usage. · 0e5257ca
    sigbjornf@opera.com authored
    If a CancellableTaskFactory is used by an Oilpan heap object, the
    closure that the factory works with/over, cannot embed a reference
    back to that object by way of an off-heap Persistent<> (WTF::Closure
    is not on the heap.) If it does, such a reference will keep the heap
    object alive, without it ever being released. Memory leaks are very likely.
    
    This is too easy a slip-up to make with the current CancellableTaskFactory
    constructor, so rephrase the constructor so as to make leaks no longer (easily)
    possible. For Oilpan heap objects baked into the closure, the persistent reference
    now held will be weak.
    
    At the same time, take the opportunity to have this object no longer be a part object,
    but a separate (off-heap) allocation. This lets us drop the ad-hoc ASan unpoisoning
    support that was previously needed if CancellableTaskFactory was a part object
    of an Oilpan heap object. Less magic.
    
    R=haraken
    BUG=
    
    Review URL: https://codereview.chromium.org/1312843009
    
    git-svn-id: svn://svn.chromium.org/blink/trunk@201787 bbb929c8-8fbe-4397-9dbb-9b2b20218538
    0e5257ca
Handle.h 43 KB