Move the interprocess notification functionality to the object store

This commit is contained in:
Thomas Goyne 2015-09-02 17:53:21 -07:00 committed by Ari Lazier
parent 5ffeedb233
commit 4dd72d47a0
2 changed files with 8 additions and 2 deletions

View File

@ -18,6 +18,7 @@
#include "shared_realm.hpp" #include "shared_realm.hpp"
#include "external_commit_helper.hpp"
#include "realm_delegate.hpp" #include "realm_delegate.hpp"
#include "transact_log_handler.hpp" #include "transact_log_handler.hpp"
@ -52,7 +53,9 @@ Realm::Config& Realm::Config::operator=(realm::Realm::Config const& c)
return *this; return *this;
} }
Realm::Realm(Config config) : m_config(std::move(config)) Realm::Realm(Config config)
: m_config(std::move(config))
, m_notifier(new ExternalCommitHelper(this))
{ {
try { try {
if (m_config.read_only) { if (m_config.read_only) {
@ -234,6 +237,7 @@ void Realm::commit_transaction()
m_in_transaction = false; m_in_transaction = false;
transaction::commit(*m_shared_group, *m_history, m_delegate.get()); transaction::commit(*m_shared_group, *m_history, m_delegate.get());
m_notifier->notify_others();
} }
void Realm::cancel_transaction() void Realm::cancel_transaction()
@ -416,4 +420,3 @@ void RealmCache::clear()
m_cache.clear(); m_cache.clear();
} }

View File

@ -28,6 +28,7 @@
namespace realm { namespace realm {
class ClientHistory; class ClientHistory;
class ExternalCommitHelper;
class Realm; class Realm;
class RealmCache; class RealmCache;
class RealmDelegate; class RealmDelegate;
@ -110,6 +111,8 @@ namespace realm {
Group *m_group = nullptr; Group *m_group = nullptr;
std::unique_ptr<ExternalCommitHelper> m_notifier;
public: public:
std::unique_ptr<RealmDelegate> m_delegate; std::unique_ptr<RealmDelegate> m_delegate;