gfx/layers/ipc/LayersMessages.ipdlh

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

michael@0 1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
michael@0 2 * vim: sw=2 ts=8 et :
michael@0 3 */
michael@0 4 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 5 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 7
michael@0 8 include LayersSurfaces;
michael@0 9 include protocol PCompositable;
michael@0 10 include protocol PCompositor;
michael@0 11 include protocol PGrallocBuffer;
michael@0 12 include protocol PLayer;
michael@0 13 include protocol PRenderFrame;
michael@0 14 include protocol PTexture;
michael@0 15
michael@0 16 include "gfxipc/ShadowLayerUtils.h";
michael@0 17 include "mozilla/GfxMessageUtils.h";
michael@0 18 include "ImageLayers.h";
michael@0 19
michael@0 20 using mozilla::GraphicsFilterType from "mozilla/GfxMessageUtils.h";
michael@0 21 using struct gfxRGBA from "gfxColor.h";
michael@0 22 using struct gfxPoint3D from "gfxPoint3D.h";
michael@0 23 using class mozilla::gfx::Matrix4x4 from "mozilla/gfx/Matrix.h";
michael@0 24 using class gfx3DMatrix from "gfx3DMatrix.h";
michael@0 25 using nscoord from "nsCoord.h";
michael@0 26 using struct nsIntPoint from "nsPoint.h";
michael@0 27 using struct nsRect from "nsRect.h";
michael@0 28 using struct nsPoint from "nsPoint.h";
michael@0 29 using class mozilla::TimeDuration from "mozilla/TimeStamp.h";
michael@0 30 using class mozilla::TimeStamp from "mozilla/TimeStamp.h";
michael@0 31 using mozilla::ScreenRotation from "mozilla/WidgetUtils.h";
michael@0 32 using nsCSSProperty from "nsCSSProperty.h";
michael@0 33 using mozilla::dom::ScreenOrientation from "mozilla/dom/ScreenOrientation.h";
michael@0 34 using struct mozilla::layers::TextureInfo from "mozilla/layers/CompositorTypes.h";
michael@0 35 using mozilla::LayerMargin from "Units.h";
michael@0 36 using mozilla::LayerPoint from "Units.h";
michael@0 37 using mozilla::LayerRect from "Units.h";
michael@0 38 using mozilla::layers::ScaleMode from "mozilla/layers/LayersTypes.h";
michael@0 39 using mozilla::layers::EventRegions from "mozilla/layers/LayersTypes.h";
michael@0 40 using mozilla::layers::DiagnosticTypes from "mozilla/layers/CompositorTypes.h";
michael@0 41 using struct mozilla::layers::FrameMetrics from "FrameMetrics.h";
michael@0 42 using mozilla::layers::FrameMetrics::ViewID from "FrameMetrics.h";
michael@0 43 using struct mozilla::layers::FenceHandle from "mozilla/layers/FenceUtils.h";
michael@0 44
michael@0 45 namespace mozilla {
michael@0 46 namespace layers {
michael@0 47
michael@0 48 struct TargetConfig {
michael@0 49 nsIntRect naturalBounds;
michael@0 50 ScreenRotation rotation;
michael@0 51 nsIntRect clientBounds;
michael@0 52 ScreenOrientation orientation;
michael@0 53 nsIntRegion clearRegion;
michael@0 54 };
michael@0 55
michael@0 56 // Create a shadow layer for |layer|
michael@0 57 struct OpCreateThebesLayer { PLayer layer; };
michael@0 58 struct OpCreateContainerLayer { PLayer layer; };
michael@0 59 struct OpCreateImageLayer { PLayer layer; };
michael@0 60 struct OpCreateColorLayer { PLayer layer; };
michael@0 61 struct OpCreateCanvasLayer { PLayer layer; };
michael@0 62 struct OpCreateRefLayer { PLayer layer; };
michael@0 63
michael@0 64 struct OpAttachCompositable {
michael@0 65 PLayer layer;
michael@0 66 PCompositable compositable;
michael@0 67 };
michael@0 68
michael@0 69 struct OpAttachAsyncCompositable {
michael@0 70 PLayer layer;
michael@0 71 uint64_t containerID;
michael@0 72 };
michael@0 73
michael@0 74 struct ThebesBufferData {
michael@0 75 nsIntRect rect;
michael@0 76 nsIntPoint rotation;
michael@0 77 };
michael@0 78
michael@0 79 struct CubicBezierFunction {
michael@0 80 float x1;
michael@0 81 float y1;
michael@0 82 float x2;
michael@0 83 float y2;
michael@0 84 };
michael@0 85
michael@0 86 struct StepFunction {
michael@0 87 int steps;
michael@0 88 // 1 = nsTimingFunction::StepStart, 2 = nsTimingFunction::StepEnd
michael@0 89 int type;
michael@0 90 };
michael@0 91
michael@0 92 union TimingFunction {
michael@0 93 CubicBezierFunction;
michael@0 94 StepFunction;
michael@0 95 };
michael@0 96
michael@0 97 struct LayerColor { gfxRGBA value; };
michael@0 98 struct Perspective { float value; };
michael@0 99 struct RotationX { float radians; };
michael@0 100 struct RotationY { float radians; };
michael@0 101 struct RotationZ { float radians; };
michael@0 102 struct Rotation { float radians; };
michael@0 103 struct Rotation3D {
michael@0 104 float x;
michael@0 105 float y;
michael@0 106 float z;
michael@0 107 float radians;
michael@0 108 };
michael@0 109 struct Scale {
michael@0 110 float x;
michael@0 111 float y;
michael@0 112 float z;
michael@0 113 };
michael@0 114 struct Skew { float x; float y; };
michael@0 115 struct SkewX { float x; };
michael@0 116 struct SkewY { float y; };
michael@0 117 struct TransformMatrix { Matrix4x4 value; };
michael@0 118 struct Translation {
michael@0 119 float x;
michael@0 120 float y;
michael@0 121 float z;
michael@0 122 };
michael@0 123
michael@0 124 union TransformFunction {
michael@0 125 Perspective;
michael@0 126 RotationX;
michael@0 127 RotationY;
michael@0 128 RotationZ;
michael@0 129 Rotation;
michael@0 130 Rotation3D;
michael@0 131 Scale;
michael@0 132 Skew;
michael@0 133 SkewX;
michael@0 134 SkewY;
michael@0 135 Translation;
michael@0 136 TransformMatrix;
michael@0 137 };
michael@0 138
michael@0 139 union Animatable {
michael@0 140 float;
michael@0 141 TransformFunction[];
michael@0 142 };
michael@0 143
michael@0 144 struct AnimationSegment {
michael@0 145 Animatable startState;
michael@0 146 Animatable endState;
michael@0 147 float startPortion;
michael@0 148 float endPortion;
michael@0 149 TimingFunction sampleFn;
michael@0 150 };
michael@0 151
michael@0 152 // Transforms need extra information to correctly convert the list of transform
michael@0 153 // functions to a gfx3DMatrix that can be applied directly to the layer.
michael@0 154 struct TransformData {
michael@0 155 // the origin of the frame being transformed in app units
michael@0 156 nsPoint origin;
michael@0 157 // the transform-origin property for the transform in css pixels
michael@0 158 gfxPoint3D transformOrigin;
michael@0 159 // the perspective-origin property for the transform in css pixels
michael@0 160 gfxPoint3D perspectiveOrigin;
michael@0 161 nsRect bounds;
michael@0 162 nscoord perspective;
michael@0 163 int32_t appUnitsPerDevPixel;
michael@0 164 };
michael@0 165
michael@0 166 union AnimationData {
michael@0 167 null_t;
michael@0 168 TransformData;
michael@0 169 };
michael@0 170
michael@0 171 struct Animation {
michael@0 172 // Unlike in nsAnimationManager, this start time is at the end of the
michael@0 173 // delay. If the delay is changed dynamically, the layer's data will
michael@0 174 // be updated.
michael@0 175 TimeStamp startTime;
michael@0 176 TimeDuration duration;
michael@0 177 // For each frame, the interpolation point is computed based on the
michael@0 178 // startTime, the direction, the duration, and the current time.
michael@0 179 // The segments must uniquely cover the portion from 0.0 to 1.0
michael@0 180 AnimationSegment[] segments;
michael@0 181 // How many times to repeat the animation. -1 means "forever".
michael@0 182 float numIterations;
michael@0 183 // This uses the NS_STYLE_ANIMATION_DIRECTION_* constants.
michael@0 184 int32_t direction;
michael@0 185 nsCSSProperty property;
michael@0 186 AnimationData data;
michael@0 187 };
michael@0 188
michael@0 189 // Change a layer's attributes
michael@0 190 struct CommonLayerAttributes {
michael@0 191 nsIntRegion visibleRegion;
michael@0 192 EventRegions eventRegions;
michael@0 193 TransformMatrix transform;
michael@0 194 float postXScale;
michael@0 195 float postYScale;
michael@0 196 uint32_t contentFlags;
michael@0 197 float opacity;
michael@0 198 bool useClipRect;
michael@0 199 nsIntRect clipRect;
michael@0 200 bool isFixedPosition;
michael@0 201 LayerPoint fixedPositionAnchor;
michael@0 202 LayerMargin fixedPositionMargin;
michael@0 203 bool isStickyPosition;
michael@0 204 uint64_t stickyScrollContainerId;
michael@0 205 LayerRect stickyScrollRangeOuter;
michael@0 206 LayerRect stickyScrollRangeInner;
michael@0 207 uint64_t scrollbarTargetContainerId;
michael@0 208 uint32_t scrollbarDirection;
michael@0 209 nullable PLayer maskLayer;
michael@0 210 // Animated colors will only honored for ColorLayers.
michael@0 211 Animation[] animations;
michael@0 212 nsIntRegion invalidRegion;
michael@0 213 };
michael@0 214
michael@0 215 struct ThebesLayerAttributes {
michael@0 216 nsIntRegion validRegion;
michael@0 217 };
michael@0 218 struct ContainerLayerAttributes {
michael@0 219 FrameMetrics metrics;
michael@0 220 ViewID scrollParentId;
michael@0 221 float preXScale;
michael@0 222 float preYScale;
michael@0 223 float inheritedXScale;
michael@0 224 float inheritedYScale;
michael@0 225 };
michael@0 226 struct ColorLayerAttributes { LayerColor color; nsIntRect bounds; };
michael@0 227 struct CanvasLayerAttributes { GraphicsFilterType filter; nsIntRect bounds; };
michael@0 228 struct RefLayerAttributes { int64_t id; };
michael@0 229 struct ImageLayerAttributes { GraphicsFilterType filter; IntSize scaleToSize; ScaleMode scaleMode; };
michael@0 230
michael@0 231 union SpecificLayerAttributes {
michael@0 232 null_t;
michael@0 233 ThebesLayerAttributes;
michael@0 234 ContainerLayerAttributes;
michael@0 235 ColorLayerAttributes;
michael@0 236 CanvasLayerAttributes;
michael@0 237 RefLayerAttributes;
michael@0 238 ImageLayerAttributes;
michael@0 239 };
michael@0 240
michael@0 241 struct LayerAttributes {
michael@0 242 CommonLayerAttributes common;
michael@0 243 SpecificLayerAttributes specific;
michael@0 244 };
michael@0 245
michael@0 246 struct OpSetLayerAttributes {
michael@0 247 PLayer layer;
michael@0 248 LayerAttributes attrs;
michael@0 249 };
michael@0 250
michael@0 251 // Monkey with the tree structure
michael@0 252 struct OpSetRoot { PLayer root; };
michael@0 253 struct OpInsertAfter { PLayer container; PLayer childLayer; PLayer after; };
michael@0 254 struct OpPrependChild { PLayer container; PLayer childLayer; };
michael@0 255 struct OpRemoveChild { PLayer container; PLayer childLayer; };
michael@0 256 struct OpRepositionChild { PLayer container; PLayer childLayer; PLayer after; };
michael@0 257 struct OpRaiseToTopChild { PLayer container; PLayer childLayer; };
michael@0 258
michael@0 259 struct OpSetDiagnosticTypes { DiagnosticTypes diagnostics; };
michael@0 260
michael@0 261 struct ShmemSection {
michael@0 262 Shmem shmem;
michael@0 263 uint32_t offset;
michael@0 264 size_t size;
michael@0 265 };
michael@0 266
michael@0 267 union TileLock {
michael@0 268 ShmemSection;
michael@0 269 uintptr_t;
michael@0 270 };
michael@0 271
michael@0 272 struct TexturedTileDescriptor {
michael@0 273 PTexture texture;
michael@0 274 TileLock sharedLock;
michael@0 275 };
michael@0 276
michael@0 277 struct PlaceholderTileDescriptor {
michael@0 278 };
michael@0 279
michael@0 280 union TileDescriptor {
michael@0 281 TexturedTileDescriptor;
michael@0 282 PlaceholderTileDescriptor;
michael@0 283 };
michael@0 284
michael@0 285 struct SurfaceDescriptorTiles {
michael@0 286 nsIntRegion validRegion;
michael@0 287 nsIntRegion paintedRegion;
michael@0 288 TileDescriptor[] tiles;
michael@0 289 int retainedWidth;
michael@0 290 int retainedHeight;
michael@0 291 float resolution;
michael@0 292 float frameResolution;
michael@0 293 };
michael@0 294
michael@0 295 struct OpUseTiledLayerBuffer {
michael@0 296 PCompositable compositable;
michael@0 297 SurfaceDescriptorTiles tileLayerDescriptor;
michael@0 298 };
michael@0 299
michael@0 300 struct OpCreatedIncrementalTexture {
michael@0 301 PCompositable compositable;
michael@0 302 TextureInfo textureInfo;
michael@0 303 nsIntRect bufferRect;
michael@0 304 };
michael@0 305
michael@0 306 struct OpPaintTextureRegion {
michael@0 307 PCompositable compositable;
michael@0 308 ThebesBufferData bufferData;
michael@0 309 nsIntRegion updatedRegion;
michael@0 310 };
michael@0 311
michael@0 312 struct OpPaintTextureIncremental {
michael@0 313 PCompositable compositable;
michael@0 314 uint32_t textureId;
michael@0 315 SurfaceDescriptor image;
michael@0 316 nsIntRegion updatedRegion;
michael@0 317 nsIntRect bufferRect;
michael@0 318 nsIntPoint bufferRotation;
michael@0 319 };
michael@0 320
michael@0 321 struct OpUpdatePictureRect {
michael@0 322 PCompositable compositable;
michael@0 323 nsIntRect picture;
michael@0 324 };
michael@0 325
michael@0 326 /**
michael@0 327 * Tells the CompositableHost to remove the corresponding TextureHost
michael@0 328 */
michael@0 329 struct OpRemoveTexture {
michael@0 330 PCompositable compositable;
michael@0 331 PTexture texture;
michael@0 332 };
michael@0 333
michael@0 334 /**
michael@0 335 * Tells the compositor-side which texture to use (for example, as front buffer
michael@0 336 * if there is several textures for double buffering)
michael@0 337 */
michael@0 338 struct OpUseTexture {
michael@0 339 PCompositable compositable;
michael@0 340 PTexture texture;
michael@0 341 };
michael@0 342
michael@0 343 struct OpUseComponentAlphaTextures {
michael@0 344 PCompositable compositable;
michael@0 345 PTexture textureOnBlack;
michael@0 346 PTexture textureOnWhite;
michael@0 347 };
michael@0 348
michael@0 349 union MaybeRegion {
michael@0 350 nsIntRegion;
michael@0 351 null_t;
michael@0 352 };
michael@0 353
michael@0 354 struct OpUpdateTexture {
michael@0 355 PCompositable compositable;
michael@0 356 PTexture texture;
michael@0 357 MaybeRegion region;
michael@0 358 };
michael@0 359
michael@0 360 union CompositableOperation {
michael@0 361 OpUpdatePictureRect;
michael@0 362
michael@0 363 OpCreatedIncrementalTexture;
michael@0 364
michael@0 365 OpPaintTextureRegion;
michael@0 366 OpPaintTextureIncremental;
michael@0 367
michael@0 368 OpUseTiledLayerBuffer;
michael@0 369
michael@0 370 OpRemoveTexture;
michael@0 371
michael@0 372 OpUpdateTexture;
michael@0 373 OpUseTexture;
michael@0 374 OpUseComponentAlphaTextures;
michael@0 375 };
michael@0 376
michael@0 377 // A unit of a changeset; a set of these comprise a changeset
michael@0 378 union Edit {
michael@0 379 OpCreateThebesLayer;
michael@0 380 OpCreateContainerLayer;
michael@0 381 OpCreateImageLayer;
michael@0 382 OpCreateColorLayer;
michael@0 383 OpCreateCanvasLayer;
michael@0 384 OpCreateRefLayer;
michael@0 385
michael@0 386 OpSetLayerAttributes;
michael@0 387 OpSetDiagnosticTypes;
michael@0 388
michael@0 389 OpSetRoot;
michael@0 390 OpInsertAfter;
michael@0 391 OpPrependChild;
michael@0 392 OpRemoveChild;
michael@0 393 OpRepositionChild;
michael@0 394 OpRaiseToTopChild;
michael@0 395
michael@0 396 OpAttachCompositable;
michael@0 397 OpAttachAsyncCompositable;
michael@0 398
michael@0 399 CompositableOperation;
michael@0 400 };
michael@0 401
michael@0 402
michael@0 403 // Replies to operations
michael@0 404
michael@0 405 struct OpContentBufferSwap {
michael@0 406 PCompositable compositable;
michael@0 407 nsIntRegion frontUpdatedRegion;
michael@0 408 };
michael@0 409
michael@0 410 struct OpTextureSwap {
michael@0 411 PCompositable compositable;
michael@0 412 uint32_t textureId;
michael@0 413 SurfaceDescriptor image;
michael@0 414 };
michael@0 415
michael@0 416 struct ReturnReleaseFence {
michael@0 417 PCompositable compositable;
michael@0 418 PTexture texture;
michael@0 419 FenceHandle fence;
michael@0 420 };
michael@0 421
michael@0 422 // Unit of a "changeset reply". This is a weird abstraction, probably
michael@0 423 // only to be used for buffer swapping.
michael@0 424 union EditReply {
michael@0 425 OpContentBufferSwap;
michael@0 426 OpTextureSwap;
michael@0 427
michael@0 428 ReturnReleaseFence;
michael@0 429 };
michael@0 430
michael@0 431 } // namespace
michael@0 432 } // namespace

mercurial