зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1612440 - Make send_transaction take &mut self. r=gw
Differential Revision: https://phabricator.services.mozilla.com/D74293
This commit is contained in:
Родитель
f16e775358
Коммит
f4e54a21aa
|
@ -1936,7 +1936,7 @@ pub extern "C" fn wr_api_send_transaction(dh: &mut DocumentHandle, transaction:
|
|||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn wr_api_send_transactions(
|
||||
document_handles: *const *const DocumentHandle,
|
||||
document_handles: *const *mut DocumentHandle,
|
||||
transactions: *const *mut Transaction,
|
||||
transaction_count: usize,
|
||||
is_async: bool,
|
||||
|
|
|
@ -24,7 +24,7 @@ struct App {
|
|||
impl Example for App {
|
||||
fn render(
|
||||
&mut self,
|
||||
_api: &RenderApi,
|
||||
_api: &mut RenderApi,
|
||||
builder: &mut DisplayListBuilder,
|
||||
_txn: &mut Transaction,
|
||||
_device_size: DeviceIntSize,
|
||||
|
@ -54,7 +54,7 @@ impl Example for App {
|
|||
fn on_event(
|
||||
&mut self,
|
||||
event: winit::WindowEvent,
|
||||
_api: &RenderApi,
|
||||
_api: &mut RenderApi,
|
||||
_document_id: DocumentId
|
||||
) -> bool {
|
||||
match event {
|
||||
|
|
|
@ -113,7 +113,7 @@ impl Example for App {
|
|||
|
||||
fn render(
|
||||
&mut self,
|
||||
_api: &RenderApi,
|
||||
_api: &mut RenderApi,
|
||||
builder: &mut DisplayListBuilder,
|
||||
_txn: &mut Transaction,
|
||||
_device_size: DeviceIntSize,
|
||||
|
@ -135,7 +135,7 @@ impl Example for App {
|
|||
self.add_rounded_rect(bounds, ColorF::new(0.0, 0.0, 1.0, 0.5), builder, pipeline_id, key2, None);
|
||||
}
|
||||
|
||||
fn on_event(&mut self, win_event: winit::WindowEvent, api: &RenderApi, document_id: DocumentId) -> bool {
|
||||
fn on_event(&mut self, win_event: winit::WindowEvent, api: &mut RenderApi, document_id: DocumentId) -> bool {
|
||||
let mut rebuild_display_list = false;
|
||||
|
||||
match win_event {
|
||||
|
|
|
@ -183,7 +183,7 @@ impl Example for App {
|
|||
|
||||
fn render(
|
||||
&mut self,
|
||||
api: &RenderApi,
|
||||
api: &mut RenderApi,
|
||||
builder: &mut DisplayListBuilder,
|
||||
txn: &mut Transaction,
|
||||
_: DeviceIntSize,
|
||||
|
@ -296,7 +296,7 @@ impl Example for App {
|
|||
builder.pop_stacking_context();
|
||||
}
|
||||
|
||||
fn on_event(&mut self, event: winit::WindowEvent, api: &RenderApi, document_id: DocumentId) -> bool {
|
||||
fn on_event(&mut self, event: winit::WindowEvent, api: &mut RenderApi, document_id: DocumentId) -> bool {
|
||||
let mut txn = Transaction::new();
|
||||
match event {
|
||||
winit::WindowEvent::Touch(touch) => match self.touch_state.handle_event(touch) {
|
||||
|
|
|
@ -197,7 +197,7 @@ struct App {}
|
|||
impl Example for App {
|
||||
fn render(
|
||||
&mut self,
|
||||
api: &RenderApi,
|
||||
api: &mut RenderApi,
|
||||
builder: &mut DisplayListBuilder,
|
||||
txn: &mut Transaction,
|
||||
_device_size: DeviceIntSize,
|
||||
|
|
|
@ -73,7 +73,7 @@ pub trait Example {
|
|||
|
||||
fn render(
|
||||
&mut self,
|
||||
api: &RenderApi,
|
||||
api: &mut RenderApi,
|
||||
builder: &mut DisplayListBuilder,
|
||||
txn: &mut Transaction,
|
||||
device_size: DeviceIntSize,
|
||||
|
@ -83,7 +83,7 @@ pub trait Example {
|
|||
fn on_event(
|
||||
&mut self,
|
||||
_: winit::WindowEvent,
|
||||
_: &RenderApi,
|
||||
_: &mut RenderApi,
|
||||
_: DocumentId,
|
||||
) -> bool {
|
||||
false
|
||||
|
@ -185,7 +185,7 @@ pub fn main_wrapper<E: Example>(
|
|||
None,
|
||||
device_size,
|
||||
).unwrap();
|
||||
let api = sender.create_api();
|
||||
let mut api = sender.create_api();
|
||||
let document_id = api.add_document(device_size, 0);
|
||||
|
||||
let (external, output) = example.get_image_handlers(&*gl);
|
||||
|
@ -205,7 +205,7 @@ pub fn main_wrapper<E: Example>(
|
|||
let mut txn = Transaction::new();
|
||||
|
||||
example.render(
|
||||
&api,
|
||||
&mut api,
|
||||
&mut builder,
|
||||
&mut txn,
|
||||
device_size,
|
||||
|
@ -278,14 +278,14 @@ pub fn main_wrapper<E: Example>(
|
|||
_ => {
|
||||
custom_event = example.on_event(
|
||||
win_event,
|
||||
&api,
|
||||
&mut api,
|
||||
document_id,
|
||||
)
|
||||
},
|
||||
},
|
||||
other => custom_event = example.on_event(
|
||||
other,
|
||||
&api,
|
||||
&mut api,
|
||||
document_id,
|
||||
),
|
||||
};
|
||||
|
@ -298,7 +298,7 @@ pub fn main_wrapper<E: Example>(
|
|||
let mut builder = DisplayListBuilder::new(pipeline_id, layout_size);
|
||||
|
||||
example.render(
|
||||
&api,
|
||||
&mut api,
|
||||
&mut builder,
|
||||
&mut txn,
|
||||
device_size,
|
||||
|
|
|
@ -33,7 +33,7 @@ struct App {
|
|||
impl App {
|
||||
fn init(
|
||||
&mut self,
|
||||
api: &RenderApi,
|
||||
api: &mut RenderApi,
|
||||
device_pixel_ratio: f32,
|
||||
) {
|
||||
let init_data = vec![
|
||||
|
@ -89,7 +89,7 @@ impl App {
|
|||
impl Example for App {
|
||||
fn render(
|
||||
&mut self,
|
||||
api: &RenderApi,
|
||||
api: &mut RenderApi,
|
||||
base_builder: &mut DisplayListBuilder,
|
||||
_txn: &mut Transaction,
|
||||
device_size: DeviceIntSize,
|
||||
|
|
|
@ -69,7 +69,7 @@ impl ExternalImageHandler for ExternalHandler {
|
|||
impl App {
|
||||
fn init_output_document(
|
||||
&mut self,
|
||||
api: &RenderApi,
|
||||
api: &mut RenderApi,
|
||||
device_size: DeviceIntSize,
|
||||
device_pixel_ratio: f32,
|
||||
) {
|
||||
|
@ -146,7 +146,7 @@ impl App {
|
|||
impl Example for App {
|
||||
fn render(
|
||||
&mut self,
|
||||
api: &RenderApi,
|
||||
api: &mut RenderApi,
|
||||
builder: &mut DisplayListBuilder,
|
||||
_txn: &mut Transaction,
|
||||
device_size: DeviceIntSize,
|
||||
|
|
|
@ -23,7 +23,7 @@ struct App {}
|
|||
impl Example for App {
|
||||
fn render(
|
||||
&mut self,
|
||||
api: &RenderApi,
|
||||
api: &mut RenderApi,
|
||||
builder: &mut DisplayListBuilder,
|
||||
_txn: &mut Transaction,
|
||||
_device_size: DeviceIntSize,
|
||||
|
|
|
@ -23,7 +23,7 @@ struct App {
|
|||
impl Example for App {
|
||||
fn render(
|
||||
&mut self,
|
||||
_api: &RenderApi,
|
||||
_api: &mut RenderApi,
|
||||
builder: &mut DisplayListBuilder,
|
||||
txn: &mut Transaction,
|
||||
_device_size: DeviceIntSize,
|
||||
|
@ -76,7 +76,7 @@ impl Example for App {
|
|||
builder.pop_stacking_context();
|
||||
}
|
||||
|
||||
fn on_event(&mut self, event: winit::WindowEvent, api: &RenderApi, document_id: DocumentId) -> bool {
|
||||
fn on_event(&mut self, event: winit::WindowEvent, api: &mut RenderApi, document_id: DocumentId) -> bool {
|
||||
match event {
|
||||
winit::WindowEvent::KeyboardInput {
|
||||
input: winit::KeyboardInput {
|
||||
|
|
|
@ -105,7 +105,7 @@ impl Window {
|
|||
};
|
||||
let notifier = Box::new(Notifier::new(events_loop.create_proxy()));
|
||||
let (renderer, sender) = webrender::Renderer::new(gl.clone(), notifier, opts, None, device_size).unwrap();
|
||||
let api = sender.create_api();
|
||||
let mut api = sender.create_api();
|
||||
let document_id = api.add_document(device_size, 0);
|
||||
|
||||
let epoch = Epoch(0);
|
||||
|
|
|
@ -25,7 +25,7 @@ struct App {
|
|||
impl Example for App {
|
||||
fn render(
|
||||
&mut self,
|
||||
_api: &RenderApi,
|
||||
_api: &mut RenderApi,
|
||||
builder: &mut DisplayListBuilder,
|
||||
_txn: &mut Transaction,
|
||||
_device_size: DeviceIntSize,
|
||||
|
@ -147,7 +147,7 @@ impl Example for App {
|
|||
builder.pop_stacking_context();
|
||||
}
|
||||
|
||||
fn on_event(&mut self, event: winit::WindowEvent, api: &RenderApi, document_id: DocumentId) -> bool {
|
||||
fn on_event(&mut self, event: winit::WindowEvent, api: &mut RenderApi, document_id: DocumentId) -> bool {
|
||||
let mut txn = Transaction::new();
|
||||
match event {
|
||||
winit::WindowEvent::KeyboardInput {
|
||||
|
|
|
@ -89,7 +89,7 @@ struct App {
|
|||
impl Example for App {
|
||||
fn render(
|
||||
&mut self,
|
||||
api: &RenderApi,
|
||||
api: &mut RenderApi,
|
||||
builder: &mut DisplayListBuilder,
|
||||
txn: &mut Transaction,
|
||||
_device_size: DeviceIntSize,
|
||||
|
@ -192,7 +192,7 @@ impl Example for App {
|
|||
fn on_event(
|
||||
&mut self,
|
||||
event: winit::WindowEvent,
|
||||
api: &RenderApi,
|
||||
api: &mut RenderApi,
|
||||
document_id: DocumentId,
|
||||
) -> bool {
|
||||
match event {
|
||||
|
|
|
@ -86,7 +86,7 @@ struct App {
|
|||
impl Example for App {
|
||||
fn render(
|
||||
&mut self,
|
||||
api: &RenderApi,
|
||||
api: &mut RenderApi,
|
||||
builder: &mut DisplayListBuilder,
|
||||
txn: &mut Transaction,
|
||||
_device_size: DeviceIntSize,
|
||||
|
@ -189,7 +189,7 @@ impl Example for App {
|
|||
fn on_event(
|
||||
&mut self,
|
||||
_event: winit::WindowEvent,
|
||||
_api: &RenderApi,
|
||||
_api: &mut RenderApi,
|
||||
_document_id: DocumentId,
|
||||
) -> bool {
|
||||
false
|
||||
|
|
|
@ -1599,13 +1599,13 @@ impl RenderApi {
|
|||
}
|
||||
|
||||
/// Send a transaction to WebRender.
|
||||
pub fn send_transaction(&self, document_id: DocumentId, transaction: Transaction) {
|
||||
pub fn send_transaction(&mut self, document_id: DocumentId, transaction: Transaction) {
|
||||
let msg = transaction.finalize();
|
||||
self.api_sender.send(ApiMsg::UpdateDocuments(vec![document_id], vec![msg])).unwrap();
|
||||
}
|
||||
|
||||
/// Send multiple transactions.
|
||||
pub fn send_transactions(&self, document_ids: Vec<DocumentId>, mut transactions: Vec<Transaction>) {
|
||||
pub fn send_transactions(&mut self, document_ids: Vec<DocumentId>, mut transactions: Vec<Transaction>) {
|
||||
debug_assert!(document_ids.len() == transactions.len());
|
||||
let msgs = transactions.drain(..)
|
||||
.map(|txn| txn.finalize())
|
||||
|
|
Загрузка…
Ссылка в новой задаче