Commit Graph

877 Commits

Author SHA1 Message Date
Mark Rowe 5b888ed91d Update to core 1.5.0 and the latest version of the object store. 2016-08-15 11:29:58 -07:00
Ari Lazier 3e55944818 [0.14.3-rc] Bump version 2016-08-15 11:12:36 -07:00
Mark Rowe b08db9f768 Merge pull request #548 from realm/mar/object-store-as-submodule
Switch to pulling the object store in as a submodule
2016-08-02 11:34:29 -07:00
Ari Lazier 1522fb3689 Merge pull request #523 from realm/al-rn-29
Support latest react-native version
2016-08-02 09:59:57 -07:00
Thomas Goyne f8ed437003 Update the binding for object store API changes 2016-08-02 09:31:25 -07:00
Mark Rowe b62a5e6d99 Pull in the object store as a submodule. 2016-08-02 09:25:17 -07:00
Ari Lazier ad97836d19 [0.14.2] Bump version 2016-07-31 14:25:13 -07:00
Yavor Georgiev 6a6ed5a214 Get the path to nan relatively
Under npm3 the `realm` and `nan` modules might end up as siblings so the best way to get the path to `nan` is to require it from within the `realm` module. The `nan` module prints its path so it can be captured by an external build system like in this patch.
2016-07-21 17:39:03 +02:00
Thomas Goyne a4c8d745cf Use List::snapshot() 2016-07-18 14:42:10 -07:00
Thomas Goyne b59af706ea Update binding code for API changes 2016-07-18 14:15:25 -07:00
Yavor Georgiev 9320be158c Allow for non-nullterminated object type names (#97)
`StringData::data()` returns the underlying buffer, which might not be null-terminated, so the resulting string from appending to `"class_"` has garbage in the end. Use the `std::string` conversion of `StringData` because it takes the size of the string into account.
2016-07-18 14:15:25 -07:00
Thomas Goyne 847b6852c9 Change the API-misuse exceptions from runtime_error to logic_error 2016-07-18 14:15:25 -07:00
Mark Rowe 11018952e9 Change API misuse exceptions in object_accessor.hpp to derive from `std::logic_error` rather than `std::runtime_error`.
Also includes the following minor changes:
* Renames `ReadOnlyPropertyValueException` to
  `ReadOnlyPropertyException` since it's the property that's read-only,
  not the value.
* Elminiates some unnecessary copies of arguments passed to the
  exception constructors.
* Makes the exception type data members public, since otherwise there's
  no point in storing them at.
2016-07-18 14:15:25 -07:00
Mark Rowe 00e4790353 Have `List` and `Results` fetch their object schema when requested.
This avoids the need to eagerly fetch the object schema in order to
construct a `List` or `Results`. Instead the work can be deferred until
the object schema is requested. Since `List` and `Results` never use the
object schema themselves this can avoid unnecessary work in some bindings.
2016-07-18 14:15:25 -07:00
Mark Rowe f529ec9f58 Fix a typo in the name of a #define. 2016-07-18 14:15:25 -07:00
Mark Rowe f00eb4f52d Enable clang's warning about implicit fallthrough. 2016-07-18 14:15:25 -07:00
Mark Rowe ac2223b32d Fix compiler checks to match clang on OS X, which CMake labels AppleClang. 2016-07-18 14:12:58 -07:00
Mark Rowe c756045871 Perform extra synchronization the first time `TsanNotifyWorker` hands a `RealmCoordinator` to the worker thread.
This prevents TSan from reporting data races on members of the coordinator.
2016-07-18 14:12:58 -07:00
Mark Rowe 7c0b99594a Replace `Results::set_live` with `Results::snapshot` and `List::snapshot`, and add tests.
`snapshot()` functions are a better fit for what realm-js needs. The new
API also makes it clearer that the liveness of a given `Results`
cannot change at arbitrary times. Changing the liveness at arbitrary
times was not safe and could result in incorrect behavior, such as a
non-live `Results` changing.
2016-07-18 14:12:58 -07:00
Mark Rowe 8798b1c617 Remove workaround for a core issue fixed in core v1.2.0. 2016-07-18 14:12:57 -07:00
Kristian Dupont edf53a1750 Specify width of PropertyType to 1 byte 2016-07-18 14:12:57 -07:00
Thomas Goyne 8293675bd6 Update to core 1.2.0 2016-07-18 14:12:57 -07:00
Thomas Goyne aaa811306e Resolve trivial differences with realm-cocoa 2016-07-18 14:12:57 -07:00
Thomas Goyne bdc8dbc5b2 Enable more warnings (and fix them)
This brings the warnings settings in line with realm-cocoa's.
2016-07-18 13:40:08 -07:00
Scott Kyle 63adf8732e [0.14.0-rc] Bump version 2016-06-28 12:15:36 -07:00
Scott Kyle 6109675749 Disable "Strip Linked Product" on our static libs
There seems to a bug inside the `strip` command (or its `ld64` library) that is being triggered by some users who get this message: `Assertion failed: (0 && "need to handle arm64 -r reloc")`

It is reported that disabling this setting side-steps the issue, and we don't need any stripping done on the static library itself.

Fixes #503
2016-06-28 12:13:58 -07:00
Scott Kyle e8ea8e493e Fix for linker error when building for iOS 7
By default, React Native projects target a minimum of iOS 7, but our projects were set to iOS 8 because previously we used a dynamic framework.

When building for an iOS 7 minimum target version, the linker would complain about thread local variables not working on iOS 7. So it was necessary to add even more checks (iOS >= 8 or OS X >= 10.7) before using native thread local variables rather than our shim.

This also changes our projects to target iOS 7 so we can catch these issues quicker in the future.
2016-06-27 12:16:35 -07:00
Ari Lazier 7d42d26fe9 quote dir path 2016-06-20 12:02:55 -07:00
Ari Lazier 5488eff9b9 recursively delete management directories 2016-06-20 11:41:18 -07:00
Ari Lazier 5eb64025f9 remove management directories in node 2016-06-20 10:49:53 -07:00
Scott Kyle adc07fdd7f Remove files accidentally added to GCDWebServers target
Not sure when this happened!
2016-06-17 13:16:01 -07:00
Scott Kyle 928ab03ce4 Update to download and use core build for Node
This will need to be updated again with a newer version since 1.1.2 build was created on CI but is not actually on static.realm.io until a new release is made.
2016-06-17 11:19:19 -07:00
Scott Kyle 12517a0d1e Add ability to run Node tests on Linux
It uses the Android ExternalCommitHelper implementation.

The Dockerfile requires that you have a static library build of core for Linux with PIC enabled.
2016-06-17 02:38:33 -07:00
Scott Kyle dc3d88f053 [0.14.0-rc] Bump version 2016-06-16 17:55:45 -07:00
Scott Kyle 55aa3d0702 Fix thread_local.hpp to compile with GCC 2016-06-16 17:32:11 -07:00
Scott Kyle 13ab8f8111 Refactor thread_id.hpp into cpp and thread_local.hpp 2016-06-16 17:02:53 -07:00
Scott Kyle b55483d2d9 Emulate thread_local for older iPhone targets
It seems that Xcode clang will not even support __thread for iPhone 5 and older, so this includes a simple abstraction over pthread keys in that case.
2016-06-16 17:02:53 -07:00
Scott Kyle 446cb0245e Fix bug due to std:🧵:id being reused
After a thread is destroyed, a thread id might be reused. This is true for pthread_self() and hence std:🧵:id. We were hitting this in Chrome debug mode because the "worker" thread was being destroyed and a new one immediately created when reloading. The thread id would be the same, and therefore we'd get back the SharedRealm for the previously destroyed thread (which had yet to be garbage collected.

The new implementation uses an atomically incremented, thread-local identifier, which serves our needs very well.

Fixes #473
2016-06-16 17:02:53 -07:00
Scott Kyle a335d7bbc8 The DEBUG macro is now defined at the project level 2016-06-15 01:19:19 -07:00
Scott Kyle 44fc1a4b36 Change RealmJS to use regular and debug cores
Bitcode build went away.
2016-06-14 18:04:12 -07:00
Scott Kyle d26edff0f5 Add format.cpp to Xcode Node build 2016-06-14 17:42:41 -07:00
Scott Kyle af52e9f437 Make stuff build for Node and Android 2016-06-14 17:22:04 -07:00
Ari Lazier 2e3b95f2e7 merge latest master 2016-06-14 16:40:57 -07:00
Ari Lazier f0b533c75f add util back to header path 2016-06-14 15:11:19 -07:00
Ari Lazier 08dd1a41be always invalidate newly opened realms 2016-06-14 14:36:27 -07:00
Ari Lazier 81a32909c1 update to latest object store changes 2016-06-14 14:33:27 -07:00
Ari Lazier 5b8f43dca2 get latest from os branch 2016-06-14 13:51:40 -07:00
Scott Kyle 6d524107e0 Silence warnings about member function pointers
The base ClassDefinition defines its constructor member as null, but some subclass have a static constructor function. This allows both cases to be handled without a warning.
2016-06-13 17:24:43 -07:00
Scott Kyle 43f7329047 Remove confusing, unnecessary typedef
This is not used anywhere.
2016-06-13 17:24:43 -07:00
Scott Kyle 9bcb30e86d Add missing source files to RealmNode target 2016-06-13 17:24:43 -07:00
Ari Lazier c7e156a7b8 Merge pull request #488 from realm/al-typos
fixes for typos and added upsert test
2016-06-13 14:51:53 -07:00
Ari Lazier 0a4e0665ae fixes for typos and added upsert test 2016-06-13 14:46:26 -07:00
Ari Lazier 3901bf53dc Merge pull request #479 from realm/al-muti-realm
fix for setting properties to objects from other realms
2016-06-13 14:44:28 -07:00
Scott Kyle 6aa9825cd1 Merge pull request #469 from realm/sk-object-store-merge
Merge latest object store (includes Android async stuff)
2016-06-13 14:38:28 -07:00
Ari Lazier 2b48ebb30a negate if statements 2016-06-13 14:07:50 -07:00
Kenneth Geisshirt 57a1015b85 Killing a few gcc warnings (#88)
* killing a few gcc warnings
2016-06-13 09:31:41 +02:00
Scott Kyle cd20d870dd Fix crash from querying with object from another Realm 2016-06-09 15:32:37 -07:00
Scott Kyle cdcb99a502 Improvements from PR feedback 2016-06-09 13:07:05 -07:00
Ari Lazier 81feca0ce9 fix for setting properties to objects from other realms 2016-06-08 11:22:12 -07:00
Mark Rowe 7f1be608f3 Merge pull request #85 from realm/mar/cocoa-list
Pull in changes to List from realm-cocoa
2016-06-07 15:45:08 -07:00
Thomas Goyne 5054bbc1a2 Add the path of the Realm file to the config mismatch exception message 2016-06-06 15:30:57 -07:00
Thomas Goyne bd0913bc03 Pull in changes to `List` from realm/realm-cocoa@355657f168. 2016-06-06 15:09:26 -07:00
Mark Rowe 152697d199 Add the linking objects property type. 2016-06-06 11:49:29 -07:00
Mark Rowe abca7c26e1 Add support for the concept of computed properties. 2016-06-06 11:41:34 -07:00
Chen Mulong 64e733e4d7 Fix compile errors for NDK (#82)
make_unique<TableView> causes ambiguous call with NDK's default gnustl.
Compiler fails to decide which constructor of Query to use.
2016-06-06 18:27:05 +08:00
Scott Kyle cd0bb079b7 Implement objectForPrimaryKey() method
Resolves #328
2016-06-03 16:51:32 -07:00
Scott Kyle cb889ea8f8 Merge pull request #466 from realm/sk-remove-gcov-config
Remove unused GCov_Build configuration
2016-06-03 16:04:29 -07:00
Thomas Goyne f4e5049f47 Add basic string formatting for error messages
The main motivation for this is that building error messages via string
concatenation is tedious and makes it hard to judge what the actual message
looks like when there are a lot of parts being inserted, to the extent that
I've been tempted to leave out some potentially useful information because the
code was getting unwieldy.

It also has some small functional benefits: bools are printed as true/false
rather than 1/0, and it is optimized for minimizing the compiled size.
Currently it cuts ~30 KB off librealm-object-store.dylib even with the addition
of new functionality.
2016-06-03 13:19:42 -07:00
Ari Lazier 49fd092cae Fix for whitespce 2016-06-02 22:05:17 -07:00
Mark Rowe 57ee591809 Merge pull request #78 from realm/mar/weakrealmnotifier-leak
Fix a potential leak within WeakRealmNotifier
2016-06-01 13:07:56 -07:00
Mark Rowe 8685390345 Merge pull request #77 from realm/mar/results-leak
Fix move-assigning to a Results that has a notifier to not leak the Realm
2016-06-01 13:07:45 -07:00
Thomas Goyne 6d22d28fea Merge pull request #72 from realm/tg/core-1.0.0
Upgrade to core 1.0.0 and update the file exception translation to match
2016-06-01 12:02:27 -07:00
Mark Rowe 08404d7098 Express `Results`' asignment operators in terms of their equivalent
constructors.

This avoids having to repeat the move constructor's logic in the move
assignment operator, and allows the copy assignment operator to compile
despite `TableViewBase`'s missing copy assignment implementation. the
copy assignment implementation can be defaulted once `TableViewBase` is
fixed.
2016-06-01 11:50:25 -07:00
Mark Rowe 3e952269da Have `Results` default its copy constructor.
The custom implementation was an attempt to ensure that
`m_has_used_table_view` and `m_wants_background_updates` had appropriate
intial values. Thomas pointed out that we can remove the reliance on the
initial values by ensure that `prepare_async` sets
`m_wants_background_updates`, removing the need for a custom copy
constructor.
2016-06-01 11:48:35 -07:00
Mark Rowe fc63c4f67b Merge pull request #76 from realm/mar/fix-building-tests-in-xcode
Fix building tests in Xcode
2016-06-01 11:40:14 -07:00
Mark Rowe 2a75edde8e Move `List`s defaulted constructors and assignment operators out of line. 2016-06-01 11:29:32 -07:00
Scott Kyle b5853c2590 Merge remote-tracking branch 'object-store/master' into sk-object-store-merge
* object-store/master:
  Make Realm::is_closed() work on read-only instances
  Fix for object store build issues on Android
  Implement commit helper and realm notifier for Android (#69)
  Build both dynamic and static libraries.
  moving pegtl dependency as step 1 in install doc
  update docu (install procedure)
2016-06-01 10:14:16 -07:00
Mark Rowe 702b8a31fb Avoid leaking the runloop and source if WeakRealmNotifier is move-assigned. 2016-05-31 21:54:40 -07:00
Mark Rowe 65a748de0c Fix move-assigning to a `Results` that has a notifier to not leak the
`Realm`, and moving from a `Results` to not result in a use-after-free.

The compiler generated move-assignment operator resulted in `m_notifier`
being assigned to without first calling `CollectionNotifier::unregister`.
This left a retain cycle in place, causing the `Realm` and other objects
to leak.

`ResultsNotifier` keeps track of which `Results` it should update when a
new `TableView` becomes available. When `Results` move-assignment
operator and move-constructor transfer ownership of the
`ResultsNotifier` to a new instance they also need to update its target
so it won't attempt to update the moved-from `Results`.
2016-05-31 19:03:29 -07:00
Mark Rowe 7e99634567 Fix building tests in Xcode.
The Xcode project generated by CMake doesn't create the dylib when built
as the dylib target does not contain any source files. Adding an empty
placeholder .cpp file to the target is sufficient to convince Xcode to
produce the dylib.
2016-05-31 17:16:52 -07:00
Mark Rowe 344fc42d4e Avoid copying `Object` unnecessarily. 2016-05-31 15:54:43 -07:00
Mark Rowe efdf0e01a9 Avoid copying `List` unnecessarily. 2016-05-31 15:27:48 -07:00
Scott Kyle 3b9b8cbc75 Remove unused GCov_Build configuration
We've never really used this, so let's remove it until we ever actually need something like this.
2016-05-31 11:30:24 -07:00
Scott Kyle 385fe97861 Make Realm::is_closed() work on read-only instances 2016-05-31 11:27:39 -07:00
Scott Kyle 7bb8a04359 Fix for object store build issues on Android 2016-05-31 11:11:39 -07:00
Scott Kyle 560e725398 Address some issues in WeakRealmNotifier for Node 2016-05-31 10:05:14 -07:00
Yavor Georgiev 91c87e4de6 Implement commit helper and realm notifier for Android (#69)
* Implement commit helper and realm notifier for Android

* Remove non-existent include

* Shut down the current instance when move-assigning

* Only use Android logging when on Android

* Cleanup realm_ptr when it hasn't been sent over the pipe

* Assed that WeakRealmNotifier is closed on the thread it was created on

* Typo

* Fix syntax error

* changes after code review

* Use the proper preprocessor definition for Android

* Pass the correct address to write(2)

* Explicitly handle looper events

* changes after code review

* Do not return after handling ALOOPER_EVENT_HANGUP

* Handle HANGUP after INPUT
2016-05-31 17:15:32 +02:00
Ari Lazier df040c7d99 fix for comment 2016-05-27 16:25:33 -07:00
Ari Lazier 7829cb5f33 fix for comment 2016-05-27 16:25:33 -07:00
Ari Lazier 38c6eb7b6b more pr feedback 2016-05-27 16:03:03 -07:00
Ari Lazier 3e74cd98d5 more pr feedback 2016-05-27 16:03:03 -07:00
Ari Lazier 9fe636b614 pr feedback 2016-05-27 15:50:33 -07:00
Ari Lazier e316b54eff pr feedback 2016-05-27 15:50:33 -07:00
Ari Lazier 9012549c5d object store pr feedback 2016-05-27 15:45:56 -07:00
Ari Lazier ceceeab9a5 object store pr feedback 2016-05-27 15:45:56 -07:00
Scott Kyle b3ec066d12 Merge pull request #451 from realm/sk-test-improvements
Improve JS tests
2016-05-27 13:56:49 -07:00
Scott Kyle d05542c031 Merge branch 'sk-node-notifier'
* sk-node-notifier:
  Create a HandleScope before calling callbacks
  Add a working WeakRealmNotifier for Node
2016-05-27 13:25:50 -07:00
Scott Kyle 8a52cf8ffe Merge branch 'sk-node-notifier'
* sk-node-notifier:
  Create a HandleScope before calling callbacks
  Add a working WeakRealmNotifier for Node
2016-05-27 13:25:50 -07:00
Scott Kyle 4e457526bb Merge branch 'sk-node-xcode'
* sk-node-xcode:
  Consolidate RealmNode.xcodeproj into RealmJS.xcodeproj
2016-05-27 13:20:01 -07:00
Scott Kyle 5a3997d268 Fix for consecutive calls to clearTestState()
This bug would only happen from Chrome debug mode, where consecutive calls would crash the app because the m_objects iterator would be in a bad state. This method is faster anyways.
2016-05-26 17:58:24 -07:00