Bug 105026

Summary: Web Inspector: Native Memory Instrumentation: MemoryInstrumentation doesn't detect reportMemoryUsage method defined in a base class.
Product: WebKit Reporter: Ilya Tikhonovsky <loislo>
Component: Web Inspector (Deprecated)Assignee: Ilya Tikhonovsky <loislo>
Status: RESOLVED FIXED    
Severity: Normal CC: apavlov, benjamin, keishi, loislo, ojan.autocc, pfeldman, pmuellr, vsevik, web-inspector-bugs, webkit.review.bot, yurys
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch
yurys: review+
for try-bots. speculative fix for windows none

Description Ilya Tikhonovsky 2012-12-14 07:50:44 PST
It is relatively frequent case when we report a pointer to an object of a class
and this class does not have reportMemoryUsage method but its parent does.
Current implementation does not detect such cases.
As a result we count such objects via sizeof and do not call reportMemoryUsage.

I found a working solution and need to check it against all the WebKit compilers.

http://stackoverflow.com/questions/1966362/sfinae-to-check-for-inherited-member-functions
Comment 1 Ilya Tikhonovsky 2012-12-14 08:00:38 PST
Created attachment 179485 [details]
Patch
Comment 2 Ilya Tikhonovsky 2012-12-14 08:03:06 PST
The coverage increases by ~3% on cnn, nytimes and google.
Comment 3 Build Bot 2012-12-14 09:01:36 PST
Comment on attachment 179485 [details]
Patch

Attachment 179485 [details] did not pass win-ews (win):
Output: http://queues.webkit.org/results/15310752
Comment 4 Yury Semikhatsky 2012-12-14 22:48:26 PST
Comment on attachment 179485 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=179485&action=review

> Source/WTF/wtf/MemoryInstrumentation.h:133
> +        struct Base : public Type, public BaseMixin { };

Will it compile if there is no default constructor for Type ?
Comment 5 Ilya Tikhonovsky 2012-12-17 00:08:54 PST
Created attachment 179698 [details]
for try-bots. speculative fix for windows
Comment 6 Yury Semikhatsky 2012-12-17 02:03:49 PST
Comment on attachment 179485 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=179485&action=review

>> Source/WTF/wtf/MemoryInstrumentation.h:133
>> +        struct Base : public Type, public BaseMixin { };
> 
> Will it compile if there is no default constructor for Type ?

Why is it called Base, shouldn't it be Derived instead?

> Source/WTF/wtf/MemoryInstrumentation.h:144
> +    template <int>

template <bool> ?
Comment 7 Ilya Tikhonovsky 2012-12-17 03:30:50 PST
Committed r137892: <http://trac.webkit.org/changeset/137892>
Comment 8 Ilya Tikhonovsky 2012-12-17 03:36:43 PST
Reverted r137892 for reason:

it broke compilation on windows

Committed r137893: <http://trac.webkit.org/changeset/137893>
Comment 9 Ilya Tikhonovsky 2012-12-17 08:32:26 PST
Committed r137911: <http://trac.webkit.org/changeset/137911>