gfx/layers/ipc/CompositorBridgeChild.cpp
author Matt Woodrow <mwoodrow@mozilla.com>
Sun, 05 Sep 2021 22:36:45 +0000 (2021-09-05)
changeset 591057 1b49e7328ae43c6565d167f4c391430575097fd3
parent 590507 3d873530ac475d9c893ca3b2add3a2c5b0621ed7
child 591230 c132721ce9b0b84ff8e4b4fd887d549ef40fdfaf
permissions -rw-r--r--
Bug 1727682 - Make WebRenderLayerManager not inherit LayerManager. r=jrmuizel Differential Revision: https://phabricator.services.mozilla.com/D124433
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
389027
5f74d262924171a8fa0b4483a64f4cac34c4c9b8 Bug 1412427 part 8: (automated patch) Switch a bunch of C++ files in gfx to use our standard mode lines. r=jrmuizel
Daniel Holbert <dholbert@cs.stanford.edu>
parents: 387789
diff changeset
     1
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
5f74d262924171a8fa0b4483a64f4cac34c4c9b8 Bug 1412427 part 8: (automated patch) Switch a bunch of C++ files in gfx to use our standard mode lines. r=jrmuizel
Daniel Holbert <dholbert@cs.stanford.edu>
parents: 387789
diff changeset
     2
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
94475
Gervase Markham <gerv@gerv.net>
parents: 89297
diff changeset
     3
/* This Source Code Form is subject to the terms of the Mozilla Public
Gervase Markham <gerv@gerv.net>
parents: 89297
diff changeset
     4
 * License, v. 2.0. If a copy of the MPL was not distributed with this
Gervase Markham <gerv@gerv.net>
parents: 89297
diff changeset
     5
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
84910
5bd7228ca8a7f416e1cf38adbde530dcdf741f79 Bug 711168 - Implement the compositor protocol for OMTC. r=cjones
Benoit Girard <b56girard@gmail.com>, Ali Juma <ajuma@mozilla.com>
parents:
diff changeset
     6
289895
4f1482e6da917442cfd73f8994ebac3c58f8fe5c Rename PCompositor to PCompositorBridge. (bug 1258479 part 2, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 289894
diff changeset
     7
#include "mozilla/layers/CompositorBridgeChild.h"
4f1482e6da917442cfd73f8994ebac3c58f8fe5c Rename PCompositor to PCompositorBridge. (bug 1258479 part 2, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 289894
diff changeset
     8
#include "mozilla/layers/CompositorBridgeParent.h"
297512
79da877c9d7064796d7e0461814b7b561971c704 Move CompositorBridgeParent::CompositorLoop to CompositorThreadHolder. (bug 1273017 part 2, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 297399
diff changeset
     9
#include "mozilla/layers/CompositorThread.h"
589858
f1086c70c60e04d45640803305e6839b8b45fb14 Bug 1727423 - Remove BasicLayerManager. r=jrmuizel
Matt Woodrow <mwoodrow@mozilla.com>
parents: 589848
diff changeset
    10
#include <stddef.h>     // for size_t
f1086c70c60e04d45640803305e6839b8b45fb14 Bug 1727423 - Remove BasicLayerManager. r=jrmuizel
Matt Woodrow <mwoodrow@mozilla.com>
parents: 589848
diff changeset
    11
#include "base/task.h"  // for NewRunnableMethod, etc
484792
4e4751677534ad208d37a0630bbcf39cf04de8e9 Bug 1563139 - Remove StaticPrefs.h. r=glandium
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 483647
diff changeset
    12
#include "mozilla/StaticPrefs_layers.h"
364056
32de56131efd1ebebf3dbeb6a48a95a25c165f02 Bug 1365927 - Part 5. Make PCompositorManager the manager protocol of PCompositorBridge. r=dvander
Andrew Osmond <aosmond@mozilla.com>
parents: 364054
diff changeset
    13
#include "mozilla/layers/CompositorManagerChild.h"
309929
e10bc41ebe781abfbbaf2641ad892e308c8d8cf0 Bug 1296206 - Include ImageBridgeChild not only on Windows r=nical
Alexandre Lissy <lissyx@lissyx.dyndns.org>
parents: 308849
diff changeset
    14
#include "mozilla/layers/ImageBridgeChild.h"
311192
1ad7640633fb14e1750f972aa70718c7c6e241e5 Bug 1289650 - Move PAPZ from PContent to PCompositorBridge. r=kats
Ryan Hunt <rhunt@mozilla.com>
parents: 311190
diff changeset
    15
#include "mozilla/layers/APZChild.h"
311190
5a883a5ff328b2de99c7cab5f1bcc04534dcda6f Bug 1289650 - Check the owning PID when creating PAPZCTreeManager, PLayerTransaction. r=kats,dvander
Ryan Hunt <rhunt@mozilla.com>
parents: 311045
diff changeset
    16
#include "mozilla/layers/IAPZCTreeManager.h"
5a883a5ff328b2de99c7cab5f1bcc04534dcda6f Bug 1289650 - Check the owning PID when creating PAPZCTreeManager, PLayerTransaction. r=kats,dvander
Ryan Hunt <rhunt@mozilla.com>
parents: 311045
diff changeset
    17
#include "mozilla/layers/APZCTreeManagerChild.h"
477808
4357d695b8d5dd901788d922b73e89f16c45b2c9 Bug 1464032 Part 12: Add CanvasParent, CanvasChild and RecordedTextureData. r=mattwoodrow, jld
Bob Owen <bobowencode@gmail.com>
parents: 477556
diff changeset
    18
#include "mozilla/layers/CanvasChild.h"
591057
1b49e7328ae43c6565d167f4c391430575097fd3 Bug 1727682 - Make WebRenderLayerManager not inherit LayerManager. r=jrmuizel
Matt Woodrow <mwoodrow@mozilla.com>
parents: 590507
diff changeset
    19
#include "mozilla/layers/WebRenderLayerManager.h"
356445
0630447dd5b6f1f4fa5e070968d1b5c3946e2a99 Bug 1343754 - Add a function for replacing event target for actor and label PTexture; r=bevistseng,billm,nical
Kevin Chen <kechen@mozilla.com>
parents: 356196
diff changeset
    20
#include "mozilla/layers/PTextureChild.h"
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
    21
#include "mozilla/layers/TextureClient.h"      // for TextureClient
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
    22
#include "mozilla/layers/TextureClientPool.h"  // for TextureClientPool
341822
b4e83ae3d878b1552bbc142d848151db100ceba6 Bug 1317774 - Add gfx code needed to use WebRender in gecko. r=gfx
Mozilla Graphics Team <graphics@mozilla.com>
parents: 322595
diff changeset
    23
#include "mozilla/layers/WebRenderBridgeChild.h"
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
    24
#include "mozilla/layers/SyncObject.h"  // for SyncObjectClient
308291
fd55bf627226a208242f9fa34b9bccb4e569cceb Move TileSize from gfxPlatform to gfxVars. (bug 1288259 part 3, r=jrmuizel)
David Anderson <danderson@mozilla.com>
parents: 307385
diff changeset
    25
#include "mozilla/gfx/gfxVars.h"
305337
e6bd9062617fecf80cf520885e367776d02c9745 Add a remote implementation of CompositorSession. (bug 1282348 part 5, r=billm)
David Anderson <dvander@alliedmods.net>
parents: 305335
diff changeset
    26
#include "mozilla/gfx/GPUProcessManager.h"
314234
1ccab89191633bcf874fa62d0e66d0b284dc9d4c Use gfxCriticalError in CompositorBridgeChild::ProcessingError. (bug 1302413, r=milan)
David Anderson <danderson@mozilla.com>
parents: 313764
diff changeset
    27
#include "mozilla/gfx/Logging.h"
558350
267fdd18674019c1c7f579722c8a2c2519c4d24e Bug 1677466 - Split Endpoint.h and ProtocolMessageUtils.h from ProtocolUtils.h. r=mccr8
Simon Giesecke <sgiesecke@mozilla.com>
parents: 551975
diff changeset
    28
#include "mozilla/ipc/Endpoint.h"
501881
97b72aea347c896e1429de4ca15624a12833a46b Bug 1575008 - WebGPU implementation basis r=baku,bzbarsky
Dzmitry Malyshau <dmalyshau@mozilla.com>
parents: 501765
diff changeset
    29
#include "mozilla/webgpu/WebGPUChild.h"
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
    30
#include "mozilla/mozalloc.h"  // for operator new, etc
385513
18cc24d492a04c0c2feeb564613de980f837c7ce Collect data on how long the main thread blocks on the paint thread. (bug 1386968, r=milan, data_r=francois)
David Anderson <danderson@mozilla.com>
parents: 381587
diff changeset
    31
#include "mozilla/Telemetry.h"
501881
97b72aea347c896e1429de4ca15624a12833a46b Bug 1575008 - WebGPU implementation basis r=baku,bzbarsky
Dzmitry Malyshau <dmalyshau@mozilla.com>
parents: 501765
diff changeset
    32
#include "gfxConfig.h"
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
    33
#include "nsDebug.h"          // for NS_WARNING
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
    34
#include "nsISupportsImpl.h"  // for MOZ_COUNT_CTOR, etc
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
    35
#include "nsTArray.h"         // for nsTArray, nsTArray_Impl
470938
9813ce146bc725dd83e8ff6f41bfc36dd17d935b Bug 1534395 - Rename TabChild to BrowserChild. r=nika
Ryan Hunt <rhunt@eqrion.net>
parents: 470936
diff changeset
    36
#include "mozilla/dom/BrowserChild.h"
470936
47813ecb1f4e0244ded2f7b938430bf52c927751 Bug 1534395 - Rename TabParent to BrowserParent. r=nika
Ryan Hunt <rhunt@eqrion.net>
parents: 469644
diff changeset
    37
#include "mozilla/dom/BrowserParent.h"
316433
e465fc24bd21069edbfe94cad5108663e1e63aa5 Bug 1297826 - Override FatalError for IPDL protocols that access the GPU process and make it non-fatal. r=billm
Matt Woodrow <mwoodrow@mozilla.com>
parents: 316033
diff changeset
    38
#include "mozilla/dom/ContentChild.h"
310969
564549c354b038a465c0b3fc245da3cab8753eab Bug 1297276 - Rename mfbt/unused.h to mfbt/Unused.h for consistency. r=froydnj
Kan-Ru Chen <kanru@kanru.info>
parents: 309929
diff changeset
    39
#include "mozilla/Unused.h"
226589
b9b207933991119c6a74c23620c590933d05fc6d Bug 1095754 - In the chrome process, combine content side plugin widget geometry with chrome layer clipping and transform data, and apply this to native plugin widgets when we compose. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 224756
diff changeset
    40
#include "mozilla/DebugOnly.h"
558379
b00006c2649aa9f2e2689c01e9d92c94f6a80513 Bug 1676365 - Move SpinEventLoopUntil to separate header. r=#xpcom-reviewers
Simon Giesecke <sgiesecke@mozilla.com>
parents: 558350
diff changeset
    41
#include "mozilla/SpinEventLoopUntil.h"
513950
88c4e60eff6ce35464a257e88382f34f768a163a Bug 1506376, make DidComposite to use mediumhigh priority message r=mattwoodrow
Olli Pettay <Olli.Pettay@helsinki.fi>
parents: 513927
diff changeset
    42
#include "nsThreadUtils.h"
226589
b9b207933991119c6a74c23620c590933d05fc6d Bug 1095754 - In the chrome process, combine content side plugin widget geometry with chrome layer clipping and transform data, and apply this to native plugin widgets when we compose. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 224756
diff changeset
    43
#if defined(XP_WIN)
454520
5f4630838d46dd81dadb13220a4af0da9e23a619 Bug 1521000 - Part 2: Adjust our clang-format rules to include spaces after the hash for nested preprocessor directives r=sylvestre
Ehsan Akhgari <ehsan@mozilla.com>
parents: 451021
diff changeset
    44
#  include "WinUtils.h"
226589
b9b207933991119c6a74c23620c590933d05fc6d Bug 1095754 - In the chrome process, combine content side plugin widget geometry with chrome layer clipping and transform data, and apply this to native plugin widgets when we compose. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 224756
diff changeset
    45
#endif
303388
bdd62c877b66dcfa83034d276f0b0c452dfcaebe Implement remote CompositorWidgets on Windows. (bug 1281998 part 7, r=billm)
David Anderson <danderson@mozilla.com>
parents: 303220
diff changeset
    46
#include "mozilla/widget/CompositorWidget.h"
bdd62c877b66dcfa83034d276f0b0c452dfcaebe Implement remote CompositorWidgets on Windows. (bug 1281998 part 7, r=billm)
David Anderson <danderson@mozilla.com>
parents: 303220
diff changeset
    47
#ifdef MOZ_WIDGET_SUPPORTS_OOP_COMPOSITING
454520
5f4630838d46dd81dadb13220a4af0da9e23a619 Bug 1521000 - Part 2: Adjust our clang-format rules to include spaces after the hash for nested preprocessor directives r=sylvestre
Ehsan Akhgari <ehsan@mozilla.com>
parents: 451021
diff changeset
    48
#  include "mozilla/widget/CompositorWidgetChild.h"
303388
bdd62c877b66dcfa83034d276f0b0c452dfcaebe Implement remote CompositorWidgets on Windows. (bug 1281998 part 7, r=billm)
David Anderson <danderson@mozilla.com>
parents: 303220
diff changeset
    49
#endif
306673
a9ef44f21177637ddda8d889ae10c79254d6f3de Send vsync rates to the compositor to avoid querying gfxPlatform. (bug 1288822, r=mchang)
David Anderson <danderson@mozilla.com>
parents: 306349
diff changeset
    50
#include "VsyncSource.h"
84910
5bd7228ca8a7f416e1cf38adbde530dcdf741f79 Bug 711168 - Implement the compositor protocol for OMTC. r=cjones
Benoit Girard <b56girard@gmail.com>, Ali Juma <ajuma@mozilla.com>
parents:
diff changeset
    51
545873
ae3feb731c92425c7bd4d32b9d0c8fbb907f4f9b Bug 1649354 - Add android Fence handling to Compositor r=jnicol
sotaro <sotaro.ikeda.g@gmail.com>
parents: 538831
diff changeset
    52
#ifdef MOZ_WIDGET_ANDROID
ae3feb731c92425c7bd4d32b9d0c8fbb907f4f9b Bug 1649354 - Add android Fence handling to Compositor r=jnicol
sotaro <sotaro.ikeda.g@gmail.com>
parents: 538831
diff changeset
    53
#  include "mozilla/layers/AndroidHardwareBuffer.h"
ae3feb731c92425c7bd4d32b9d0c8fbb907f4f9b Bug 1649354 - Add android Fence handling to Compositor r=jnicol
sotaro <sotaro.ikeda.g@gmail.com>
parents: 538831
diff changeset
    54
#endif
ae3feb731c92425c7bd4d32b9d0c8fbb907f4f9b Bug 1649354 - Add android Fence handling to Compositor r=jnicol
sotaro <sotaro.ikeda.g@gmail.com>
parents: 538831
diff changeset
    55
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
    56
using mozilla::Unused;
306173
0055f23a1374324df40c85c27b4ac417de6e2cc2 Bug 1281575 - Create IPDL protocol implementation of IAPZCTreeManager. r=kats
Ryan Hunt <rhunt@mozilla.com>
parents: 306017
diff changeset
    57
using mozilla::gfx::GPUProcessManager;
84910
5bd7228ca8a7f416e1cf38adbde530dcdf741f79 Bug 711168 - Implement the compositor protocol for OMTC. r=cjones
Benoit Girard <b56girard@gmail.com>, Ali Juma <ajuma@mozilla.com>
parents:
diff changeset
    58
5bd7228ca8a7f416e1cf38adbde530dcdf741f79 Bug 711168 - Implement the compositor protocol for OMTC. r=cjones
Benoit Girard <b56girard@gmail.com>, Ali Juma <ajuma@mozilla.com>
parents:
diff changeset
    59
namespace mozilla {
5bd7228ca8a7f416e1cf38adbde530dcdf741f79 Bug 711168 - Implement the compositor protocol for OMTC. r=cjones
Benoit Girard <b56girard@gmail.com>, Ali Juma <ajuma@mozilla.com>
parents:
diff changeset
    60
namespace layers {
5bd7228ca8a7f416e1cf38adbde530dcdf741f79 Bug 711168 - Implement the compositor protocol for OMTC. r=cjones
Benoit Girard <b56girard@gmail.com>, Ali Juma <ajuma@mozilla.com>
parents:
diff changeset
    61
315316
b7ead4d4eb90ac9e8f112574dc194691e507658e Bug 1281456 - Decouple TextureForwarder and CompositableForwarder. r=gw280
Matt Woodrow <mwoodrow@mozilla.com>
parents: 315202
diff changeset
    62
static int sShmemCreationCounter = 0;
b7ead4d4eb90ac9e8f112574dc194691e507658e Bug 1281456 - Decouple TextureForwarder and CompositableForwarder. r=gw280
Matt Woodrow <mwoodrow@mozilla.com>
parents: 315202
diff changeset
    63
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
    64
static void ResetShmemCounter() { sShmemCreationCounter = 0; }
315316
b7ead4d4eb90ac9e8f112574dc194691e507658e Bug 1281456 - Decouple TextureForwarder and CompositableForwarder. r=gw280
Matt Woodrow <mwoodrow@mozilla.com>
parents: 315202
diff changeset
    65
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
    66
static void ShmemAllocated(CompositorBridgeChild* aProtocol) {
315316
b7ead4d4eb90ac9e8f112574dc194691e507658e Bug 1281456 - Decouple TextureForwarder and CompositableForwarder. r=gw280
Matt Woodrow <mwoodrow@mozilla.com>
parents: 315202
diff changeset
    67
  sShmemCreationCounter++;
b7ead4d4eb90ac9e8f112574dc194691e507658e Bug 1281456 - Decouple TextureForwarder and CompositableForwarder. r=gw280
Matt Woodrow <mwoodrow@mozilla.com>
parents: 315202
diff changeset
    68
  if (sShmemCreationCounter > 256) {
b7ead4d4eb90ac9e8f112574dc194691e507658e Bug 1281456 - Decouple TextureForwarder and CompositableForwarder. r=gw280
Matt Woodrow <mwoodrow@mozilla.com>
parents: 315202
diff changeset
    69
    aProtocol->SendSyncWithCompositor();
b7ead4d4eb90ac9e8f112574dc194691e507658e Bug 1281456 - Decouple TextureForwarder and CompositableForwarder. r=gw280
Matt Woodrow <mwoodrow@mozilla.com>
parents: 315202
diff changeset
    70
    ResetShmemCounter();
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
    71
    MOZ_PERFORMANCE_WARNING(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
    72
        "gfx", "The number of shmem allocations is too damn high!");
315316
b7ead4d4eb90ac9e8f112574dc194691e507658e Bug 1281456 - Decouple TextureForwarder and CompositableForwarder. r=gw280
Matt Woodrow <mwoodrow@mozilla.com>
parents: 315202
diff changeset
    73
  }
b7ead4d4eb90ac9e8f112574dc194691e507658e Bug 1281456 - Decouple TextureForwarder and CompositableForwarder. r=gw280
Matt Woodrow <mwoodrow@mozilla.com>
parents: 315202
diff changeset
    74
}
b7ead4d4eb90ac9e8f112574dc194691e507658e Bug 1281456 - Decouple TextureForwarder and CompositableForwarder. r=gw280
Matt Woodrow <mwoodrow@mozilla.com>
parents: 315202
diff changeset
    75
292235
577472ad5c385b2013bcf018cf7bc7e2c70eef8c Bug 1215265 - Shut PCompositorBridge down properly. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 290880
diff changeset
    76
static StaticRefPtr<CompositorBridgeChild> sCompositorBridge;
99609
aeafc64692a5f965917ba07b1f7bf2d99413047e Bug 745148, part 8: Implement the little boilerplate-y bits and pieces needed for cross-process compositor. r=ajuma,BenWa
Chris Jones <jones.chris.g@gmail.com>
parents: 99607
diff changeset
    77
315316
b7ead4d4eb90ac9e8f112574dc194691e507658e Bug 1281456 - Decouple TextureForwarder and CompositableForwarder. r=gw280
Matt Woodrow <mwoodrow@mozilla.com>
parents: 315202
diff changeset
    78
Atomic<int32_t> KnowsCompositor::sSerialCounter(0);
169090
405f0e05bf568f044f90ac410e2d7c82b3c98562 Bug 889959 - Implement GetTextureClient for CairoImage. r=nical
Matt Woodrow <mwoodrow@mozilla.com>
parents: 169081
diff changeset
    79
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
    80
CompositorBridgeChild::CompositorBridgeChild(CompositorManagerChild* aManager)
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
    81
    : mCompositorManager(aManager),
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
    82
      mIdNamespace(0),
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
    83
      mResourceId(0),
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
    84
      mCanSend(false),
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
    85
      mActorDestroyed(false),
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
    86
      mFwdTransactionId(0),
528941
728ba655194f682510149c0107cbe8e335f306e6 Bug 1634253 - P6. Remove MessageLoop use from gfx. r=kats,mattwoodrow
Jean-Yves Avenard <jyavenard@mozilla.com>
parents: 528903
diff changeset
    87
      mThread(NS_GetCurrentThread()),
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
    88
      mProcessToken(0),
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
    89
      mSectionAllocator(nullptr),
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
    90
      mPaintLock("CompositorBridgeChild.mPaintLock"),
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
    91
      mTotalAsyncPaints(0),
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
    92
      mOutstandingAsyncPaints(0),
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
    93
      mOutstandingAsyncEndTransaction(false),
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
    94
      mIsDelayingForAsyncPaints(false),
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
    95
      mSlowFlushCount(0),
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
    96
      mTotalFlushCount(0) {
302048
ada00a4c36c5ba384e2fdc2c4bd94f20fe7c744c Bug 1176011 - Move TextureClientPool to CompositorBridgeChild r=nical
George Wright <george@mozilla.com>
parents: 301875
diff changeset
    97
  MOZ_ASSERT(NS_IsMainThread());
84910
5bd7228ca8a7f416e1cf38adbde530dcdf741f79 Bug 711168 - Implement the compositor protocol for OMTC. r=cjones
Benoit Girard <b56girard@gmail.com>, Ali Juma <ajuma@mozilla.com>
parents:
diff changeset
    98
}
5bd7228ca8a7f416e1cf38adbde530dcdf741f79 Bug 711168 - Implement the compositor protocol for OMTC. r=cjones
Benoit Girard <b56girard@gmail.com>, Ali Juma <ajuma@mozilla.com>
parents:
diff changeset
    99
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   100
CompositorBridgeChild::~CompositorBridgeChild() {
237012
295db120bf1294195fdee467ba8fded9caae4842 Bug 1125848 - Consolidate PCompositor's creation-destruction logic. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 236994
diff changeset
   101
  if (mCanSend) {
289895
4f1482e6da917442cfd73f8994ebac3c58f8fe5c Rename PCompositor to PCompositorBridge. (bug 1258479 part 2, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 289894
diff changeset
   102
    gfxCriticalError() << "CompositorBridgeChild was not deinitialized";
237012
295db120bf1294195fdee467ba8fded9caae4842 Bug 1125848 - Consolidate PCompositor's creation-destruction logic. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 236994
diff changeset
   103
  }
273747
acbac8b866193b77e9d36b0d45f1ee9094a107f6 Backed out changeset 7b113a6167e9 (bug 1215265) for mass bustage CLOSED TREE
Wes Kocher <wkocher@mozilla.com>
parents: 273734
diff changeset
   104
}
acbac8b866193b77e9d36b0d45f1ee9094a107f6 Backed out changeset 7b113a6167e9 (bug 1215265) for mass bustage CLOSED TREE
Wes Kocher <wkocher@mozilla.com>
parents: 273734
diff changeset
   105
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   106
bool CompositorBridgeChild::IsSameProcess() const {
292235
577472ad5c385b2013bcf018cf7bc7e2c70eef8c Bug 1215265 - Shut PCompositorBridge down properly. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 290880
diff changeset
   107
  return OtherPid() == base::GetCurrentProcId();
577472ad5c385b2013bcf018cf7bc7e2c70eef8c Bug 1215265 - Shut PCompositorBridge down properly. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 290880
diff changeset
   108
}
577472ad5c385b2013bcf018cf7bc7e2c70eef8c Bug 1215265 - Shut PCompositorBridge down properly. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 290880
diff changeset
   109
513950
88c4e60eff6ce35464a257e88382f34f768a163a Bug 1506376, make DidComposite to use mediumhigh priority message r=mattwoodrow
Olli Pettay <Olli.Pettay@helsinki.fi>
parents: 513927
diff changeset
   110
void CompositorBridgeChild::PrepareFinalDestroy() {
88c4e60eff6ce35464a257e88382f34f768a163a Bug 1506376, make DidComposite to use mediumhigh priority message r=mattwoodrow
Olli Pettay <Olli.Pettay@helsinki.fi>
parents: 513927
diff changeset
   111
  // Because of medium high priority DidComposite, we need to repost to
88c4e60eff6ce35464a257e88382f34f768a163a Bug 1506376, make DidComposite to use mediumhigh priority message r=mattwoodrow
Olli Pettay <Olli.Pettay@helsinki.fi>
parents: 513927
diff changeset
   112
  // medium high priority queue to ensure the actor is destroyed after possible
88c4e60eff6ce35464a257e88382f34f768a163a Bug 1506376, make DidComposite to use mediumhigh priority message r=mattwoodrow
Olli Pettay <Olli.Pettay@helsinki.fi>
parents: 513927
diff changeset
   113
  // pending DidComposite message.
88c4e60eff6ce35464a257e88382f34f768a163a Bug 1506376, make DidComposite to use mediumhigh priority message r=mattwoodrow
Olli Pettay <Olli.Pettay@helsinki.fi>
parents: 513927
diff changeset
   114
  nsCOMPtr<nsIRunnable> runnable =
88c4e60eff6ce35464a257e88382f34f768a163a Bug 1506376, make DidComposite to use mediumhigh priority message r=mattwoodrow
Olli Pettay <Olli.Pettay@helsinki.fi>
parents: 513927
diff changeset
   115
      NewRunnableMethod("CompositorBridgeChild::AfterDestroy", this,
88c4e60eff6ce35464a257e88382f34f768a163a Bug 1506376, make DidComposite to use mediumhigh priority message r=mattwoodrow
Olli Pettay <Olli.Pettay@helsinki.fi>
parents: 513927
diff changeset
   116
                        &CompositorBridgeChild::AfterDestroy);
88c4e60eff6ce35464a257e88382f34f768a163a Bug 1506376, make DidComposite to use mediumhigh priority message r=mattwoodrow
Olli Pettay <Olli.Pettay@helsinki.fi>
parents: 513927
diff changeset
   117
  NS_DispatchToCurrentThreadQueue(runnable.forget(),
88c4e60eff6ce35464a257e88382f34f768a163a Bug 1506376, make DidComposite to use mediumhigh priority message r=mattwoodrow
Olli Pettay <Olli.Pettay@helsinki.fi>
parents: 513927
diff changeset
   118
                                  EventQueuePriority::MediumHigh);
88c4e60eff6ce35464a257e88382f34f768a163a Bug 1506376, make DidComposite to use mediumhigh priority message r=mattwoodrow
Olli Pettay <Olli.Pettay@helsinki.fi>
parents: 513927
diff changeset
   119
}
88c4e60eff6ce35464a257e88382f34f768a163a Bug 1506376, make DidComposite to use mediumhigh priority message r=mattwoodrow
Olli Pettay <Olli.Pettay@helsinki.fi>
parents: 513927
diff changeset
   120
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   121
void CompositorBridgeChild::AfterDestroy() {
364056
32de56131efd1ebebf3dbeb6a48a95a25c165f02 Bug 1365927 - Part 5. Make PCompositorManager the manager protocol of PCompositorBridge. r=dvander
Andrew Osmond <aosmond@mozilla.com>
parents: 364054
diff changeset
   122
  // Note that we cannot rely upon mCanSend here because we already set that to
32de56131efd1ebebf3dbeb6a48a95a25c165f02 Bug 1365927 - Part 5. Make PCompositorManager the manager protocol of PCompositorBridge. r=dvander
Andrew Osmond <aosmond@mozilla.com>
parents: 364054
diff changeset
   123
  // false to prevent normal IPDL calls from being made after SendWillClose.
32de56131efd1ebebf3dbeb6a48a95a25c165f02 Bug 1365927 - Part 5. Make PCompositorManager the manager protocol of PCompositorBridge. r=dvander
Andrew Osmond <aosmond@mozilla.com>
parents: 364054
diff changeset
   124
  // The only time we should not issue Send__delete__ is if the actor is already
32de56131efd1ebebf3dbeb6a48a95a25c165f02 Bug 1365927 - Part 5. Make PCompositorManager the manager protocol of PCompositorBridge. r=dvander
Andrew Osmond <aosmond@mozilla.com>
parents: 364054
diff changeset
   125
  // destroyed, e.g. the compositor process crashed.
32de56131efd1ebebf3dbeb6a48a95a25c165f02 Bug 1365927 - Part 5. Make PCompositorManager the manager protocol of PCompositorBridge. r=dvander
Andrew Osmond <aosmond@mozilla.com>
parents: 364054
diff changeset
   126
  if (!mActorDestroyed) {
32de56131efd1ebebf3dbeb6a48a95a25c165f02 Bug 1365927 - Part 5. Make PCompositorManager the manager protocol of PCompositorBridge. r=dvander
Andrew Osmond <aosmond@mozilla.com>
parents: 364054
diff changeset
   127
    Send__delete__(this);
379563
df9d3661abb63c68caeca8de66c6e44eb7456260 Bug 1389021 - CompositorBridgeChild::ActorDestroy should not prevent CompositorBridgeChild::ShutDown from returning. r=nical
Andrew Osmond <aosmond@mozilla.com>
parents: 377666
diff changeset
   128
    mActorDestroyed = true;
364056
32de56131efd1ebebf3dbeb6a48a95a25c165f02 Bug 1365927 - Part 5. Make PCompositorManager the manager protocol of PCompositorBridge. r=dvander
Andrew Osmond <aosmond@mozilla.com>
parents: 364054
diff changeset
   129
  }
292235
577472ad5c385b2013bcf018cf7bc7e2c70eef8c Bug 1215265 - Shut PCompositorBridge down properly. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 290880
diff changeset
   130
477808
4357d695b8d5dd901788d922b73e89f16c45b2c9 Bug 1464032 Part 12: Add CanvasParent, CanvasChild and RecordedTextureData. r=mattwoodrow, jld
Bob Owen <bobowencode@gmail.com>
parents: 477556
diff changeset
   131
  if (mCanvasChild) {
4357d695b8d5dd901788d922b73e89f16c45b2c9 Bug 1464032 Part 12: Add CanvasParent, CanvasChild and RecordedTextureData. r=mattwoodrow, jld
Bob Owen <bobowencode@gmail.com>
parents: 477556
diff changeset
   132
    mCanvasChild->Destroy();
4357d695b8d5dd901788d922b73e89f16c45b2c9 Bug 1464032 Part 12: Add CanvasParent, CanvasChild and RecordedTextureData. r=mattwoodrow, jld
Bob Owen <bobowencode@gmail.com>
parents: 477556
diff changeset
   133
  }
4357d695b8d5dd901788d922b73e89f16c45b2c9 Bug 1464032 Part 12: Add CanvasParent, CanvasChild and RecordedTextureData. r=mattwoodrow, jld
Bob Owen <bobowencode@gmail.com>
parents: 477556
diff changeset
   134
364056
32de56131efd1ebebf3dbeb6a48a95a25c165f02 Bug 1365927 - Part 5. Make PCompositorManager the manager protocol of PCompositorBridge. r=dvander
Andrew Osmond <aosmond@mozilla.com>
parents: 364054
diff changeset
   135
  if (sCompositorBridge == this) {
292235
577472ad5c385b2013bcf018cf7bc7e2c70eef8c Bug 1215265 - Shut PCompositorBridge down properly. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 290880
diff changeset
   136
    sCompositorBridge = nullptr;
577472ad5c385b2013bcf018cf7bc7e2c70eef8c Bug 1215265 - Shut PCompositorBridge down properly. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 290880
diff changeset
   137
  }
84910
5bd7228ca8a7f416e1cf38adbde530dcdf741f79 Bug 711168 - Implement the compositor protocol for OMTC. r=cjones
Benoit Girard <b56girard@gmail.com>, Ali Juma <ajuma@mozilla.com>
parents:
diff changeset
   138
}
5bd7228ca8a7f416e1cf38adbde530dcdf741f79 Bug 711168 - Implement the compositor protocol for OMTC. r=cjones
Benoit Girard <b56girard@gmail.com>, Ali Juma <ajuma@mozilla.com>
parents:
diff changeset
   139
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   140
void CompositorBridgeChild::Destroy() {
237012
295db120bf1294195fdee467ba8fded9caae4842 Bug 1125848 - Consolidate PCompositor's creation-destruction logic. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 236994
diff changeset
   141
  // This must not be called from the destructor!
476506
996a636778d0557ffd9a36e1a63cb7a1f4d00122 Bug 1555544 - Change function name from CancelWaitForRecycle() to CancelWaitForNotifyNotUsed() r=jgilbert
sotaro <sotaro.ikeda.g@gmail.com>
parents: 475617
diff changeset
   142
  mTexturesWaitingNotifyNotUsed.clear();
237012
295db120bf1294195fdee467ba8fded9caae4842 Bug 1125848 - Consolidate PCompositor's creation-destruction logic. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 236994
diff changeset
   143
379563
df9d3661abb63c68caeca8de66c6e44eb7456260 Bug 1389021 - CompositorBridgeChild::ActorDestroy should not prevent CompositorBridgeChild::ShutDown from returning. r=nical
Andrew Osmond <aosmond@mozilla.com>
parents: 377666
diff changeset
   144
  // Destroying the layer manager may cause all sorts of things to happen, so
df9d3661abb63c68caeca8de66c6e44eb7456260 Bug 1389021 - CompositorBridgeChild::ActorDestroy should not prevent CompositorBridgeChild::ShutDown from returning. r=nical
Andrew Osmond <aosmond@mozilla.com>
parents: 377666
diff changeset
   145
  // let's make sure there is still a reference to keep this alive whatever
df9d3661abb63c68caeca8de66c6e44eb7456260 Bug 1389021 - CompositorBridgeChild::ActorDestroy should not prevent CompositorBridgeChild::ShutDown from returning. r=nical
Andrew Osmond <aosmond@mozilla.com>
parents: 377666
diff changeset
   146
  // happens.
df9d3661abb63c68caeca8de66c6e44eb7456260 Bug 1389021 - CompositorBridgeChild::ActorDestroy should not prevent CompositorBridgeChild::ShutDown from returning. r=nical
Andrew Osmond <aosmond@mozilla.com>
parents: 377666
diff changeset
   147
  RefPtr<CompositorBridgeChild> selfRef = this;
df9d3661abb63c68caeca8de66c6e44eb7456260 Bug 1389021 - CompositorBridgeChild::ActorDestroy should not prevent CompositorBridgeChild::ShutDown from returning. r=nical
Andrew Osmond <aosmond@mozilla.com>
parents: 377666
diff changeset
   148
302048
ada00a4c36c5ba384e2fdc2c4bd94f20fe7c744c Bug 1176011 - Move TextureClientPool to CompositorBridgeChild r=nical
George Wright <george@mozilla.com>
parents: 301875
diff changeset
   149
  for (size_t i = 0; i < mTexturePools.Length(); i++) {
ada00a4c36c5ba384e2fdc2c4bd94f20fe7c744c Bug 1176011 - Move TextureClientPool to CompositorBridgeChild r=nical
George Wright <george@mozilla.com>
parents: 301875
diff changeset
   150
    mTexturePools[i]->Destroy();
ada00a4c36c5ba384e2fdc2c4bd94f20fe7c744c Bug 1176011 - Move TextureClientPool to CompositorBridgeChild r=nical
George Wright <george@mozilla.com>
parents: 301875
diff changeset
   151
  }
ada00a4c36c5ba384e2fdc2c4bd94f20fe7c744c Bug 1176011 - Move TextureClientPool to CompositorBridgeChild r=nical
George Wright <george@mozilla.com>
parents: 301875
diff changeset
   152
312304
9beac1f92bd0b559e46039061a3ce9a09350ce96 Bug 1280715 - Move FixedSizeShmemAllocator to CompositorBridgeChild to allow for a more sane destruction sequence r=nical
George Wright <george@mozilla.com>
parents: 311192
diff changeset
   153
  if (mSectionAllocator) {
9beac1f92bd0b559e46039061a3ce9a09350ce96 Bug 1280715 - Move FixedSizeShmemAllocator to CompositorBridgeChild to allow for a more sane destruction sequence r=nical
George Wright <george@mozilla.com>
parents: 311192
diff changeset
   154
    delete mSectionAllocator;
9beac1f92bd0b559e46039061a3ce9a09350ce96 Bug 1280715 - Move FixedSizeShmemAllocator to CompositorBridgeChild to allow for a more sane destruction sequence r=nical
George Wright <george@mozilla.com>
parents: 311192
diff changeset
   155
    mSectionAllocator = nullptr;
9beac1f92bd0b559e46039061a3ce9a09350ce96 Bug 1280715 - Move FixedSizeShmemAllocator to CompositorBridgeChild to allow for a more sane destruction sequence r=nical
George Wright <george@mozilla.com>
parents: 311192
diff changeset
   156
  }
9beac1f92bd0b559e46039061a3ce9a09350ce96 Bug 1280715 - Move FixedSizeShmemAllocator to CompositorBridgeChild to allow for a more sane destruction sequence r=nical
George Wright <george@mozilla.com>
parents: 311192
diff changeset
   157
237012
295db120bf1294195fdee467ba8fded9caae4842 Bug 1125848 - Consolidate PCompositor's creation-destruction logic. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 236994
diff changeset
   158
  if (mLayerManager) {
295db120bf1294195fdee467ba8fded9caae4842 Bug 1125848 - Consolidate PCompositor's creation-destruction logic. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 236994
diff changeset
   159
    mLayerManager->Destroy();
295db120bf1294195fdee467ba8fded9caae4842 Bug 1125848 - Consolidate PCompositor's creation-destruction logic. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 236994
diff changeset
   160
    mLayerManager = nullptr;
295db120bf1294195fdee467ba8fded9caae4842 Bug 1125848 - Consolidate PCompositor's creation-destruction logic. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 236994
diff changeset
   161
  }
295db120bf1294195fdee467ba8fded9caae4842 Bug 1125848 - Consolidate PCompositor's creation-destruction logic. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 236994
diff changeset
   162
381587
4dd86bbce6496319e18e00d0aa81112e01f273a9 Bug 1389021 - Force CompositorManagerParent to close before shutting down the compositor thread. r=dvander,me
Andrew Osmond <aosmond@mozilla.com>
parents: 379563
diff changeset
   163
  if (!mCanSend) {
4dd86bbce6496319e18e00d0aa81112e01f273a9 Bug 1389021 - Force CompositorManagerParent to close before shutting down the compositor thread. r=dvander,me
Andrew Osmond <aosmond@mozilla.com>
parents: 379563
diff changeset
   164
    // We may have already called destroy but still have lingering references
4dd86bbce6496319e18e00d0aa81112e01f273a9 Bug 1389021 - Force CompositorManagerParent to close before shutting down the compositor thread. r=dvander,me
Andrew Osmond <aosmond@mozilla.com>
parents: 379563
diff changeset
   165
    // or CompositorBridgeChild::ActorDestroy was called. Ensure that we do our
4dd86bbce6496319e18e00d0aa81112e01f273a9 Bug 1389021 - Force CompositorManagerParent to close before shutting down the compositor thread. r=dvander,me
Andrew Osmond <aosmond@mozilla.com>
parents: 379563
diff changeset
   166
    // post destroy clean up no matter what. It is safe to call multiple times.
528941
728ba655194f682510149c0107cbe8e335f306e6 Bug 1634253 - P6. Remove MessageLoop use from gfx. r=kats,mattwoodrow
Jean-Yves Avenard <jyavenard@mozilla.com>
parents: 528903
diff changeset
   167
    NS_GetCurrentThread()->Dispatch(
513950
88c4e60eff6ce35464a257e88382f34f768a163a Bug 1506376, make DidComposite to use mediumhigh priority message r=mattwoodrow
Olli Pettay <Olli.Pettay@helsinki.fi>
parents: 513927
diff changeset
   168
        NewRunnableMethod("CompositorBridgeChild::PrepareFinalDestroy", selfRef,
88c4e60eff6ce35464a257e88382f34f768a163a Bug 1506376, make DidComposite to use mediumhigh priority message r=mattwoodrow
Olli Pettay <Olli.Pettay@helsinki.fi>
parents: 513927
diff changeset
   169
                          &CompositorBridgeChild::PrepareFinalDestroy));
381587
4dd86bbce6496319e18e00d0aa81112e01f273a9 Bug 1389021 - Force CompositorManagerParent to close before shutting down the compositor thread. r=dvander,me
Andrew Osmond <aosmond@mozilla.com>
parents: 379563
diff changeset
   170
    return;
4dd86bbce6496319e18e00d0aa81112e01f273a9 Bug 1389021 - Force CompositorManagerParent to close before shutting down the compositor thread. r=dvander,me
Andrew Osmond <aosmond@mozilla.com>
parents: 379563
diff changeset
   171
  }
4dd86bbce6496319e18e00d0aa81112e01f273a9 Bug 1389021 - Force CompositorManagerParent to close before shutting down the compositor thread. r=dvander,me
Andrew Osmond <aosmond@mozilla.com>
parents: 379563
diff changeset
   172
366862
c00b134804208c2652ebd4f45a1d37277c54e60b Bug 1377024 - Add support of device reset test from about:support r=kats,dvander
sotaro <sotaro.ikeda.g@gmail.com>
parents: 366332
diff changeset
   173
  AutoTArray<PWebRenderBridgeChild*, 16> wrBridges;
c00b134804208c2652ebd4f45a1d37277c54e60b Bug 1377024 - Add support of device reset test from about:support r=kats,dvander
sotaro <sotaro.ikeda.g@gmail.com>
parents: 366332
diff changeset
   174
  ManagedPWebRenderBridgeChild(wrBridges);
c00b134804208c2652ebd4f45a1d37277c54e60b Bug 1377024 - Add support of device reset test from about:support r=kats,dvander
sotaro <sotaro.ikeda.g@gmail.com>
parents: 366332
diff changeset
   175
  for (int i = wrBridges.Length() - 1; i >= 0; --i) {
c00b134804208c2652ebd4f45a1d37277c54e60b Bug 1377024 - Add support of device reset test from about:support r=kats,dvander
sotaro <sotaro.ikeda.g@gmail.com>
parents: 366332
diff changeset
   176
    RefPtr<WebRenderBridgeChild> wrBridge =
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   177
        static_cast<WebRenderBridgeChild*>(wrBridges[i]);
366862
c00b134804208c2652ebd4f45a1d37277c54e60b Bug 1377024 - Add support of device reset test from about:support r=kats,dvander
sotaro <sotaro.ikeda.g@gmail.com>
parents: 366332
diff changeset
   178
    wrBridge->Destroy(/* aIsSync */ false);
