From 2218925961f4a086f185a04a4b5a26da921c7a4a Mon Sep 17 00:00:00 2001 From: Jim Mathies Date: Mon, 26 Mar 2018 08:55:21 -0500 Subject: Bug 1447080 - Remove SEE_MASK_FLAG_NO_UI for better Windows 10 compatibility. r=dparks, a=lizzard MozReview-Commit-ID: FbaKIfQdV8K --HG-- extra : source : 56bfd2178dcad46a5b611b14e31938f1d96124a0 extra : intermediate-source : ed7be30d31414eedb16d557c0a2e7a9aeb5ec36d --- uriloader/exthandler/win/nsMIMEInfoWin.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/uriloader/exthandler/win/nsMIMEInfoWin.cpp b/uriloader/exthandler/win/nsMIMEInfoWin.cpp index 2c7171c87..6ead8f4c3 100644 --- a/uriloader/exthandler/win/nsMIMEInfoWin.cpp +++ b/uriloader/exthandler/win/nsMIMEInfoWin.cpp @@ -243,8 +243,7 @@ nsMIMEInfoWin::LoadUriInternal(nsIURI * aURL) SHELLEXECUTEINFOW sinfo; memset(&sinfo, 0, sizeof(sinfo)); sinfo.cbSize = sizeof(sinfo); - sinfo.fMask = SEE_MASK_FLAG_DDEWAIT | - SEE_MASK_FLAG_NO_UI; + sinfo.fMask = SEE_MASK_FLAG_DDEWAIT; sinfo.hwnd = nullptr; sinfo.lpVerb = (LPWSTR)&cmdVerb; sinfo.nShow = SW_SHOWNORMAL; -- cgit v1.2.3 From dc7515e3d7456201d5d841a6561dd565d23eaebd Mon Sep 17 00:00:00 2001 From: Paul Adenot Date: Mon, 16 Apr 2018 10:51:48 +0200 Subject: Bug 1426129 - Hold CamerasChild via promoting "this" to a RefPtr. r=pehrsons, a=RyanVM --- dom/media/systemservices/CamerasChild.cpp | 15 +++++++++++++-- dom/media/systemservices/CamerasChild.h | 11 ++++++++++- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/dom/media/systemservices/CamerasChild.cpp b/dom/media/systemservices/CamerasChild.cpp index 0f7d1c1df..a3fbec850 100644 --- a/dom/media/systemservices/CamerasChild.cpp +++ b/dom/media/systemservices/CamerasChild.cpp @@ -35,7 +35,9 @@ CamerasSingleton::CamerasSingleton() : mCamerasMutex("CamerasSingleton::mCamerasMutex"), mCameras(nullptr), mCamerasChildThread(nullptr), - mFakeDeviceChangeEventThread(nullptr) { + mFakeDeviceChangeEventThread(nullptr), + mInShutdown(false) +{ LOG(("CamerasSingleton: %p", this)); } @@ -285,6 +287,7 @@ CamerasChild::NumberOfCapabilities(CaptureEngine aCapEngine, LOG((__PRETTY_FUNCTION__)); LOG(("NumberOfCapabilities for %s", deviceUniqueIdUTF8)); nsCString unique_id(deviceUniqueIdUTF8); + RefPtr deathGrip = this; nsCOMPtr runnable = mozilla::NewNonOwningRunnableMethod (this, &CamerasChild::SendNumberOfCapabilities, aCapEngine, unique_id); @@ -321,6 +324,7 @@ int CamerasChild::EnsureInitialized(CaptureEngine aCapEngine) { LOG((__PRETTY_FUNCTION__)); + RefPtr deathGrip = this; nsCOMPtr runnable = mozilla::NewNonOwningRunnableMethod (this, &CamerasChild::SendEnsureInitialized, aCapEngine); @@ -336,6 +340,7 @@ CamerasChild::GetCaptureCapability(CaptureEngine aCapEngine, webrtc::CaptureCapability& capability) { LOG(("GetCaptureCapability: %s %d", unique_idUTF8, capability_number)); + RefPtr deathGrip = this; nsCString unique_id(unique_idUTF8); nsCOMPtr runnable = mozilla::NewNonOwningRunnableMethod @@ -374,6 +379,7 @@ CamerasChild::GetCaptureDevice(CaptureEngine aCapEngine, bool* scary) { LOG((__PRETTY_FUNCTION__)); + RefPtr deathGrip = this; nsCOMPtr runnable = mozilla::NewNonOwningRunnableMethod (this, &CamerasChild::SendGetCaptureDevice, aCapEngine, list_number); @@ -413,6 +419,7 @@ CamerasChild::AllocateCaptureDevice(CaptureEngine aCapEngine, const nsACString& aOrigin) { LOG((__PRETTY_FUNCTION__)); + RefPtr deathGrip = this; nsCString unique_id(unique_idUTF8); nsCString origin(aOrigin); nsCOMPtr runnable = @@ -444,6 +451,7 @@ CamerasChild::ReleaseCaptureDevice(CaptureEngine aCapEngine, const int capture_id) { LOG((__PRETTY_FUNCTION__)); + RefPtr deathGrip = this; nsCOMPtr runnable = mozilla::NewNonOwningRunnableMethod (this, &CamerasChild::SendReleaseCaptureDevice, aCapEngine, capture_id); @@ -491,6 +499,7 @@ CamerasChild::StartCapture(CaptureEngine aCapEngine, webrtcCaps.rawType, webrtcCaps.codecType, webrtcCaps.interlaced); + RefPtr deathGrip = this; nsCOMPtr runnable = mozilla::NewNonOwningRunnableMethod (this, &CamerasChild::SendStartCapture, aCapEngine, capture_id, capCap); @@ -502,6 +511,7 @@ int CamerasChild::StopCapture(CaptureEngine aCapEngine, const int capture_id) { LOG((__PRETTY_FUNCTION__)); + RefPtr deathGrip = this; nsCOMPtr runnable = mozilla::NewNonOwningRunnableMethod (this, &CamerasChild::SendStopCapture, aCapEngine, capture_id); @@ -567,6 +577,7 @@ CamerasChild::ShutdownParent() // Delete the parent actor. // CamerasChild (this) will remain alive and is only deleted by the // IPC layer when SendAllDone returns. + RefPtr deathGrip = this; nsCOMPtr deleteRunnable = mozilla::NewNonOwningRunnableMethod(this, &CamerasChild::SendAllDone); CamerasSingleton::Thread()->Dispatch(deleteRunnable, NS_DISPATCH_NORMAL); @@ -695,7 +706,7 @@ CamerasChild::~CamerasChild() { LOG(("~CamerasChild: %p", this)); - { + if (!CamerasSingleton::InShutdown()) { OffTheBooksMutexAutoLock lock(CamerasSingleton::Mutex()); // In normal circumstances we've already shut down and the // following does nothing. But on fatal IPC errors we will diff --git a/dom/media/systemservices/CamerasChild.h b/dom/media/systemservices/CamerasChild.h index 1530714e9..9ca125cfd 100644 --- a/dom/media/systemservices/CamerasChild.h +++ b/dom/media/systemservices/CamerasChild.h @@ -89,6 +89,14 @@ public: return gTheInstance.get()->mFakeDeviceChangeEventThread; } + static bool InShutdown() { + return gTheInstance.get()->mInShutdown; + } + + static void StartShutdown() { + gTheInstance.get()->mInShutdown = true; + } + private: static Singleton gTheInstance; @@ -106,6 +114,7 @@ private: CamerasChild* mCameras; nsCOMPtr mCamerasChildThread; nsCOMPtr mFakeDeviceChangeEventThread; + Atomic mInShutdown; }; // Get a pointer to a CamerasChild object we can use to do IPC with. @@ -145,7 +154,7 @@ class CamerasChild final : public PCamerasChild public: // We are owned by the PBackground thread only. CamerasSingleton // takes a non-owning reference. - NS_INLINE_DECL_REFCOUNTING(CamerasChild) + NS_INLINE_DECL_THREADSAFE_REFCOUNTING(CamerasChild) // IPC messages recevied, received on the PBackground thread // these are the actual callbacks with data -- cgit v1.2.3 From 04b3d5178c893bfb794c0053e559133f413250e7 Mon Sep 17 00:00:00 2001 From: Lee Salzman Date: Sun, 29 Apr 2018 20:10:51 -0400 Subject: Bug 1454692 - Backport some upstream Skia fixes to ESR52. r=rhunt, a=abillings --HG-- extra : histedit_source : 0fcd64cabe6f54a2286083d6518e4e6451183a19%2C37f5e7f9dbbfc01102631c33b23329d2af5aa71b --- gfx/skia/skia/src/core/SkMask.cpp | 7 ++++++- gfx/skia/skia/src/gpu/GrBufferAllocPool.cpp | 5 +++-- gfx/skia/skia/src/gpu/batches/GrAAHairLinePathRenderer.cpp | 9 ++++++++- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/gfx/skia/skia/src/core/SkMask.cpp b/gfx/skia/skia/src/core/SkMask.cpp index 111508074..b40b94974 100644 --- a/gfx/skia/skia/src/core/SkMask.cpp +++ b/gfx/skia/skia/src/core/SkMask.cpp @@ -43,7 +43,12 @@ uint8_t* SkMask::AllocImage(size_t size) { #ifdef TRACK_SKMASK_LIFETIME SkDebugf("SkMask::AllocImage %d\n", gCounter++); #endif - return (uint8_t*)sk_malloc_throw(SkAlign4(size)); + size_t aligned_size = std::numeric_limits::max(); + size_t adjustment = 3; + if (size + adjustment > size) { + aligned_size = (size + adjustment) & ~adjustment; + } + return static_cast(sk_malloc_throw(aligned_size)); } /** We explicitly use this allocator for SkBimap pixels, so that we can diff --git a/gfx/skia/skia/src/gpu/GrBufferAllocPool.cpp b/gfx/skia/skia/src/gpu/GrBufferAllocPool.cpp index e3f30b0c1..993e1c59d 100644 --- a/gfx/skia/skia/src/gpu/GrBufferAllocPool.cpp +++ b/gfx/skia/skia/src/gpu/GrBufferAllocPool.cpp @@ -14,6 +14,7 @@ #include "GrResourceProvider.h" #include "GrTypes.h" +#include "SkSafeMath.h" #include "SkTraceEvent.h" #ifdef SK_DEBUG @@ -335,7 +336,7 @@ void* GrVertexBufferAllocPool::makeSpace(size_t vertexSize, SkASSERT(startVertex); size_t offset = 0; // assign to suppress warning - void* ptr = INHERITED::makeSpace(vertexSize * vertexCount, + void* ptr = INHERITED::makeSpace(SkSafeMath::Mul(vertexSize, vertexCount), vertexSize, buffer, &offset); @@ -360,7 +361,7 @@ void* GrIndexBufferAllocPool::makeSpace(int indexCount, SkASSERT(startIndex); size_t offset = 0; // assign to suppress warning - void* ptr = INHERITED::makeSpace(indexCount * sizeof(uint16_t), + void* ptr = INHERITED::makeSpace(SkSafeMath::Mul(indexCount, sizeof(uint16_t)), sizeof(uint16_t), buffer, &offset); diff --git a/gfx/skia/skia/src/gpu/batches/GrAAHairLinePathRenderer.cpp b/gfx/skia/skia/src/gpu/batches/GrAAHairLinePathRenderer.cpp index 9d73cf4f1..ec6c99c6e 100644 --- a/gfx/skia/skia/src/gpu/batches/GrAAHairLinePathRenderer.cpp +++ b/gfx/skia/skia/src/gpu/batches/GrAAHairLinePathRenderer.cpp @@ -828,6 +828,13 @@ void AAHairlineBatch::onPrepareDraws(Target* target) const { int lineCount = lines.count() / 2; int conicCount = conics.count() / 3; + int quadAndConicCount = conicCount + quadCount; + + static constexpr int kMaxLines = SK_MaxS32 / kLineSegNumVertices; + static constexpr int kMaxQuadsAndConics = SK_MaxS32 / kQuadNumVertices; + if (lineCount > kMaxLines || quadAndConicCount > kMaxQuadsAndConics) { + return; + } // do lines first if (lineCount) { @@ -899,7 +906,7 @@ void AAHairlineBatch::onPrepareDraws(Target* target) const { ref_quads_index_buffer(target->resourceProvider())); size_t vertexStride = sizeof(BezierVertex); - int vertexCount = kQuadNumVertices * quadCount + kQuadNumVertices * conicCount; + int vertexCount = kQuadNumVertices * quadAndConicCount; void *vertices = target->makeVertexSpace(vertexStride, vertexCount, &vertexBuffer, &firstVertex); -- cgit v1.2.3