• viettrungluu@chromium.org's avatar
    Mojo: DataPipe: Implement "may discard" for two-phase writes. · 75db57b9
    viettrungluu@chromium.org authored
    Arguably more importantly, make data pipe producers not writable during
    two-phase writes and consumers not readable during two-phase reads. This
    allows multiple threads to simultaneously use the two-phase APIs in a
    sane way; they can respond to a "busy" error by waiting. (Why not
    "should wait" instead of "busy"? Because waiting is only an appropriate
    response if you know that someone else is going to end the two-phase
    read/write -- e.g., if a two-phase read/write is happening on another
    thread.)
    
    Also refactor the waiter-awakening stuff so that it's taken care of by
    the DataPipe superclass, rather than the LocalDataPipe implementation
    subclass.
    
    Note that a two-phase write will only discard if "all-or-none" is
    requested. Otherwise, as usual, it'll provide as much space as
    available.
    
    R=darin@chromium.org
    
    Review URL: https://codereview.chromium.org/129163003
    
    git-svn-id: svn://svn.chromium.org/chrome/trunk/src@243920 0039d316-1c4b-4281-b951-d872f2087c98
    75db57b9
data_pipe.h 7.92 KB