Closed cpearce closed 7 years ago
@bors-servo r=philn
:pushpin: Commit 969a58b has been approved by philn
:hourglass: Testing commit 969a58bbf5129428af1c3a3f6049f91bb890bc89 with merge ebd80378f11db3acf88fdbc46122741d86e3d7fe...
:sunny: Test successful - status-travis Approved by: philn Pushing ebd80378f11db3acf88fdbc46122741d86e3d7fe to master...
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.