341891
8ecafae107fbb8856948513301e2a726256b19d8 Bug 1320023 - Make WebRenderBridgeChild destroy simiar to LayerTransactionChild r=nical
sotaro <sotaro.ikeda.g@gmail.com>
parents: 341853
diff changeset
   179
  }
8ecafae107fbb8856948513301e2a726256b19d8 Bug 1320023 - Make WebRenderBridgeChild destroy simiar to LayerTransactionChild r=nical
sotaro <sotaro.ikeda.g@gmail.com>
parents: 341853
diff changeset
   180
472712
c737fc642ddcaa5846383f906ec3f24145d4a7a5 Bug 1533673 - Prevent the GPU RemoteContentController from sending messages to a dead actor. r=rhunt
Kartikaya Gupta <kgupta@mozilla.com>
parents: 470938
diff changeset
   181
  AutoTArray<PAPZChild*, 16> apzChildren;
c737fc642ddcaa5846383f906ec3f24145d4a7a5 Bug 1533673 - Prevent the GPU RemoteContentController from sending messages to a dead actor. r=rhunt
Kartikaya Gupta <kgupta@mozilla.com>
parents: 470938
diff changeset
   182
  ManagedPAPZChild(apzChildren);
c737fc642ddcaa5846383f906ec3f24145d4a7a5 Bug 1533673 - Prevent the GPU RemoteContentController from sending messages to a dead actor. r=rhunt
Kartikaya Gupta <kgupta@mozilla.com>
parents: 470938
diff changeset
   183
  for (PAPZChild* child : apzChildren) {
c737fc642ddcaa5846383f906ec3f24145d4a7a5 Bug 1533673 - Prevent the GPU RemoteContentController from sending messages to a dead actor. r=rhunt
Kartikaya Gupta <kgupta@mozilla.com>
parents: 470938
diff changeset
   184
    Unused << child->SendDestroy();
c737fc642ddcaa5846383f906ec3f24145d4a7a5 Bug 1533673 - Prevent the GPU RemoteContentController from sending messages to a dead actor. r=rhunt
Kartikaya Gupta <kgupta@mozilla.com>
parents: 470938
diff changeset
   185
  }
c737fc642ddcaa5846383f906ec3f24145d4a7a5 Bug 1533673 - Prevent the GPU RemoteContentController from sending messages to a dead actor. r=rhunt
Kartikaya Gupta <kgupta@mozilla.com>
parents: 470938
diff changeset
   186
501881
97b72aea347c896e1429de4ca15624a12833a46b Bug 1575008 - WebGPU implementation basis r=baku,bzbarsky
Dzmitry Malyshau <dmalyshau@mozilla.com>
parents: 501765
diff changeset
   187
  AutoTArray<PWebGPUChild*, 16> webGPUChildren;
97b72aea347c896e1429de4ca15624a12833a46b Bug 1575008 - WebGPU implementation basis r=baku,bzbarsky
Dzmitry Malyshau <dmalyshau@mozilla.com>
parents: 501765
diff changeset
   188
  ManagedPWebGPUChild(webGPUChildren);
97b72aea347c896e1429de4ca15624a12833a46b Bug 1575008 - WebGPU implementation basis r=baku,bzbarsky
Dzmitry Malyshau <dmalyshau@mozilla.com>
parents: 501765
diff changeset
   189
  for (PWebGPUChild* child : webGPUChildren) {
97b72aea347c896e1429de4ca15624a12833a46b Bug 1575008 - WebGPU implementation basis r=baku,bzbarsky
Dzmitry Malyshau <dmalyshau@mozilla.com>
parents: 501765
diff changeset
   190
    Unused << child->SendShutdown();
97b72aea347c896e1429de4ca15624a12833a46b Bug 1575008 - WebGPU implementation basis r=baku,bzbarsky
Dzmitry Malyshau <dmalyshau@mozilla.com>
parents: 501765
diff changeset
   191
  }
97b72aea347c896e1429de4ca15624a12833a46b Bug 1575008 - WebGPU implementation basis r=baku,bzbarsky
Dzmitry Malyshau <dmalyshau@mozilla.com>
parents: 501765
diff changeset
   192
303407
9a31a3a2470af998f11630940ed2f972aa1e63ce Bug 1167235 - Part 6 - Destroy textures while TextureForwarder is still usable. r=gw280
Nicolas Silva <nsilva@mozilla.com>
parents: 303388
diff changeset
   193
  const ManagedContainer<PTextureChild>& textures = ManagedPTextureChild();
572899
b2e334974f9b553ce3fda9a34efb377ca6ac6a77 Bug 708901 - Migrate to nsTHashSet in ipc. r=ipc-reviewers,nika
Simon Giesecke <sgiesecke@mozilla.com>
parents: 572889
diff changeset
   194
  for (const auto& key : textures) {
b2e334974f9b553ce3fda9a34efb377ca6ac6a77 Bug 708901 - Migrate to nsTHashSet in ipc. r=ipc-reviewers,nika
Simon Giesecke <sgiesecke@mozilla.com>
parents: 572889
diff changeset
   195
    RefPtr<TextureClient> texture = TextureClient::AsTextureClient(key);
303407
9a31a3a2470af998f11630940ed2f972aa1e63ce Bug 1167235 - Part 6 - Destroy textures while TextureForwarder is still usable. r=gw280
Nicolas Silva <nsilva@mozilla.com>
parents: 303388
diff changeset
   196
9a31a3a2470af998f11630940ed2f972aa1e63ce Bug 1167235 - Part 6 - Destroy textures while TextureForwarder is still usable. r=gw280
Nicolas Silva <nsilva@mozilla.com>
parents: 303388
diff changeset
   197
    if (texture) {
9a31a3a2470af998f11630940ed2f972aa1e63ce Bug 1167235 - Part 6 - Destroy textures while TextureForwarder is still usable. r=gw280
Nicolas Silva <nsilva@mozilla.com>
parents: 303388
diff changeset
   198
      texture->Destroy();
9a31a3a2470af998f11630940ed2f972aa1e63ce Bug 1167235 - Part 6 - Destroy textures while TextureForwarder is still usable. r=gw280
Nicolas Silva <nsilva@mozilla.com>
parents: 303388
diff changeset
   199
    }
9a31a3a2470af998f11630940ed2f972aa1e63ce Bug 1167235 - Part 6 - Destroy textures while TextureForwarder is still usable. r=gw280
Nicolas Silva <nsilva@mozilla.com>
parents: 303388
diff changeset
   200
  }
