Bug 136112

Summary: Clean up DiskCacheMonitor object memory management after bug 135896
Product: WebKit Reporter: Pratik Solanki <psolanki>
Component: PlatformAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: ap
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   

Description Pratik Solanki 2014-08-20 11:20:57 PDT
In <https://bugs.webkit.org/show_bug.cgi?id=135896#c11>, Darin commented

> > Source/WebKit2/NetworkProcess/mac/NetworkDiskCacheMonitor.mm:53
> > +    new NetworkDiskCacheMonitor(cachedResponse, loader); // Balanced by adoptPtr in the blocks setup in the DiskCacheMonitor constructor, one of which is guaranteed to run.
> 
> Should be "set up" rather than "setup".
> 
> This is a bad situation; code to implement this unconventional storage management is now spread across two classes, with the new call in the derived class and the adoptPtr in the base class. It’s really easy to get that wrong. Can we find a more straightforward idiom for this? I think we should consider moving the logic from the DiskCacheMonitor constructor into a separate function that takes a std::unique_ptr to get rid of this strangeness.

---

We should clean up this code and make the memory management more sane once my fix for bug 135896 lands.