Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 18f3ba3

Browse filesBrowse files
addaleaxdanielleadams
authored andcommitted
worker: leave TODO comments for using std::variant when possible
We don’t use C++17 as a baseline yet, but once we do, we can use `std::variant` to make a few things more performant (and cleaner). There is a similar TODO comment in the crypto source already. PR-URL: #38788 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
1 parent 3741595 commit 18f3ba3
Copy full SHA for 18f3ba3

File tree

Expand file treeCollapse file tree

1 file changed

+6
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+6
-0
lines changed
Open diff view settings
Collapse file

‎src/node_messaging.h‎

Copy file name to clipboardExpand all lines: src/node_messaging.h
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,9 @@ class Message : public MemoryRetainer {
107107

108108
private:
109109
MallocedBuffer<char> main_message_buf_;
110+
// TODO(addaleax): Make this a std::variant to save storage size in the common
111+
// case (which is that all of these vectors are empty) once that is available
112+
// with C++17.
110113
std::vector<std::shared_ptr<v8::BackingStore>> array_buffers_;
111114
std::vector<std::shared_ptr<v8::BackingStore>> shared_array_buffers_;
112115
std::vector<std::unique_ptr<TransferData>> transferables_;
@@ -202,6 +205,9 @@ class MessagePortData : public TransferData {
202205
// This mutex protects all fields below it, with the exception of
203206
// sibling_.
204207
mutable Mutex mutex_;
208+
// TODO(addaleax): Make this a std::variant<std::shared_ptr, std::unique_ptr>
209+
// once that is available with C++17, because std::shared_ptr comes with
210+
// overhead that is only necessary for BroadcastChannel.
205211
std::deque<std::shared_ptr<Message>> incoming_messages_;
206212
MessagePort* owner_ = nullptr;
207213
std::shared_ptr<SiblingGroup> group_;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.