9a31a3a2470af998f11630940ed2f972aa1e63ce Bug 1167235 - Part 6 - Destroy textures while TextureForwarder is still usable. r=gw280
Nicolas Silva <nsilva@mozilla.com>
parents: 303388
diff changeset
   201
472712
c737fc642ddcaa5846383f906ec3f24145d4a7a5 Bug 1533673 - Prevent the GPU RemoteContentController from sending messages to a dead actor. r=rhunt
Kartikaya Gupta <kgupta@mozilla.com>
parents: 470938
diff changeset
   202
  // The WillClose message is synchronous, so we know that after it returns
c737fc642ddcaa5846383f906ec3f24145d4a7a5 Bug 1533673 - Prevent the GPU RemoteContentController from sending messages to a dead actor. r=rhunt
Kartikaya Gupta <kgupta@mozilla.com>
parents: 470938
diff changeset
   203
  // any messages sent by the above code will have been processed on the
c737fc642ddcaa5846383f906ec3f24145d4a7a5 Bug 1533673 - Prevent the GPU RemoteContentController from sending messages to a dead actor. r=rhunt
Kartikaya Gupta <kgupta@mozilla.com>
parents: 470938
diff changeset
   204
  // other side.
292235
577472ad5c385b2013bcf018cf7bc7e2c70eef8c Bug 1215265 - Shut PCompositorBridge down properly. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 290880
diff changeset
   205
  SendWillClose();
577472ad5c385b2013bcf018cf7bc7e2c70eef8c Bug 1215265 - Shut PCompositorBridge down properly. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 290880
diff changeset
   206
  mCanSend = false;
577472ad5c385b2013bcf018cf7bc7e2c70eef8c Bug 1215265 - Shut PCompositorBridge down properly. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 290880
diff changeset
   207
305337
e6bd9062617fecf80cf520885e367776d02c9745 Add a remote implementation of CompositorSession. (bug 1282348 part 5, r=billm)
David Anderson <dvander@alliedmods.net>
parents: 305335
diff changeset
   208
  // We no longer care about unexpected shutdowns, in the remote process case.
e6bd9062617fecf80cf520885e367776d02c9745 Add a remote implementation of CompositorSession. (bug 1282348 part 5, r=billm)
David Anderson <dvander@alliedmods.net>
parents: 305335
diff changeset
   209
  mProcessToken = 0;
237012
295db120bf1294195fdee467ba8fded9caae4842 Bug 1125848 - Consolidate PCompositor's creation-destruction logic. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 236994
diff changeset
   210
292235
577472ad5c385b2013bcf018cf7bc7e2c70eef8c Bug 1215265 - Shut PCompositorBridge down properly. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 290880
diff changeset
   211
  // The call just made to SendWillClose can result in IPC from the
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   212
  // CompositorBridgeParent to the CompositorBridgeChild (e.g. caused by the
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   213
  // destruction of shared memory). We need to ensure this gets processed by the
292235
577472ad5c385b2013bcf018cf7bc7e2c70eef8c Bug 1215265 - Shut PCompositorBridge down properly. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 290880
diff changeset
   214
  // CompositorBridgeChild before it gets destroyed. It suffices to ensure that
528941
728ba655194f682510149c0107cbe8e335f306e6 Bug 1634253 - P6. Remove MessageLoop use from gfx. r=kats,mattwoodrow
Jean-Yves Avenard <jyavenard@mozilla.com>
parents: 528903
diff changeset
   215
  // events already in the thread get processed before the
728ba655194f682510149c0107cbe8e335f306e6 Bug 1634253 - P6. Remove MessageLoop use from gfx. r=kats,mattwoodrow
Jean-Yves Avenard <jyavenard@mozilla.com>
parents: 528903
diff changeset
   216
  // CompositorBridgeChild is destroyed, so we add a task to the thread to
368300
495183c0c39097efdc623c46c725901b16388ef2 Bug 1380124 - Fix 'desctruction' typos. r=njn
Andrew McCreight <continuation@gmail.com>
parents: 367549
diff changeset
   217
  // handle compositor destruction.
292235
577472ad5c385b2013bcf018cf7bc7e2c70eef8c Bug 1215265 - Shut PCompositorBridge down properly. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 290880
diff changeset
   218
577472ad5c385b2013bcf018cf7bc7e2c70eef8c Bug 1215265 - Shut PCompositorBridge down properly. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 290880
diff changeset
   219
  // From now on we can't send any message message.
528941
728ba655194f682510149c0107cbe8e335f306e6 Bug 1634253 - P6. Remove MessageLoop use from gfx. r=kats,mattwoodrow
Jean-Yves Avenard <jyavenard@mozilla.com>
parents: 528903
diff changeset
   220
  NS_GetCurrentThread()->Dispatch(
513950
88c4e60eff6ce35464a257e88382f34f768a163a Bug 1506376, make DidComposite to use mediumhigh priority message r=mattwoodrow
Olli Pettay <Olli.Pettay@helsinki.fi>
parents: 513927
diff changeset
   221
      NewRunnableMethod("CompositorBridgeChild::PrepareFinalDestroy", selfRef,
88c4e60eff6ce35464a257e88382f34f768a163a Bug 1506376, make DidComposite to use mediumhigh priority message r=mattwoodrow
Olli Pettay <Olli.Pettay@helsinki.fi>
parents: 513927
diff changeset
   222
                        &CompositorBridgeChild::PrepareFinalDestroy));
84910
5bd7228ca8a7f416e1cf38adbde530dcdf741f79 Bug 711168 - Implement the compositor protocol for OMTC. r=cjones
Benoit Girard <b56girard@gmail.com>, Ali Juma <ajuma@mozilla.com>
parents:
diff changeset
   223
}
5bd7228ca8a7f416e1cf38adbde530dcdf741f79 Bug 711168 - Implement the compositor protocol for OMTC. r=cjones
Benoit Girard <b56girard@gmail.com>, Ali Juma <ajuma@mozilla.com>
parents:
diff changeset
   224
292235
577472ad5c385b2013bcf018cf7bc7e2c70eef8c Bug 1215265 - Shut PCompositorBridge down properly. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 290880
diff changeset
   225
