Page MenuHomePhabricator

Implement DraftStoreOperations C++ utility
ClosedPublic

Authored by marcin on Nov 16 2022, 5:11 AM.
Tags
None
Referenced Files
F3393637: D5647.id18472.diff
Sat, Nov 30, 3:15 PM
Unknown Object (File)
Thu, Nov 28, 8:55 AM
Unknown Object (File)
Thu, Nov 28, 8:39 AM
Unknown Object (File)
Thu, Nov 28, 7:49 AM
Unknown Object (File)
Thu, Nov 28, 5:58 AM
Unknown Object (File)
Wed, Nov 27, 3:30 AM
Unknown Object (File)
Tue, Nov 26, 5:34 AM
Unknown Object (File)
Tue, Nov 26, 5:34 AM
Subscribers

Details

Summary

This differential implements DraftStoreOperations C++ utility to convert drafts related redux actions payloads to DatabaseQueryExecutor calls.

Test Plan

This differential only introduces C++ header file, so it is not possible to create test plan.

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

This revision is now accepted and ready to land.Nov 17 2022, 12:43 PM
tomek added inline comments.
native/cpp/CommonCpp/NativeModules/DraftStoreOperations.h
7 ↗(On Diff #18472)

Why do we need a virtual destructor?

native/cpp/CommonCpp/NativeModules/DraftStoreOperations.h
7 ↗(On Diff #18472)

I think we should always have a virtual destructor for anything that gets subtyped. Note that we are currently seeing compiler warnings in the native build because MessageSpec does not specify a virtual destructor

native/cpp/CommonCpp/NativeModules/DraftStoreOperations.h
7 ↗(On Diff #18472)

In CommCoreModule we will (introduced in further diffs in this stack) have function that returns object of type std::vector<std::unique_ptr<DraftStoreOperationBase>>. When it gets destroyed, destructor of each element in this vector will be called and without destructor being virtual only memory allocated for DraftStoreOperationBase would be deleted.

Note that we are currently seeing compiler warnings in the native build because MessageSpec does not specify a virtual destructor

Without any doubt it was a mistake not to introduce it. I will create Linear task to introduce virtual destructors for any C++ class in the codebase that is meant to be derived from.

Implement remove all drafts operation in C++

I will create Linear task to introduce virtual destructors for any C++ class in the codebase that is meant to be derived from.

Thank you @marcin!! Please link before landing :)

This revision was automatically updated to reflect the committed changes.