RESOLVED FIXED 120619
Use OwnPtr in the RenderLayerFilterInfo map
https://bugs.webkit.org/show_bug.cgi?id=120619
Summary Use OwnPtr in the RenderLayerFilterInfo map
Darin Adler
Reported 2013-09-03 00:01:38 PDT
Use OwnPtr in the RenderLayerFilterInfo map
Attachments
Patch (6.16 KB, patch)
2013-09-03 00:05 PDT, Darin Adler
no flags
Patch (36.00 KB, patch)
2013-09-03 21:36 PDT, Darin Adler
no flags
Patch (36.00 KB, patch)
2013-09-03 21:45 PDT, Darin Adler
no flags
Archive of layout-test-results from webkit-ews-10 for mac-mountainlion-wk2 (480.51 KB, application/zip)
2013-09-03 22:39 PDT, Build Bot
no flags
Patch (35.89 KB, patch)
2013-09-03 22:40 PDT, Darin Adler
andersca: review+
andersca: commit-queue-
Darin Adler
Comment 1 2013-09-03 00:05:13 PDT
Early Warning System Bot
Comment 2 2013-09-03 00:09:43 PDT
Early Warning System Bot
Comment 3 2013-09-03 00:10:09 PDT
Build Bot
Comment 4 2013-09-03 00:32:23 PDT
Build Bot
Comment 5 2013-09-03 00:44:02 PDT
Build Bot
Comment 6 2013-09-03 00:50:04 PDT
Anders Carlsson
Comment 7 2013-09-03 07:41:39 PDT
Comment on attachment 210329 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=210329&action=review I wonder if the optimization to delete the map if it's empty is actually useful here. > Source/WebCore/rendering/RenderLayerFilterInfo.cpp:57 > +static OwnPtr<RenderLayerFilterInfoMap>& filterMap() I wish we had a better name for these types of global smart pointer variable slots.
Darin Adler
Comment 8 2013-09-03 09:06:49 PDT
Comment on attachment 210329 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=210329&action=review > Source/WebCore/rendering/RenderLayerFilterInfo.cpp:94 > + filterMap() = nullptr; If we didn’t need to destroy the map here, then we would not have to have filterMap() return an OwnPtr& at all. It could just return a pointer. It actually seems dumb to destroy this global map.
Darin Adler
Comment 9 2013-09-03 21:36:08 PDT
Darin Adler
Comment 10 2013-09-03 21:36:49 PDT
My second try makes more changes, eliminating some of the stranger things about the old code.
Early Warning System Bot
Comment 11 2013-09-03 21:43:14 PDT
Early Warning System Bot
Comment 12 2013-09-03 21:45:16 PDT
Darin Adler
Comment 13 2013-09-03 21:45:23 PDT
Darin Adler
Comment 14 2013-09-03 22:20:23 PDT
I have an even better version where I turn RenderLayerFilterInfo into RenderLayer::FilterInfo.
Build Bot
Comment 15 2013-09-03 22:39:25 PDT
Comment on attachment 210428 [details] Patch Attachment 210428 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.appspot.com/results/1692446 New failing tests: fast/workers/termination-with-port-messages.html
Build Bot
Comment 16 2013-09-03 22:39:28 PDT
Created attachment 210430 [details] Archive of layout-test-results from webkit-ews-10 for mac-mountainlion-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: webkit-ews-10 Port: mac-mountainlion-wk2 Platform: Mac OS X 10.8.4
Darin Adler
Comment 17 2013-09-03 22:40:01 PDT
Anders Carlsson
Comment 18 2013-09-04 06:18:37 PDT
Comment on attachment 210431 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=210431&action=review > Source/WebCore/rendering/RenderLayerFilterInfo.cpp:50 > + static Map& map = *new Map; > + return map; I think you can still use NeverDestroyed here. > Source/WebCore/rendering/RenderLayerFilterInfo.h:51 > +class RenderLayer::FilterInfo > +#if ENABLE(CSS_SHADERS) && ENABLE(SVG) > + FINAL : public CustomFilterProgramClient, public CachedSVGDocumentClient > +#elif ENABLE(CSS_SHADERS) > + FINAL : public CustomFilterProgramClient > +#else > + FINAL : public CachedSVGDocumentClient I'd just put the FINAL on the previous line instead of duplicating it three times. > Source/WebCore/rendering/RenderLayerFilterInfo.h:91 > + typedef HashMap<const RenderLayer*, OwnPtr<FilterInfo>> Map; > + static Map& map(); I think you should just use the HashMap type directly instead of the typedef.
Darin Adler
Comment 19 2013-09-04 09:17:19 PDT
Comment on attachment 210431 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=210431&action=review >> Source/WebCore/rendering/RenderLayerFilterInfo.cpp:50 >> + return map; > > I think you can still use NeverDestroyed here. Oh, good idea! >> Source/WebCore/rendering/RenderLayerFilterInfo.h:51 >> + FINAL : public CachedSVGDocumentClient > > I'd just put the FINAL on the previous line instead of duplicating it three times. Oops, got the condition wrong. The last one is supposed to be: #elif ENABLE(SVG) That’s why FINAL is in the duplicate lines, because it can’t be used in the fourth case, when there is no base class at all. >> Source/WebCore/rendering/RenderLayerFilterInfo.h:91 >> + static Map& map(); > > I think you should just use the HashMap type directly instead of the typedef. I like the typedef for the implementation of the map() function, to avoid repeating the type two more times. But I can repeat it three times.
Darin Adler
Comment 20 2013-09-04 09:42:02 PDT
Anders Carlsson
Comment 21 2013-09-04 10:02:26 PDT
(In reply to comment #19) > > I think you should just use the HashMap type directly instead of the typedef. > > I like the typedef for the implementation of the map() function, to avoid repeating the type two more times. But I can repeat it three times. I don’t like having to go hunting for the real type whenever I need to know what the memory semantics for a collection is.
Note You need to log in before you can comment on or make changes to this bug.