Refactor Native Messages (#4738)
* refactor: move ipc queue into its own class * refactor: move windows.h related functions to AW * refactor: make NM-Client methods static * refactor: json access * refactor: use struct initializer * refactor: move `handleMessage` to anon-namespace * refactor: clean-up includes * refactor: move action handler to functions * refactor: cleanup `handleSelect` * fix: cleanup clang-tidy warnings * chore: simplify json * revert: keep handlers as methods This is more readable and extensible. * fix: typo * fix: namespace * fix: rename define * refactor: `IpcQueue` to be simpler * fix: rename cmake option * fix: use variant when constructing * fix: make it a ref * fix: its a pair now
This commit is contained in:
@@ -30,7 +30,7 @@ namespace {
|
||||
#endif
|
||||
}
|
||||
|
||||
void runLoop(NativeMessagingClient &client)
|
||||
void runLoop()
|
||||
{
|
||||
auto received_message = std::make_shared<std::atomic_bool>(true);
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace {
|
||||
|
||||
received_message->store(true);
|
||||
|
||||
client.sendMessage(data);
|
||||
nm::client::sendMessage(data);
|
||||
}
|
||||
_Exit(0);
|
||||
}
|
||||
@@ -83,9 +83,7 @@ void runBrowserExtensionHost()
|
||||
{
|
||||
initFileMode();
|
||||
|
||||
NativeMessagingClient client;
|
||||
|
||||
runLoop(client);
|
||||
runLoop();
|
||||
}
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
Reference in New Issue
Block a user