Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

[core] Abstract libuv - #3139

Merged
tmpsantos merged 25 commits into
masterfrom
tmpsantos-libuv_abstracted
Dec 1, 2015
Merged

tmpsantos merged 25 commits into
masterfrom
tmpsantos-libuv_abstracted

Conversation

@tmpsantos

Copy link
Copy Markdown
Contributor

This branch reduces the delta between master and the Qt branch that is under development. It enables the platform to reimplement the main loop and get rid of libuv in favor of, say, glib or the Qt main loop.

Wrapping is mostly done by reusing existing util:: like util::Thread and also by 3 new classes:

  • AsyncTask: Send asynchronous messages to the main loop where the AsyncTask object lives, coalescing multiple messages.
  • Timer: an ordinary timer.
  • RunLoop: not exactly new but was refactored to allow reimplementation. Consists of a platform main loop, using AsyncTask internally for waking up.

All these new classes were implemented in a way to be almost a drop-in replacement for the libuv counterparts, making the changes as mild as possible. AssetFS and AssetZIP are exceptions, as they were heavily refactored to use util::Thread for doing threaded file I/O instead of libuv workers.

For all the newly introduced classes, unit tests were also added and in some cases, like for the AssetZIP, broken unit tests were fixed and more were added.

This PR also is also a enabler for #2909.

@tmpsantos

Copy link
Copy Markdown
Contributor Author

👀 @kkaefer @brunoabinader @jfirebaugh

@tmpsantos tmpsantos mentioned this pull request Nov 27, 2015
11 tasks done
@tmpsantos
tmpsantos force-pushed the tmpsantos-libuv_abstracted branch 3 times, most recently from 5bb52db to c95c4ba Compare November 30, 2015 14:09
Comment thread linux/mapboxgl-app.gypi Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's this necessary for? IIRC, we want to use the apps partly as as examples, which means they should avoid using internal includes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one slipped. Removing.

@tmpsantos
tmpsantos force-pushed the tmpsantos-libuv_abstracted branch from c95c4ba to 6083882 Compare November 30, 2015 22:31
It was being used as a normal mutex anyway.
Moved the fd watcher to the RunLoop. So far only needs to
be implemented by platforms using HTTPCurlRequest et al.
ASSET=zip make test-* was broken and now works.

Also added a test stressing concurrent file access.
Now only a few things depend on libuv and they can use it directly.
Also simplified the code making the logic more linear.
@tmpsantos
tmpsantos force-pushed the tmpsantos-libuv_abstracted branch from 6083882 to e7b6d72 Compare December 1, 2015 09:49
@tmpsantos
tmpsantos merged commit e7b6d72 into master Dec 1, 2015
@mourner mourner removed the ready label Dec 1, 2015
@tmpsantos
tmpsantos deleted the tmpsantos-libuv_abstracted branch December 1, 2015 10:32
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants