On Tue, Aug 16, 2011 at 12:44 PM, Xianzhu Wang <phnix...@gmail.com> wrote:
> > > On Tue, Aug 16, 2011 at 3:41 PM, Pavel Feldman <pfeld...@chromium.org>wrote: > >> On Tue, Aug 16, 2011 at 11:20 AM, Xianzhu Wang <phnix...@gmail.com>wrote: >> >>> Hi, >>> >>> I found that DocumentLoader will hold m_mainResourceData during its whole >>> life. I'm wondering if this is necessary. I searched all callers of >>> DocumentLoader::mainResourceData() and DocumentLoader::mainResource() and >>> they seem all called before or just after the document is loaded. >>> >> >> This is not the case for the inspector and a number of other usages I can >> see here: >> >> http://codesearch.google.com/codesearch#search/&exact_package=chromium&q=mainResourceData%5C(%5C)&type=cs >> > > Thanks. I missed some cases (like WebKit2 and WebDataSource ones) as I only > searched the compiled files in my environment. And I did overlooked the > first case in inspector. > > >> "just after" might be problematic to define as well. >> > > I meant "just after" that the function is called from somewhere > xxxDidFinishLoading() etc. For these cases, by carefully adjust the > sequence, we can let them depend on DocumentLoader::m_mainResourceLoader > instead of m_mainResourceData. > > An (maybe incomplete) list of cases that might use > DocumentLoader::mainResourceData() after loading is: > WebDataSource::data() > WebKit::WebFrame::source() > WebKit::WebPage::getMainResourceDataOfFrame() > InspectorPageAgent::resourceContent() > > As the amount of memory saved by removing m_mainResourceData could be > significant on mobile devices, for these cases I think it might be > reasonable to have some constraints on particular platforms. For example, > use an alternative way like fetching from cache, reloading, etc., or simply > don't support them. > > See https://bugs.webkit.org/show_bug.cgi?id=49246 as a relevant request. > >> Regards >> Pavel >> >> If we remove DocumentLoader::m_mainResourceData, the main resource data >>> could be freed if there is no other references (seems true if the page is >>> not inspected) and will save memory. >>> >>> I tried to removing DocumentLoader::m_mainResourceData and run all layout >>> tests in chromium-linux. I got 6 text mismatches and 1 timeout and will >>> investigate the failures. >>> >>> However, can anyone describe the original intent of >>> DocumentLoader::m_mainResourceData? What's the case that it is used after >>> the document is loaded? >>> >>> Thanks, >>> Xianzhu >>> >>> >>> _______________________________________________ >>> webkit-dev mailing list >>> webkit-dev@lists.webkit.org >>> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev >>> >>> >> >
_______________________________________________ webkit-dev mailing list webkit-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev