Commit Graph

12 Commits

Author SHA1 Message Date
John Firebaugh
5fa0512be2 Shorten method names 2015-04-15 20:38:25 -07:00
John Firebaugh
1eaf6b8c18 Stricter Thread<> interface
Implements a Thread<>::invoke interface that only permits calling
member functions with bound arguments.

Also introduce invokeWithResult, which accepts a callback and invokes
it, passing the result, on the invoking thread's RunLoop. This closes
the loop of two evented threads doing message passing.
2015-04-15 20:38:25 -07:00
Konstantin Käfer
1066504008 separate SQLiteCache::Impl header from implementation file 2015-04-13 18:38:39 +02:00
Konstantin Käfer
352ff64e06 rename SQLiteCache::Thread to SQLiteCache::Impl 2015-04-13 18:32:59 +02:00
Konstantin Käfer
452d12e6e6 make implementation files private headers 2015-04-13 18:28:18 +02:00
Konstantin Käfer
16849a341b hide Thread<> and separate the Implementation object 2015-04-13 17:57:45 +02:00
Konstantin Käfer
bba3d9838a add Thread<T> and RunLoop
Thread<T> is a generic thread management object that starts a thread, creates an object T in that thread and calls its .start() function. When the Thread<T> object is destructed (which must happen in the thread that created it), it'll call the object's .stop() function, and wait for thread termination. The .stop() function must somehow get the thread to terminate. Note that object T's constructor/destructor/start()/stop() must be protected/private, and Thread<T> must be declared as a friend class. All public functions may be called from any thread and are exposed through operator->().

RunLoop encapsulates a libuv runloop and has a facility of dispatching function objects to the thread. It can be used either as a worker thread class by itself, or it can be derived from. This commit converts SQLiteCache to derive from RunLoop and removes the custom code used previously for managing the cache thread.
2015-04-10 15:36:32 +02:00
Konstantin Käfer
4b66c490b4 guard against invalid database files 2015-04-08 14:55:47 +02:00
Konstantin Käfer
7d58a41de5 make sqlite storage more resilient to sporadic errors
- catch SQLite exceptions and report them
- failed statements are ignored, we're really just caching here, so if it fails we're handling it gracefully elsewhere
- handle cases where the database file goes away after we opened it
- handle cases where the schema wasn't created after the database file was opened successfully
- add tests
2015-04-07 18:04:23 +02:00
Konstantin Käfer
48c55af5c1 fix sprites for pixel ratios that are not 1 and 2
- OpenGL ES 2 doesn't allow NPOT textures with wrap-around
- The Sprite object reported the map's pixelRatio, even though it loaded @2x assets
- Copying icons from the sprite into the atlas now uses bilinear scaling to scale up to the actual size
2015-03-17 12:30:40 +01:00
Konstantin Käfer
8c0acecbe3 fix handling around unique_ptr releases 2015-03-06 16:17:49 +01:00
Konstantin Käfer
272fa8935e make storage lib separate so we can build without storage libs 2015-02-04 10:49:07 +01:00