servo / gecko-media

Firefox's media playback stack in a stand alone Rust crate
Mozilla Public License 2.0
6 stars 9 forks source link

Use the Rust message loop thread as the Gecko main thread #46

Closed cpearce closed 7 years ago

cpearce commented 7 years ago

In order to prevent excessive shuffling of function calls between threads and synchronization, make Runnables dispatched to be run on Gecko's "main" thread run on the thread that the Rust GeckoMedia code creates for receiving and processing messages. To achieve this, we pass a pointers to a mspc::Sender over to the C++ code, and when the C++ code needs to run tasks on the "main" thread, it calls a Rust function over FFI that causes the Sender to have the appropriate message sent on it. When the Rust message loop processes that message, it will call back into Gecko/C++ on the Rust message loop thread, and run Gecko "main" thread Runnables.

philn commented 7 years ago

@bors-servo r=philn

bors-servo commented 7 years ago

:pushpin: Commit 969a58b has been approved by philn

bors-servo commented 7 years ago

:hourglass: Testing commit 969a58bbf5129428af1c3a3f6049f91bb890bc89 with merge ebd80378f11db3acf88fdbc46122741d86e3d7fe...

bors-servo commented 7 years ago

:sunny: Test successful - status-travis Approved by: philn Pushing ebd80378f11db3acf88fdbc46122741d86e3d7fe to master...