Bug 136112 - Clean up DiskCacheMonitor object memory management after bug 135896
Summary: Clean up DiskCacheMonitor object memory management after bug 135896
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Platform (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-08-20 11:20 PDT by Pratik Solanki
Modified: 2014-08-23 00:27 PDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.