Bug 1460495 - When sending a transaction, ensure the new transaction that takes its place has the same async-scene-build flag set. r=sotaro

MozReview-Commit-ID: HYwUwqE2P2O

--HG--
extra : rebase_source : 9540a4dc271d51b5d517fb6498d54d0c55eec6c6
This commit is contained in:
Kartikaya Gupta 2018-05-10 13:05:22 -04:00
Родитель 02a451dc6e
Коммит 27baa6b4f2
4 изменённых файлов: 19 добавлений и 16 удалений

Просмотреть файл

@ -134,16 +134,10 @@ private:
TransactionBuilder::TransactionBuilder()
: mUseSceneBuilderThread(gfxPrefs::WebRenderAsyncSceneBuild())
{
// We need the if statement to avoid miscompilation on windows, see
// bug 1449982 comment 22.
if (gfxPrefs::WebRenderAsyncSceneBuild()) {
mTxn = wr_transaction_new(true);
mResourceUpdates = wr_resource_updates_new();
} else {
mResourceUpdates = wr_resource_updates_new();
mTxn = wr_transaction_new(false);
}
mTxn = wr_transaction_new(mUseSceneBuilderThread);
mResourceUpdates = wr_resource_updates_new();
}
TransactionBuilder::~TransactionBuilder()
@ -366,7 +360,7 @@ void
WebRenderAPI::SendTransaction(TransactionBuilder& aTxn)
{
wr_transaction_update_resources(aTxn.Raw(), aTxn.RawUpdates());
wr_api_send_transaction(mDocHandle, aTxn.Raw());
wr_api_send_transaction(mDocHandle, aTxn.Raw(), aTxn.UseSceneBuilderThread());
}
bool

Просмотреть файл

@ -138,9 +138,11 @@ public:
void Clear();
bool UseSceneBuilderThread() const { return mUseSceneBuilderThread; }
Transaction* Raw() { return mTxn; }
wr::ResourceUpdates* RawUpdates() { return mResourceUpdates; }
protected:
bool mUseSceneBuilderThread;
Transaction* mTxn;
wr::ResourceUpdates* mResourceUpdates;
};

Просмотреть файл

@ -981,8 +981,7 @@ pub unsafe extern "C" fn wr_api_shut_down(dh: &mut DocumentHandle) {
dh.api.shut_down();
}
#[no_mangle]
pub extern "C" fn wr_transaction_new(do_async: bool) -> *mut Transaction {
fn make_transaction(do_async: bool) -> Transaction {
let mut transaction = Transaction::new();
// Ensure that we either use async scene building or not based on the
// gecko pref, regardless of what the default is. We can remove this once
@ -992,7 +991,12 @@ pub extern "C" fn wr_transaction_new(do_async: bool) -> *mut Transaction {
} else {
transaction.skip_scene_builder();
}
Box::into_raw(Box::new(transaction))
transaction
}
#[no_mangle]
pub extern "C" fn wr_transaction_new(do_async: bool) -> *mut Transaction {
Box::into_raw(Box::new(make_transaction(do_async)))
}
/// cbindgen:postfix=WR_DESTRUCTOR_SAFE_FUNC
@ -1290,12 +1294,14 @@ pub extern "C" fn wr_resource_updates_delete_image(
#[no_mangle]
pub extern "C" fn wr_api_send_transaction(
dh: &mut DocumentHandle,
transaction: &mut Transaction
transaction: &mut Transaction,
is_async: bool
) {
if transaction.is_empty() {
return;
}
let txn = mem::replace(transaction, Transaction::new());
let new_txn = make_transaction(is_async);
let txn = mem::replace(transaction, new_txn);
dh.api.send_transaction(dh.document_id, txn);
}

Просмотреть файл

@ -1073,7 +1073,8 @@ WR_DESTRUCTOR_SAFE_FUNC;
WR_INLINE
void wr_api_send_transaction(DocumentHandle *aDh,
Transaction *aTransaction)
Transaction *aTransaction,
bool aIsAsync)
WR_FUNC;
WR_INLINE