From 5e7a952f4888bb7b1b16a7afcf6a535bb81780f9 Mon Sep 17 00:00:00 2001 From: Ari Lazier Date: Tue, 1 Dec 2015 20:49:31 -0800 Subject: [PATCH] just use one symlink to the binding source, make more stuff compile --- shared_realm.cpp | 17 +++++++++++++++-- shared_realm.hpp | 4 +++- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/shared_realm.cpp b/shared_realm.cpp index fd85e8f9..7806dd2f 100644 --- a/shared_realm.cpp +++ b/shared_realm.cpp @@ -18,10 +18,13 @@ #include "shared_realm.hpp" +#if __APPLE__ #include "external_commit_helper.hpp" +#endif + #include "binding_context.hpp" #include "schema.hpp" -#include "transact_log_handler.hpp" +#include "impl/transact_log_handler.hpp" #include #include @@ -101,9 +104,11 @@ Realm::Realm(Config config) } Realm::~Realm() { +#if __APPLE__ if (m_notifier) { // might not exist yet if an error occurred during init m_notifier->remove_realm(this); } +#endif } Group *Realm::read_group() @@ -154,11 +159,15 @@ SharedRealm Realm::get_shared_realm(Config config) // FIXME - need to validate that schemas match realm->m_config.schema = std::make_unique(*existing->m_config.schema); +#if __APPLE__ realm->m_notifier = existing->m_notifier; realm->m_notifier->add_realm(realm.get()); +#endif } else { +#if __APPLE__ realm->m_notifier = std::make_shared(realm.get()); +#endif // otherwise get the schema from the group realm->m_config.schema = std::make_unique(ObjectStore::schema_from_group(realm->read_group())); @@ -290,7 +299,9 @@ void Realm::commit_transaction() m_in_transaction = false; transaction::commit(*m_shared_group, *m_history, m_binding_context.get()); +#if __APPLE__ m_notifier->notify_others(); +#endif } void Realm::cancel_transaction() @@ -398,15 +409,17 @@ uint64_t Realm::get_schema_version(const realm::Realm::Config &config) void Realm::close() { +#if __APPLE__ if (m_notifier) { m_notifier->remove_realm(this); } + m_notifier = nullptr; +#endif m_group = nullptr; m_shared_group = nullptr; m_history = nullptr; m_read_only_group = nullptr; - m_notifier = nullptr; m_binding_context = nullptr; } diff --git a/shared_realm.hpp b/shared_realm.hpp index 85e42224..e20f6fbd 100644 --- a/shared_realm.hpp +++ b/shared_realm.hpp @@ -124,8 +124,10 @@ namespace realm { Group *m_group = nullptr; +#if __APPLE__ std::shared_ptr<_impl::ExternalCommitHelper> m_notifier; - +#endif + public: std::unique_ptr m_binding_context;