- 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.
The util::Thread will call the stop() method of the MapContext's RunLoop
which will wait for the pending tasks tied to it to complete.
If we have a request that is timeout'ing, this could mean a really long
wait. Instead, we now send a cleanup message that will reset all the
attributes first (canceling the pending requests) so the the MapContext
gets destructed quickly.
We start loading the resources at the moment we set the style, but we
set the callback for error notification at renderStill(), which happen
afterwards.
If some error occurs in this short window, it was never being notified.
Now we save the last error and we check after we set the callback.
After parsing a tile, it redoes placement for that tile if the angle has
changed since it started parsing. These redo calls were accidentally
done from the worker thread. Assigning the new work to `workRequest`
caused it to cancel itself.
Fix the problem by calling redoPlacement from the map thread.