// static
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   226
void CompositorBridgeChild::ShutDown() {
292235
577472ad5c385b2013bcf018cf7bc7e2c70eef8c Bug 1215265 - Shut PCompositorBridge down properly. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 290880
diff changeset
   227
  if (sCompositorBridge) {
577472ad5c385b2013bcf018cf7bc7e2c70eef8c Bug 1215265 - Shut PCompositorBridge down properly. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 290880
diff changeset
   228
    sCompositorBridge->Destroy();
358431
c8840a3a2c3b99270e26709c9549496fa206b8eb Bug 1359490 - add an event loop spinning abstraction function; r=gerald
Nathan Froyd <froydnj@mozilla.com>
parents: 358038
diff changeset
   229
    SpinEventLoopUntil([&]() { return !sCompositorBridge; });
292235
577472ad5c385b2013bcf018cf7bc7e2c70eef8c Bug 1215265 - Shut PCompositorBridge down properly. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 290880
diff changeset
   230
  }
577472ad5c385b2013bcf018cf7bc7e2c70eef8c Bug 1215265 - Shut PCompositorBridge down properly. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 290880
diff changeset
   231
}
577472ad5c385b2013bcf018cf7bc7e2c70eef8c Bug 1215265 - Shut PCompositorBridge down properly. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 290880
diff changeset
   232
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   233
void CompositorBridgeChild::InitForContent(uint32_t aNamespace) {
314602
9a6f5fac405ffd3ab59163bf4c5ec866a1bb142b Recreate content compositor endpoints when the GPU process dies. (bug 1300936 part 3, r=mattwoodrow,billm)
David Anderson <danderson@mozilla.com>
parents: 314234
diff changeset
   234
  MOZ_ASSERT(NS_IsMainThread());
364056
32de56131efd1ebebf3dbeb6a48a95a25c165f02 Bug 1365927 - Part 5. Make PCompositorManager the manager protocol of PCompositorBridge. r=dvander
Andrew Osmond <aosmond@mozilla.com>
parents: 364054
diff changeset
   235
  MOZ_ASSERT(aNamespace);
314602
9a6f5fac405ffd3ab59163bf4c5ec866a1bb142b Recreate content compositor endpoints when the GPU process dies. (bug 1300936 part 3, r=mattwoodrow,billm)
David Anderson <danderson@mozilla.com>
parents: 314234
diff changeset
   236
9a6f5fac405ffd3ab59163bf4c5ec866a1bb142b Recreate content compositor endpoints when the GPU process dies. (bug 1300936 part 3, r=mattwoodrow,billm)
David Anderson <danderson@mozilla.com>
parents: 314234
diff changeset
   237
  if (RefPtr<CompositorBridgeChild> old = sCompositorBridge.forget()) {
9a6f5fac405ffd3ab59163bf4c5ec866a1bb142b Recreate content compositor endpoints when the GPU process dies. (bug 1300936 part 3, r=mattwoodrow,billm)
David Anderson <danderson@mozilla.com>
parents: 314234
diff changeset
   238
    // Note that at this point, ActorDestroy may not have been called yet,
9a6f5fac405ffd3ab59163bf4c5ec866a1bb142b Recreate content compositor endpoints when the GPU process dies. (bug 1300936 part 3, r=mattwoodrow,billm)
David Anderson <danderson@mozilla.com>
parents: 314234
diff changeset
   239
    // meaning mCanSend is still true. In this case we will try to send a
9a6f5fac405ffd3ab59163bf4c5ec866a1bb142b Recreate content compositor endpoints when the GPU process dies. (bug 1300936 part 3, r=mattwoodrow,billm)
David Anderson <danderson@mozilla.com>
parents: 314234
diff changeset
   240
    // synchronous WillClose message to the parent, and will certainly get
9a6f5fac405ffd3ab59163bf4c5ec866a1bb142b Recreate content compositor endpoints when the GPU process dies. (bug 1300936 part 3, r=mattwoodrow,billm)
David Anderson <danderson@mozilla.com>
parents: 314234
diff changeset
   241
    // a false result and a MsgDropped processing error. This is okay.
9a6f5fac405ffd3ab59163bf4c5ec866a1bb142b Recreate content compositor endpoints when the GPU process dies. (bug 1300936 part 3, r=mattwoodrow,billm)
David Anderson <danderson@mozilla.com>
parents: 314234
diff changeset
   242
    old->Destroy();
9a6f5fac405ffd3ab59163bf4c5ec866a1bb142b Recreate content compositor endpoints when the GPU process dies. (bug 1300936 part 3, r=mattwoodrow,billm)
David Anderson <danderson@mozilla.com>
parents: 314234
diff changeset
   243
  }
9a6f5fac405ffd3ab59163bf4c5ec866a1bb142b Recreate content compositor endpoints when the GPU process dies. (bug 1300936 part 3, r=mattwoodrow,billm)
David Anderson <danderson@mozilla.com>
parents: 314234
diff changeset
   244
364056
32de56131efd1ebebf3dbeb6a48a95a25c165f02 Bug 1365927 - Part 5. Make PCompositorManager the manager protocol of PCompositorBridge. r=dvander
Andrew Osmond <aosmond@mozilla.com>
parents: 364054
diff changeset
   245
  mCanSend = true;
32de56131efd1ebebf3dbeb6a48a95a25c165f02 Bug 1365927 - Part 5. Make PCompositorManager the manager protocol of PCompositorBridge. r=dvander
Andrew Osmond <aosmond@mozilla.com>
parents: 364054
diff changeset
   246
  mIdNamespace = aNamespace;
477808
4357d695b8d5dd901788d922b73e89f16c45b2c9 Bug 1464032 Part 12: Add CanvasParent, CanvasChild and RecordedTextureData. r=mattwoodrow, jld
Bob Owen <bobowencode@gmail.com>
parents: 477556
diff changeset
   247
364056
32de56131efd1ebebf3dbeb6a48a95a25c165f02 Bug 1365927 - Part 5. Make PCompositorManager the manager protocol of PCompositorBridge. r=dvander
Andrew Osmond <aosmond@mozilla.com>
parents: 364054
diff changeset
   248
  sCompositorBridge = this;
305337
e6bd9062617fecf80cf520885e367776d02c9745 Add a remote implementation of CompositorSession. (bug 1282348 part 5, r=billm)
David Anderson <dvander@alliedmods.net>
parents: 305335
diff changeset
   249
}
e6bd9062617fecf80cf520885e367776d02c9745 Add a remote implementation of CompositorSession. (bug 1282348 part 5, r=billm)
David Anderson <dvander@alliedmods.net>
parents: 305335
diff changeset
   250
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   251
void CompositorBridgeChild::InitForWidget(uint64_t aProcessToken,
591057
1b49e7328ae43c6565d167f4c391430575097fd3 Bug 1727682 - Make WebRenderLayerManager not inherit LayerManager. r=jrmuizel
Matt Woodrow <mwoodrow@mozilla.com>
parents: 590507
diff changeset
   252
                                          WebRenderLayerManager* aLayerManager,
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   253
                                          uint32_t aNamespace) {
364056
32de56131efd1ebebf3dbeb6a48a95a25c165f02 Bug 1365927 - Part 5. Make PCompositorManager the manager protocol of PCompositorBridge. r=dvander
Andrew Osmond <aosmond@mozilla.com>
parents: 364054
diff changeset
   254
  MOZ_ASSERT(NS_IsMainThread());
32de56131efd1ebebf3dbeb6a48a95a25c165f02 Bug 1365927 - Part 5. Make PCompositorManager the manager protocol of PCompositorBridge. r=dvander
Andrew Osmond <aosmond@mozilla.com>
parents: 364054
diff changeset
   255
  MOZ_ASSERT(aProcessToken);
32de56131efd1ebebf3dbeb6a48a95a25c165f02 Bug 1365927 - Part 5. Make PCompositorManager the manager protocol of PCompositorBridge. r=dvander
Andrew Osmond <aosmond@mozilla.com>
parents: 364054
diff changeset
   256
  MOZ_ASSERT(aLayerManager);
32de56131efd1ebebf3dbeb6a48a95a25c165f02 Bug 1365927 - Part 5. Make PCompositorManager the manager protocol of PCompositorBridge. r=dvander
Andrew Osmond <aosmond@mozilla.com>
parents: 364054
diff changeset
   257
  MOZ_ASSERT(aNamespace);
32de56131efd1ebebf3dbeb6a48a95a25c165f02 Bug 1365927 - Part 5. Make PCompositorManager the manager protocol of PCompositorBridge. r=dvander
Andrew Osmond <aosmond@mozilla.com>
parents: 364054
diff changeset
   258
363766
bc0caf02d29423964f43f0bb83b2cb17ea33144d Backed out 6 changesets (bug 1365927) for build failures in ipc_message_utils.h a=backout CLOSED TREE
Wes Kocher <wkocher@mozilla.com>
parents: 363764
diff changeset
   259
  mCanSend = true;
364056
32de56131efd1ebebf3dbeb6a48a95a25c165f02 Bug 1365927 - Part 5. Make PCompositorManager the manager protocol of PCompositorBridge. r=dvander
Andrew Osmond <aosmond@mozilla.com>
parents: 364054
diff changeset
   260
  mProcessToken = aProcessToken;
32de56131efd1ebebf3dbeb6a48a95a25c165f02 Bug 1365927 - Part 5. Make PCompositorManager the manager protocol of PCompositorBridge. r=dvander
Andrew Osmond <aosmond@mozilla.com>
parents: 364054
diff changeset
   261
  mLayerManager = aLayerManager;
32de56131efd1ebebf3dbeb6a48a95a25c165f02 Bug 1365927 - Part 5. Make PCompositorManager the manager protocol of PCompositorBridge. r=dvander
Andrew Osmond <aosmond@mozilla.com>
parents: 364054
diff changeset
   262
  mIdNamespace = aNamespace;
321783
6cfa59e10e839247e5ee4fb363f52e15d4dae5e9 Ensure that CompositorBridgeChild retains an IPDL ref while owning a Transport. (bug 1314520, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 321768
diff changeset
   263
}
6cfa59e10e839247e5ee4fb363f52e15d4dae5e9 Ensure that CompositorBridgeChild retains an IPDL ref while owning a Transport. (bug 1314520, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 321768
diff changeset
   264
461889
5b5e6a9942777d6faee07db57fd6b14d465b3ab3 Bug 1523969 part 8 - Move method definition inline comments to new line in 'gfx/'. r=kats
Ryan Hunt <rhunt@eqrion.net>
parents: 458857
diff changeset
   265
/*static*/
5b5e6a9942777d6faee07db57fd6b14d465b3ab3 Bug 1523969 part 8 - Move method definition inline comments to new line in 'gfx/'. r=kats
Ryan Hunt <rhunt@eqrion.net>
parents: 458857
diff changeset
   266
CompositorBridgeChild* CompositorBridgeChild::Get() {
434843
36c326e6058bc0e23520f0275b91638231b8ddb3 Bug 1488498 - expand comment in CompositorBridgeChild::Get(); r=nical
Alex Gaynor <agaynor@mozilla.com>
parents: 432691
diff changeset
   267
  // This is only expected to be used in child processes. While the parent
36c326e6058bc0e23520f0275b91638231b8ddb3 Bug 1488498 - expand comment in CompositorBridgeChild::Get(); r=nical
Alex Gaynor <agaynor@mozilla.com>
parents: 432691
diff changeset
   268
  // process does have CompositorBridgeChild instances, it has _multiple_ (one
36c326e6058bc0e23520f0275b91638231b8ddb3 Bug 1488498 - expand comment in CompositorBridgeChild::Get(); r=nical
Alex Gaynor <agaynor@mozilla.com>
parents: 432691
diff changeset
   269
  // per window), and therefore there is no global singleton available.
251413
0ac19d3bf7bfef3b699c413a3350cb7de0292f7b Bug 1171931 - Refactor duplicated code using XRE_IsParent/ContentProcess. r=froydnj
Juan Gomez <atilag@gmail.com>
parents: 250595
diff changeset
   270
  MOZ_ASSERT(!XRE_IsParentProcess());
292235
577472ad5c385b2013bcf018cf7bc7e2c70eef8c Bug 1215265 - Shut PCompositorBridge down properly. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 290880
diff changeset
   271
  return sCompositorBridge;
577472ad5c385b2013bcf018cf7bc7e2c70eef8c Bug 1215265 - Shut PCompositorBridge down properly. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 290880
diff changeset
   272
}
577472ad5c385b2013bcf018cf7bc7e2c70eef8c Bug 1215265 - Shut PCompositorBridge down properly. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 290880
diff changeset
   273
577472ad5c385b2013bcf018cf7bc7e2c70eef8c Bug 1215265 - Shut PCompositorBridge down properly. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 290880
diff changeset
   274
// static
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   275
bool CompositorBridgeChild::ChildProcessHasCompositorBridge() {
292235
577472ad5c385b2013bcf018cf7bc7e2c70eef8c Bug 1215265 - Shut PCompositorBridge down properly. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 290880
diff changeset
   276
  return sCompositorBridge != nullptr;
99609
aeafc64692a5f965917ba07b1f7bf2d99413047e Bug 745148, part 8: Implement the little boilerplate-y bits and pieces needed for cross-process compositor. r=ajuma,BenWa
Chris Jones <jones.chris.g@gmail.com>
parents: 99607
diff changeset
   277
}
aeafc64692a5f965917ba07b1f7bf2d99413047e Bug 745148, part 8: Implement the little boilerplate-y bits and pieces needed for cross-process compositor. r=ajuma,BenWa
Chris Jones <jones.chris.g@gmail.com>
parents: 99607
diff changeset
   278
461889
5b5e6a9942777d6faee07db57fd6b14d465b3ab3 Bug 1523969 part 8 - Move method definition inline comments to new line in 'gfx/'. r=kats
Ryan Hunt <rhunt@eqrion.net>
parents: 458857
diff changeset
   279
/* static */
5b5e6a9942777d6faee07db57fd6b14d465b3ab3 Bug 1523969 part 8 - Move method definition inline comments to new line in 'gfx/'. r=kats
Ryan Hunt <rhunt@eqrion.net>
parents: 458857
diff changeset
   280
bool CompositorBridgeChild::CompositorIsInGPUProcess() {
324706
28e269b5ab120e15b7cf22f082befb1ed00cd5d5 Clean up and relax some assertions in SyncObjectD3D11.cpp. (bug 1319557, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 324439
diff changeset
   281
  MOZ_ASSERT(NS_IsMainThread());
28e269b5ab120e15b7cf22f082befb1ed00cd5d5 Clean up and relax some assertions in SyncObjectD3D11.cpp. (bug 1319557, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 324439
diff changeset
   282
28e269b5ab120e15b7cf22f082befb1ed00cd5d5 Clean up and relax some assertions in SyncObjectD3D11.cpp. (bug 1319557, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 324439
diff changeset
   283
  if (XRE_IsParentProcess()) {
28e269b5ab120e15b7cf22f082befb1ed00cd5d5 Clean up and relax some assertions in SyncObjectD3D11.cpp. (bug 1319557, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 324439
diff changeset
   284
    return !!GPUProcessManager::Get()->GetGPUChild();
28e269b5ab120e15b7cf22f082befb1ed00cd5d5 Clean up and relax some assertions in SyncObjectD3D11.cpp. (bug 1319557, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 324439
diff changeset
   285
  }
28e269b5ab120e15b7cf22f082befb1ed00cd5d5 Clean up and relax some assertions in SyncObjectD3D11.cpp. (bug 1319557, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 324439
diff changeset
   286
28e269b5ab120e15b7cf22f082befb1ed00cd5d5 Clean up and relax some assertions in SyncObjectD3D11.cpp. (bug 1319557, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 324439
diff changeset
   287
  MOZ_ASSERT(XRE_IsContentProcess());
28e269b5ab120e15b7cf22f082befb1ed00cd5d5 Clean up and relax some assertions in SyncObjectD3D11.cpp. (bug 1319557, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 324439
diff changeset
   288
  CompositorBridgeChild* bridge = CompositorBridgeChild::Get();
28e269b5ab120e15b7cf22f082befb1ed00cd5d5 Clean up and relax some assertions in SyncObjectD3D11.cpp. (bug 1319557, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 324439
diff changeset
   289
  if (!bridge) {
28e269b5ab120e15b7cf22f082befb1ed00cd5d5 Clean up and relax some assertions in SyncObjectD3D11.cpp. (bug 1319557, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 324439
diff changeset
   290
    return false;
28e269b5ab120e15b7cf22f082befb1ed00cd5d5 Clean up and relax some assertions in SyncObjectD3D11.cpp. (bug 1319557, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 324439
diff changeset
   291
  }
28e269b5ab120e15b7cf22f082befb1ed00cd5d5 Clean up and relax some assertions in SyncObjectD3D11.cpp. (bug 1319557, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 324439
diff changeset
   292
28e269b5ab120e15b7cf22f082befb1ed00cd5d5 Clean up and relax some assertions in SyncObjectD3D11.cpp. (bug 1319557, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 324439
diff changeset
   293
  return bridge->OtherPid() != dom::ContentChild::GetSingleton()->OtherPid();
28e269b5ab120e15b7cf22f082befb1ed00cd5d5 Clean up and relax some assertions in SyncObjectD3D11.cpp. (bug 1319557, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 324439
diff changeset
   294
}
28e269b5ab120e15b7cf22f082befb1ed00cd5d5 Clean up and relax some assertions in SyncObjectD3D11.cpp. (bug 1319557, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 324439
diff changeset
   295
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   296
mozilla::ipc::IPCResult CompositorBridgeChild::RecvInvalidateLayers(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   297
    const LayersId& aLayersId) {
180862
58879e37779b71aeaf17352cb8407eb179eed858 Bug 999584: Do not try to invalidate a null layermanager. r=nical
Bas Schouten <bschouten@mozilla.com>
parents: 178416
diff changeset
   298
  if (mLayerManager) {
409886
5d9f32557d7740c7c30f7bc6057c4de0c294d828 Bug 1448490 - Make the layers id a struct instead of a uint64_t. r=mattwoodrow
Kartikaya Gupta <kgupta@mozilla.com>
parents: 408652
diff changeset
   299
    MOZ_ASSERT(!aLayersId.IsValid());
5d9f32557d7740c7c30f7bc6057c4de0c294d828 Bug 1448490 - Make the layers id a struct instead of a uint64_t. r=mattwoodrow
Kartikaya Gupta <kgupta@mozilla.com>
parents: 408652
diff changeset
   300
  } else if (aLayersId.IsValid()) {
470938
9813ce146bc725dd83e8ff6f41bfc36dd17d935b Bug 1534395 - Rename TabChild to BrowserChild. r=nika
Ryan Hunt <rhunt@eqrion.net>
parents: 470936
diff changeset
   301
    if (dom::BrowserChild* child = dom::BrowserChild::GetFrom(aLayersId)) {
286055
6fcea9ec83505069544ad8671b468dff7bd87aea Propagate D3D9 device resets to remote layers. (bug 1245765 part 2, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 284750
diff changeset
   302
      child->InvalidateLayers();
6fcea9ec83505069544ad8671b468dff7bd87aea Propagate D3D9 device resets to remote layers. (bug 1245765 part 2, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 284750
diff changeset
   303
    }
180862
58879e37779b71aeaf17352cb8407eb179eed858 Bug 999584: Do not try to invalidate a null layermanager. r=nical
Bas Schouten <bschouten@mozilla.com>
parents: 178416
diff changeset
   304
  }
322595
39ac4382a2c019178604b90acd816753fe142908 Bug 1314254 - Add mozilla::ipc::IPCResult type and convert IPDL handlers to use new return type. r=billm
Kan-Ru Chen <kanru@kanru.info>
parents: 322481
diff changeset
   305
  return IPC_OK();
156966
bbd6b4411f7c6a047e15c6ed0cedba62fd193bb1 Bug 900248. Rebuild the d3d9 device. r=Bas
Nicholas Cameron <ncameron@mozilla.com>
parents: 150377
diff changeset
   306
}
bbd6b4411f7c6a047e15c6ed0cedba62fd193bb1 Bug 900248. Rebuild the d3d9 device. r=Bas
Nicholas Cameron <ncameron@mozilla.com>
parents: 150377
diff changeset
   307
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   308
mozilla::ipc::IPCResult CompositorBridgeChild::RecvDidComposite(
579195
c26142ed63a90f324ffe350c352b92b6591023f5 Bug 1708325 - Change frame throttling code in nsRefreshDriver to explicitly track the pending frames. r=mstange
Matt Woodrow <mwoodrow@mozilla.com>
parents: 579194
diff changeset
   309
    const LayersId& aId, const nsTArray<TransactionId>& aTransactionIds,
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   310
    const TimeStamp& aCompositeStart, const TimeStamp& aCompositeEnd) {
387789
8199078921c6b4c0ee4c984100d33750dfe8e144 Bug 1387799 - Keep an extra reference. r=jrmuizel
Milan Sreckovic <milan@mozilla.com>
parents: 386167
diff changeset
   311
  // Hold a reference to keep texture pools alive.  See bug 1387799
528126
ae0a12a3935f77346ce4d04aa9092052dc2f6d05 Bug 1626570 - Improve handling of copying arrays in gfx/layers/. r=botond
Simon Giesecke <sgiesecke@mozilla.com>
parents: 527351
diff changeset
   312
  const auto texturePools = mTexturePools.Clone();
387789
8199078921c6b4c0ee4c984100d33750dfe8e144 Bug 1387799 - Keep an extra reference. r=jrmuizel
Milan Sreckovic <milan@mozilla.com>
parents: 386167
diff changeset
   313
579195
c26142ed63a90f324ffe350c352b92b6591023f5 Bug 1708325 - Change frame throttling code in nsRefreshDriver to explicitly track the pending frames. r=mstange
Matt Woodrow <mwoodrow@mozilla.com>
parents: 579194
diff changeset
   314
  for (const auto& id : aTransactionIds) {
c26142ed63a90f324ffe350c352b92b6591023f5 Bug 1708325 - Change frame throttling code in nsRefreshDriver to explicitly track the pending frames. r=mstange
Matt Woodrow <mwoodrow@mozilla.com>
parents: 579194
diff changeset
   315
    if (mLayerManager) {
c26142ed63a90f324ffe350c352b92b6591023f5 Bug 1708325 - Change frame throttling code in nsRefreshDriver to explicitly track the pending frames. r=mstange
Matt Woodrow <mwoodrow@mozilla.com>
parents: 579194
diff changeset
   316
      MOZ_ASSERT(!aId.IsValid());
c26142ed63a90f324ffe350c352b92b6591023f5 Bug 1708325 - Change frame throttling code in nsRefreshDriver to explicitly track the pending frames. r=mstange
Matt Woodrow <mwoodrow@mozilla.com>
parents: 579194
diff changeset
   317
      MOZ_ASSERT(mLayerManager->GetBackendType() ==
c26142ed63a90f324ffe350c352b92b6591023f5 Bug 1708325 - Change frame throttling code in nsRefreshDriver to explicitly track the pending frames. r=mstange
Matt Woodrow <mwoodrow@mozilla.com>
parents: 579194
diff changeset
   318
                     LayersBackend::LAYERS_CLIENT ||
c26142ed63a90f324ffe350c352b92b6591023f5 Bug 1708325 - Change frame throttling code in nsRefreshDriver to explicitly track the pending frames. r=mstange
Matt Woodrow <mwoodrow@mozilla.com>
parents: 579194
diff changeset
   319
                 mLayerManager->GetBackendType() == LayersBackend::LAYERS_WR);
c26142ed63a90f324ffe350c352b92b6591023f5 Bug 1708325 - Change frame throttling code in nsRefreshDriver to explicitly track the pending frames. r=mstange
Matt Woodrow <mwoodrow@mozilla.com>
parents: 579194
diff changeset
   320
      // Hold a reference to keep LayerManager alive. See Bug 1242668.
591057
1b49e7328ae43c6565d167f4c391430575097fd3 Bug 1727682 - Make WebRenderLayerManager not inherit LayerManager. r=jrmuizel
Matt Woodrow <mwoodrow@mozilla.com>
parents: 590507
diff changeset
   321
      RefPtr<WebRenderLayerManager> m = mLayerManager;
579195
c26142ed63a90f324ffe350c352b92b6591023f5 Bug 1708325 - Change frame throttling code in nsRefreshDriver to explicitly track the pending frames. r=mstange
Matt Woodrow <mwoodrow@mozilla.com>
parents: 579194
diff changeset
   322
      m->DidComposite(id, aCompositeStart, aCompositeEnd);
c26142ed63a90f324ffe350c352b92b6591023f5 Bug 1708325 - Change frame throttling code in nsRefreshDriver to explicitly track the pending frames. r=mstange
Matt Woodrow <mwoodrow@mozilla.com>
parents: 579194
diff changeset
   323
    } else if (aId.IsValid()) {
c26142ed63a90f324ffe350c352b92b6591023f5 Bug 1708325 - Change frame throttling code in nsRefreshDriver to explicitly track the pending frames. r=mstange
Matt Woodrow <mwoodrow@mozilla.com>
parents: 579194
diff changeset
   324
      RefPtr<dom::BrowserChild> child = dom::BrowserChild::GetFrom(aId);
c26142ed63a90f324ffe350c352b92b6591023f5 Bug 1708325 - Change frame throttling code in nsRefreshDriver to explicitly track the pending frames. r=mstange
Matt Woodrow <mwoodrow@mozilla.com>
parents: 579194
diff changeset
   325
      if (child) {
c26142ed63a90f324ffe350c352b92b6591023f5 Bug 1708325 - Change frame throttling code in nsRefreshDriver to explicitly track the pending frames. r=mstange
Matt Woodrow <mwoodrow@mozilla.com>
parents: 579194
diff changeset
   326
        child->DidComposite(id, aCompositeStart, aCompositeEnd);
c26142ed63a90f324ffe350c352b92b6591023f5 Bug 1708325 - Change frame throttling code in nsRefreshDriver to explicitly track the pending frames. r=mstange
Matt Woodrow <mwoodrow@mozilla.com>
parents: 579194
diff changeset
   327
      }
178416
263f232855ad658b96452cb431db499ac2505fcb Bug 974197 - Fire MozAfterPaint after the compositor has composited the frame. r=roc
Matt Woodrow <mwoodrow@mozilla.com>
parents: 177846
diff changeset
   328
    }
263f232855ad658b96452cb431db499ac2505fcb Bug 974197 - Fire MozAfterPaint after the compositor has composited the frame. r=roc
Matt Woodrow <mwoodrow@mozilla.com>
parents: 177846
diff changeset
   329
  }
302048
ada00a4c36c5ba384e2fdc2c4bd94f20fe7c744c Bug 1176011 - Move TextureClientPool to CompositorBridgeChild r=nical
George Wright <george@mozilla.com>
parents: 301875
diff changeset
   330
387789
8199078921c6b4c0ee4c984100d33750dfe8e144 Bug 1387799 - Keep an extra reference. r=jrmuizel
Milan Sreckovic <milan@mozilla.com>
parents: 386167
diff changeset
   331
  for (size_t i = 0; i < texturePools.Length(); i++) {
8199078921c6b4c0ee4c984100d33750dfe8e144 Bug 1387799 - Keep an extra reference. r=jrmuizel
Milan Sreckovic <milan@mozilla.com>
parents: 386167
diff changeset
   332
    texturePools[i]->ReturnDeferredClients();
302048
ada00a4c36c5ba384e2fdc2c4bd94f20fe7c744c Bug 1176011 - Move TextureClientPool to CompositorBridgeChild r=nical
George Wright <george@mozilla.com>
parents: 301875
diff changeset
   333
  }
ada00a4c36c5ba384e2fdc2c4bd94f20fe7c744c Bug 1176011 - Move TextureClientPool to CompositorBridgeChild r=nical
George Wright <george@mozilla.com>
parents: 301875
diff changeset
   334
322595
39ac4382a2c019178604b90acd816753fe142908 Bug 1314254 - Add mozilla::ipc::IPCResult type and convert IPDL handlers to use new return type. r=billm
Kan-Ru Chen <kanru@kanru.info>
parents: 322481
diff changeset
   335
  return IPC_OK();
178416
263f232855ad658b96452cb431db499ac2505fcb Bug 974197 - Fire MozAfterPaint after the compositor has composited the frame. r=roc
Matt Woodrow <mwoodrow@mozilla.com>
parents: 177846
diff changeset
   336
}
263f232855ad658b96452cb431db499ac2505fcb Bug 974197 - Fire MozAfterPaint after the compositor has composited the frame. r=roc
Matt Woodrow <mwoodrow@mozilla.com>
parents: 177846
diff changeset
   337
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   338
mozilla::ipc::IPCResult CompositorBridgeChild::RecvNotifyFrameStats(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   339
    nsTArray<FrameStats>&& aFrameStats) {
447335
52a798ad6583b97fb3faf68f1849e7098d9ce4ae Bug 1507680 - Record detailed statistics about slow WebRender frames in about:support. r=jrmuizel
Matt Woodrow <mwoodrow@mozilla.com>
parents: 444295
diff changeset
   340
  gfxPlatform::GetPlatform()->NotifyFrameStats(std::move(aFrameStats));
52a798ad6583b97fb3faf68f1849e7098d9ce4ae Bug 1507680 - Record detailed statistics about slow WebRender frames in about:support. r=jrmuizel
Matt Woodrow <mwoodrow@mozilla.com>
parents: 444295
diff changeset
   341
  return IPC_OK();
52a798ad6583b97fb3faf68f1849e7098d9ce4ae Bug 1507680 - Record detailed statistics about slow WebRender frames in about:support. r=jrmuizel
Matt Woodrow <mwoodrow@mozilla.com>
parents: 444295
diff changeset
   342
}
387789
8199078921c6b4c0ee4c984100d33750dfe8e144 Bug 1387799 - Keep an extra reference. r=jrmuizel
Milan Sreckovic <milan@mozilla.com>
parents: 386167
diff changeset
   343
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   344
void CompositorBridgeChild::ActorDestroy(ActorDestroyReason aWhy) {
287171
722fb8b4213bca2b78d8f50e0e397f7115022c2a Bug 1250418 - Remove the assertion check of mCanSend in CompositorChild::ActorDestroy, r=nical
peter chang <pchang@mozilla.com>
parents: 286060
diff changeset
   345
  if (aWhy == AbnormalShutdown) {
722fb8b4213bca2b78d8f50e0e397f7115022c2a Bug 1250418 - Remove the assertion check of mCanSend in CompositorChild::ActorDestroy, r=nical
peter chang <pchang@mozilla.com>
parents: 286060
diff changeset
   346
    // If the parent side runs into a problem then the actor will be destroyed.
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   347
    // There is nothing we can do in the child side, here sets mCanSend as
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   348
    // false.
292235
577472ad5c385b2013bcf018cf7bc7e2c70eef8c Bug 1215265 - Shut PCompositorBridge down properly. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 290880
diff changeset
   349
    gfxCriticalNote << "Receive IPC close with reason=AbnormalShutdown";
128662
7fb4bd994bdf394e86194eb3060582da28b57c29 Bug 860892 - IPC failure handling in CompositorChild and ShadowLayers. r=jmuizelaar
Sotaro Ikeda <sikeda@mozilla.com>
parents: 128567
diff changeset
   350
  }
305337
e6bd9062617fecf80cf520885e367776d02c9745 Add a remote implementation of CompositorSession. (bug 1282348 part 5, r=billm)
David Anderson <dvander@alliedmods.net>
parents: 305335
diff changeset
   351
367549
26efbaef8509fb11be96b34a1c2734d3b0029391 Implement asynchronous OMTP behind a pref. (bug 1377060 part 2, r=mchang)
David Anderson <dvander@alliedmods.net>
parents: 367190
diff changeset
   352
  {
26efbaef8509fb11be96b34a1c2734d3b0029391 Implement asynchronous OMTP behind a pref. (bug 1377060 part 2, r=mchang)
David Anderson <dvander@alliedmods.net>
parents: 367190
diff changeset
   353
    // We take the lock to update these fields, since they are read from the
26efbaef8509fb11be96b34a1c2734d3b0029391 Implement asynchronous OMTP behind a pref. (bug 1377060 part 2, r=mchang)
David Anderson <dvander@alliedmods.net>
parents: 367190
diff changeset
   354
    // paint thread. We don't need the lock to init them, since that happens
26efbaef8509fb11be96b34a1c2734d3b0029391 Implement asynchronous OMTP behind a pref. (bug 1377060 part 2, r=mchang)
David Anderson <dvander@alliedmods.net>
parents: 367190
diff changeset
   355
    // on the main thread before the paint thread can ever grab a reference
26efbaef8509fb11be96b34a1c2734d3b0029391 Implement asynchronous OMTP behind a pref. (bug 1377060 part 2, r=mchang)
David Anderson <dvander@alliedmods.net>
parents: 367190
diff changeset
   356
    // to the CompositorBridge object.
26efbaef8509fb11be96b34a1c2734d3b0029391 Implement asynchronous OMTP behind a pref. (bug 1377060 part 2, r=mchang)
David Anderson <dvander@alliedmods.net>
parents: 367190
diff changeset
   357
    //
26efbaef8509fb11be96b34a1c2734d3b0029391 Implement asynchronous OMTP behind a pref. (bug 1377060 part 2, r=mchang)
David Anderson <dvander@alliedmods.net>
parents: 367190
diff changeset
   358
    // Note that it is useful to take this lock for one other reason: It also
26efbaef8509fb11be96b34a1c2734d3b0029391 Implement asynchronous OMTP behind a pref. (bug 1377060 part 2, r=mchang)
David Anderson <dvander@alliedmods.net>
parents: 367190
diff changeset
   359
    // tells us whether GetIPCChannel is safe to call. If we access the IPC
26efbaef8509fb11be96b34a1c2734d3b0029391 Implement asynchronous OMTP behind a pref. (bug 1377060 part 2, r=mchang)
David Anderson <dvander@alliedmods.net>
parents: 367190
diff changeset
   360
    // channel within this lock, when mCanSend is true, then we know it has not
26efbaef8509fb11be96b34a1c2734d3b0029391 Implement asynchronous OMTP behind a pref. (bug 1377060 part 2, r=mchang)
David Anderson <dvander@alliedmods.net>
parents: 367190
diff changeset
   361
    // been zapped by IPDL.
26efbaef8509fb11be96b34a1c2734d3b0029391 Implement asynchronous OMTP behind a pref. (bug 1377060 part 2, r=mchang)
David Anderson <dvander@alliedmods.net>
parents: 367190
diff changeset
   362
    MonitorAutoLock lock(mPaintLock);
26efbaef8509fb11be96b34a1c2734d3b0029391 Implement asynchronous OMTP behind a pref. (bug 1377060 part 2, r=mchang)
David Anderson <dvander@alliedmods.net>
parents: 367190
diff changeset
   363
    mCanSend = false;
26efbaef8509fb11be96b34a1c2734d3b0029391 Implement asynchronous OMTP behind a pref. (bug 1377060 part 2, r=mchang)
David Anderson <dvander@alliedmods.net>
parents: 367190
diff changeset
   364
    mActorDestroyed = true;
26efbaef8509fb11be96b34a1c2734d3b0029391 Implement asynchronous OMTP behind a pref. (bug 1377060 part 2, r=mchang)
David Anderson <dvander@alliedmods.net>
parents: 367190
diff changeset
   365
  }
321783
6cfa59e10e839247e5ee4fb363f52e15d4dae5e9 Ensure that CompositorBridgeChild retains an IPDL ref while owning a Transport. (bug 1314520, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 321768
diff changeset
   366
305337
e6bd9062617fecf80cf520885e367776d02c9745 Add a remote implementation of CompositorSession. (bug 1282348 part 5, r=billm)
David Anderson <dvander@alliedmods.net>
parents: 305335
diff changeset
   367
  if (mProcessToken && XRE_IsParentProcess()) {
e6bd9062617fecf80cf520885e367776d02c9745 Add a remote implementation of CompositorSession. (bug 1282348 part 5, r=billm)
David Anderson <dvander@alliedmods.net>
parents: 305335
diff changeset
   368
    GPUProcessManager::Get()->NotifyRemoteActorDestroyed(mProcessToken);
e6bd9062617fecf80cf520885e367776d02c9745 Add a remote implementation of CompositorSession. (bug 1282348 part 5, r=billm)
David Anderson <dvander@alliedmods.net>
parents: 305335
diff changeset
   369
  }
99609
aeafc64692a5f965917ba07b1f7bf2d99413047e Bug 745148, part 8: Implement the little boilerplate-y bits and pieces needed for cross-process compositor. r=ajuma,BenWa
Chris Jones <jones.chris.g@gmail.com>
parents: 99607
diff changeset
   370
}
aeafc64692a5f965917ba07b1f7bf2d99413047e Bug 745148, part 8: Implement the little boilerplate-y bits and pieces needed for cross-process compositor. r=ajuma,BenWa
Chris Jones <jones.chris.g@gmail.com>
parents: 99607
diff changeset
   371
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   372
bool CompositorBridgeChild::SendWillClose() {
313764
178a264a42febf49062cf19eebcdb046378462ce Bug 1297565 - Fine tune and update our assertions based on old assumptions which may no longer be valid with a GPU process r=dvander
George Wright <george@mozilla.com>
parents: 313492
diff changeset
   373
  MOZ_RELEASE_ASSERT(mCanSend);
292235
577472ad5c385b2013bcf018cf7bc7e2c70eef8c Bug 1215265 - Shut PCompositorBridge down properly. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 290880
diff changeset
   374
  return PCompositorBridgeChild::SendWillClose();
232068
1c85afc8c1894972fbca0c9043279ecbdaad2509 Bug 1125848 - Prevent PCompositorChild messages to be sent after the actor started shutting down. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 232034
diff changeset
   375
}
1c85afc8c1894972fbca0c9043279ecbdaad2509 Bug 1125848 - Prevent PCompositorChild messages to be sent after the actor started shutting down. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 232034
diff changeset
   376
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   377
bool CompositorBridgeChild::SendPause() {
232068
1c85afc8c1894972fbca0c9043279ecbdaad2509 Bug 1125848 - Prevent PCompositorChild messages to be sent after the actor started shutting down. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 232034
diff changeset
   378
  if (!mCanSend) {
313764
178a264a42febf49062cf19eebcdb046378462ce Bug 1297565 - Fine tune and update our assertions based on old assumptions which may no longer be valid with a GPU process r=dvander
George Wright <george@mozilla.com>
parents: 313492
diff changeset
   379
    return false;
232068
1c85afc8c1894972fbca0c9043279ecbdaad2509 Bug 1125848 - Prevent PCompositorChild messages to be sent after the actor started shutting down. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 232034
diff changeset
   380
  }
289894
92ece637da91a904708bbd3165950fb47e235f1e Rename PCompositor to PCompositorBridge. (bug 1258479 part 1, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 289444
diff changeset
   381
  return PCompositorBridgeChild::SendPause();
232068
1c85afc8c1894972fbca0c9043279ecbdaad2509 Bug 1125848 - Prevent PCompositorChild messages to be sent after the actor started shutting down. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 232034
diff changeset
   382
}
1c85afc8c1894972fbca0c9043279ecbdaad2509 Bug 1125848 - Prevent PCompositorChild messages to be sent after the actor started shutting down. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 232034
diff changeset
   383
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   384
bool CompositorBridgeChild::SendResume() {
232068
1c85afc8c1894972fbca0c9043279ecbdaad2509 Bug 1125848 - Prevent PCompositorChild messages to be sent after the actor started shutting down. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 232034
diff changeset
   385
  if (!mCanSend) {
313764
178a264a42febf49062cf19eebcdb046378462ce Bug 1297565 - Fine tune and update our assertions based on old assumptions which may no longer be valid with a GPU process r=dvander
George Wright <george@mozilla.com>
parents: 313492
diff changeset
   386
    return false;
232068
1c85afc8c1894972fbca0c9043279ecbdaad2509 Bug 1125848 - Prevent PCompositorChild messages to be sent after the actor started shutting down. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 232034
diff changeset
   387
  }
289894
92ece637da91a904708bbd3165950fb47e235f1e Rename PCompositor to PCompositorBridge. (bug 1258479 part 1, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 289444
diff changeset
   388
  return PCompositorBridgeChild::SendResume();
232068
1c85afc8c1894972fbca0c9043279ecbdaad2509 Bug 1125848 - Prevent PCompositorChild messages to be sent after the actor started shutting down. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 232034
diff changeset
   389
}
1c85afc8c1894972fbca0c9043279ecbdaad2509 Bug 1125848 - Prevent PCompositorChild messages to be sent after the actor started shutting down. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 232034
diff changeset
   390
482872
840b6bd9e818d5982c4560c9c712abef3a5d0cfe Bug 1565785 - Skip WR rendering until window becomes ready to draw on Wayland r=nical
sotaro <sotaro.ikeda.g@gmail.com>
parents: 482867
diff changeset
   391
bool CompositorBridgeChild::SendResumeAsync() {
840b6bd9e818d5982c4560c9c712abef3a5d0cfe Bug 1565785 - Skip WR rendering until window becomes ready to draw on Wayland r=nical
sotaro <sotaro.ikeda.g@gmail.com>
parents: 482867
diff changeset
   392
  if (!mCanSend) {
840b6bd9e818d5982c4560c9c712abef3a5d0cfe Bug 1565785 - Skip WR rendering until window becomes ready to draw on Wayland r=nical
sotaro <sotaro.ikeda.g@gmail.com>
parents: 482867
diff changeset
   393
    return false;
840b6bd9e818d5982c4560c9c712abef3a5d0cfe Bug 1565785 - Skip WR rendering until window becomes ready to draw on Wayland r=nical
sotaro <sotaro.ikeda.g@gmail.com>
parents: 482867
diff changeset
   394
  }
840b6bd9e818d5982c4560c9c712abef3a5d0cfe Bug 1565785 - Skip WR rendering until window becomes ready to draw on Wayland r=nical
sotaro <sotaro.ikeda.g@gmail.com>
parents: 482867
diff changeset
   395
  return PCompositorBridgeChild::SendResumeAsync();
840b6bd9e818d5982c4560c9c712abef3a5d0cfe Bug 1565785 - Skip WR rendering until window becomes ready to draw on Wayland r=nical
sotaro <sotaro.ikeda.g@gmail.com>
parents: 482867
diff changeset
   396
}
840b6bd9e818d5982c4560c9c712abef3a5d0cfe Bug 1565785 - Skip WR rendering until window becomes ready to draw on Wayland r=nical
sotaro <sotaro.ikeda.g@gmail.com>
parents: 482867
diff changeset
   397
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   398
bool CompositorBridgeChild::SendNotifyChildCreated(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   399
    const LayersId& id, CompositorOptions* aOptions) {
232068
1c85afc8c1894972fbca0c9043279ecbdaad2509 Bug 1125848 - Prevent PCompositorChild messages to be sent after the actor started shutting down. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 232034
diff changeset
   400
  if (!mCanSend) {
313764
178a264a42febf49062cf19eebcdb046378462ce Bug 1297565 - Fine tune and update our assertions based on old assumptions which may no longer be valid with a GPU process r=dvander
George Wright <george@mozilla.com>
parents: 313492
diff changeset
   401
    return false;
232068
1c85afc8c1894972fbca0c9043279ecbdaad2509 Bug 1125848 - Prevent PCompositorChild messages to be sent after the actor started shutting down. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 232034
diff changeset
   402
  }
352068
e3ddc4081b947910affb3c7fb6207e0adfe6a251 Bug 1350638 - Remove sync GetCompositorOptions call in TabChild::InitRenderingState. r=dvander
Kartikaya Gupta <kgupta@mozilla.com>
parents: 349802
diff changeset
   403
  return PCompositorBridgeChild::SendNotifyChildCreated(id, aOptions);
232068
1c85afc8c1894972fbca0c9043279ecbdaad2509 Bug 1125848 - Prevent PCompositorChild messages to be sent after the actor started shutting down. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 232034
diff changeset
   404
}
1c85afc8c1894972fbca0c9043279ecbdaad2509 Bug 1125848 - Prevent PCompositorChild messages to be sent after the actor started shutting down. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 232034
diff changeset
   405
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   406
bool CompositorBridgeChild::SendAdoptChild(const LayersId& id) {
232068
1c85afc8c1894972fbca0c9043279ecbdaad2509 Bug 1125848 - Prevent PCompositorChild messages to be sent after the actor started shutting down. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 232034
diff changeset
   407
  if (!mCanSend) {
313764
178a264a42febf49062cf19eebcdb046378462ce Bug 1297565 - Fine tune and update our assertions based on old assumptions which may no longer be valid with a GPU process r=dvander
George Wright <george@mozilla.com>
parents: 313492
diff changeset
   408
    return false;
232068
1c85afc8c1894972fbca0c9043279ecbdaad2509 Bug 1125848 - Prevent PCompositorChild messages to be sent after the actor started shutting down. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 232034
diff changeset
   409
  }
289894
92ece637da91a904708bbd3165950fb47e235f1e Rename PCompositor to PCompositorBridge. (bug 1258479 part 1, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 289444
diff changeset
   410
  return PCompositorBridgeChild::SendAdoptChild(id);
232068
1c85afc8c1894972fbca0c9043279ecbdaad2509 Bug 1125848 - Prevent PCompositorChild messages to be sent after the actor started shutting down. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 232034
diff changeset
   411
}
1c85afc8c1894972fbca0c9043279ecbdaad2509 Bug 1125848 - Prevent PCompositorChild messages to be sent after the actor started shutting down. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 232034
diff changeset
   412
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   413
bool CompositorBridgeChild::SendMakeSnapshot(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   414
    const SurfaceDescriptor& inSnapshot, const gfx::IntRect& dirtyRect) {
232068
1c85afc8c1894972fbca0c9043279ecbdaad2509 Bug 1125848 - Prevent PCompositorChild messages to be sent after the actor started shutting down. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 232034
diff changeset
   415
  if (!mCanSend) {
313764
178a264a42febf49062cf19eebcdb046378462ce Bug 1297565 - Fine tune and update our assertions based on old assumptions which may no longer be valid with a GPU process r=dvander
George Wright <george@mozilla.com>
parents: 313492
diff changeset
   416
    return false;
232068
1c85afc8c1894972fbca0c9043279ecbdaad2509 Bug 1125848 - Prevent PCompositorChild messages to be sent after the actor started shutting down. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 232034
diff changeset
   417
  }
289894
92ece637da91a904708bbd3165950fb47e235f1e Rename PCompositor to PCompositorBridge. (bug 1258479 part 1, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 289444
diff changeset
   418
  return PCompositorBridgeChild::SendMakeSnapshot(inSnapshot, dirtyRect);
232068
1c85afc8c1894972fbca0c9043279ecbdaad2509 Bug 1125848 - Prevent PCompositorChild messages to be sent after the actor started shutting down. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 232034
diff changeset
   419
}
1c85afc8c1894972fbca0c9043279ecbdaad2509 Bug 1125848 - Prevent PCompositorChild messages to be sent after the actor started shutting down. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 232034
diff changeset
   420
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   421
bool CompositorBridgeChild::SendFlushRendering() {
232068
1c85afc8c1894972fbca0c9043279ecbdaad2509 Bug 1125848 - Prevent PCompositorChild messages to be sent after the actor started shutting down. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 232034
diff changeset
   422
  if (!mCanSend) {
313764
178a264a42febf49062cf19eebcdb046378462ce Bug 1297565 - Fine tune and update our assertions based on old assumptions which may no longer be valid with a GPU process r=dvander
George Wright <george@mozilla.com>
parents: 313492
diff changeset
   423
    return false;
232068
1c85afc8c1894972fbca0c9043279ecbdaad2509 Bug 1125848 - Prevent PCompositorChild messages to be sent after the actor started shutting down. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 232034
diff changeset
   424
  }
289894
92ece637da91a904708bbd3165950fb47e235f1e Rename PCompositor to PCompositorBridge. (bug 1258479 part 1, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 289444
diff changeset
   425
  return PCompositorBridgeChild::SendFlushRendering();
232068
1c85afc8c1894972fbca0c9043279ecbdaad2509 Bug 1125848 - Prevent PCompositorChild messages to be sent after the actor started shutting down. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 232034
diff changeset
   426
}
1c85afc8c1894972fbca0c9043279ecbdaad2509 Bug 1125848 - Prevent PCompositorChild messages to be sent after the actor started shutting down. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 232034
diff changeset
   427
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   428
bool CompositorBridgeChild::SendStartFrameTimeRecording(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   429
    const int32_t& bufferSize, uint32_t* startIndex) {
232068
1c85afc8c1894972fbca0c9043279ecbdaad2509 Bug 1125848 - Prevent PCompositorChild messages to be sent after the actor started shutting down. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 232034
diff changeset
   430
  if (!mCanSend) {
313764
178a264a42febf49062cf19eebcdb046378462ce Bug 1297565 - Fine tune and update our assertions based on old assumptions which may no longer be valid with a GPU process r=dvander
George Wright <george@mozilla.com>
parents: 313492
diff changeset
   431
    return false;
232068
1c85afc8c1894972fbca0c9043279ecbdaad2509 Bug 1125848 - Prevent PCompositorChild messages to be sent after the actor started shutting down. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 232034
diff changeset
   432
  }
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   433
  return PCompositorBridgeChild::SendStartFrameTimeRecording(bufferSize,
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   434
                                                             startIndex);
232068
1c85afc8c1894972fbca0c9043279ecbdaad2509 Bug 1125848 - Prevent PCompositorChild messages to be sent after the actor started shutting down. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 232034
diff changeset
   435
}
1c85afc8c1894972fbca0c9043279ecbdaad2509 Bug 1125848 - Prevent PCompositorChild messages to be sent after the actor started shutting down. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 232034
diff changeset
   436
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   437
bool CompositorBridgeChild::SendStopFrameTimeRecording(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   438
    const uint32_t& startIndex, nsTArray<float>* intervals) {
232068
1c85afc8c1894972fbca0c9043279ecbdaad2509 Bug 1125848 - Prevent PCompositorChild messages to be sent after the actor started shutting down. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 232034
diff changeset
   439
  if (!mCanSend) {
313764
178a264a42febf49062cf19eebcdb046378462ce Bug 1297565 - Fine tune and update our assertions based on old assumptions which may no longer be valid with a GPU process r=dvander
George Wright <george@mozilla.com>
parents: 313492
diff changeset
   440
    return false;
232068
1c85afc8c1894972fbca0c9043279ecbdaad2509 Bug 1125848 - Prevent PCompositorChild messages to be sent after the actor started shutting down. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 232034
diff changeset
   441
  }
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   442
  return PCompositorBridgeChild::SendStopFrameTimeRecording(startIndex,
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   443
                                                            intervals);
232068
1c85afc8c1894972fbca0c9043279ecbdaad2509 Bug 1125848 - Prevent PCompositorChild messages to be sent after the actor started shutting down. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 232034
diff changeset
   444
}
1c85afc8c1894972fbca0c9043279ecbdaad2509 Bug 1125848 - Prevent PCompositorChild messages to be sent after the actor started shutting down. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 232034
diff changeset
   445
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   446
bool CompositorBridgeChild::SendNotifyRegionInvalidated(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   447
    const nsIntRegion& region) {
232068
1c85afc8c1894972fbca0c9043279ecbdaad2509 Bug 1125848 - Prevent PCompositorChild messages to be sent after the actor started shutting down. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 232034
diff changeset
   448
  if (!mCanSend) {
313764
178a264a42febf49062cf19eebcdb046378462ce Bug 1297565 - Fine tune and update our assertions based on old assumptions which may no longer be valid with a GPU process r=dvander
George Wright <george@mozilla.com>
parents: 313492
diff changeset
   449
    return false;
232068
1c85afc8c1894972fbca0c9043279ecbdaad2509 Bug 1125848 - Prevent PCompositorChild messages to be sent after the actor started shutting down. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 232034
diff changeset
   450
  }
289894
92ece637da91a904708bbd3165950fb47e235f1e Rename PCompositor to PCompositorBridge. (bug 1258479 part 1, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 289444
diff changeset
   451
  return PCompositorBridgeChild::SendNotifyRegionInvalidated(region);
232068
1c85afc8c1894972fbca0c9043279ecbdaad2509 Bug 1125848 - Prevent PCompositorChild messages to be sent after the actor started shutting down. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 232034
diff changeset
   452
}
1c85afc8c1894972fbca0c9043279ecbdaad2509 Bug 1125848 - Prevent PCompositorChild messages to be sent after the actor started shutting down. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 232034
diff changeset
   453
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   454
PTextureChild* CompositorBridgeChild::AllocPTextureChild(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   455
    const SurfaceDescriptor&, const ReadLockDescriptor&, const LayersBackend&,
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   456
    const TextureFlags&, const LayersId&, const uint64_t& aSerial,
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   457
    const wr::MaybeExternalImageId& aExternalImageId) {
297399
dc0186974f99dd83f39c69b8ba1635fee83f8c55 Bug 1264764 - Move PTexture under PCompositorBridge r=nical,dvander
George Wright <george@mozilla.com>
parents: 295208
diff changeset
   458
  return TextureClient::CreateIPDLActor();
dc0186974f99dd83f39c69b8ba1635fee83f8c55 Bug 1264764 - Move PTexture under PCompositorBridge r=nical,dvander
George Wright <george@mozilla.com>
parents: 295208
diff changeset
   459
}
dc0186974f99dd83f39c69b8ba1635fee83f8c55 Bug 1264764 - Move PTexture under PCompositorBridge r=nical,dvander
George Wright <george@mozilla.com>
parents: 295208
diff changeset
   460
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   461
bool CompositorBridgeChild::DeallocPTextureChild(PTextureChild* actor) {
297399
dc0186974f99dd83f39c69b8ba1635fee83f8c55 Bug 1264764 - Move PTexture under PCompositorBridge r=nical,dvander
George Wright <george@mozilla.com>
parents: 295208
diff changeset
   462
  return TextureClient::DestroyIPDLActor(actor);
dc0186974f99dd83f39c69b8ba1635fee83f8c55 Bug 1264764 - Move PTexture under PCompositorBridge r=nical,dvander
George Wright <george@mozilla.com>
parents: 295208
diff changeset
   463
}
dc0186974f99dd83f39c69b8ba1635fee83f8c55 Bug 1264764 - Move PTexture under PCompositorBridge r=nical,dvander
George Wright <george@mozilla.com>
parents: 295208
diff changeset
   464
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   465
mozilla::ipc::IPCResult CompositorBridgeChild::RecvParentAsyncMessages(
482208
f41647d7c6d440d0fcb0a2b8c4b0805eb9cd51fc Bug 1289211 - Rename InfallibleTArray to nsTArray in gfx/layers/ r=mattwoodrow
Barret Rennie <barret@brennie.ca>
parents: 480648
diff changeset
   466
    nsTArray<AsyncParentMessageData>&& aMessages) {
301875
5748a69df90b4f22108b67c01a1e331ef9018c29 Bug 1252835 - Make TextureHost recycling implicit r=nical
Sotaro Ikeda <sotaro.ikeda.g@gmail.com>
parents: 301599
diff changeset
   467
  for (AsyncParentMessageArray::index_type i = 0; i < aMessages.Length(); ++i) {
5748a69df90b4f22108b67c01a1e331ef9018c29 Bug 1252835 - Make TextureHost recycling implicit r=nical
Sotaro Ikeda <sotaro.ikeda.g@gmail.com>
parents: 301599
diff changeset
   468
    const AsyncParentMessageData& message = aMessages[i];
5748a69df90b4f22108b67c01a1e331ef9018c29 Bug 1252835 - Make TextureHost recycling implicit r=nical
Sotaro Ikeda <sotaro.ikeda.g@gmail.com>
parents: 301599
diff changeset
   469
5748a69df90b4f22108b67c01a1e331ef9018c29 Bug 1252835 - Make TextureHost recycling implicit r=nical
Sotaro Ikeda <sotaro.ikeda.g@gmail.com>
parents: 301599
diff changeset
   470
    switch (message.type()) {
5748a69df90b4f22108b67c01a1e331ef9018c29 Bug 1252835 - Make TextureHost recycling implicit r=nical
Sotaro Ikeda <sotaro.ikeda.g@gmail.com>
parents: 301599
diff changeset
   471
      case AsyncParentMessageData::TOpNotifyNotUsed: {
5748a69df90b4f22108b67c01a1e331ef9018c29 Bug 1252835 - Make TextureHost recycling implicit r=nical
Sotaro Ikeda <sotaro.ikeda.g@gmail.com>
parents: 301599
diff changeset
   472
        const OpNotifyNotUsed& op = message.get_OpNotifyNotUsed();
5748a69df90b4f22108b67c01a1e331ef9018c29 Bug 1252835 - Make TextureHost recycling implicit r=nical
Sotaro Ikeda <sotaro.ikeda.g@gmail.com>
parents: 301599
diff changeset
   473
        NotifyNotUsed(op.TextureId(), op.fwdTransactionId());
5748a69df90b4f22108b67c01a1e331ef9018c29 Bug 1252835 - Make TextureHost recycling implicit r=nical
Sotaro Ikeda <sotaro.ikeda.g@gmail.com>
parents: 301599
diff changeset
   474
        break;
5748a69df90b4f22108b67c01a1e331ef9018c29 Bug 1252835 - Make TextureHost recycling implicit r=nical
Sotaro Ikeda <sotaro.ikeda.g@gmail.com>
parents: 301599
diff changeset
   475
      }
545873
ae3feb731c92425c7bd4d32b9d0c8fbb907f4f9b Bug 1649354 - Add android Fence handling to Compositor r=jnicol
sotaro <sotaro.ikeda.g@gmail.com>
parents: 538831
diff changeset
   476
      case AsyncParentMessageData::TOpDeliverReleaseFence: {
ae3feb731c92425c7bd4d32b9d0c8fbb907f4f9b Bug 1649354 - Add android Fence handling to Compositor r=jnicol
sotaro <sotaro.ikeda.g@gmail.com>
parents: 538831
diff changeset
   477
        // Release fences are delivered via ImageBridge.
ae3feb731c92425c7bd4d32b9d0c8fbb907f4f9b Bug 1649354 - Add android Fence handling to Compositor r=jnicol
sotaro <sotaro.ikeda.g@gmail.com>
parents: 538831
diff changeset
   478
        // Since some TextureClients are recycled without recycle callback.
ae3feb731c92425c7bd4d32b9d0c8fbb907f4f9b Bug 1649354 - Add android Fence handling to Compositor r=jnicol
sotaro <sotaro.ikeda.g@gmail.com>
parents: 538831
diff changeset
   479
        MOZ_ASSERT_UNREACHABLE("unexpected to be called");
ae3feb731c92425c7bd4d32b9d0c8fbb907f4f9b Bug 1649354 - Add android Fence handling to Compositor r=jnicol
sotaro <sotaro.ikeda.g@gmail.com>
parents: 538831
diff changeset
   480
        break;
ae3feb731c92425c7bd4d32b9d0c8fbb907f4f9b Bug 1649354 - Add android Fence handling to Compositor r=jnicol
sotaro <sotaro.ikeda.g@gmail.com>
parents: 538831
diff changeset
   481
      }
301875
5748a69df90b4f22108b67c01a1e331ef9018c29 Bug 1252835 - Make TextureHost recycling implicit r=nical
Sotaro Ikeda <sotaro.ikeda.g@gmail.com>
parents: 301599
diff changeset
   482
      default:
5748a69df90b4f22108b67c01a1e331ef9018c29 Bug 1252835 - Make TextureHost recycling implicit r=nical
Sotaro Ikeda <sotaro.ikeda.g@gmail.com>
parents: 301599
diff changeset
   483
        NS_ERROR("unknown AsyncParentMessageData type");
322595
39ac4382a2c019178604b90acd816753fe142908 Bug 1314254 - Add mozilla::ipc::IPCResult type and convert IPDL handlers to use new return type. r=billm
Kan-Ru Chen <kanru@kanru.info>
parents: 322481
diff changeset
   484
        return IPC_FAIL_NO_REASON(this);
301875
5748a69df90b4f22108b67c01a1e331ef9018c29 Bug 1252835 - Make TextureHost recycling implicit r=nical
Sotaro Ikeda <sotaro.ikeda.g@gmail.com>
parents: 301599
diff changeset
   485
    }
5748a69df90b4f22108b67c01a1e331ef9018c29 Bug 1252835 - Make TextureHost recycling implicit r=nical
Sotaro Ikeda <sotaro.ikeda.g@gmail.com>
parents: 301599
diff changeset
   486
  }
322595
39ac4382a2c019178604b90acd816753fe142908 Bug 1314254 - Add mozilla::ipc::IPCResult type and convert IPDL handlers to use new return type. r=billm
Kan-Ru Chen <kanru@kanru.info>
parents: 322481
diff changeset
   487
  return IPC_OK();
301875
5748a69df90b4f22108b67c01a1e331ef9018c29 Bug 1252835 - Make TextureHost recycling implicit r=nical
Sotaro Ikeda <sotaro.ikeda.g@gmail.com>
parents: 301599
diff changeset
   488
}
5748a69df90b4f22108b67c01a1e331ef9018c29 Bug 1252835 - Make TextureHost recycling implicit r=nical
Sotaro Ikeda <sotaro.ikeda.g@gmail.com>
parents: 301599
diff changeset
   489
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   490
mozilla::ipc::IPCResult CompositorBridgeChild::RecvObserveLayersUpdate(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   491
    const LayersId& aLayersId, const LayersObserverEpoch& aEpoch,
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   492
    const bool& aActive) {
315202
faeda156db9b8b8e52c85f9e9bc44470798eb69c Support tab-switching in the GPU process. (bug 1298507, r=billm)
David Anderson <danderson@mozilla.com>
parents: 315014
diff changeset
   493
  // This message is sent via the window compositor, not the tab compositor -
faeda156db9b8b8e52c85f9e9bc44470798eb69c Support tab-switching in the GPU process. (bug 1298507, r=billm)
David Anderson <danderson@mozilla.com>
parents: 315014
diff changeset
   494
  // however it still has a layers id.
409886
5d9f32557d7740c7c30f7bc6057c4de0c294d828 Bug 1448490 - Make the layers id a struct instead of a uint64_t. r=mattwoodrow
Kartikaya Gupta <kgupta@mozilla.com>
parents: 408652
diff changeset
   495
  MOZ_ASSERT(aLayersId.IsValid());
315202
faeda156db9b8b8e52c85f9e9bc44470798eb69c Support tab-switching in the GPU process. (bug 1298507, r=billm)
David Anderson <danderson@mozilla.com>
parents: 315014
diff changeset
   496
  MOZ_ASSERT(XRE_IsParentProcess());
faeda156db9b8b8e52c85f9e9bc44470798eb69c Support tab-switching in the GPU process. (bug 1298507, r=billm)
David Anderson <danderson@mozilla.com>
parents: 315014
diff changeset
   497
470936
47813ecb1f4e0244ded2f7b938430bf52c927751 Bug 1534395 - Rename TabParent to BrowserParent. r=nika
Ryan Hunt <rhunt@eqrion.net>
parents: 469644
diff changeset
   498
  if (RefPtr<dom::BrowserParent> tab =
47813ecb1f4e0244ded2f7b938430bf52c927751 Bug 1534395 - Rename TabParent to BrowserParent. r=nika
Ryan Hunt <rhunt@eqrion.net>
parents: 469644
diff changeset
   499
          dom::BrowserParent::GetBrowserParentFromLayersId(aLayersId)) {
315202
faeda156db9b8b8e52c85f9e9bc44470798eb69c Support tab-switching in the GPU process. (bug 1298507, r=billm)
David Anderson <danderson@mozilla.com>
parents: 315014
diff changeset
   500
    tab->LayerTreeUpdate(aEpoch, aActive);
faeda156db9b8b8e52c85f9e9bc44470798eb69c Support tab-switching in the GPU process. (bug 1298507, r=billm)
David Anderson <danderson@mozilla.com>
parents: 315014
diff changeset
   501
  }
322595
39ac4382a2c019178604b90acd816753fe142908 Bug 1314254 - Add mozilla::ipc::IPCResult type and convert IPDL handlers to use new return type. r=billm
Kan-Ru Chen <kanru@kanru.info>
parents: 322481
diff changeset
   502
  return IPC_OK();
315202
faeda156db9b8b8e52c85f9e9bc44470798eb69c Support tab-switching in the GPU process. (bug 1298507, r=billm)
David Anderson <danderson@mozilla.com>
parents: 315014
diff changeset
   503
}
faeda156db9b8b8e52c85f9e9bc44470798eb69c Support tab-switching in the GPU process. (bug 1298507, r=billm)
David Anderson <danderson@mozilla.com>
parents: 315014
diff changeset
   504
502510
408a199d1d47d782a0a6f43991d72a00a7a7da49 Bug 1589022 - Partial support for moving a tab between windows with different APZ enablement. r=nika,tnikkel
Botond Ballo <botond@mozilla.com>
parents: 501881
diff changeset
   505
mozilla::ipc::IPCResult CompositorBridgeChild::RecvCompositorOptionsChanged(
408a199d1d47d782a0a6f43991d72a00a7a7da49 Bug 1589022 - Partial support for moving a tab between windows with different APZ enablement. r=nika,tnikkel
Botond Ballo <botond@mozilla.com>
parents: 501881
diff changeset
   506
    const LayersId& aLayersId, const CompositorOptions& aNewOptions) {
408a199d1d47d782a0a6f43991d72a00a7a7da49 Bug 1589022 - Partial support for moving a tab between windows with different APZ enablement. r=nika,tnikkel
Botond Ballo <botond@mozilla.com>
parents: 501881
diff changeset
   507
  MOZ_ASSERT(aLayersId.IsValid());
408a199d1d47d782a0a6f43991d72a00a7a7da49 Bug 1589022 - Partial support for moving a tab between windows with different APZ enablement. r=nika,tnikkel
Botond Ballo <botond@mozilla.com>
parents: 501881
diff changeset
   508
  MOZ_ASSERT(XRE_IsParentProcess());
408a199d1d47d782a0a6f43991d72a00a7a7da49 Bug 1589022 - Partial support for moving a tab between windows with different APZ enablement. r=nika,tnikkel
Botond Ballo <botond@mozilla.com>
parents: 501881
diff changeset
   509
408a199d1d47d782a0a6f43991d72a00a7a7da49 Bug 1589022 - Partial support for moving a tab between windows with different APZ enablement. r=nika,tnikkel
Botond Ballo <botond@mozilla.com>
parents: 501881
diff changeset
   510
  if (RefPtr<dom::BrowserParent> tab =
408a199d1d47d782a0a6f43991d72a00a7a7da49 Bug 1589022 - Partial support for moving a tab between windows with different APZ enablement. r=nika,tnikkel
Botond Ballo <botond@mozilla.com>
parents: 501881
diff changeset
   511
          dom::BrowserParent::GetBrowserParentFromLayersId(aLayersId)) {
408a199d1d47d782a0a6f43991d72a00a7a7da49 Bug 1589022 - Partial support for moving a tab between windows with different APZ enablement. r=nika,tnikkel
Botond Ballo <botond@mozilla.com>
parents: 501881
diff changeset
   512
    Unused << tab->SendCompositorOptionsChanged(aNewOptions);
408a199d1d47d782a0a6f43991d72a00a7a7da49 Bug 1589022 - Partial support for moving a tab between windows with different APZ enablement. r=nika,tnikkel
Botond Ballo <botond@mozilla.com>
parents: 501881
diff changeset
   513
  }
408a199d1d47d782a0a6f43991d72a00a7a7da49 Bug 1589022 - Partial support for moving a tab between windows with different APZ enablement. r=nika,tnikkel
Botond Ballo <botond@mozilla.com>
parents: 501881
diff changeset
   514
  return IPC_OK();
408a199d1d47d782a0a6f43991d72a00a7a7da49 Bug 1589022 - Partial support for moving a tab between windows with different APZ enablement. r=nika,tnikkel
Botond Ballo <botond@mozilla.com>
parents: 501881
diff changeset
   515
}
408a199d1d47d782a0a6f43991d72a00a7a7da49 Bug 1589022 - Partial support for moving a tab between windows with different APZ enablement. r=nika,tnikkel
Botond Ballo <botond@mozilla.com>
parents: 501881
diff changeset
   516
538831
5d5e5aafec2f3c8f1c66e99c2c74b078647f7b5f Bug 1324591 - Report janked animations to the main-thread and update them on the main-thread. r=botond,boris
Hiroyuki Ikezoe <hikezoe.birchill@mozilla.com>
parents: 538822
diff changeset
   517
mozilla::ipc::IPCResult CompositorBridgeChild::RecvNotifyJankedAnimations(
5d5e5aafec2f3c8f1c66e99c2c74b078647f7b5f Bug 1324591 - Report janked animations to the main-thread and update them on the main-thread. r=botond,boris
Hiroyuki Ikezoe <hikezoe.birchill@mozilla.com>
parents: 538822
diff changeset
   518
    const LayersId& aLayersId, nsTArray<uint64_t>&& aJankedAnimations) {
5d5e5aafec2f3c8f1c66e99c2c74b078647f7b5f Bug 1324591 - Report janked animations to the main-thread and update them on the main-thread. r=botond,boris
Hiroyuki Ikezoe <hikezoe.birchill@mozilla.com>
parents: 538822
diff changeset
   519
  if (mLayerManager) {
5d5e5aafec2f3c8f1c66e99c2c74b078647f7b5f Bug 1324591 - Report janked animations to the main-thread and update them on the main-thread. r=botond,boris
Hiroyuki Ikezoe <hikezoe.birchill@mozilla.com>
parents: 538822
diff changeset
   520
    MOZ_ASSERT(!aLayersId.IsValid());
5d5e5aafec2f3c8f1c66e99c2c74b078647f7b5f Bug 1324591 - Report janked animations to the main-thread and update them on the main-thread. r=botond,boris
Hiroyuki Ikezoe <hikezoe.birchill@mozilla.com>
parents: 538822
diff changeset
   521
    mLayerManager->UpdatePartialPrerenderedAnimations(aJankedAnimations);
5d5e5aafec2f3c8f1c66e99c2c74b078647f7b5f Bug 1324591 - Report janked animations to the main-thread and update them on the main-thread. r=botond,boris
Hiroyuki Ikezoe <hikezoe.birchill@mozilla.com>
parents: 538822
diff changeset
   522
  } else if (aLayersId.IsValid()) {
5d5e5aafec2f3c8f1c66e99c2c74b078647f7b5f Bug 1324591 - Report janked animations to the main-thread and update them on the main-thread. r=botond,boris
Hiroyuki Ikezoe <hikezoe.birchill@mozilla.com>
parents: 538822
diff changeset
   523
    RefPtr<dom::BrowserChild> child = dom::BrowserChild::GetFrom(aLayersId);
5d5e5aafec2f3c8f1c66e99c2c74b078647f7b5f Bug 1324591 - Report janked animations to the main-thread and update them on the main-thread. r=botond,boris
Hiroyuki Ikezoe <hikezoe.birchill@mozilla.com>
parents: 538822
diff changeset
   524
    if (child) {
5d5e5aafec2f3c8f1c66e99c2c74b078647f7b5f Bug 1324591 - Report janked animations to the main-thread and update them on the main-thread. r=botond,boris
Hiroyuki Ikezoe <hikezoe.birchill@mozilla.com>
parents: 538822
diff changeset
   525
      child->NotifyJankedAnimations(aJankedAnimations);
5d5e5aafec2f3c8f1c66e99c2c74b078647f7b5f Bug 1324591 - Report janked animations to the main-thread and update them on the main-thread. r=botond,boris
Hiroyuki Ikezoe <hikezoe.birchill@mozilla.com>
parents: 538822
diff changeset
   526
    }
5d5e5aafec2f3c8f1c66e99c2c74b078647f7b5f Bug 1324591 - Report janked animations to the main-thread and update them on the main-thread. r=botond,boris
Hiroyuki Ikezoe <hikezoe.birchill@mozilla.com>
parents: 538822
diff changeset
   527
  }
5d5e5aafec2f3c8f1c66e99c2c74b078647f7b5f Bug 1324591 - Report janked animations to the main-thread and update them on the main-thread. r=botond,boris
Hiroyuki Ikezoe <hikezoe.birchill@mozilla.com>
parents: 538822
diff changeset
   528
5d5e5aafec2f3c8f1c66e99c2c74b078647f7b5f Bug 1324591 - Report janked animations to the main-thread and update them on the main-thread. r=botond,boris
Hiroyuki Ikezoe <hikezoe.birchill@mozilla.com>
parents: 538822
diff changeset
   529
  return IPC_OK();
5d5e5aafec2f3c8f1c66e99c2c74b078647f7b5f Bug 1324591 - Report janked animations to the main-thread and update them on the main-thread. r=botond,boris
Hiroyuki Ikezoe <hikezoe.birchill@mozilla.com>
parents: 538822
diff changeset
   530
}
5d5e5aafec2f3c8f1c66e99c2c74b078647f7b5f Bug 1324591 - Report janked animations to the main-thread and update them on the main-thread. r=botond,boris
Hiroyuki Ikezoe <hikezoe.birchill@mozilla.com>
parents: 538822
diff changeset
   531
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   532
void CompositorBridgeChild::HoldUntilCompositableRefReleasedIfNecessary(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   533
    TextureClient* aClient) {
301875
5748a69df90b4f22108b67c01a1e331ef9018c29 Bug 1252835 - Make TextureHost recycling implicit r=nical
Sotaro Ikeda <sotaro.ikeda.g@gmail.com>
parents: 301599
diff changeset
   534
  if (!aClient) {
5748a69df90b4f22108b67c01a1e331ef9018c29 Bug 1252835 - Make TextureHost recycling implicit r=nical
Sotaro Ikeda <sotaro.ikeda.g@gmail.com>
parents: 301599
diff changeset
   535
    return;
5748a69df90b4f22108b67c01a1e331ef9018c29 Bug 1252835 - Make TextureHost recycling implicit r=nical
Sotaro Ikeda <sotaro.ikeda.g@gmail.com>
parents: 301599
diff changeset
   536
  }
5748a69df90b4f22108b67c01a1e331ef9018c29 Bug 1252835 - Make TextureHost recycling implicit r=nical
Sotaro Ikeda <sotaro.ikeda.g@gmail.com>
parents: 301599
diff changeset
   537
545873
ae3feb731c92425c7bd4d32b9d0c8fbb907f4f9b Bug 1649354 - Add android Fence handling to Compositor r=jnicol
sotaro <sotaro.ikeda.g@gmail.com>
parents: 538831
diff changeset
   538
#ifdef MOZ_WIDGET_ANDROID
ae3feb731c92425c7bd4d32b9d0c8fbb907f4f9b Bug 1649354 - Add android Fence handling to Compositor r=jnicol
sotaro <sotaro.ikeda.g@gmail.com>
parents: 538831
diff changeset
   539
  auto bufferId = aClient->GetInternalData()->GetBufferId();
ae3feb731c92425c7bd4d32b9d0c8fbb907f4f9b Bug 1649354 - Add android Fence handling to Compositor r=jnicol
sotaro <sotaro.ikeda.g@gmail.com>
parents: 538831
diff changeset
   540
  if (bufferId.isSome()) {
ae3feb731c92425c7bd4d32b9d0c8fbb907f4f9b Bug 1649354 - Add android Fence handling to Compositor r=jnicol
sotaro <sotaro.ikeda.g@gmail.com>
parents: 538831
diff changeset
   541
    MOZ_ASSERT(aClient->GetFlags() & TextureFlags::WAIT_HOST_USAGE_END);
ae3feb731c92425c7bd4d32b9d0c8fbb907f4f9b Bug 1649354 - Add android Fence handling to Compositor r=jnicol
sotaro <sotaro.ikeda.g@gmail.com>
parents: 538831
diff changeset
   542
    AndroidHardwareBufferManager::Get()->HoldUntilNotifyNotUsed(
ae3feb731c92425c7bd4d32b9d0c8fbb907f4f9b Bug 1649354 - Add android Fence handling to Compositor r=jnicol
sotaro <sotaro.ikeda.g@gmail.com>
parents: 538831
diff changeset
   543
        bufferId.ref(), GetFwdTransactionId(), /* aUsesImageBridge */ false);
ae3feb731c92425c7bd4d32b9d0c8fbb907f4f9b Bug 1649354 - Add android Fence handling to Compositor r=jnicol
sotaro <sotaro.ikeda.g@gmail.com>
parents: 538831
diff changeset
   544
  }
ae3feb731c92425c7bd4d32b9d0c8fbb907f4f9b Bug 1649354 - Add android Fence handling to Compositor r=jnicol
sotaro <sotaro.ikeda.g@gmail.com>
parents: 538831
diff changeset
   545
#endif
ae3feb731c92425c7bd4d32b9d0c8fbb907f4f9b Bug 1649354 - Add android Fence handling to Compositor r=jnicol
sotaro <sotaro.ikeda.g@gmail.com>
parents: 538831
diff changeset
   546
477030
bbab037b0f9fc6e460e62e3f4da98e984f83714b Bug 1556340 - Make D3D11TextureData and DXGIYCbCrTextureData alive during host side usage with WebRender r=nical
sotaro <sotaro.ikeda.g@gmail.com>
parents: 476506
diff changeset
   547
  bool waitNotifyNotUsed =
bbab037b0f9fc6e460e62e3f4da98e984f83714b Bug 1556340 - Make D3D11TextureData and DXGIYCbCrTextureData alive during host side usage with WebRender r=nical
sotaro <sotaro.ikeda.g@gmail.com>
parents: 476506
diff changeset
   548
      aClient->GetFlags() & TextureFlags::RECYCLE ||
bbab037b0f9fc6e460e62e3f4da98e984f83714b Bug 1556340 - Make D3D11TextureData and DXGIYCbCrTextureData alive during host side usage with WebRender r=nical
sotaro <sotaro.ikeda.g@gmail.com>
parents: 476506
diff changeset
   549
      aClient->GetFlags() & TextureFlags::WAIT_HOST_USAGE_END;
bbab037b0f9fc6e460e62e3f4da98e984f83714b Bug 1556340 - Make D3D11TextureData and DXGIYCbCrTextureData alive during host side usage with WebRender r=nical
sotaro <sotaro.ikeda.g@gmail.com>
parents: 476506
diff changeset
   550
  if (!waitNotifyNotUsed) {
301875
5748a69df90b4f22108b67c01a1e331ef9018c29 Bug 1252835 - Make TextureHost recycling implicit r=nical
Sotaro Ikeda <sotaro.ikeda.g@gmail.com>
parents: 301599
diff changeset
   551
    return;
5748a69df90b4f22108b67c01a1e331ef9018c29 Bug 1252835 - Make TextureHost recycling implicit r=nical
Sotaro Ikeda <sotaro.ikeda.g@gmail.com>
parents: 301599
diff changeset
   552
  }
5748a69df90b4f22108b67c01a1e331ef9018c29 Bug 1252835 - Make TextureHost recycling implicit r=nical
Sotaro Ikeda <sotaro.ikeda.g@gmail.com>
parents: 301599
diff changeset
   553
319700
72f023146710175d724a27ce099f48a316ce5fdc Bug 1313281 - Part 5: Remove NeedsFenceHandle. r=sotaro
Matt Woodrow <mwoodrow@mozilla.com>
parents: 319697
diff changeset
   554
  aClient->SetLastFwdTransactionId(GetFwdTransactionId());
476506
996a636778d0557ffd9a36e1a63cb7a1f4d00122 Bug 1555544 - Change function name from CancelWaitForRecycle() to CancelWaitForNotifyNotUsed() r=jgilbert
sotaro <sotaro.ikeda.g@gmail.com>
parents: 475617
diff changeset
   555
  mTexturesWaitingNotifyNotUsed.emplace(aClient->GetSerial(), aClient);
301875
5748a69df90b4f22108b67c01a1e331ef9018c29 Bug 1252835 - Make TextureHost recycling implicit r=nical
Sotaro Ikeda <sotaro.ikeda.g@gmail.com>
parents: 301599
diff changeset
   556
}
5748a69df90b4f22108b67c01a1e331ef9018c29 Bug 1252835 - Make TextureHost recycling implicit r=nical
Sotaro Ikeda <sotaro.ikeda.g@gmail.com>
parents: 301599
diff changeset
   557
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   558
void CompositorBridgeChild::NotifyNotUsed(uint64_t aTextureId,
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   559
                                          uint64_t aFwdTransactionId) {
476506
996a636778d0557ffd9a36e1a63cb7a1f4d00122 Bug 1555544 - Change function name from CancelWaitForRecycle() to CancelWaitForNotifyNotUsed() r=jgilbert
sotaro <sotaro.ikeda.g@gmail.com>
parents: 475617
diff changeset
   560
  auto it = mTexturesWaitingNotifyNotUsed.find(aTextureId);
996a636778d0557ffd9a36e1a63cb7a1f4d00122 Bug 1555544 - Change function name from CancelWaitForRecycle() to CancelWaitForNotifyNotUsed() r=jgilbert
sotaro <sotaro.ikeda.g@gmail.com>
parents: 475617
diff changeset
   561
  if (it != mTexturesWaitingNotifyNotUsed.end()) {
426343
7bba6867db6efc3da44365e92cb01efd0ad7e35d Bug 1474806 - Use more std::unordered_map in layers r=nical
sotaro <sotaro.ikeda.g@gmail.com>
parents: 425071
diff changeset
   562
    if (aFwdTransactionId < it->second->GetLastFwdTransactionId()) {
366332
aab3c3535a0c4ad61e7fbcc0a41d2aba385ccd42 Bug 1376296 part 1 - Use Lookup instead of Get+Remove, and remove a useless Get before Remove, to avoid unnecessary hashtable lookups. r=froydnj
Mats Palmgren <mats@mozilla.com>
parents: 366127
diff changeset
   563
      // Released on host side, but client already requested newer use texture.
aab3c3535a0c4ad61e7fbcc0a41d2aba385ccd42 Bug 1376296 part 1 - Use Lookup instead of Get+Remove, and remove a useless Get before Remove, to avoid unnecessary hashtable lookups. r=froydnj
Mats Palmgren <mats@mozilla.com>
parents: 366127
diff changeset
   564
      return;
aab3c3535a0c4ad61e7fbcc0a41d2aba385ccd42 Bug 1376296 part 1 - Use Lookup instead of Get+Remove, and remove a useless Get before Remove, to avoid unnecessary hashtable lookups. r=froydnj
Mats Palmgren <mats@mozilla.com>
parents: 366127
diff changeset
   565
    }
476506
996a636778d0557ffd9a36e1a63cb7a1f4d00122 Bug 1555544 - Change function name from CancelWaitForRecycle() to CancelWaitForNotifyNotUsed() r=jgilbert
sotaro <sotaro.ikeda.g@gmail.com>
parents: 475617
diff changeset
   566
    mTexturesWaitingNotifyNotUsed.erase(it);
301875
5748a69df90b4f22108b67c01a1e331ef9018c29 Bug 1252835 - Make TextureHost recycling implicit r=nical
Sotaro Ikeda <sotaro.ikeda.g@gmail.com>
parents: 301599
diff changeset
   567
  }
5748a69df90b4f22108b67c01a1e331ef9018c29 Bug 1252835 - Make TextureHost recycling implicit r=nical
Sotaro Ikeda <sotaro.ikeda.g@gmail.com>
parents: 301599
diff changeset
   568
}
5748a69df90b4f22108b67c01a1e331ef9018c29 Bug 1252835 - Make TextureHost recycling implicit r=nical
Sotaro Ikeda <sotaro.ikeda.g@gmail.com>
parents: 301599
diff changeset
   569
476506
996a636778d0557ffd9a36e1a63cb7a1f4d00122 Bug 1555544 - Change function name from CancelWaitForRecycle() to CancelWaitForNotifyNotUsed() r=jgilbert
sotaro <sotaro.ikeda.g@gmail.com>
parents: 475617
diff changeset
   570
void CompositorBridgeChild::CancelWaitForNotifyNotUsed(uint64_t aTextureId) {
996a636778d0557ffd9a36e1a63cb7a1f4d00122 Bug 1555544 - Change function name from CancelWaitForRecycle() to CancelWaitForNotifyNotUsed() r=jgilbert
sotaro <sotaro.ikeda.g@gmail.com>
parents: 475617
diff changeset
   571
  mTexturesWaitingNotifyNotUsed.erase(aTextureId);
301875
5748a69df90b4f22108b67c01a1e331ef9018c29 Bug 1252835 - Make TextureHost recycling implicit r=nical
Sotaro Ikeda <sotaro.ikeda.g@gmail.com>
parents: 301599
diff changeset
   572
}
5748a69df90b4f22108b67c01a1e331ef9018c29 Bug 1252835 - Make TextureHost recycling implicit r=nical
Sotaro Ikeda <sotaro.ikeda.g@gmail.com>
parents: 301599
diff changeset
   573
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   574
TextureClientPool* CompositorBridgeChild::GetTexturePool(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   575
    KnowsCompositor* aAllocator, SurfaceFormat aFormat, TextureFlags aFlags) {
302048
ada00a4c36c5ba384e2fdc2c4bd94f20fe7c744c Bug 1176011 - Move TextureClientPool to CompositorBridgeChild r=nical
George Wright <george@mozilla.com>
parents: 301875
diff changeset
   576
  for (size_t i = 0; i < mTexturePools.Length(); i++) {
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   577
    if (mTexturePools[i]->GetBackend() ==
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   578
            aAllocator->GetCompositorBackendType() &&
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   579
        mTexturePools[i]->GetMaxTextureSize() ==
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   580
            aAllocator->GetMaxTextureSize() &&
303070
4675dc158077525777e902a91ddc31c1af79452f Bug 1281780 - Forward ShadowLayerForwarder texture-related methods to CompositorBridgeChild. r=gw280
Nicolas Silva <nsilva@mozilla.com>
parents: 303004
diff changeset
   581
        mTexturePools[i]->GetFormat() == aFormat &&
302048
ada00a4c36c5ba384e2fdc2c4bd94f20fe7c744c Bug 1176011 - Move TextureClientPool to CompositorBridgeChild r=nical
George Wright <george@mozilla.com>
parents: 301875
diff changeset
   582
        mTexturePools[i]->GetFlags() == aFlags) {
ada00a4c36c5ba384e2fdc2c4bd94f20fe7c744c Bug 1176011 - Move TextureClientPool to CompositorBridgeChild r=nical
George Wright <george@mozilla.com>
parents: 301875
diff changeset
   583
      return mTexturePools[i];
ada00a4c36c5ba384e2fdc2c4bd94f20fe7c744c Bug 1176011 - Move TextureClientPool to CompositorBridgeChild r=nical
George Wright <george@mozilla.com>
parents: 301875
diff changeset
   584
    }
ada00a4c36c5ba384e2fdc2c4bd94f20fe7c744c Bug 1176011 - Move TextureClientPool to CompositorBridgeChild r=nical
George Wright <george@mozilla.com>
parents: 301875
diff changeset
   585
  }
ada00a4c36c5ba384e2fdc2c4bd94f20fe7c744c Bug 1176011 - Move TextureClientPool to CompositorBridgeChild r=nical
George Wright <george@mozilla.com>
parents: 301875
diff changeset
   586
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   587
  mTexturePools.AppendElement(new TextureClientPool(
551975
7515e8dd3a75c0b9b082353cae37243c6d92557c Bug 1668713 - Disable D2D canvas when using SWGL. r=jrmuizel
Matt Woodrow <mwoodrow@mozilla.com>
parents: 551649
diff changeset
   588
      aAllocator, aFormat, gfx::gfxVars::TileSize(), aFlags,
7515e8dd3a75c0b9b082353cae37243c6d92557c Bug 1668713 - Disable D2D canvas when using SWGL. r=jrmuizel
Matt Woodrow <mwoodrow@mozilla.com>
parents: 551649
diff changeset
   589
      StaticPrefs::layers_tile_pool_shrink_timeout_AtStartup(),
483647
2cb4ffa920c6ad8a4f9b500222dc41d929114646 Bug 1567329 - Append `_AtStartup` to `once` static pref getters. r=erahm
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 482872
diff changeset
   590
      StaticPrefs::layers_tile_pool_clear_timeout_AtStartup(),
2cb4ffa920c6ad8a4f9b500222dc41d929114646 Bug 1567329 - Append `_AtStartup` to `once` static pref getters. r=erahm
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 482872
diff changeset
   591
      StaticPrefs::layers_tile_initial_pool_size_AtStartup(),
2cb4ffa920c6ad8a4f9b500222dc41d929114646 Bug 1567329 - Append `_AtStartup` to `once` static pref getters. r=erahm
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 482872
diff changeset
   592
      StaticPrefs::layers_tile_pool_unused_size_AtStartup(), this));
302048
ada00a4c36c5ba384e2fdc2c4bd94f20fe7c744c Bug 1176011 - Move TextureClientPool to CompositorBridgeChild r=nical
George Wright <george@mozilla.com>
parents: 301875
diff changeset
   593
ada00a4c36c5ba384e2fdc2c4bd94f20fe7c744c Bug 1176011 - Move TextureClientPool to CompositorBridgeChild r=nical
George Wright <george@mozilla.com>
parents: 301875
diff changeset
   594
  return mTexturePools.LastElement();
ada00a4c36c5ba384e2fdc2c4bd94f20fe7c744c Bug 1176011 - Move TextureClientPool to CompositorBridgeChild r=nical
George Wright <george@mozilla.com>
parents: 301875
diff changeset
   595
}
ada00a4c36c5ba384e2fdc2c4bd94f20fe7c744c Bug 1176011 - Move TextureClientPool to CompositorBridgeChild r=nical
George Wright <george@mozilla.com>
parents: 301875
diff changeset
   596
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   597
void CompositorBridgeChild::HandleMemoryPressure() {
302048
ada00a4c36c5ba384e2fdc2c4bd94f20fe7c744c Bug 1176011 - Move TextureClientPool to CompositorBridgeChild r=nical
George Wright <george@mozilla.com>
parents: 301875
diff changeset
   598
  for (size_t i = 0; i < mTexturePools.Length(); i++) {
306017
0affe22555807bf2b349f94e115ce0f038ff989d Bug 1279341 - Keep track of unused tiles in determining TextureClientPool size instead of overall size r=jnicol
George Wright <george@mozilla.com>
parents: 306007
diff changeset
   599
    mTexturePools[i]->Clear();
302048
ada00a4c36c5ba384e2fdc2c4bd94f20fe7c744c Bug 1176011 - Move TextureClientPool to CompositorBridgeChild r=nical
George Wright <george@mozilla.com>
parents: 301875
diff changeset
   600
  }
ada00a4c36c5ba384e2fdc2c4bd94f20fe7c744c Bug 1176011 - Move TextureClientPool to CompositorBridgeChild r=nical
George Wright <george@mozilla.com>
parents: 301875
diff changeset
   601
}
ada00a4c36c5ba384e2fdc2c4bd94f20fe7c744c Bug 1176011 - Move TextureClientPool to CompositorBridgeChild r=nical
George Wright <george@mozilla.com>
parents: 301875
diff changeset
   602
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   603
void CompositorBridgeChild::ClearTexturePool() {
302048
ada00a4c36c5ba384e2fdc2c4bd94f20fe7c744c Bug 1176011 - Move TextureClientPool to CompositorBridgeChild r=nical
George Wright <george@mozilla.com>
parents: 301875
diff changeset
   604
  for (size_t i = 0; i < mTexturePools.Length(); i++) {
ada00a4c36c5ba384e2fdc2c4bd94f20fe7c744c Bug 1176011 - Move TextureClientPool to CompositorBridgeChild r=nical
George Wright <george@mozilla.com>
parents: 301875
diff changeset
   605
    mTexturePools[i]->Clear();
ada00a4c36c5ba384e2fdc2c4bd94f20fe7c744c Bug 1176011 - Move TextureClientPool to CompositorBridgeChild r=nical
George Wright <george@mozilla.com>
parents: 301875
diff changeset
   606
  }
ada00a4c36c5ba384e2fdc2c4bd94f20fe7c744c Bug 1176011 - Move TextureClientPool to CompositorBridgeChild r=nical
George Wright <george@mozilla.com>
parents: 301875
diff changeset
   607
}
ada00a4c36c5ba384e2fdc2c4bd94f20fe7c744c Bug 1176011 - Move TextureClientPool to CompositorBridgeChild r=nical
George Wright <george@mozilla.com>
parents: 301875
diff changeset
   608
312304
9beac1f92bd0b559e46039061a3ce9a09350ce96 Bug 1280715 - Move FixedSizeShmemAllocator to CompositorBridgeChild to allow for a more sane destruction sequence r=nical
George Wright <george@mozilla.com>
parents: 311192
diff changeset
   609
FixedSizeSmallShmemSectionAllocator*
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   610
CompositorBridgeChild::GetTileLockAllocator() {
312304
9beac1f92bd0b559e46039061a3ce9a09350ce96 Bug 1280715 - Move FixedSizeShmemAllocator to CompositorBridgeChild to allow for a more sane destruction sequence r=nical
George Wright <george@mozilla.com>
parents: 311192
diff changeset
   611
  if (!IPCOpen()) {
9beac1f92bd0b559e46039061a3ce9a09350ce96 Bug 1280715 - Move FixedSizeShmemAllocator to CompositorBridgeChild to allow for a more sane destruction sequence r=nical
George Wright <george@mozilla.com>
parents: 311192
diff changeset
   612
    return nullptr;
9beac1f92bd0b559e46039061a3ce9a09350ce96 Bug 1280715 - Move FixedSizeShmemAllocator to CompositorBridgeChild to allow for a more sane destruction sequence r=nical
George Wright <george@mozilla.com>
parents: 311192
diff changeset
   613
  }
9beac1f92bd0b559e46039061a3ce9a09350ce96 Bug 1280715 - Move FixedSizeShmemAllocator to CompositorBridgeChild to allow for a more sane destruction sequence r=nical
George Wright <george@mozilla.com>
parents: 311192
diff changeset
   614
9beac1f92bd0b559e46039061a3ce9a09350ce96 Bug 1280715 - Move FixedSizeShmemAllocator to CompositorBridgeChild to allow for a more sane destruction sequence r=nical
George Wright <george@mozilla.com>
parents: 311192
diff changeset
   615
  if (!mSectionAllocator) {
9beac1f92bd0b559e46039061a3ce9a09350ce96 Bug 1280715 - Move FixedSizeShmemAllocator to CompositorBridgeChild to allow for a more sane destruction sequence r=nical
George Wright <george@mozilla.com>
parents: 311192
diff changeset
   616
    mSectionAllocator = new FixedSizeSmallShmemSectionAllocator(this);
9beac1f92bd0b559e46039061a3ce9a09350ce96 Bug 1280715 - Move FixedSizeShmemAllocator to CompositorBridgeChild to allow for a more sane destruction sequence r=nical
George Wright <george@mozilla.com>
parents: 311192
diff changeset
   617
  }
9beac1f92bd0b559e46039061a3ce9a09350ce96 Bug 1280715 - Move FixedSizeShmemAllocator to CompositorBridgeChild to allow for a more sane destruction sequence r=nical
George Wright <george@mozilla.com>
parents: 311192
diff changeset
   618
  return mSectionAllocator;
9beac1f92bd0b559e46039061a3ce9a09350ce96 Bug 1280715 - Move FixedSizeShmemAllocator to CompositorBridgeChild to allow for a more sane destruction sequence r=nical
George Wright <george@mozilla.com>
parents: 311192
diff changeset
   619
}
9beac1f92bd0b559e46039061a3ce9a09350ce96 Bug 1280715 - Move FixedSizeShmemAllocator to CompositorBridgeChild to allow for a more sane destruction sequence r=nical
George Wright <george@mozilla.com>
parents: 311192
diff changeset
   620
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   621
PTextureChild* CompositorBridgeChild::CreateTexture(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   622
    const SurfaceDescriptor& aSharedData, const ReadLockDescriptor& aReadLock,
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   623
    LayersBackend aLayersBackend, TextureFlags aFlags, uint64_t aSerial,
536716
444848bd6526999138a685b1f484b8901e30567f Bug 1647133 - P4. Use nsISerialEventTarget where it's actually that. r=mattwoodrow
Jean-Yves Avenard <jyavenard@mozilla.com>
parents: 528941
diff changeset
   624
    wr::MaybeExternalImageId& aExternalImageId, nsISerialEventTarget* aTarget) {
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   625
  PTextureChild* textureChild =
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   626
      AllocPTextureChild(aSharedData, aReadLock, aLayersBackend, aFlags,
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   627
                         LayersId{0} /* FIXME */, aSerial, aExternalImageId);
356445
0630447dd5b6f1f4fa5e070968d1b5c3946e2a99 Bug 1343754 - Add a function for replacing event target for actor and label PTexture; r=bevistseng,billm,nical
Kevin Chen <kechen@mozilla.com>
parents: 356196
diff changeset
   628
0630447dd5b6f1f4fa5e070968d1b5c3946e2a99 Bug 1343754 - Add a function for replacing event target for actor and label PTexture; r=bevistseng,billm,nical
Kevin Chen <kechen@mozilla.com>
parents: 356196
diff changeset
   629
  // Do the DOM labeling.
0630447dd5b6f1f4fa5e070968d1b5c3946e2a99 Bug 1343754 - Add a function for replacing event target for actor and label PTexture; r=bevistseng,billm,nical
Kevin Chen <kechen@mozilla.com>
parents: 356196
diff changeset
   630
  if (aTarget) {
0630447dd5b6f1f4fa5e070968d1b5c3946e2a99 Bug 1343754 - Add a function for replacing event target for actor and label PTexture; r=bevistseng,billm,nical
Kevin Chen <kechen@mozilla.com>
parents: 356196
diff changeset
   631
    SetEventTargetForActor(textureChild, aTarget);
0630447dd5b6f1f4fa5e070968d1b5c3946e2a99 Bug 1343754 - Add a function for replacing event target for actor and label PTexture; r=bevistseng,billm,nical
Kevin Chen <kechen@mozilla.com>
parents: 356196
diff changeset
   632
  }
0630447dd5b6f1f4fa5e070968d1b5c3946e2a99 Bug 1343754 - Add a function for replacing event target for actor and label PTexture; r=bevistseng,billm,nical
Kevin Chen <kechen@mozilla.com>
parents: 356196
diff changeset
   633
0630447dd5b6f1f4fa5e070968d1b5c3946e2a99 Bug 1343754 - Add a function for replacing event target for actor and label PTexture; r=bevistseng,billm,nical
Kevin Chen <kechen@mozilla.com>
parents: 356196
diff changeset
   634
  return SendPTextureConstructor(
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   635
      textureChild, aSharedData, aReadLock, aLayersBackend, aFlags,
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   636
      LayersId{0} /* FIXME? */, aSerial, aExternalImageId);
302048
ada00a4c36c5ba384e2fdc2c4bd94f20fe7c744c Bug 1176011 - Move TextureClientPool to CompositorBridgeChild r=nical
George Wright <george@mozilla.com>
parents: 301875
diff changeset
   637
}
ada00a4c36c5ba384e2fdc2c4bd94f20fe7c744c Bug 1176011 - Move TextureClientPool to CompositorBridgeChild r=nical
George Wright <george@mozilla.com>
parents: 301875
diff changeset
   638
477808
4357d695b8d5dd901788d922b73e89f16c45b2c9 Bug 1464032 Part 12: Add CanvasParent, CanvasChild and RecordedTextureData. r=mattwoodrow, jld
Bob Owen <bobowencode@gmail.com>
parents: 477556
diff changeset
   639
already_AddRefed<CanvasChild> CompositorBridgeChild::GetCanvasChild() {
494199
a03583b4aa2b4f749c546043c7aabef76f4afa5c Bug 1578475: Cleanup Remote Canvas 2D IPC classes when not used for certain duration. r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 484792
diff changeset
   640
  MOZ_ASSERT(gfx::gfxVars::RemoteCanvasEnabled());
537574
9ca1037fc1cd611ba0fef4a483b1b7669b996a62 Bug 1641722: Deactivate remote canvas 2D when device creation or stream read failure occurs. r=jrmuizel,chutten
Bob Owen <bobowencode@gmail.com>
parents: 537568
diff changeset
   641
9ca1037fc1cd611ba0fef4a483b1b7669b996a62 Bug 1641722: Deactivate remote canvas 2D when device creation or stream read failure occurs. r=jrmuizel,chutten
Bob Owen <bobowencode@gmail.com>
parents: 537568
diff changeset
   642
  if (CanvasChild::Deactivated()) {
9ca1037fc1cd611ba0fef4a483b1b7669b996a62 Bug 1641722: Deactivate remote canvas 2D when device creation or stream read failure occurs. r=jrmuizel,chutten
Bob Owen <bobowencode@gmail.com>
parents: 537568
diff changeset
   643
    return nullptr;
9ca1037fc1cd611ba0fef4a483b1b7669b996a62 Bug 1641722: Deactivate remote canvas 2D when device creation or stream read failure occurs. r=jrmuizel,chutten
Bob Owen <bobowencode@gmail.com>
parents: 537568
diff changeset
   644
  }
9ca1037fc1cd611ba0fef4a483b1b7669b996a62 Bug 1641722: Deactivate remote canvas 2D when device creation or stream read failure occurs. r=jrmuizel,chutten
Bob Owen <bobowencode@gmail.com>
parents: 537568
diff changeset
   645
494199
a03583b4aa2b4f749c546043c7aabef76f4afa5c Bug 1578475: Cleanup Remote Canvas 2D IPC classes when not used for certain duration. r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 484792
diff changeset
   646
  if (!mCanvasChild) {
a03583b4aa2b4f749c546043c7aabef76f4afa5c Bug 1578475: Cleanup Remote Canvas 2D IPC classes when not used for certain duration. r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 484792
diff changeset
   647
    ipc::Endpoint<PCanvasParent> parentEndpoint;
a03583b4aa2b4f749c546043c7aabef76f4afa5c Bug 1578475: Cleanup Remote Canvas 2D IPC classes when not used for certain duration. r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 484792
diff changeset
   648
    ipc::Endpoint<PCanvasChild> childEndpoint;
a03583b4aa2b4f749c546043c7aabef76f4afa5c Bug 1578475: Cleanup Remote Canvas 2D IPC classes when not used for certain duration. r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 484792
diff changeset
   649
    nsresult rv = PCanvas::CreateEndpoints(OtherPid(), base::GetCurrentProcId(),
a03583b4aa2b4f749c546043c7aabef76f4afa5c Bug 1578475: Cleanup Remote Canvas 2D IPC classes when not used for certain duration. r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 484792
diff changeset
   650
                                           &parentEndpoint, &childEndpoint);
a03583b4aa2b4f749c546043c7aabef76f4afa5c Bug 1578475: Cleanup Remote Canvas 2D IPC classes when not used for certain duration. r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 484792
diff changeset
   651
    if (NS_SUCCEEDED(rv)) {
a03583b4aa2b4f749c546043c7aabef76f4afa5c Bug 1578475: Cleanup Remote Canvas 2D IPC classes when not used for certain duration. r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 484792
diff changeset
   652
      Unused << SendInitPCanvasParent(std::move(parentEndpoint));
a03583b4aa2b4f749c546043c7aabef76f4afa5c Bug 1578475: Cleanup Remote Canvas 2D IPC classes when not used for certain duration. r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 484792
diff changeset
   653
      mCanvasChild = new CanvasChild(std::move(childEndpoint));
a03583b4aa2b4f749c546043c7aabef76f4afa5c Bug 1578475: Cleanup Remote Canvas 2D IPC classes when not used for certain duration. r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 484792
diff changeset
   654
    }
a03583b4aa2b4f749c546043c7aabef76f4afa5c Bug 1578475: Cleanup Remote Canvas 2D IPC classes when not used for certain duration. r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 484792
diff changeset
   655
  }
a03583b4aa2b4f749c546043c7aabef76f4afa5c Bug 1578475: Cleanup Remote Canvas 2D IPC classes when not used for certain duration. r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 484792
diff changeset
   656
477808
4357d695b8d5dd901788d922b73e89f16c45b2c9 Bug 1464032 Part 12: Add CanvasParent, CanvasChild and RecordedTextureData. r=mattwoodrow, jld
Bob Owen <bobowencode@gmail.com>
parents: 477556
diff changeset
   657
  return do_AddRef(mCanvasChild);
4357d695b8d5dd901788d922b73e89f16c45b2c9 Bug 1464032 Part 12: Add CanvasParent, CanvasChild and RecordedTextureData. r=mattwoodrow, jld
Bob Owen <bobowencode@gmail.com>
parents: 477556
diff changeset
   658
}
4357d695b8d5dd901788d922b73e89f16c45b2c9 Bug 1464032 Part 12: Add CanvasParent, CanvasChild and RecordedTextureData. r=mattwoodrow, jld
Bob Owen <bobowencode@gmail.com>
parents: 477556
diff changeset
   659
4357d695b8d5dd901788d922b73e89f16c45b2c9 Bug 1464032 Part 12: Add CanvasParent, CanvasChild and RecordedTextureData. r=mattwoodrow, jld
Bob Owen <bobowencode@gmail.com>
parents: 477556
diff changeset
   660
void CompositorBridgeChild::EndCanvasTransaction() {
4357d695b8d5dd901788d922b73e89f16c45b2c9 Bug 1464032 Part 12: Add CanvasParent, CanvasChild and RecordedTextureData. r=mattwoodrow, jld
Bob Owen <bobowencode@gmail.com>
parents: 477556
diff changeset
   661
  if (mCanvasChild) {
4357d695b8d5dd901788d922b73e89f16c45b2c9 Bug 1464032 Part 12: Add CanvasParent, CanvasChild and RecordedTextureData. r=mattwoodrow, jld
Bob Owen <bobowencode@gmail.com>
parents: 477556
diff changeset
   662
    mCanvasChild->EndTransaction();
494199
a03583b4aa2b4f749c546043c7aabef76f4afa5c Bug 1578475: Cleanup Remote Canvas 2D IPC classes when not used for certain duration. r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 484792
diff changeset
   663
    if (mCanvasChild->ShouldBeCleanedUp()) {
a03583b4aa2b4f749c546043c7aabef76f4afa5c Bug 1578475: Cleanup Remote Canvas 2D IPC classes when not used for certain duration. r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 484792
diff changeset
   664
      mCanvasChild->Destroy();
a03583b4aa2b4f749c546043c7aabef76f4afa5c Bug 1578475: Cleanup Remote Canvas 2D IPC classes when not used for certain duration. r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 484792
diff changeset
   665
      Unused << SendReleasePCanvasParent();
a03583b4aa2b4f749c546043c7aabef76f4afa5c Bug 1578475: Cleanup Remote Canvas 2D IPC classes when not used for certain duration. r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 484792
diff changeset
   666
      mCanvasChild = nullptr;
a03583b4aa2b4f749c546043c7aabef76f4afa5c Bug 1578475: Cleanup Remote Canvas 2D IPC classes when not used for certain duration. r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 484792
diff changeset
   667
    }
477808
4357d695b8d5dd901788d922b73e89f16c45b2c9 Bug 1464032 Part 12: Add CanvasParent, CanvasChild and RecordedTextureData. r=mattwoodrow, jld
Bob Owen <bobowencode@gmail.com>
parents: 477556
diff changeset
   668
  }
4357d695b8d5dd901788d922b73e89f16c45b2c9 Bug 1464032 Part 12: Add CanvasParent, CanvasChild and RecordedTextureData. r=mattwoodrow, jld
Bob Owen <bobowencode@gmail.com>
parents: 477556
diff changeset
   669
}
4357d695b8d5dd901788d922b73e89f16c45b2c9 Bug 1464032 Part 12: Add CanvasParent, CanvasChild and RecordedTextureData. r=mattwoodrow, jld
Bob Owen <bobowencode@gmail.com>
parents: 477556
diff changeset
   670
501881
97b72aea347c896e1429de4ca15624a12833a46b Bug 1575008 - WebGPU implementation basis r=baku,bzbarsky
Dzmitry Malyshau <dmalyshau@mozilla.com>
parents: 501765
diff changeset
   671
RefPtr<webgpu::WebGPUChild> CompositorBridgeChild::GetWebGPUChild() {
97b72aea347c896e1429de4ca15624a12833a46b Bug 1575008 - WebGPU implementation basis r=baku,bzbarsky
Dzmitry Malyshau <dmalyshau@mozilla.com>
parents: 501765
diff changeset
   672
  MOZ_ASSERT(gfx::gfxConfig::IsEnabled(gfx::Feature::WEBGPU));
97b72aea347c896e1429de4ca15624a12833a46b Bug 1575008 - WebGPU implementation basis r=baku,bzbarsky
Dzmitry Malyshau <dmalyshau@mozilla.com>
parents: 501765
diff changeset
   673
  if (!mWebGPUChild) {
97b72aea347c896e1429de4ca15624a12833a46b Bug 1575008 - WebGPU implementation basis r=baku,bzbarsky
Dzmitry Malyshau <dmalyshau@mozilla.com>
parents: 501765
diff changeset
   674
    webgpu::PWebGPUChild* bridge = SendPWebGPUConstructor();
97b72aea347c896e1429de4ca15624a12833a46b Bug 1575008 - WebGPU implementation basis r=baku,bzbarsky
Dzmitry Malyshau <dmalyshau@mozilla.com>
parents: 501765
diff changeset
   675
    mWebGPUChild = static_cast<webgpu::WebGPUChild*>(bridge);
97b72aea347c896e1429de4ca15624a12833a46b Bug 1575008 - WebGPU implementation basis r=baku,bzbarsky
Dzmitry Malyshau <dmalyshau@mozilla.com>
parents: 501765
diff changeset
   676
  }
97b72aea347c896e1429de4ca15624a12833a46b Bug 1575008 - WebGPU implementation basis r=baku,bzbarsky
Dzmitry Malyshau <dmalyshau@mozilla.com>
parents: 501765
diff changeset
   677
97b72aea347c896e1429de4ca15624a12833a46b Bug 1575008 - WebGPU implementation basis r=baku,bzbarsky
Dzmitry Malyshau <dmalyshau@mozilla.com>
parents: 501765
diff changeset
   678
  return mWebGPUChild;
97b72aea347c896e1429de4ca15624a12833a46b Bug 1575008 - WebGPU implementation basis r=baku,bzbarsky
Dzmitry Malyshau <dmalyshau@mozilla.com>
parents: 501765
diff changeset
   679
}
97b72aea347c896e1429de4ca15624a12833a46b Bug 1575008 - WebGPU implementation basis r=baku,bzbarsky
Dzmitry Malyshau <dmalyshau@mozilla.com>
parents: 501765
diff changeset
   680
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   681
bool CompositorBridgeChild::AllocUnsafeShmem(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   682
    size_t aSize, ipc::SharedMemory::SharedMemoryType aType,
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   683
    ipc::Shmem* aShmem) {
315316
b7ead4d4eb90ac9e8f112574dc194691e507658e Bug 1281456 - Decouple TextureForwarder and CompositableForwarder. r=gw280
Matt Woodrow <mwoodrow@mozilla.com>
parents: 315202
diff changeset
   684
  ShmemAllocated(this);
302048
ada00a4c36c5ba384e2fdc2c4bd94f20fe7c744c Bug 1176011 - Move TextureClientPool to CompositorBridgeChild r=nical
George Wright <george@mozilla.com>
parents: 301875
diff changeset
   685
  return PCompositorBridgeChild::AllocUnsafeShmem(aSize, aType, aShmem);
ada00a4c36c5ba384e2fdc2c4bd94f20fe7c744c Bug 1176011 - Move TextureClientPool to CompositorBridgeChild r=nical
George Wright <george@mozilla.com>
parents: 301875
diff changeset
   686
}
ada00a4c36c5ba384e2fdc2c4bd94f20fe7c744c Bug 1176011 - Move TextureClientPool to CompositorBridgeChild r=nical
George Wright <george@mozilla.com>
parents: 301875
diff changeset
   687
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   688
bool CompositorBridgeChild::AllocShmem(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   689
    size_t aSize, ipc::SharedMemory::SharedMemoryType aType,
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   690
    ipc::Shmem* aShmem) {
315316
b7ead4d4eb90ac9e8f112574dc194691e507658e Bug 1281456 - Decouple TextureForwarder and CompositableForwarder. r=gw280
Matt Woodrow <mwoodrow@mozilla.com>
parents: 315202
diff changeset
   691
  ShmemAllocated(this);
302048
ada00a4c36c5ba384e2fdc2c4bd94f20fe7c744c Bug 1176011 - Move TextureClientPool to CompositorBridgeChild r=nical
George Wright <george@mozilla.com>
parents: 301875
diff changeset
   692
  return PCompositorBridgeChild::AllocShmem(aSize, aType, aShmem);
ada00a4c36c5ba384e2fdc2c4bd94f20fe7c744c Bug 1176011 - Move TextureClientPool to CompositorBridgeChild r=nical
George Wright <george@mozilla.com>
parents: 301875
diff changeset
   693
}
ada00a4c36c5ba384e2fdc2c4bd94f20fe7c744c Bug 1176011 - Move TextureClientPool to CompositorBridgeChild r=nical
George Wright <george@mozilla.com>
parents: 301875
diff changeset
   694
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   695
bool CompositorBridgeChild::DeallocShmem(ipc::Shmem& aShmem) {
319156
cd05381f28b151f9b8afb11af3f6b9366677d598 Fix assert deallocating shmems on GPU process restart. (bug 1311715, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 316433
diff changeset
   696
  if (!mCanSend) {
320981
5771d02d895e876ed321d5707ec984114c93e128 Bug 1300676 - Part 1: Allow asynchronous deletion of Shmem for VideoDecoderManagerChild. r=dvander
Matt Woodrow <mwoodrow@mozilla.com>
parents: 319700
diff changeset
   697
    return false;
319156
cd05381f28b151f9b8afb11af3f6b9366677d598 Fix assert deallocating shmems on GPU process restart. (bug 1311715, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 316433
diff changeset
   698
  }
320981
5771d02d895e876ed321d5707ec984114c93e128 Bug 1300676 - Part 1: Allow asynchronous deletion of Shmem for VideoDecoderManagerChild. r=dvander
Matt Woodrow <mwoodrow@mozilla.com>
parents: 319700
diff changeset
   699
  return PCompositorBridgeChild::DeallocShmem(aShmem);
302048
ada00a4c36c5ba384e2fdc2c4bd94f20fe7c744c Bug 1176011 - Move TextureClientPool to CompositorBridgeChild r=nical
George Wright <george@mozilla.com>
parents: 301875
diff changeset
   700
}
ada00a4c36c5ba384e2fdc2c4bd94f20fe7c744c Bug 1176011 - Move TextureClientPool to CompositorBridgeChild r=nical
George Wright <george@mozilla.com>
parents: 301875
diff changeset
   701
303388
bdd62c877b66dcfa83034d276f0b0c452dfcaebe Implement remote CompositorWidgets on Windows. (bug 1281998 part 7, r=billm)
David Anderson <danderson@mozilla.com>
parents: 303220
diff changeset
   702
widget::PCompositorWidgetChild*
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   703
CompositorBridgeChild::AllocPCompositorWidgetChild(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   704
    const CompositorWidgetInitData& aInitData) {
303388
bdd62c877b66dcfa83034d276f0b0c452dfcaebe Implement remote CompositorWidgets on Windows. (bug 1281998 part 7, r=billm)
David Anderson <danderson@mozilla.com>
parents: 303220
diff changeset
   705
  // We send the constructor manually.
bdd62c877b66dcfa83034d276f0b0c452dfcaebe Implement remote CompositorWidgets on Windows. (bug 1281998 part 7, r=billm)
David Anderson <danderson@mozilla.com>
parents: 303220
diff changeset
   706
  MOZ_CRASH("Should not be called");
bdd62c877b66dcfa83034d276f0b0c452dfcaebe Implement remote CompositorWidgets on Windows. (bug 1281998 part 7, r=billm)
David Anderson <danderson@mozilla.com>
parents: 303220
diff changeset
   707
  return nullptr;
bdd62c877b66dcfa83034d276f0b0c452dfcaebe Implement remote CompositorWidgets on Windows. (bug 1281998 part 7, r=billm)
David Anderson <danderson@mozilla.com>
parents: 303220
diff changeset
   708
}
bdd62c877b66dcfa83034d276f0b0c452dfcaebe Implement remote CompositorWidgets on Windows. (bug 1281998 part 7, r=billm)
David Anderson <danderson@mozilla.com>
parents: 303220
diff changeset
   709
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   710
bool CompositorBridgeChild::DeallocPCompositorWidgetChild(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   711
    PCompositorWidgetChild* aActor) {
303388
bdd62c877b66dcfa83034d276f0b0c452dfcaebe Implement remote CompositorWidgets on Windows. (bug 1281998 part 7, r=billm)
David Anderson <danderson@mozilla.com>
parents: 303220
diff changeset
   712
#ifdef MOZ_WIDGET_SUPPORTS_OOP_COMPOSITING
bdd62c877b66dcfa83034d276f0b0c452dfcaebe Implement remote CompositorWidgets on Windows. (bug 1281998 part 7, r=billm)
David Anderson <danderson@mozilla.com>
parents: 303220
diff changeset
   713
  delete aActor;
bdd62c877b66dcfa83034d276f0b0c452dfcaebe Implement remote CompositorWidgets on Windows. (bug 1281998 part 7, r=billm)
David Anderson <danderson@mozilla.com>
parents: 303220
diff changeset
   714
  return true;
bdd62c877b66dcfa83034d276f0b0c452dfcaebe Implement remote CompositorWidgets on Windows. (bug 1281998 part 7, r=billm)
David Anderson <danderson@mozilla.com>
parents: 303220
diff changeset
   715
#else
bdd62c877b66dcfa83034d276f0b0c452dfcaebe Implement remote CompositorWidgets on Windows. (bug 1281998 part 7, r=billm)
David Anderson <danderson@mozilla.com>
parents: 303220
diff changeset
   716
  return false;
bdd62c877b66dcfa83034d276f0b0c452dfcaebe Implement remote CompositorWidgets on Windows. (bug 1281998 part 7, r=billm)
David Anderson <danderson@mozilla.com>
parents: 303220
diff changeset
   717
#endif
bdd62c877b66dcfa83034d276f0b0c452dfcaebe Implement remote CompositorWidgets on Windows. (bug 1281998 part 7, r=billm)
David Anderson <danderson@mozilla.com>
parents: 303220
diff changeset
   718
}
bdd62c877b66dcfa83034d276f0b0c452dfcaebe Implement remote CompositorWidgets on Windows. (bug 1281998 part 7, r=billm)
David Anderson <danderson@mozilla.com>
parents: 303220
diff changeset
   719
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   720
PAPZCTreeManagerChild* CompositorBridgeChild::AllocPAPZCTreeManagerChild(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   721
    const LayersId& aLayersId) {
311190
5a883a5ff328b2de99c7cab5f1bcc04534dcda6f Bug 1289650 - Check the owning PID when creating PAPZCTreeManager, PLayerTransaction. r=kats,dvander
Ryan Hunt <rhunt@mozilla.com>
parents: 311045
diff changeset
   722
  APZCTreeManagerChild* child = new APZCTreeManagerChild();
451021
f8de6c2014ad30a05ed40e5862f3088388639e57 Bug 1514818 - Introduce the mIPCOpen boilerplate to APZCTreeManagerChild. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 448947
diff changeset
   723
  child->AddIPDLReference();
349802
3ff9768569a491da474c0ecea20317220c9ab9f4 Bug 1343479 - Label the tasks for APZ module. r=bevistseng,kats
Kevin Chen <kechen@mozilla.com>
parents: 347274
diff changeset
   724
311190
5a883a5ff328b2de99c7cab5f1bcc04534dcda6f Bug 1289650 - Check the owning PID when creating PAPZCTreeManager, PLayerTransaction. r=kats,dvander
Ryan Hunt <rhunt@mozilla.com>
parents: 311045
diff changeset
   725
  return child;
5a883a5ff328b2de99c7cab5f1bcc04534dcda6f Bug 1289650 - Check the owning PID when creating PAPZCTreeManager, PLayerTransaction. r=kats,dvander
Ryan Hunt <rhunt@mozilla.com>
parents: 311045
diff changeset
   726
}
5a883a5ff328b2de99c7cab5f1bcc04534dcda6f Bug 1289650 - Check the owning PID when creating PAPZCTreeManager, PLayerTransaction. r=kats,dvander
Ryan Hunt <rhunt@mozilla.com>
parents: 311045
diff changeset
   727
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   728
PAPZChild* CompositorBridgeChild::AllocPAPZChild(const LayersId& aLayersId) {
311192
1ad7640633fb14e1750f972aa70718c7c6e241e5 Bug 1289650 - Move PAPZ from PContent to PCompositorBridge. r=kats
Ryan Hunt <rhunt@mozilla.com>
parents: 311190
diff changeset
   729
  // We send the constructor manually.
1ad7640633fb14e1750f972aa70718c7c6e241e5 Bug 1289650 - Move PAPZ from PContent to PCompositorBridge. r=kats
Ryan Hunt <rhunt@mozilla.com>
parents: 311190
diff changeset
   730
  MOZ_CRASH("Should not be called");
1ad7640633fb14e1750f972aa70718c7c6e241e5 Bug 1289650 - Move PAPZ from PContent to PCompositorBridge. r=kats
Ryan Hunt <rhunt@mozilla.com>
parents: 311190
diff changeset
   731
  return nullptr;
1ad7640633fb14e1750f972aa70718c7c6e241e5 Bug 1289650 - Move PAPZ from PContent to PCompositorBridge. r=kats
Ryan Hunt <rhunt@mozilla.com>
parents: 311190
diff changeset
   732
}
1ad7640633fb14e1750f972aa70718c7c6e241e5 Bug 1289650 - Move PAPZ from PContent to PCompositorBridge. r=kats
Ryan Hunt <rhunt@mozilla.com>
parents: 311190
diff changeset
   733
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   734
bool CompositorBridgeChild::DeallocPAPZChild(PAPZChild* aActor) {
311192
1ad7640633fb14e1750f972aa70718c7c6e241e5 Bug 1289650 - Move PAPZ from PContent to PCompositorBridge. r=kats
Ryan Hunt <rhunt@mozilla.com>
parents: 311190
diff changeset
   735
  delete aActor;
1ad7640633fb14e1750f972aa70718c7c6e241e5 Bug 1289650 - Move PAPZ from PContent to PCompositorBridge. r=kats
Ryan Hunt <rhunt@mozilla.com>
parents: 311190
diff changeset
   736
  return true;
1ad7640633fb14e1750f972aa70718c7c6e241e5 Bug 1289650 - Move PAPZ from PContent to PCompositorBridge. r=kats
Ryan Hunt <rhunt@mozilla.com>
parents: 311190
diff changeset
   737
}
1ad7640633fb14e1750f972aa70718c7c6e241e5 Bug 1289650 - Move PAPZ from PContent to PCompositorBridge. r=kats
Ryan Hunt <rhunt@mozilla.com>
parents: 311190
diff changeset
   738
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   739
bool CompositorBridgeChild::DeallocPAPZCTreeManagerChild(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   740
    PAPZCTreeManagerChild* aActor) {
451021
f8de6c2014ad30a05ed40e5862f3088388639e57 Bug 1514818 - Introduce the mIPCOpen boilerplate to APZCTreeManagerChild. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 448947
diff changeset
   741
  APZCTreeManagerChild* child = static_cast<APZCTreeManagerChild*>(aActor);
f8de6c2014ad30a05ed40e5862f3088388639e57 Bug 1514818 - Introduce the mIPCOpen boilerplate to APZCTreeManagerChild. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 448947
diff changeset
   742
  child->ReleaseIPDLReference();
311190
5a883a5ff328b2de99c7cab5f1bcc04534dcda6f Bug 1289650 - Check the owning PID when creating PAPZCTreeManager, PLayerTransaction. r=kats,dvander
Ryan Hunt <rhunt@mozilla.com>
parents: 311045
diff changeset
   743
  return true;
5a883a5ff328b2de99c7cab5f1bcc04534dcda6f Bug 1289650 - Check the owning PID when creating PAPZCTreeManager, PLayerTransaction. r=kats,dvander
Ryan Hunt <rhunt@mozilla.com>
parents: 311045
diff changeset
   744
}
5a883a5ff328b2de99c7cab5f1bcc04534dcda6f Bug 1289650 - Check the owning PID when creating PAPZCTreeManager, PLayerTransaction. r=kats,dvander
Ryan Hunt <rhunt@mozilla.com>
parents: 311045
diff changeset
   745
509445
ccfa767dba644dc193e0246eb8e8ff3377e8b8a5 Bug 1477756 - Client-side bindings mirror for precise CC, and merge similar codepaths. r=handyman
Jeff Gilbert <jgilbert@mozilla.com>
parents: 509444
diff changeset
   746
// -
509444
71c122ac0ca73391866b1ef19f4f82bc2d28568b Bug 1477756 - Initial out-of-process WebGL implementation. r=mccr8,handyman
David Parks <davidp99@gmail.com>
parents: 505802
diff changeset
   747
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   748
void CompositorBridgeChild::WillEndTransaction() { ResetShmemCounter(); }
315316
b7ead4d4eb90ac9e8f112574dc194691e507658e Bug 1281456 - Decouple TextureForwarder and CompositableForwarder. r=gw280
Matt Woodrow <mwoodrow@mozilla.com>
parents: 315202
diff changeset
   749
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   750
PWebRenderBridgeChild* CompositorBridgeChild::AllocPWebRenderBridgeChild(
561253
207b0761ade5421696ed4865d41552add6edaaa3 Bug 1624264 - Use different texture cache sizes for popup windows. r=jrmuizel
Nicolas Silva <nsilva@mozilla.com>
parents: 558379
diff changeset
   751
    const wr::PipelineId& aPipelineId, const LayoutDeviceIntSize&,
207b0761ade5421696ed4865d41552add6edaaa3 Bug 1624264 - Use different texture cache sizes for popup windows. r=jrmuizel
Nicolas Silva <nsilva@mozilla.com>
parents: 558379
diff changeset
   752
    const WindowKind&) {
345780
709f9115cd7022ca78a5f448934acce353fe9f34 Bug 1342754 - Make WebRenderBridgeChild::mIdNamespace unique r=jrmuizel
sotaro <sotaro.ikeda.g@gmail.com>
parents: 345774
diff changeset
   753
  WebRenderBridgeChild* child = new WebRenderBridgeChild(aPipelineId);
341891
8ecafae107fbb8856948513301e2a726256b19d8 Bug 1320023 - Make WebRenderBridgeChild destroy simiar to LayerTransactionChild r=nical
sotaro <sotaro.ikeda.g@gmail.com>
parents: 341853
diff changeset
   754
  child->AddIPDLReference();
341822
b4e83ae3d878b1552bbc142d848151db100ceba6 Bug 1317774 - Add gfx code needed to use WebRender in gecko. r=gfx
Mozilla Graphics Team <graphics@mozilla.com>
parents: 322595
diff changeset
   755
  return child;
b4e83ae3d878b1552bbc142d848151db100ceba6 Bug 1317774 - Add gfx code needed to use WebRender in gecko. r=gfx
Mozilla Graphics Team <graphics@mozilla.com>
parents: 322595
diff changeset
   756
}
b4e83ae3d878b1552bbc142d848151db100ceba6 Bug 1317774 - Add gfx code needed to use WebRender in gecko. r=gfx
Mozilla Graphics Team <graphics@mozilla.com>
parents: 322595
diff changeset
   757
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   758
bool CompositorBridgeChild::DeallocPWebRenderBridgeChild(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   759
    PWebRenderBridgeChild* aActor) {
341822
b4e83ae3d878b1552bbc142d848151db100ceba6 Bug 1317774 - Add gfx code needed to use WebRender in gecko. r=gfx
Mozilla Graphics Team <graphics@mozilla.com>
parents: 322595
diff changeset
   760
  WebRenderBridgeChild* child = static_cast<WebRenderBridgeChild*>(aActor);
341891
8ecafae107fbb8856948513301e2a726256b19d8 Bug 1320023 - Make WebRenderBridgeChild destroy simiar to LayerTransactionChild r=nical
sotaro <sotaro.ikeda.g@gmail.com>
parents: 341853
diff changeset
   761
  child->ReleaseIPDLReference();
341822
b4e83ae3d878b1552bbc142d848151db100ceba6 Bug 1317774 - Add gfx code needed to use WebRender in gecko. r=gfx
Mozilla Graphics Team <graphics@mozilla.com>
parents: 322595
diff changeset
   762
  return true;
b4e83ae3d878b1552bbc142d848151db100ceba6 Bug 1317774 - Add gfx code needed to use WebRender in gecko. r=gfx
Mozilla Graphics Team <graphics@mozilla.com>
parents: 322595
diff changeset
   763
}
b4e83ae3d878b1552bbc142d848151db100ceba6 Bug 1317774 - Add gfx code needed to use WebRender in gecko. r=gfx
Mozilla Graphics Team <graphics@mozilla.com>
parents: 322595
diff changeset
   764
501881
97b72aea347c896e1429de4ca15624a12833a46b Bug 1575008 - WebGPU implementation basis r=baku,bzbarsky
Dzmitry Malyshau <dmalyshau@mozilla.com>
parents: 501765
diff changeset
   765
webgpu::PWebGPUChild* CompositorBridgeChild::AllocPWebGPUChild() {
97b72aea347c896e1429de4ca15624a12833a46b Bug 1575008 - WebGPU implementation basis r=baku,bzbarsky
Dzmitry Malyshau <dmalyshau@mozilla.com>
parents: 501765
diff changeset
   766
  webgpu::WebGPUChild* child = new webgpu::WebGPUChild();
97b72aea347c896e1429de4ca15624a12833a46b Bug 1575008 - WebGPU implementation basis r=baku,bzbarsky
Dzmitry Malyshau <dmalyshau@mozilla.com>
parents: 501765
diff changeset
   767
  child->AddIPDLReference();
97b72aea347c896e1429de4ca15624a12833a46b Bug 1575008 - WebGPU implementation basis r=baku,bzbarsky
Dzmitry Malyshau <dmalyshau@mozilla.com>
parents: 501765
diff changeset
   768
  return child;
97b72aea347c896e1429de4ca15624a12833a46b Bug 1575008 - WebGPU implementation basis r=baku,bzbarsky
Dzmitry Malyshau <dmalyshau@mozilla.com>
parents: 501765
diff changeset
   769
}
97b72aea347c896e1429de4ca15624a12833a46b Bug 1575008 - WebGPU implementation basis r=baku,bzbarsky
Dzmitry Malyshau <dmalyshau@mozilla.com>
parents: 501765
diff changeset
   770
97b72aea347c896e1429de4ca15624a12833a46b Bug 1575008 - WebGPU implementation basis r=baku,bzbarsky
Dzmitry Malyshau <dmalyshau@mozilla.com>
parents: 501765
diff changeset
   771
bool CompositorBridgeChild::DeallocPWebGPUChild(webgpu::PWebGPUChild* aActor) {
97b72aea347c896e1429de4ca15624a12833a46b Bug 1575008 - WebGPU implementation basis r=baku,bzbarsky
Dzmitry Malyshau <dmalyshau@mozilla.com>
parents: 501765
diff changeset
   772
  webgpu::WebGPUChild* child = static_cast<webgpu::WebGPUChild*>(aActor);
97b72aea347c896e1429de4ca15624a12833a46b Bug 1575008 - WebGPU implementation basis r=baku,bzbarsky
Dzmitry Malyshau <dmalyshau@mozilla.com>
parents: 501765
diff changeset
   773
  child->ReleaseIPDLReference();
97b72aea347c896e1429de4ca15624a12833a46b Bug 1575008 - WebGPU implementation basis r=baku,bzbarsky
Dzmitry Malyshau <dmalyshau@mozilla.com>
parents: 501765
diff changeset
   774
  return true;
97b72aea347c896e1429de4ca15624a12833a46b Bug 1575008 - WebGPU implementation basis r=baku,bzbarsky
Dzmitry Malyshau <dmalyshau@mozilla.com>
parents: 501765
diff changeset
   775
}
97b72aea347c896e1429de4ca15624a12833a46b Bug 1575008 - WebGPU implementation basis r=baku,bzbarsky
Dzmitry Malyshau <dmalyshau@mozilla.com>
parents: 501765
diff changeset
   776
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   777
uint64_t CompositorBridgeChild::GetNextResourceId() {
361247
392436e4adff730e3d8da332bcde199bd1151a7b Bug 1366915 part 2 - Make CompositorBridgeChild allocate pipeline id for async image pipeline r=nical
sotaro <sotaro.ikeda.g@gmail.com>
parents: 359348
diff changeset
   778
  ++mResourceId;
392436e4adff730e3d8da332bcde199bd1151a7b Bug 1366915 part 2 - Make CompositorBridgeChild allocate pipeline id for async image pipeline r=nical
sotaro <sotaro.ikeda.g@gmail.com>
parents: 359348
diff changeset
   779
  MOZ_RELEASE_ASSERT(mResourceId != UINT32_MAX);
392436e4adff730e3d8da332bcde199bd1151a7b Bug 1366915 part 2 - Make CompositorBridgeChild allocate pipeline id for async image pipeline r=nical
sotaro <sotaro.ikeda.g@gmail.com>
parents: 359348
diff changeset
   780
392436e4adff730e3d8da332bcde199bd1151a7b Bug 1366915 part 2 - Make CompositorBridgeChild allocate pipeline id for async image pipeline r=nical
sotaro <sotaro.ikeda.g@gmail.com>
parents: 359348
diff changeset
   781
  uint64_t id = mIdNamespace;
392436e4adff730e3d8da332bcde199bd1151a7b Bug 1366915 part 2 - Make CompositorBridgeChild allocate pipeline id for async image pipeline r=nical
sotaro <sotaro.ikeda.g@gmail.com>
parents: 359348
diff changeset
   782
  id = (id << 32) | mResourceId;
392436e4adff730e3d8da332bcde199bd1151a7b Bug 1366915 part 2 - Make CompositorBridgeChild allocate pipeline id for async image pipeline r=nical
sotaro <sotaro.ikeda.g@gmail.com>
parents: 359348
diff changeset
   783
392436e4adff730e3d8da332bcde199bd1151a7b Bug 1366915 part 2 - Make CompositorBridgeChild allocate pipeline id for async image pipeline r=nical
sotaro <sotaro.ikeda.g@gmail.com>
parents: 359348
diff changeset
   784
  return id;
392436e4adff730e3d8da332bcde199bd1151a7b Bug 1366915 part 2 - Make CompositorBridgeChild allocate pipeline id for async image pipeline r=nical
sotaro <sotaro.ikeda.g@gmail.com>
parents: 359348
diff changeset
   785
}
392436e4adff730e3d8da332bcde199bd1151a7b Bug 1366915 part 2 - Make CompositorBridgeChild allocate pipeline id for async image pipeline r=nical
sotaro <sotaro.ikeda.g@gmail.com>
parents: 359348
diff changeset
   786
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   787
wr::MaybeExternalImageId CompositorBridgeChild::GetNextExternalImageId() {
361247
392436e4adff730e3d8da332bcde199bd1151a7b Bug 1366915 part 2 - Make CompositorBridgeChild allocate pipeline id for async image pipeline r=nical
sotaro <sotaro.ikeda.g@gmail.com>
parents: 359348
diff changeset
   788
  return Some(wr::ToExternalImageId(GetNextResourceId()));
392436e4adff730e3d8da332bcde199bd1151a7b Bug 1366915 part 2 - Make CompositorBridgeChild allocate pipeline id for async image pipeline r=nical
sotaro <sotaro.ikeda.g@gmail.com>
parents: 359348
diff changeset
   789
}
353420
de44ef87432b3ca50dff0fc3c4a76b2d539d1ac8 Bug 1356190 - Fix GetNextExternalImageId() r=jrmuizel
sotaro <sotaro.ikeda.g@gmail.com>
parents: 352557
diff changeset
   790
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   791
wr::PipelineId CompositorBridgeChild::GetNextPipelineId() {
361247
392436e4adff730e3d8da332bcde199bd1151a7b Bug 1366915 part 2 - Make CompositorBridgeChild allocate pipeline id for async image pipeline r=nical
sotaro <sotaro.ikeda.g@gmail.com>
parents: 359348
diff changeset
   792
  return wr::AsPipelineId(GetNextResourceId());
353420
de44ef87432b3ca50dff0fc3c4a76b2d539d1ac8 Bug 1356190 - Fix GetNextExternalImageId() r=jrmuizel
sotaro <sotaro.ikeda.g@gmail.com>
parents: 352557
diff changeset
   793
}
de44ef87432b3ca50dff0fc3c4a76b2d539d1ac8 Bug 1356190 - Fix GetNextExternalImageId() r=jrmuizel
sotaro <sotaro.ikeda.g@gmail.com>
parents: 352557
diff changeset
   794
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   795
bool CompositorBridgeChild::NotifyBeginAsyncEndLayerTransaction(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   796
    SyncObjectClient* aSyncObject) {
375360
7bd53f7a21168f28a974a92c6cb1dceaaf590cd9 Bug 1390755 - Ensure PaintThread::EndTransaction runs before IPDL messages are resumed. r=mchang
Ryan Hunt <rhunt@eqrion.net>
parents: 374728
diff changeset
   797
  MOZ_ASSERT(NS_IsMainThread());
7bd53f7a21168f28a974a92c6cb1dceaaf590cd9 Bug 1390755 - Ensure PaintThread::EndTransaction runs before IPDL messages are resumed. r=mchang
Ryan Hunt <rhunt@eqrion.net>
parents: 374728
diff changeset
   798
  MonitorAutoLock lock(mPaintLock);
7bd53f7a21168f28a974a92c6cb1dceaaf590cd9 Bug 1390755 - Ensure PaintThread::EndTransaction runs before IPDL messages are resumed. r=mchang
Ryan Hunt <rhunt@eqrion.net>
parents: 374728
diff changeset
   799
7bd53f7a21168f28a974a92c6cb1dceaaf590cd9 Bug 1390755 - Ensure PaintThread::EndTransaction runs before IPDL messages are resumed. r=mchang
Ryan Hunt <rhunt@eqrion.net>
parents: 374728
diff changeset
   800
  MOZ_ASSERT(!mOutstandingAsyncEndTransaction);
7bd53f7a21168f28a974a92c6cb1dceaaf590cd9 Bug 1390755 - Ensure PaintThread::EndTransaction runs before IPDL messages are resumed. r=mchang
Ryan Hunt <rhunt@eqrion.net>
parents: 374728
diff changeset
   801
  mOutstandingAsyncEndTransaction = true;
398688
b7d96ef3b33c77e7a8fe367d4b6c463a07aac63a Create a PaintWorker thread pool and dispatch tiles to it (bug 1425056, r=bas)
Ryan Hunt <rhunt@eqrion.net>
parents: 397180
diff changeset
   802
  mOutstandingAsyncSyncObject = aSyncObject;
b7d96ef3b33c77e7a8fe367d4b6c463a07aac63a Create a PaintWorker thread pool and dispatch tiles to it (bug 1425056, r=bas)
Ryan Hunt <rhunt@eqrion.net>
parents: 397180
diff changeset
   803
  return mOutstandingAsyncPaints == 0;
375360
7bd53f7a21168f28a974a92c6cb1dceaaf590cd9 Bug 1390755 - Ensure PaintThread::EndTransaction runs before IPDL messages are resumed. r=mchang
Ryan Hunt <rhunt@eqrion.net>
parents: 374728
diff changeset
   804
}
7bd53f7a21168f28a974a92c6cb1dceaaf590cd9 Bug 1390755 - Ensure PaintThread::EndTransaction runs before IPDL messages are resumed. r=mchang
Ryan Hunt <rhunt@eqrion.net>
parents: 374728
diff changeset
   805
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   806
}  // namespace layers
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 447335
diff changeset
   807
}  // namespace mozilla