Use the callback provided for reporting the errors instead of throwing
an exception. The problem with the exception is it will happen on the
Map thread which makes it impossible to the user of our API to catch,
ultimately resulting in a crash.
In the scenario of not providing a callback, we just print an error.
- Adds testDelegatesStartStopLocatingUser: Tests mapViewWillStartLocatingUser and mapViewDidStopLocatingUser delegate methods
- Adds testUserTrackingModeFollow
- Adds testUserTrackingModeFollowWithHeading (disabled because of library bug)
Fakes user location via swizzled CLLocationManager and hard-coded mock coordinates and heading.
- Document Node.js v0.12.x and io.js support
- Document map.release functionality.
- Add notes on garbage collection and request handling.
- Update binary platforms and build instructions.
- Document API token FileSource implementation from
https://github.com/mapbox/mapbox-gl-native/pull/1607
- Update Kind enum values.
On the code path built with node v0.12.4, we are storing
an invalid reference to NodeRequest on the "pending" list. It will
crash when we need to access it like we do when canceling a request.
Ideally we should just have a "std::unordered_map<mbgl::Resource,
v8::UniquePersistent>" but that is not possible because the move
semantics are not fully implemented until V8 v4.3.22. It can be used
on a std::vector but not on a std::map.
See: https://code.google.com/p/v8/issues/detail?id=3669
The solution for keep using C++11 move semantics is to declare the
v8::CopyablePersistentTraits shenanigans and explicitly clear the
v8::Persistent (like we do already for node v0.10).
When Node gets V8 v4.3.22+ we can go back to v8::UniquePersistent
with a more clear implementation.
When requests are made to the FileSource, we now group them by
resource, similarly to what is done on the native implementation. The
file source will reuse the same Response for all the requests on the
observer list.
The NodeRequest no longer holds a reference to the mbgl::Request, so
we can cancel it synchronously. This is needed to avoid a deadlock
when releasing the NodeMap resources with pending requests.
Before:
- Main thread | NodeMap::release()
- Main thread | mbgl::~Map()
- Main thread | Blocks waiting for the Map thread to join
- Map thread | mbgl::Request::cancel()
- Map thread | NodeFileSource posts the "cancel" message to main thread
- *deadlock* | Map thread cannot join because mbgl::Request holds a
reference to the Map thread main loop. Main thread is
blocked, never gets the "cancel" message.
Now:
- Main thread | NodeMap::release()
- Main thread | mbgl::~Map()
- Main thread | Blocks waiting for the Map thread to join
- Map thread | Request::cancel()
- Map thread | NodeFileSource::cancel(), destroys the mbgl::Request
synchronously, mutex guarded access. We also send
a notification to cancel the NodeRequest on the main
thread.
- Map thread | Map thread joins.
- Main thread | NodeMap::release() returns
- Main thread | NodeRequest gets canceled. If NodeRequest replies
before it gets the "cancel" message, nothing happens,
notification gets discarded.
Added some nullability qualifiers in method implementation selectors for consistency with declarations.
The user dot view now has a non-zero size. Previously only its layer was sized properly. Also resolved some pedantic warnings about missing designated initializer overrides.
Xcode 6.3 or above is now required for building this project.
Test whenever destroying a Map object with requests pending
works and is done quickly.
The test injects artificial delays in selected requests and
tries to destroy the Map object afterwards.
Currently glyph requests are skipped because there is a bug
being worked on in a different issue.