aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2020-10-16 03:49:52 +0200
committerdec05eba <dec05eba@protonmail.com>2020-10-16 03:49:52 +0200
commit66a97007eb36a112f31e923c20e434ba8b39c4ba (patch)
tree026d4dd8dafe0d807e5480d538fa17a981b64508 /plugins
parentc23ceac642ea95081a239c7af9f882082addb8c1 (diff)
Matrix: use rapidjson instead of jsoncpp to decrease memory usage from 58mb to 24mb
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Matrix.hpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/plugins/Matrix.hpp b/plugins/Matrix.hpp
index 5819420..09895b0 100644
--- a/plugins/Matrix.hpp
+++ b/plugins/Matrix.hpp
@@ -6,7 +6,7 @@
#include <SFML/Graphics/Color.hpp>
#include <unordered_map>
#include <mutex>
-#include <json/value.h>
+#include <rapidjson/document.h>
namespace QuickMedia {
// Dummy, only play one video. TODO: Play all videos in room, as related videos?
@@ -150,19 +150,19 @@ namespace QuickMedia {
bool use_tor = false;
private:
- PluginResult sync_response_to_body_items(const Json::Value &root, RoomSyncMessages &room_messages);
+ PluginResult sync_response_to_body_items(const rapidjson::Document &root, RoomSyncMessages &room_messages);
PluginResult get_previous_room_messages(std::shared_ptr<RoomData> &room_data);
- void events_add_user_info(const Json::Value &events_json, RoomData *room_data);
- void events_add_user_read_markers(const Json::Value &events_json, RoomData *room_data);
- void events_add_messages(const Json::Value &events_json, std::shared_ptr<RoomData> &room_data, MessageDirection message_dir, RoomSyncMessages *room_messages, bool has_unread_notifications);
- void events_set_room_name(const Json::Value &events_json, RoomData *room_data);
+ void events_add_user_info(const rapidjson::Value &events_json, RoomData *room_data);
+ void events_add_user_read_markers(const rapidjson::Value &events_json, RoomData *room_data);
+ void events_add_messages(const rapidjson::Value &events_json, std::shared_ptr<RoomData> &room_data, MessageDirection message_dir, RoomSyncMessages *room_messages, bool has_unread_notifications);
+ void events_set_room_name(const rapidjson::Value &events_json, RoomData *room_data);
PluginResult upload_file(const std::string &room_id, const std::string &filepath, UploadInfo &file_info, UploadInfo &thumbnail_info, std::string &err_msg);
std::shared_ptr<Message> get_edited_message_original_message(RoomData *room_data, std::shared_ptr<Message> message);
std::shared_ptr<RoomData> get_room_by_id(const std::string &id);
void add_room(std::shared_ptr<RoomData> room);
- DownloadResult download_json(Json::Value &result, const std::string &url, std::vector<CommandArg> additional_args, bool use_browser_useragent = false, std::string *err_msg = nullptr) const;
+ DownloadResult download_json(rapidjson::Document &result, const std::string &url, std::vector<CommandArg> additional_args, bool use_browser_useragent = false, std::string *err_msg = nullptr) const;
private:
std::unordered_map<std::string, std::shared_ptr<RoomData>> room_data_by_id;
std::mutex room_data_mutex;