Files
palemoon27/widget/nsShmImage.h
T
roytam1 60a7b63caa import changes from `dev' branch of rmottola/Arctic-Fox:
- Bug 1202965 (part 1) - Add MOZ_UNUSED. r=froydnj. (457960f48)
- Bug 1200097 - Fix warnings in logalloc. r=glandium. (3f115e470)
- Bug 1200623 - Fix FdPrintf.o link error in --disable-optimize builds. r=glandium. (4f07a36e2)
- Bug 1202965 (part 2) - Use MOZ_UNUSED in FdPrintf.c. r=glandium. (2dd55aaa7)
- Bug 1203314 - Make operator<< a method on unused_t. r=froydnj This prevents operator overload resolution from failing when this file is included in a file that uses Chromium IPC logging. (80f5cf4c5)
- Bug 1014691 - Move APZ mochitests to gfx/layers/apz/test/mochitest. r=kats (b3e811b10)
- Bug 1014691 - Move TestAsyncPanZoomController.cpp to gfx/layers/apz/test/gtest. r=kats,glandium (7c7598033)
- Bug 1083101 - Add a memory arena to Moz2D. r=jrmuizel (986b49392)
- Bug 1083101 - Add a task scheduler to Moz2D. r=jrmuizel (58002f967)
- partial of Bug 1140675 - Disable failing tests on windows opt. r=me (8d4b5b761)
- Bug 1170081 - Add a tag to run only mochitests that use HTMLMediaElement::MozCaptureStream. r=cpearce. (fc9e19146)
- Bug 1189744 - Fix crash after GetOwnPropertyDescriptor failed to populate all fields of desc. r=jandem, a=abillings. (464905f1b)
- Bug 1184414 - X.[[SetPrototypeOf]](Y) should succeed if X.[[Prototype]] is already Y. r=jorendorff. (3c3b9767c)
- Bug 1240792 - Test that assignment to primitives throws in strict mode. r=jorendorff (5fe30b7d1)
- Bug 1172609 - Part 5: Add js::ResetTimeZone() function. r=waldo, r=ted (2f8021714)
- Bug 1172609 - Part 6: Add nsJSUtils::ResetTimeZone() function. r=ehsan (35c1bbeb2)
- Bug 1172609 - Part 7: Hal calls nsJSUtils::ResetTimeZone() when timezone changes. r=dhylands (fe55a0830)
- Bug 1150534 - Synchronously decode favicons before calling GetFrame. r=tn (4f1acc810)
- Bug 1168495 - Restrict updated region to fall within GTK window. r=jrmuizel (d92a71a5c)
- Bug 1180971 - Fix X11 SHM invalidation regions on HiDPI with GTK3. r=karlt (98cce94d0)
- Bug 1156182 - Prevent widgets from creating a LayerManager during shutdown. r=sotaro (4af6914c9)
- Bug 1194397 - Force gdk_window_ensure_native on gdk window creation. r=acomminos (06a6eb2d8)
- Bug 1190935 - Fix race condition in gtk window EndRemoteDrawingInRegion. r=nical (cc7468e81)
- Bug 1182972 - Fallback to GTK monitor scale factor when mGdkWindow is null. r=karlt (69326bcfd)
- Bug 1168843 - use thread-safe refcounting for shared memory surfaces to avoid shutdown crashes. r=jmuizelaar (1d9b0914e)
- Bug 1167786. Restrict bounds of drawn region to the nsShmImage bounds to avoid X errors. r=karlt (005464f91)
- Bug 1205045 - remove GTK calls from compositor thread. r=jmuizelaar (ce5753137)
- Bug 1120851 - Set candidate window position for prediction even if no composition. r=masayuki (5814e776e)
- Bug 1176843 - Don't query caret rect on layout change. r=masayuki (4673f14ff)
- Bug 1177171 - Round widget coordinates on GTK3. r=karlt (3cd3af1c1)
- Bug 1186017 part.1 Rename nsGtkIMModule to mozilla::widget::IMContextWrapper r=m_kato+kerlt (f2b60dcd2)
- Bug 1186017 part.2 Rename GetBoolName() in IMContextWrapper.cpp to ToChar() r=kerlt (dade4fd9d)
- bug 1182972 remove unused aRepaint parameter from NativeResize methods r=acomminos (ae76c8f99)
- bug 1182972 remove mNeedsMove/mNeedsResize logic; instead process changes immediately r=acomminos (9417b03dc)
- bug 1182972 no need to pass member variable bounds to NativeResize r=acomminos (422e57acc)
- Bug 1181000 - Use logical pixel to set IME candidate window. r=karlt (d6f78610a)
- Bug 1191213 nsBaseWidget::NotifyWindowMoved() shouldn't notify IME when native IME handler doesn't have focus r=m_kato (59ee4fc9c)
- Bug 1198861 - Improve aliasing information and type barrier handling for unboxed arrays, r=jandem. (9ea8fd1cd)
- Bug 1198861 - Improve type barrier logic to avoid unnecessary tests on primitive types, and fix redundant baseline stubs for SETELEM property adds, r=jandem. (f1f2252c0)
- Bug 1083101 - Win32 implementation of the JobScheduler. r=jrmuizel (https://github.com/mozilla/newtab-dev/commit/120cce1d)
- Bug 1083101 - rename gfx::Mutex into gfx::CriticalSection and move it to its own file. r=jrmuizel (https://github.com/mozilla/newtab-dev/commit/6198b794)
- Bug 1083101 - Make SyncObject's waiting jobs list lock-free. r=jrmuizel (https://github.com/mozilla/newtab-dev/commit/e27060d8)
2021-11-15 14:53:00 +08:00

90 lines
2.5 KiB
C++

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef __mozilla_widget_nsShmImage_h__
#define __mozilla_widget_nsShmImage_h__
#include "mozilla/ipc/SharedMemorySysV.h"
#if defined(MOZ_X11) && defined(MOZ_HAVE_SHAREDMEMORYSYSV)
# define MOZ_HAVE_SHMIMAGE
#endif
#ifdef MOZ_HAVE_SHMIMAGE
#include "mozilla/gfx/2D.h"
#include "nsIWidget.h"
#include "nsAutoPtr.h"
#include "mozilla/X11Util.h"
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/extensions/XShm.h>
#ifdef MOZ_WIDGET_QT
class QRect;
class QWindow;
#endif
class nsShmImage {
// bug 1168843, compositor thread may create shared memory instances that are destroyed by main thread on shutdown, so this must use thread-safe RC to avoid hitting assertion
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(nsShmImage)
typedef mozilla::ipc::SharedMemorySysV SharedMemorySysV;
public:
static bool UseShm();
static already_AddRefed<nsShmImage>
Create(const gfxIntSize& aSize,
Display* aDisplay, Visual* aVisual, unsigned int aDepth);
static already_AddRefed<mozilla::gfx::DrawTarget>
EnsureShmImage(const gfxIntSize& aSize,
Display* aDisplay, Visual* aVisual, unsigned int aDepth,
nsRefPtr<nsShmImage>& aImage);
private:
~nsShmImage() {
if (mImage) {
mozilla::FinishX(mDisplay);
if (mXAttached) {
XShmDetach(mDisplay, &mInfo);
}
XDestroyImage(mImage);
}
}
public:
already_AddRefed<mozilla::gfx::DrawTarget> CreateDrawTarget();
#ifdef MOZ_WIDGET_GTK
void Put(Display* aDisplay, Drawable aWindow, const nsIntRegion& aRegion);
#elif defined(MOZ_WIDGET_QT)
void Put(QWindow* aWindow, QRect& aRect);
#endif
gfxIntSize Size() const { return mSize; }
private:
nsShmImage()
: mImage(nullptr)
, mDisplay(nullptr)
, mFormat(mozilla::gfx::SurfaceFormat::UNKNOWN)
, mXAttached(false)
{ mInfo.shmid = SharedMemorySysV::NULLHandle(); }
nsRefPtr<SharedMemorySysV> mSegment;
XImage* mImage;
Display* mDisplay;
XShmSegmentInfo mInfo;
gfxIntSize mSize;
mozilla::gfx::SurfaceFormat mFormat;
bool mXAttached;
};
#endif // MOZ_HAVE_SHMIMAGE
#endif