RESOLVED FIXED237485
Modernize OriginLock
https://bugs.webkit.org/show_bug.cgi?id=237485
Summary Modernize OriginLock
Chris Dumez
Reported 2022-03-04 13:53:27 PST
Modernize OriginLock.
Attachments
Patch (6.93 KB, patch)
2022-03-04 13:55 PST, Chris Dumez
no flags
Patch (7.00 KB, patch)
2022-03-04 14:00 PST, Chris Dumez
no flags
Chris Dumez
Comment 1 2022-03-04 13:55:38 PST
Chris Dumez
Comment 2 2022-03-04 14:00:29 PST
Darin Adler
Comment 3 2022-03-04 14:34:38 PST
Comment on attachment 453871 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=453871&action=review > Source/WebCore/Modules/webdatabase/OriginLock.h:-36 > - WTF_MAKE_NONCOPYABLE(OriginLock); WTF_MAKE_FAST_ALLOCATED; Why aren’t these helpful? I don’t understand this change. > Source/WebCore/Modules/webdatabase/OriginLock.h:40 > + static Ref<OriginLock> create(const String& originPath) > + { > + return adoptRef(*new OriginLock(originPath)); > + } I don’t think we want to inline this. It would be better to have it in the .cpp file, since we’d rather inline the constructor in the create function rather than inlining the create function in the create call site.
Chris Dumez
Comment 4 2022-03-04 14:38:08 PST
(In reply to Darin Adler from comment #3) > Comment on attachment 453871 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=453871&action=review > > > Source/WebCore/Modules/webdatabase/OriginLock.h:-36 > > - WTF_MAKE_NONCOPYABLE(OriginLock); WTF_MAKE_FAST_ALLOCATED; > > Why aren’t these helpful? I don’t understand this change. We get them from the base class already. > > > Source/WebCore/Modules/webdatabase/OriginLock.h:40 > > + static Ref<OriginLock> create(const String& originPath) > > + { > > + return adoptRef(*new OriginLock(originPath)); > > + } > > I don’t think we want to inline this. It would be better to have it in the > .cpp file, since we’d rather inline the constructor in the create function > rather than inlining the create function in the create call site. OK.
Darin Adler
Comment 5 2022-03-04 14:40:31 PST
Comment on attachment 453871 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=453871&action=review >>> Source/WebCore/Modules/webdatabase/OriginLock.h:-36 >>> - WTF_MAKE_NONCOPYABLE(OriginLock); WTF_MAKE_FAST_ALLOCATED; >> >> Why aren’t these helpful? I don’t understand this change. > > We get them from the base class already. Not being copyable or movable is effectively inherited. Is fast allocation inherited? I didn’t realize it was.
Chris Dumez
Comment 6 2022-03-04 14:53:06 PST
(In reply to Darin Adler from comment #5) > Comment on attachment 453871 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=453871&action=review > > >>> Source/WebCore/Modules/webdatabase/OriginLock.h:-36 > >>> - WTF_MAKE_NONCOPYABLE(OriginLock); WTF_MAKE_FAST_ALLOCATED; > >> > >> Why aren’t these helpful? I don’t understand this change. > > > > We get them from the base class already. > > Not being copyable or movable is effectively inherited. Is fast allocation > inherited? I didn’t realize it was. I am pretty sure it is. As a matter of fact, we almost never explicit mark our classes as FACT_ALLOCATED when they subclass RefCounted. To be certain, I ran the following code: ``` #include <iostream> class A { public: void* operator new(size_t size) { std::cout << "Uses custom allocator" << std::endl; return malloc(size); } }; class B : public A { }; int main() { auto b = new B; return 0; } ``` It definitely printed my log line so the `operator new` gets inherited just fine and this is essentially what WTF_MAKE_FAST_ALLOCATED defines.
EWS
Comment 7 2022-03-04 16:49:24 PST
Committed r290854 (248086@main): <https://commits.webkit.org/248086@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 453871 [details].
Radar WebKit Bug Importer
Comment 8 2022-03-04 16:50:19 PST
Note You need to log in before you can comment on or make changes to this bug.