Commit Graph

28 Commits

Author SHA1 Message Date
Thiago Marcos P. Santos
ec1b4c43fd Do not force uv_loop_t as the first parameter for a threaded object ctor 2015-07-06 16:01:59 +03:00
John Firebaugh
fc64e97bce Simplify RunLoop
Instead of transforming between return value and callback, pass
the wrapped callback on to the invoked function as the last argument.

This eliminates the need for multiple invokeWithArgument overloads
and permits invoked functions to be asynchronous.
2015-07-01 16:12:12 -07:00
Thiago Marcos P. Santos
ac4179e7de Use a pipe() to synchronize the server initialization
As the signals are intercepted by debuggers.
2015-06-18 15:48:39 +03:00
Konstantin Käfer
f4707f72e0 Replace mbgl::util::make_unique<> with std::make_unique<> 2015-05-26 17:57:38 +02:00
John Firebaugh
386be7c0fa Remove unused
There are no longer any requests made that don't have a run loop to
dispatch back to.
2015-05-13 13:54:16 -07:00
Konstantin Käfer
fb984a22d1 don't trigger a HTTP request twice 2015-05-08 11:30:26 +02:00
John Firebaugh
36f695b411 Write SQLite tests in terms of Impl 2015-05-01 14:31:39 -04:00
John Firebaugh
c0b75f1af7 Remove Environment::terminate and associated code
Fixes #1336
2015-04-28 09:16:26 -04:00
John Firebaugh
ac25d32a09 Convert storage tests to RunLoop 2015-04-15 20:38:26 -07: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
4c7132337f convert DefaultFileSource to use util::Thread<> 2015-04-10 22:37:27 +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
59bd300b43 use sqlite itself to lock the database file rather than those unportable bsd locks 2015-04-08 16:24:10 +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
John Firebaugh
9331acf8e6 Add typedefs for std::chrono::steady_clock types 2015-04-02 12:28:12 +02:00
Konstantin Käfer
9781785ab7 scope Requests to an Environment object for easier cancelation
we are now scoping all file requests to an environment object. The FileSource implementation treats
this as an opaque pointer, but allows canceling all Requests that are associated with that pointer.
This is necessary to abort all file requests that originated from a particular Map object. Aborting
a file request is different from canceling a file request: A canceled request doesn't have its
callback called, while an aborted request will have its callback called with an error, indicating
that the environment is going to be shut down.
2015-03-06 08:21:47 -08:00
Konstantin Käfer
b29bce0936 add ca bundle loading back to CURL 2015-02-17 11:42:47 -08:00
Konstantin Käfer
fe0baffe0d update uv_zip and add tests 2015-02-16 18:30:19 -08:00
Konstantin Käfer
aecef6da1a make sure that the async handle always gets closed 2015-02-13 13:28:40 -08:00
Konstantin Käfer
73f7db9af2 cleanup makefiles 2015-02-04 11:54:01 +01:00
Konstantin Käfer
29baacf3a5 refactor makefile 2015-02-04 10:49:09 +01:00
Konstantin Käfer
6f349a796c execute the correct server path and use the exepath for application root rather than the cwd 2015-02-04 10:49:07 +01:00
Konstantin Käfer
4a985e09f2 asset:// URLs are local to the executable path now 2015-02-04 10:49:06 +01:00
Konstantin Käfer
032c245bfe remove unused files 2015-02-04 10:49:06 +01:00
Konstantin Käfer
aa09aa321b rearrange tests and make more robust 2015-02-04 10:49:06 +01:00
Konstantin Käfer
8a1fce547e rearrange tests and add storage tests 2015-02-04 10:49:05 +01:00