RESOLVED FIXED 29106
[Qt] make CachedResourceHandle.h compile in winscw Symbian compiler.
https://bugs.webkit.org/show_bug.cgi?id=29106
Summary [Qt] make CachedResourceHandle.h compile in winscw Symbian compiler.
Yongjun Zhang
Reported 2009-09-09 14:45:51 PDT
In Winscw compiler, when CachedResourceHandle<T> is used as a class member, the compiler will aggressively resolve the inheritance of R* when constructor CachedResourceHandle(R* res) is inlined, which means the class definition of T must come before CachedResourceHandle<T> and the header file of class T must be included wherever CachedResourceHandler<T> is defined. To avoid unnecessary inclusion of header files, the right workaround would be removing inline for CacheResourceHandler<T>(R*) in winscw compiler, while keep it inline for other compilers to avoid performance penalty.
Attachments
don't inline CachedResourceHandle<T>(R*) for winscw compiler. (2.80 KB, patch)
2009-09-09 21:23 PDT, Yongjun Zhang
eric: review-
modify patch to include Eric's comments. (3.14 KB, patch)
2009-09-30 14:25 PDT, Yongjun Zhang
no flags
Yongjun Zhang
Comment 1 2009-09-09 21:23:20 PDT
Created attachment 39320 [details] don't inline CachedResourceHandle<T>(R*) for winscw compiler.
Ariya Hidayat
Comment 2 2009-09-10 03:13:32 PDT
Nitpick: technically [Qt] is not needed, right?
Eric Seidel (no email)
Comment 3 2009-09-10 12:45:22 PDT
Comment on attachment 39320 [details] don't inline CachedResourceHandle<T>(R*) for winscw compiler. I'm not sure how it makes sense to ever have a non-inline constructor definition in a header file. :)
Simon Hausmann
Comment 4 2009-09-10 13:39:29 PDT
From what I understand from Janne the outlining shouldn't be necessary if RefPtr is patched appropriately. Janne, can you elaborate? :)
Janne Koskinen
Comment 5 2009-09-10 14:05:01 PDT
Right, I'll post my patch first thing in the morning. So we can fight it over tomorrow :)
Yongjun Zhang
Comment 6 2009-09-10 20:02:52 PDT
(In reply to comment #4) > From what I understand from Janne the outlining shouldn't be necessary if > RefPtr is patched appropriately. Janne, can you elaborate? :) RefPtr is not related here. The root cause is the base constructor requires CachedResource* argument. When CachedResourceHandle<T>(R*) is used, the compiler tries to convert R to CachedResource in the base class's ctor, which fails compiling when class R's header file is not included. Making it not inline can defer the type conversion till it is really needed.
Janne Koskinen
Comment 7 2009-09-11 03:31:36 PDT
> RefPtr is not related here. > > The root cause is the base constructor requires CachedResource* argument. When > CachedResourceHandle<T>(R*) is used, the compiler tries to convert R to Right you are. I had a fix in CachedImage that I had forgotten. Putting the fix into base class is better. Those who still are sceptical: mwccsym2 tries to resolve inlines immediately and here if the constructor is not taken out would give "illegal use of incomplete struct/union/class" - error as the actual class is not yet been defined within the compilation unit, only forward declared.
Eric Seidel (no email)
Comment 8 2009-09-15 23:15:33 PDT
Comment on attachment 39320 [details] don't inline CachedResourceHandle<T>(R*) for winscw compiler. See my comments on your other bug about "inline" for templates functions. Style: + CachedResourceHandle(R* res); We need a comment which references the bug. The compiler bug should be linked to from the ChangeLog too.
Yongjun Zhang
Comment 9 2009-09-30 14:25:43 PDT
Created attachment 40399 [details] modify patch to include Eric's comments. Added links to winscw compiler bug in ChangeLog and header file.
WebKit Commit Bot
Comment 10 2009-10-13 07:27:40 PDT
Comment on attachment 40399 [details] modify patch to include Eric's comments. Rejecting patch 40399 from commit-queue. Patch https://bugs.webkit.org/attachment.cgi?id=40399 from bug 29106 failed to download and apply.
Laszlo Gombos
Comment 11 2009-10-13 16:39:53 PDT
Comment on attachment 40399 [details] modify patch to include Eric's comments. Will commit manually; patch does not apply cleanly.
Laszlo Gombos
Comment 12 2009-10-13 22:24:14 PDT
Landed as http://trac.webkit.org/changeset/49556. - part of it was landed previously as http://trac.webkit.org/changeset/49017.
Note You need to log in before you can comment on or make changes to this bug.