diff --git a/application/basilisk/components/places/PlacesUIUtils.jsm b/application/basilisk/components/places/PlacesUIUtils.jsm index dc0463c37f..c38edce230 100644 --- a/application/basilisk/components/places/PlacesUIUtils.jsm +++ b/application/basilisk/components/places/PlacesUIUtils.jsm @@ -1018,7 +1018,9 @@ this.PlacesUIUtils = { if (PlacesUtils.nodeIsURI(aNodes[i])) urlsToOpen.push({uri: aNodes[i].uri, isBookmark: PlacesUtils.nodeIsBookmark(aNodes[i])}); } - this._openTabset(urlsToOpen, aEvent, window); + if (this.confirmOpenInTabs(urlsToOpen.length, window)) { + this._openTabset(urlsToOpen, aEvent, window); + } }, /** diff --git a/application/palemoon/branding/shared/pref/uaoverrides.inc b/application/palemoon/branding/shared/pref/uaoverrides.inc index 7a56551ac6..15652256b4 100644 --- a/application/palemoon/branding/shared/pref/uaoverrides.inc +++ b/application/palemoon/branding/shared/pref/uaoverrides.inc @@ -59,7 +59,7 @@ pref("@GUAO_PREF@.twitter.com","Mozilla/5.0 (%OS_SLICE% rv:@GRE_VERSION@) @GRE_D // UA-Sniffing domains below have indicated no interest in supporting Pale Moon (BOO!) pref("@GUAO_PREF@.humblebundle.com","Mozilla/5.0 (%OS_SLICE% rv:@GK_VERSION@) @GK_SLICE@ @FX_SLICE@ (Pale Moon)"); pref("@GUAO_PREF@.privat24.ua","Mozilla/5.0 (%OS_SLICE% rv:38.0) @GK_SLICE@ Firefox/38.0"); -pref("@GUAO_PREF@.citi.com","Mozilla/5.0 (%OS_SLICE% rv:81.0) @GK_SLICE@ Firefox/81.0 (Pale Moon)"); +pref("@GUAO_PREF@.citi.com","Mozilla/5.0 (%OS_SLICE% rv:88.0) @GK_SLICE@ Firefox/88.0 (Pale Moon)"); pref("@GUAO_PREF@.netflix.com","Mozilla/5.0 (Windows NT 6.1; rv:45.9) @GK_SLICE@ Firefox/45.9"); pref("@GUAO_PREF@.netflximg.net","Mozilla/5.0 (Windows NT 6.1; rv:45.9) @GK_SLICE@ Firefox/45.9"); diff --git a/build/moz.configure/init.configure b/build/moz.configure/init.configure index 3ae1875ed4..24771cd69a 100644 --- a/build/moz.configure/init.configure +++ b/build/moz.configure/init.configure @@ -542,20 +542,6 @@ def target_is_unix(target): set_define('XP_UNIX', target_is_unix) -@depends(target) -def target_is_darwin(target): - if target.kernel == 'Darwin': - return True - -set_define('XP_DARWIN', target_is_darwin) - -@depends(target) -def target_is_ios(target): - if target.kernel == 'Darwin' and target.os == 'iOS': - return True - -set_define('XP_IOS', target_is_ios) - @depends(target) def target_is_osx(target): if target.kernel == 'Darwin' and target.os == 'OSX': diff --git a/config/external/nspr/prcpucfg.h b/config/external/nspr/prcpucfg.h index 8769abeeb8..8f455b509c 100644 --- a/config/external/nspr/prcpucfg.h +++ b/config/external/nspr/prcpucfg.h @@ -10,9 +10,7 @@ * Need to support conditionals that are defined in both the top-level build * system as well as NSS' build system for now. */ -#if defined(XP_DARWIN) || defined(DARWIN) -#include "md/_darwin.cfg" -#elif defined(XP_WIN) || defined(_WINDOWS) +#if defined(XP_WIN) || defined(_WINDOWS) #include "md/_win95.cfg" #elif defined(__FreeBSD__) #include "md/_freebsd.cfg" diff --git a/config/gcc-stl-wrapper.template.h b/config/gcc-stl-wrapper.template.h index e7b01482c2..3bc65bd6ab 100644 --- a/config/gcc-stl-wrapper.template.h +++ b/config/gcc-stl-wrapper.template.h @@ -8,9 +8,7 @@ #ifndef mozilla_${HEADER}_h #define mozilla_${HEADER}_h -// For some reason, Apple's GCC refuses to honor -fno-exceptions when -// compiling ObjC. -#if defined(__EXCEPTIONS) && __EXCEPTIONS && !(__OBJC__ && __GNUC__ && XP_IOS) +#if defined(__EXCEPTIONS) && __EXCEPTIONS # error "STL code can only be used with -fno-exceptions" #endif diff --git a/dom/base/Navigator.cpp b/dom/base/Navigator.cpp index c0580c3590..e15e32d328 100644 --- a/dom/base/Navigator.cpp +++ b/dom/base/Navigator.cpp @@ -1407,12 +1407,6 @@ Navigator::GetPlatform(nsAString& aPlatform, bool aUsePrefOverriddenValue) aPlatform.AssignLiteral("Win64"); #elif defined(WIN32) aPlatform.AssignLiteral("Win32"); -#elif defined(XP_MACOSX) && defined(__ppc__) - aPlatform.AssignLiteral("MacPPC"); -#elif defined(XP_MACOSX) && defined(__i386__) - aPlatform.AssignLiteral("MacIntel"); -#elif defined(XP_MACOSX) && defined(__x86_64__) - aPlatform.AssignLiteral("MacIntel"); #else // XXX Communicator uses compiled-in build-time string defines // to indicate the platform it was compiled *for*, not what it is diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp index 7dc6ccb990..95f176ca8f 100644 --- a/dom/base/nsContentUtils.cpp +++ b/dom/base/nsContentUtils.cpp @@ -6842,10 +6842,6 @@ nsContentUtils::HaveEqualPrincipals(nsIDocument* aDoc1, nsIDocument* aDoc2) bool nsContentUtils::HasPluginWithUncontrolledEventDispatch(nsIContent* aContent) { -#ifdef XP_MACOSX - // We control dispatch to all mac plugins. - return false; -#else if (!aContent || !aContent->IsInUncomposedDoc()) { return false; } @@ -6868,7 +6864,6 @@ nsContentUtils::HasPluginWithUncontrolledEventDispatch(nsIContent* aContent) } return !isWindowless; -#endif } /* static */ diff --git a/dom/base/nsFocusManager.cpp b/dom/base/nsFocusManager.cpp index 637e3954e1..bfd2e334ea 100644 --- a/dom/base/nsFocusManager.cpp +++ b/dom/base/nsFocusManager.cpp @@ -66,9 +66,7 @@ #include "nsAccessibilityService.h" #endif -#ifndef XP_MACOSX #include "nsIScriptError.h" -#endif using namespace mozilla; using namespace mozilla::dom; @@ -1270,12 +1268,10 @@ nsFocusManager::SetFocusInner(nsIContent* aNewContent, int32_t aFlags, } } - // Exit fullscreen if we're focusing a windowed plugin on a non-MacOSX - // system. We don't control event dispatch to windowed plugins on non-MacOSX, - // so we can't display the "Press ESC to leave fullscreen mode" warning on - // key input if a windowed plugin is focused, so just exit fullscreen - // to guard against phishing. -#ifndef XP_MACOSX + // Exit fullscreen if we're focusing a windowed plugin. We don't control + // event dispatch to windowed plugins, so we can't display the warning on key input if a windowed plugin is + // focused, so just exit fullscreen to guard against phishing. if (contentToFocus && nsContentUtils:: GetRootDocument(contentToFocus->OwnerDoc())->GetFullscreenElement() && @@ -1287,7 +1283,6 @@ nsFocusManager::SetFocusInner(nsIContent* aNewContent, int32_t aFlags, "FocusedWindowedPluginWhileFullscreen"); nsIDocument::AsyncExitFullscreen(contentToFocus->OwnerDoc()); } -#endif // if the FLAG_NOSWITCHFRAME flag is used, only allow the focus to be // shifted away from the current element if the new shell to focus is diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index a09847820b..293a522efe 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -6254,18 +6254,7 @@ nsGlobalWindow::CheckSecurityLeftAndTop(int32_t* aLeft, int32_t* aTop, bool aCal screen->GetAvailLeft(&screenLeft); screen->GetAvailWidth(&screenWidth); screen->GetAvailHeight(&screenHeight); -#if defined(XP_MACOSX) - /* The mac's coordinate system is different from the assumed Windows' - system. It offsets by the height of the menubar so that a window - placed at (0,0) will be entirely visible. Unfortunately that - correction is made elsewhere (in Widget) and the meaning of - the Avail... coordinates is overloaded. Here we allow a window - to be placed at (0,0) because it does make sense to do so. - */ - screen->GetTop(&screenTop); -#else screen->GetAvailTop(&screenTop); -#endif if (aLeft) { if (screenLeft+screenWidth < *aLeft+winWidth) @@ -7103,16 +7092,6 @@ nsGlobalWindow::Dump(const nsAString& aStr) char *cstr = ToNewUTF8String(aStr); -#if defined(XP_MACOSX) - // have to convert \r to \n so that printing to the console works - char *c = cstr, *cEnd = cstr + strlen(cstr); - while (c < cEnd) { - if (*c == '\r') - *c = '\n'; - c++; - } -#endif - if (cstr) { MOZ_LOG(nsContentUtils::DOMDumpLog(), LogLevel::Debug, ("[Window.Dump] %s", cstr)); #ifdef XP_WIN diff --git a/dom/base/nsJSEnvironment.cpp b/dom/base/nsJSEnvironment.cpp index 5382f4494f..3b2a1cb19f 100644 --- a/dom/base/nsJSEnvironment.cpp +++ b/dom/base/nsJSEnvironment.cpp @@ -60,10 +60,6 @@ #include "nsJSPrincipals.h" -#ifdef XP_MACOSX -// AssertMacros.h defines 'check' and conflicts with AccessCheck.h -#undef check -#endif #include "AccessCheck.h" #include "mozilla/Logging.h" diff --git a/dom/base/nsObjectLoadingContent.cpp b/dom/base/nsObjectLoadingContent.cpp index e508a22f3e..27e4e7b7e9 100644 --- a/dom/base/nsObjectLoadingContent.cpp +++ b/dom/base/nsObjectLoadingContent.cpp @@ -95,13 +95,6 @@ #endif #endif // XP_WIN -#ifdef XP_MACOSX -// HandlePluginCrashed() and HandlePluginInstantiated() needed from here to -// fix bug 1147521. Should later be replaced by proper interface methods, -// maybe on nsIObjectLoadingContext. -#include "mozilla/dom/HTMLObjectElement.h" -#endif - static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID); static const char *kPrefJavaMIME = "plugin.java.mime"; @@ -916,10 +909,6 @@ nsObjectLoadingContent::InstantiatePluginInstance(bool aIsLoading) NS_LITERAL_STRING("PluginInstantiated")); NS_DispatchToCurrentThread(ev); -#ifdef XP_MACOSX - HTMLObjectElement::HandlePluginInstantiated(thisContent->AsElement()); -#endif - return NS_OK; } @@ -2948,10 +2937,6 @@ nsObjectLoadingContent::PluginCrashed(nsIPluginTag* aPluginTag, nsCOMPtr thisContent = do_QueryInterface(static_cast(this)); -#ifdef XP_MACOSX - HTMLObjectElement::HandlePluginCrashed(thisContent->AsElement()); -#endif - PluginDestroyed(); // Switch to fallback/crashed state, notify @@ -3190,10 +3175,6 @@ nsObjectLoadingContent::DoStopPlugin(nsPluginInstanceOwner* aInstanceOwner, return; } -#if defined(XP_MACOSX) - aInstanceOwner->HidePluginWindow(); -#endif - RefPtr pluginHost = nsPluginHost::GetInst(); NS_ASSERTION(pluginHost, "No plugin host?"); pluginHost->StopPluginInstance(inst); diff --git a/dom/base/nsWindowRoot.cpp b/dom/base/nsWindowRoot.cpp index 8175877148..30360eb1f4 100644 --- a/dom/base/nsWindowRoot.cpp +++ b/dom/base/nsWindowRoot.cpp @@ -37,14 +37,8 @@ nsWindowRoot::nsWindowRoot(nsPIDOMWindowOuter* aWindow) mWindow = aWindow; MOZ_ASSERT(mWindow->IsOuterWindow()); - // Keyboard indicators are not shown on Mac by default. -#if defined(XP_MACOSX) - mShowAccelerators = false; - mShowFocusRings = false; -#else mShowAccelerators = true; mShowFocusRings = true; -#endif } nsWindowRoot::~nsWindowRoot() diff --git a/dom/canvas/WebGL2Context.cpp b/dom/canvas/WebGL2Context.cpp index f9a1eba4bf..e88e22e861 100644 --- a/dom/canvas/WebGL2Context.cpp +++ b/dom/canvas/WebGL2Context.cpp @@ -126,13 +126,6 @@ WebGLContext::InitWebGL2(FailureReason* const out_failReason) fnGatherMissing2(gl::GLFeature::occlusion_query_boolean, gl::GLFeature::occlusion_query); -#ifdef XP_MACOSX - // On OSX, GL core profile is used. This requires texture swizzle - // support to emulate legacy texture formats: ALPHA, LUMINANCE, - // and LUMINANCE_ALPHA. - fnGatherMissing(gl::GLFeature::texture_swizzle); -#endif - fnGatherMissing2(gl::GLFeature::prim_restart_fixed, gl::GLFeature::prim_restart); diff --git a/dom/canvas/WebGLBuffer.cpp b/dom/canvas/WebGLBuffer.cpp index 02a8f649fe..11d956c8a4 100644 --- a/dom/canvas/WebGLBuffer.cpp +++ b/dom/canvas/WebGLBuffer.cpp @@ -115,7 +115,7 @@ WebGLBuffer::BufferData(GLenum target, size_t size, const void* data, GLenum usa const ScopedLazyBind lazyBind(gl, target, this); mContext->InvalidateBufferFetching(); -#if defined(XP_MACOSX) || defined(MOZ_WIDGET_GTK) +#if defined(MOZ_WIDGET_GTK) // bug 790879 if (gl->WorkAroundDriverBugs() && size > INT32_MAX) diff --git a/dom/canvas/WebGLContext.h b/dom/canvas/WebGLContext.h index 0510e6898a..628d4713ca 100644 --- a/dom/canvas/WebGLContext.h +++ b/dom/canvas/WebGLContext.h @@ -30,10 +30,6 @@ #include "ScopedGLHelpers.h" #include "TexUnpackBlob.h" -#ifdef XP_MACOSX -#include "ForceDiscreteGPUHelperCGL.h" -#endif - // Local #include "WebGLContextLossHandler.h" #include "WebGLContextUnchecked.h" @@ -2015,15 +2011,6 @@ protected: JSObject* WebGLObjectAsJSObject(JSContext* cx, const WebGLObjectType*, ErrorResult& rv) const; -#ifdef XP_MACOSX - // see bug 713305. This RAII helper guarantees that we're on the discrete GPU, during its lifetime - // Debouncing note: we don't want to switch GPUs too frequently, so try to not create and destroy - // these objects at high frequency. Having WebGLContext's hold one such object seems fine, - // because WebGLContext objects only go away during GC, which shouldn't happen too frequently. - // If in the future GC becomes much more frequent, we may have to revisit then (maybe use a timer). - ForceDiscreteGPUHelperCGL mForceDiscreteGPUHelper; -#endif - public: // console logging helpers void GenerateWarning(const char* fmt, ...); diff --git a/dom/canvas/WebGLContextBuffers.cpp b/dom/canvas/WebGLContextBuffers.cpp index e787b99143..6f583c10c6 100644 --- a/dom/canvas/WebGLContextBuffers.cpp +++ b/dom/canvas/WebGLContextBuffers.cpp @@ -295,16 +295,6 @@ WebGLContext::BindBufferRange(GLenum target, GLuint index, WebGLBuffer* buffer, //// -#ifdef XP_MACOSX - if (buffer && buffer->Content() == WebGLBuffer::Kind::Undefined && - gl->WorkAroundDriverBugs()) - { - // BindBufferRange will fail if the buffer's contents is undefined. - // Bind so driver initializes the buffer. - gl->fBindBuffer(target, buffer->mGLName); - } -#endif - gl->fBindBufferRange(target, index, buffer ? buffer->mGLName : 0, offset, size); //// @@ -352,12 +342,6 @@ WebGLContext::BufferData(GLenum target, WebGLsizeiptr size, GLenum usage) if (!checkedSize.isValid()) return ErrorOutOfMemory("%s: Size too large for platform.", funcName); -#if defined(XP_MACOSX) - if (gl->WorkAroundDriverBugs() && size > 1200000000) { - return ErrorOutOfMemory("Allocations larger than 1200000000 fail on MacOS."); - } -#endif - const UniqueBuffer zeroBuffer(calloc(size, 1)); if (!zeroBuffer) return ErrorOutOfMemory("%s: Failed to allocate zeros.", funcName); diff --git a/dom/canvas/WebGLContextDraw.cpp b/dom/canvas/WebGLContextDraw.cpp index fd9ee49579..8e437a07f3 100644 --- a/dom/canvas/WebGLContextDraw.cpp +++ b/dom/canvas/WebGLContextDraw.cpp @@ -1045,13 +1045,6 @@ WebGLContext::WhatDoesVertexAttrib0Need() const const auto& isAttribArray0Enabled = mBoundVertexArray->mAttribs[0].mEnabled; bool legacyAttrib0 = gl->IsCompatibilityProfile(); -#ifdef XP_MACOSX - if (gl->WorkAroundDriverBugs()) { - // Failures in conformance/attribs/gl-disabled-vertex-attrib. - // Even in Core profiles on NV. Sigh. - legacyAttrib0 |= (gl->Vendor() == gl::GLVendor::NVIDIA); - } -#endif if (!legacyAttrib0) return WebGLVertexAttrib0Status::Default; diff --git a/dom/canvas/WebGLContextValidate.cpp b/dom/canvas/WebGLContextValidate.cpp index 30d4c65221..60bb3a32cc 100644 --- a/dom/canvas/WebGLContextValidate.cpp +++ b/dom/canvas/WebGLContextValidate.cpp @@ -695,18 +695,6 @@ WebGLContext::InitAndValidateGL(FailureReason* const out_failReason) gl->fEnable(LOCAL_GL_PROGRAM_POINT_SIZE); } -#ifdef XP_MACOSX - if (gl->WorkAroundDriverBugs() && - gl->Vendor() == gl::GLVendor::ATI && - !nsCocoaFeatures::IsAtLeastVersion(10,9)) - { - // The Mac ATI driver, in all known OSX version up to and including - // 10.8, renders points sprites upside-down. (Apple bug 11778921) - gl->fPointParameterf(LOCAL_GL_POINT_SPRITE_COORD_ORIGIN, - LOCAL_GL_LOWER_LEFT); - } -#endif - if (gl->IsSupported(gl::GLFeature::seamless_cube_map_opt_in)) { gl->fEnable(LOCAL_GL_TEXTURE_CUBE_MAP_SEAMLESS); } diff --git a/dom/canvas/WebGLProgram.cpp b/dom/canvas/WebGLProgram.cpp index 9b204358bb..1ff27e1d2f 100644 --- a/dom/canvas/WebGLProgram.cpp +++ b/dom/canvas/WebGLProgram.cpp @@ -689,24 +689,6 @@ WebGLProgram::GetFragDataLocation(const nsAString& userName_wide) const gl->MakeCurrent(); const NS_LossyConvertUTF16toASCII userName(userName_wide); -#ifdef XP_MACOSX - if (gl->WorkAroundDriverBugs()) { - // OSX doesn't return locs for indexed names, just the base names. - // Indicated by failure in: conformance2/programs/gl-get-frag-data-location.html - bool isArray; - size_t arrayIndex; - nsCString baseUserName; - if (!ParseName(userName, &baseUserName, &isArray, &arrayIndex)) - return -1; - - if (arrayIndex >= mContext->mImplMaxDrawBuffers) - return -1; - - const auto baseLoc = GetFragDataByUserName(this, baseUserName); - const auto loc = baseLoc + GLint(arrayIndex); - return loc; - } -#endif return GetFragDataByUserName(this, userName); } @@ -770,11 +752,6 @@ WebGLProgram::GetProgramParameter(GLenum pname) const return JS::BooleanValue(IsLinked()); case LOCAL_GL_VALIDATE_STATUS: -#ifdef XP_MACOSX - // See comment in ValidateProgram. - if (gl->WorkAroundDriverBugs()) - return JS::BooleanValue(true); -#endif // Todo: Implement this in our code. return JS::BooleanValue(bool(GetProgramiv(gl, mGLName, pname))); @@ -1377,17 +1354,6 @@ WebGLProgram::ValidateProgram() const { mContext->MakeContextCurrent(); gl::GLContext* gl = mContext->gl; - -#ifdef XP_MACOSX - // See bug 593867 for NVIDIA and bug 657201 for ATI. The latter is confirmed - // with Mac OS 10.6.7. - if (gl->WorkAroundDriverBugs()) { - mContext->GenerateWarning("validateProgram: Implemented as a no-op on" - " Mac to work around crashes."); - return; - } -#endif - gl->fValidateProgram(mGLName); } diff --git a/dom/canvas/WebGLShaderValidator.cpp b/dom/canvas/WebGLShaderValidator.cpp index bf2df82f71..eadeeb56b0 100644 --- a/dom/canvas/WebGLShaderValidator.cpp +++ b/dom/canvas/WebGLShaderValidator.cpp @@ -63,34 +63,8 @@ ChooseValidatorCompileOptions(const ShBuiltInResources& resources, SH_REGENERATE_STRUCT_NAMES; } -#ifndef XP_MACOSX - // We want to do this everywhere, but to do this on Mac, we need - // to do it only on Mac OSX > 10.6 as this causes the shader - // compiler in 10.6 to crash + // We want to do this everywhere. options |= SH_CLAMP_INDIRECT_ARRAY_BOUNDS; -#endif - -#ifdef XP_MACOSX - if (gl->WorkAroundDriverBugs()) { - // Work around https://bugs.webkit.org/show_bug.cgi?id=124684, - // https://chromium.googlesource.com/angle/angle/+/5e70cf9d0b1bb - options |= SH_UNFOLD_SHORT_CIRCUIT; - - // OS X 10.7/10.8 specific: - - // Work around bug 665578 and bug 769810 - if (gl->Vendor() == gl::GLVendor::ATI) { - options |= SH_EMULATE_BUILT_IN_FUNCTIONS; - } - // Work around bug 735560 - if (gl->Vendor() == gl::GLVendor::Intel) { - options |= SH_EMULATE_BUILT_IN_FUNCTIONS; - } - - // Work around that Mac drivers handle struct scopes incorrectly. - options |= SH_REGENERATE_STRUCT_NAMES; - } -#endif if (resources.MaxExpressionComplexity > 0) { options |= SH_LIMIT_EXPRESSION_COMPLEXITY; @@ -187,15 +161,6 @@ WebGLContext::CreateShaderValidator(GLenum shaderType) const // If underlying GLES doesn't have highp in frag shaders, it should complain anyways. resources.FragmentPrecisionHigh = mDisableFragHighP ? 0 : 1; - if (gl->WorkAroundDriverBugs()) { -#ifdef XP_MACOSX - if (gl->Vendor() == gl::GLVendor::NVIDIA) { - // Work around bug 890432 - resources.MaxExpressionComplexity = 1000; - } -#endif - } - int compileOptions = webgl::ChooseValidatorCompileOptions(resources, gl); return webgl::ShaderValidator::Create(shaderType, spec, outputLanguage, resources, compileOptions); diff --git a/dom/events/EventStateManager.cpp b/dom/events/EventStateManager.cpp index c8f1acdb55..87c4827fab 100644 --- a/dom/events/EventStateManager.cpp +++ b/dom/events/EventStateManager.cpp @@ -95,10 +95,6 @@ #include "Units.h" #include "mozilla/layers/APZCTreeManager.h" -#ifdef XP_MACOSX -#import -#endif - namespace mozilla { using namespace dom; @@ -1517,14 +1513,6 @@ EventStateManager::FireContextClick() return; } -#ifdef XP_MACOSX - // Hack to ensure that we don't show a context menu when the user - // let go of the mouse after a long cpu-hogging operation prevented - // us from handling any OS events. See bug 117589. - if (!CGEventSourceButtonState(kCGEventSourceStateCombinedSessionState, kCGMouseButtonLeft)) - return; -#endif - nsEventStatus status = nsEventStatus_eIgnore; // Dispatch to the DOM. We have to fake out the ESM and tell it that the @@ -2841,29 +2829,6 @@ EventStateManager::DecideGestureEvent(WidgetGestureNotifyEvent* aEvent, aEvent->mPanDirection = panDirection; } -#ifdef XP_MACOSX -static bool -NodeAllowsClickThrough(nsINode* aNode) -{ - while (aNode) { - if (aNode->IsXULElement()) { - mozilla::dom::Element* element = aNode->AsElement(); - static nsIContent::AttrValuesArray strings[] = - {&nsGkAtoms::always, &nsGkAtoms::never, nullptr}; - switch (element->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::clickthrough, - strings, eCaseMatters)) { - case 0: - return true; - case 1: - return false; - } - } - aNode = nsContentUtils::GetCrossDocParentNode(aNode); - } - return true; -} -#endif - void EventStateManager::PostHandleKeyboardEvent(WidgetKeyboardEvent* aKeyboardEvent, nsEventStatus& aStatus, @@ -3096,10 +3061,7 @@ EventStateManager::PostHandleEvent(nsPresContext* aPresContext, // focused frame EnsureDocument(mPresContext); if (mDocument) { -#ifdef XP_MACOSX - if (!activeContent || !activeContent->IsXULElement()) -#endif - fm->ClearFocus(mDocument->GetWindow()); + fm->ClearFocus(mDocument->GetWindow()); fm->SetFocusedWindow(mDocument->GetWindow()); } } @@ -3511,18 +3473,6 @@ EventStateManager::PostHandleEvent(nsPresContext* aPresContext, } break; -#ifdef XP_MACOSX - case eMouseActivate: - if (mCurrentTarget) { - nsCOMPtr targetContent; - mCurrentTarget->GetContentForEvent(aEvent, getter_AddRefs(targetContent)); - if (!NodeAllowsClickThrough(targetContent)) { - *aStatus = nsEventStatus_eConsumeNoDefault; - } - } - break; -#endif - default: break; } diff --git a/dom/events/TextComposition.cpp b/dom/events/TextComposition.cpp index bd7ebbc468..3b3dc6505b 100644 --- a/dom/events/TextComposition.cpp +++ b/dom/events/TextComposition.cpp @@ -21,21 +21,8 @@ #include "mozilla/Unused.h" #include "mozilla/dom/TabParent.h" -#ifdef XP_MACOSX -// Some defiens will be conflict with OSX SDK -#define TextRange _TextRange -#define TextRangeArray _TextRangeArray -#define Comment _Comment -#endif - #include "nsPluginInstanceOwner.h" -#ifdef XP_MACOSX -#undef TextRange -#undef TextRangeArray -#undef Comment -#endif - using namespace mozilla::widget; namespace mozilla { diff --git a/dom/html/HTMLButtonElement.cpp b/dom/html/HTMLButtonElement.cpp index e493d1891d..80df5bc740 100644 --- a/dom/html/HTMLButtonElement.cpp +++ b/dom/html/HTMLButtonElement.cpp @@ -156,11 +156,7 @@ HTMLButtonElement::IsHTMLFocusable(bool aWithMouse, bool *aIsFocusable, int32_t return true; } - *aIsFocusable = -#ifdef XP_MACOSX - (!aWithMouse || nsFocusManager::sMouseFocusesFormControl) && -#endif - !IsDisabled(); + *aIsFocusable = !IsDisabled(); return false; } diff --git a/dom/html/HTMLImageElement.cpp b/dom/html/HTMLImageElement.cpp index 5e75d09349..cb586d68ac 100644 --- a/dom/html/HTMLImageElement.cpp +++ b/dom/html/HTMLImageElement.cpp @@ -599,9 +599,6 @@ HTMLImageElement::IsHTMLFocusable(bool aWithMouse, } *aIsFocusable = -#ifdef XP_MACOSX - (!aWithMouse || nsFocusManager::sMouseFocusesFormControl) && -#endif (tabIndex >= 0 || HasAttr(kNameSpaceID_None, nsGkAtoms::tabindex)); return false; diff --git a/dom/html/HTMLInputElement.cpp b/dom/html/HTMLInputElement.cpp index 557e673e15..8cc25d064a 100644 --- a/dom/html/HTMLInputElement.cpp +++ b/dom/html/HTMLInputElement.cpp @@ -3566,7 +3566,7 @@ HTMLInputElement::Focus(ErrorResult& aError) return; } -#if !defined(ANDROID) && !defined(XP_MACOSX) +#if !defined(ANDROID) bool HTMLInputElement::IsNodeApzAwareInternal() const { @@ -4728,7 +4728,7 @@ HTMLInputElement::PostHandleEvent(EventChainPostVisitor& aVisitor) } break; } -#if !defined(ANDROID) && !defined(XP_MACOSX) +#if !defined(ANDROID) case eWheel: { // Handle wheel events as increasing / decreasing the input element's // value when it's focused and it's type is number or range. @@ -6665,7 +6665,7 @@ FireEventForAccessibility(nsIDOMHTMLInputElement* aTarget, void HTMLInputElement::UpdateApzAwareFlag() { -#if !defined(ANDROID) && !defined(XP_MACOSX) +#if !defined(ANDROID) if ((mType == NS_FORM_INPUT_NUMBER) || (mType == NS_FORM_INPUT_RANGE)) { SetMayBeApzAware(); } @@ -7239,11 +7239,7 @@ HTMLInputElement::IsHTMLFocusable(bool aWithMouse, bool* aIsFocusable, int32_t* return false; } -#ifdef XP_MACOSX - const bool defaultFocusable = !aWithMouse || nsFocusManager::sMouseFocusesFormControl; -#else const bool defaultFocusable = true; -#endif if (mType == NS_FORM_INPUT_FILE || mType == NS_FORM_INPUT_NUMBER || diff --git a/dom/html/HTMLInputElement.h b/dom/html/HTMLInputElement.h index 16651d5200..275d80b3a4 100644 --- a/dom/html/HTMLInputElement.h +++ b/dom/html/HTMLInputElement.h @@ -137,7 +137,7 @@ public: virtual void Focus(ErrorResult& aError) override; // nsINode -#if !defined(ANDROID) && !defined(XP_MACOSX) +#if !defined(ANDROID) virtual bool IsNodeApzAwareInternal() const override; #endif diff --git a/dom/html/HTMLObjectElement.cpp b/dom/html/HTMLObjectElement.cpp index 496080c11b..e0e79b69af 100644 --- a/dom/html/HTMLObjectElement.cpp +++ b/dom/html/HTMLObjectElement.cpp @@ -18,11 +18,6 @@ #include "nsNPAPIPluginInstance.h" #include "nsIWidget.h" #include "nsContentUtils.h" -#ifdef XP_MACOSX -#include "mozilla/EventDispatcher.h" -#include "mozilla/dom/Event.h" -#include "nsFocusManager.h" -#endif namespace mozilla { namespace dom { @@ -44,9 +39,6 @@ HTMLObjectElement::HTMLObjectElement(already_AddRefed& a HTMLObjectElement::~HTMLObjectElement() { -#ifdef XP_MACOSX - OnFocusBlurPlugin(this, false); -#endif UnregisterActivityObserver(); DestroyImageLoadingContent(); } @@ -117,131 +109,6 @@ NS_IMPL_ELEMENT_CLONE(HTMLObjectElement) // nsIConstraintValidation NS_IMPL_NSICONSTRAINTVALIDATION(HTMLObjectElement) -#ifdef XP_MACOSX - -static nsIWidget* GetWidget(Element* aElement) -{ - return nsContentUtils::WidgetForDocument(aElement->OwnerDoc()); -} - -Element* HTMLObjectElement::sLastFocused = nullptr; // Weak - -class PluginFocusSetter : public Runnable -{ -public: - PluginFocusSetter(nsIWidget* aWidget, Element* aElement) - : mWidget(aWidget), mElement(aElement) - { - } - - NS_IMETHOD Run() override - { - if (mElement) { - HTMLObjectElement::sLastFocused = mElement; - bool value = true; - mWidget->SetPluginFocused(value); - } else if (!HTMLObjectElement::sLastFocused) { - bool value = false; - mWidget->SetPluginFocused(value); - } - - return NS_OK; - } - -private: - nsCOMPtr mWidget; - nsCOMPtr mElement; -}; - -void -HTMLObjectElement::OnFocusBlurPlugin(Element* aElement, bool aFocus) -{ - // In general we don't want to call nsIWidget::SetPluginFocused() for any - // Element that doesn't have a plugin running. But if SetPluginFocused(true) - // was just called for aElement while it had a plugin running, we want to - // make sure nsIWidget::SetPluginFocused(false) gets called for it now, even - // if aFocus is true. - if (aFocus) { - nsCOMPtr olc = do_QueryInterface(aElement); - bool hasRunningPlugin = false; - if (olc) { - // nsIObjectLoadingContent::GetHasRunningPlugin() fails when - // nsContentUtils::IsCallerChrome() returns false (which it can do even - // when we're processing a trusted focus event). We work around this by - // calling nsObjectLoadingContent::HasRunningPlugin() directly. - hasRunningPlugin = - static_cast(olc.get())->HasRunningPlugin(); - } - if (!hasRunningPlugin) { - aFocus = false; - } - } - - if (aFocus || aElement == sLastFocused) { - if (!aFocus) { - sLastFocused = nullptr; - } - nsIWidget* widget = GetWidget(aElement); - if (widget) { - nsContentUtils::AddScriptRunner( - new PluginFocusSetter(widget, aFocus ? aElement : nullptr)); - } - } -} - -void -HTMLObjectElement::HandlePluginCrashed(Element* aElement) -{ - OnFocusBlurPlugin(aElement, false); -} - -void -HTMLObjectElement::HandlePluginInstantiated(Element* aElement) -{ - // If aElement is already focused when a plugin is instantiated, we need - // to initiate a call to nsIWidget::SetPluginFocused(true). Otherwise - // keyboard input won't work in a click-to-play plugin until aElement - // loses focus and regains it. - nsIContent* focusedContent = nullptr; - nsFocusManager *fm = nsFocusManager::GetFocusManager(); - if (fm) { - focusedContent = fm->GetFocusedContent(); - } - if (SameCOMIdentity(focusedContent, aElement)) { - OnFocusBlurPlugin(aElement, true); - } -} - -void -HTMLObjectElement::HandleFocusBlurPlugin(Element* aElement, - WidgetEvent* aEvent) -{ - if (!aEvent->IsTrusted()) { - return; - } - switch (aEvent->mMessage) { - case eFocus: { - OnFocusBlurPlugin(aElement, true); - break; - } - case eBlur: { - OnFocusBlurPlugin(aElement, false); - break; - } - default: - break; - } -} - -NS_IMETHODIMP -HTMLObjectElement::PostHandleEvent(EventChainPostVisitor& aVisitor) -{ - HandleFocusBlurPlugin(this, aVisitor.mEvent); - return NS_OK; -} - -#endif // #ifdef XP_MACOSX - NS_IMETHODIMP HTMLObjectElement::GetForm(nsIDOMHTMLFormElement **aForm) { @@ -282,14 +149,6 @@ void HTMLObjectElement::UnbindFromTree(bool aDeep, bool aNullParent) { -#ifdef XP_MACOSX - // When a page is reloaded (when an nsIDocument's content is removed), the - // focused element isn't necessarily sent an eBlur event. See - // nsFocusManager::ContentRemoved(). This means that a widget may think it - // still contains a focused plugin when it doesn't -- which in turn can - // disable text input in the browser window. See bug 1137229. - OnFocusBlurPlugin(this, false); -#endif nsObjectLoadingContent::UnbindFromTree(aDeep, aNullParent); nsGenericHTMLFormElement::UnbindFromTree(aDeep, aNullParent); } diff --git a/dom/html/HTMLSharedObjectElement.cpp b/dom/html/HTMLSharedObjectElement.cpp index f8b795af7d..f0cf4c188c 100644 --- a/dom/html/HTMLSharedObjectElement.cpp +++ b/dom/html/HTMLSharedObjectElement.cpp @@ -16,10 +16,6 @@ #include "nsIScriptError.h" #include "nsIWidget.h" #include "nsContentUtils.h" -#ifdef XP_MACOSX -#include "mozilla/EventDispatcher.h" -#include "mozilla/dom/Event.h" -#endif #include "mozilla/dom/HTMLObjectElement.h" @@ -42,9 +38,6 @@ HTMLSharedObjectElement::HTMLSharedObjectElement(already_AddRefed -#endif - extern mozilla::LazyLogModule gMediaStreamGraphLog; #define STREAM_LOG(type, msg) MOZ_LOG(gMediaStreamGraphLog, type, msg) @@ -586,32 +582,6 @@ AudioCallbackDriver::~AudioCallbackDriver() MOZ_ASSERT(mPromisesForOperation.IsEmpty()); } -bool IsMacbookOrMacbookAir() -{ -#ifdef XP_MACOSX - size_t len = 0; - sysctlbyname("hw.model", NULL, &len, NULL, 0); - if (len) { - UniquePtr model(new char[len]); - // This string can be - // MacBook%d,%d for a normal MacBook - // MacBookPro%d,%d for a MacBook Pro - // MacBookAir%d,%d for a Macbook Air - sysctlbyname("hw.model", model.get(), &len, NULL, 0); - char* substring = strstr(model.get(), "MacBook"); - if (substring) { - const size_t offset = strlen("MacBook"); - if (strncmp(model.get() + offset, "Air", len - offset) || - isdigit(model[offset + 1])) { - return true; - } - } - return false; - } -#endif - return false; -} - void AudioCallbackDriver::Init() { @@ -648,13 +618,6 @@ AudioCallbackDriver::Init() } } - // Macbook and MacBook air don't have enough CPU to run very low latency - // MediaStreamGraphs, cap the minimal latency to 512 frames int this case. - if (IsMacbookOrMacbookAir()) { - latency_frames = std::max((uint32_t) 512, latency_frames); - } - - input = output; input.channels = mInputChannels; // change to support optional stereo capture @@ -1068,44 +1031,6 @@ AudioCallbackDriver::MixerCallback(AudioDataValue* aMixedBuffer, NS_WARNING_ASSERTION(written == aFrames - toWrite, "Dropping frames."); }; -void AudioCallbackDriver::PanOutputIfNeeded(bool aMicrophoneActive) -{ -#ifdef XP_MACOSX - cubeb_device* out; - int rv; - char name[128]; - size_t length = sizeof(name); - - rv = sysctlbyname("hw.model", name, &length, NULL, 0); - if (rv) { - return; - } - - if (!strncmp(name, "MacBookPro", 10)) { - if (cubeb_stream_get_current_device(mAudioStream, &out) == CUBEB_OK) { - // Check if we are currently outputing sound on external speakers. - if (!strcmp(out->output_name, "ispk")) { - // Pan everything to the right speaker. - if (aMicrophoneActive) { - if (cubeb_stream_set_panning(mAudioStream, 1.0) != CUBEB_OK) { - NS_WARNING("Could not pan audio output to the right."); - } - } else { - if (cubeb_stream_set_panning(mAudioStream, 0.0) != CUBEB_OK) { - NS_WARNING("Could not pan audio output to the center."); - } - } - } else { - if (cubeb_stream_set_panning(mAudioStream, 0.0) != CUBEB_OK) { - NS_WARNING("Could not pan audio output to the center."); - } - } - cubeb_stream_device_destroy(mAudioStream, out); - } - } -#endif -} - void AudioCallbackDriver::DeviceChangedCallback() { // Tell the audio engine the device has changed, it might want to reset some @@ -1114,9 +1039,6 @@ AudioCallbackDriver::DeviceChangedCallback() { if (mAudioInput) { mAudioInput->DeviceChanged(); } -#ifdef XP_MACOSX - PanOutputIfNeeded(mMicrophoneActive); -#endif } void @@ -1125,10 +1047,6 @@ AudioCallbackDriver::SetMicrophoneActive(bool aActive) MonitorAutoLock mon(mGraphImpl->GetMonitor()); mMicrophoneActive = aActive; - -#ifdef XP_MACOSX - PanOutputIfNeeded(mMicrophoneActive); -#endif } uint32_t diff --git a/dom/media/GraphDriver.h b/dom/media/GraphDriver.h index bb4f2689b8..f2a514b328 100644 --- a/dom/media/GraphDriver.h +++ b/dom/media/GraphDriver.h @@ -456,11 +456,6 @@ public: void CompleteAudioContextOperations(AsyncCubebOperation aOperation); private: - /** - * On certain MacBookPro, the microphone is located near the left speaker. - * We need to pan the sound output to the right speaker if we are using the - * mic and the built-in speaker, or we will have terrible echo. */ - void PanOutputIfNeeded(bool aMicrophoneActive); /** * This is called when the output device used by the cubeb stream changes. */ void DeviceChangedCallback(); diff --git a/dom/media/eme/MediaKeySystemAccessManager.cpp b/dom/media/eme/MediaKeySystemAccessManager.cpp index 8fefc62ec7..770f3b3620 100644 --- a/dom/media/eme/MediaKeySystemAccessManager.cpp +++ b/dom/media/eme/MediaKeySystemAccessManager.cpp @@ -14,9 +14,6 @@ #ifdef XP_WIN #include "mozilla/WindowsVersion.h" #endif -#ifdef XP_MACOSX -#include "nsCocoaFeatures.h" -#endif #include "nsPrintfCString.h" namespace mozilla { diff --git a/dom/media/gmp/GMPChild.cpp b/dom/media/gmp/GMPChild.cpp index 14b06cc726..f0bfaf93aa 100644 --- a/dom/media/gmp/GMPChild.cpp +++ b/dom/media/gmp/GMPChild.cpp @@ -110,14 +110,12 @@ GetPluginFile(const nsAString& aPluginPath, nsAutoString baseName; GetFileBase(aPluginPath, aLibDirectory, aLibFile, baseName); -#if defined(XP_MACOSX) - nsAutoString binaryName = NS_LITERAL_STRING("lib") + baseName + NS_LITERAL_STRING(".dylib"); -#elif defined(OS_POSIX) +#if defined(OS_POSIX) nsAutoString binaryName = NS_LITERAL_STRING("lib") + baseName + NS_LITERAL_STRING(".so"); #elif defined(XP_WIN) nsAutoString binaryName = baseName + NS_LITERAL_STRING(".dll"); #else -#error not defined +#error Unsupported O.S. #endif aLibFile->AppendRelativePath(binaryName); return true; diff --git a/dom/media/gmp/rlz/GMPDeviceBinding.cpp b/dom/media/gmp/rlz/GMPDeviceBinding.cpp index 04def8e8e0..0871d2e4ee 100644 --- a/dom/media/gmp/rlz/GMPDeviceBinding.cpp +++ b/dom/media/gmp/rlz/GMPDeviceBinding.cpp @@ -32,14 +32,6 @@ #include "windows.h" #endif -#ifdef XP_MACOSX -#include -#ifdef HASH_NODE_ID_WITH_DEVICE_ID -#include -#include -#include -#endif -#endif #endif // HASH_NODE_ID_WITH_DEVICE_ID @@ -83,46 +75,6 @@ GetStackAfterCurrentFrame(uint8_t** aOutTop, uint8_t** aOutBottom) } #endif -#if defined(XP_MACOSX) && defined(HASH_NODE_ID_WITH_DEVICE_ID) -static mach_vm_address_t -RegionContainingAddress(mach_vm_address_t aAddress) -{ - mach_port_t task; - kern_return_t kr = task_for_pid(mach_task_self(), getpid(), &task); - if (kr != KERN_SUCCESS) { - return 0; - } - - mach_vm_address_t address = aAddress; - mach_vm_size_t size; - vm_region_basic_info_data_64_t info; - mach_msg_type_number_t count = VM_REGION_BASIC_INFO_COUNT_64; - mach_port_t object_name; - kr = mach_vm_region(task, &address, &size, VM_REGION_BASIC_INFO_64, - reinterpret_cast(&info), &count, - &object_name); - if (kr != KERN_SUCCESS || size == 0 - || address > aAddress || address + size <= aAddress) { - // mach_vm_region failed, or couldn't find region at given address. - return 0; - } - - return address; -} - -MOZ_NEVER_INLINE -static bool -GetStackAfterCurrentFrame(uint8_t** aOutTop, uint8_t** aOutBottom) -{ - mach_vm_address_t stackFrame = - reinterpret_cast(__builtin_frame_address(0)); - *aOutTop = reinterpret_cast(stackFrame); - // Kernel code shows that stack is always a single region. - *aOutBottom = reinterpret_cast(RegionContainingAddress(stackFrame)); - return *aOutBottom && (*aOutBottom < *aOutTop); -} -#endif - #ifdef HASH_NODE_ID_WITH_DEVICE_ID static void SecureMemset(void* start, uint8_t value, size_t size) { diff --git a/dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.cpp b/dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.cpp index 4671499e5d..513a8998b8 100644 --- a/dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.cpp +++ b/dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.cpp @@ -26,14 +26,6 @@ public: static FFmpegLibWrapper sLibAV; static const char* sLibs[] = { -#if defined(XP_DARWIN) - "libavcodec.58.dylib", - "libavcodec.57.dylib", - "libavcodec.56.dylib", - "libavcodec.55.dylib", - "libavcodec.54.dylib", - "libavcodec.53.dylib", -#else "libavcodec.so.58", "libavcodec-ffmpeg.so.58", "libavcodec-ffmpeg.so.57", @@ -43,7 +35,6 @@ static const char* sLibs[] = { "libavcodec.so.55", "libavcodec.so.54", "libavcodec.so.53", -#endif }; /* static */ bool diff --git a/dom/media/systemservices/LoadMonitor.cpp b/dom/media/systemservices/LoadMonitor.cpp index 7a64c4fb0b..ef8d1a0cc7 100644 --- a/dom/media/systemservices/LoadMonitor.cpp +++ b/dom/media/systemservices/LoadMonitor.cpp @@ -31,12 +31,6 @@ #include #endif -#ifdef XP_MACOSX -#include -#include -#include -#endif - #if defined(__DragonFly__) || defined(__FreeBSD__) \ || defined(__NetBSD__) || defined(__OpenBSD__) #include @@ -410,27 +404,6 @@ nsresult RTCLoadInfo::UpdateSystemLoad() const uint64_t cpu_times = nice + system + user; const uint64_t total_times = cpu_times + idle; - UpdateCpuLoad(mTicksPerInterval, - total_times, - cpu_times, - &mSystemLoad); - return NS_OK; -#elif defined(XP_MACOSX) - mach_msg_type_number_t info_cnt = HOST_CPU_LOAD_INFO_COUNT; - host_cpu_load_info_data_t load_info; - kern_return_t rv = host_statistics(mach_host_self(), HOST_CPU_LOAD_INFO, - (host_info_t)(&load_info), &info_cnt); - - if (rv != KERN_SUCCESS || info_cnt != HOST_CPU_LOAD_INFO_COUNT) { - LOG(("Error from mach/host_statistics call")); - return NS_ERROR_FAILURE; - } - - const uint64_t cpu_times = load_info.cpu_ticks[CPU_STATE_NICE] - + load_info.cpu_ticks[CPU_STATE_SYSTEM] - + load_info.cpu_ticks[CPU_STATE_USER]; - const uint64_t total_times = cpu_times + load_info.cpu_ticks[CPU_STATE_IDLE]; - UpdateCpuLoad(mTicksPerInterval, total_times, cpu_times, diff --git a/dom/media/webaudio/AudioContext.cpp b/dom/media/webaudio/AudioContext.cpp index 75f57a630b..3c7958349b 100755 --- a/dom/media/webaudio/AudioContext.cpp +++ b/dom/media/webaudio/AudioContext.cpp @@ -873,7 +873,6 @@ AudioContext::OnStateChanged(void* aPromise, AudioContextState aNewState) } #ifndef WIN32 // Bug 1170547 -#ifndef XP_MACOSX #ifdef DEBUG if (!((mAudioContextState == AudioContextState::Suspended && @@ -892,7 +891,6 @@ AudioContext::OnStateChanged(void* aPromise, AudioContextState aNewState) } #endif // DEBUG -#endif // XP_MACOSX #endif // WIN32 MOZ_ASSERT( diff --git a/dom/media/webrtc/MediaEngineCameraVideoSource.cpp b/dom/media/webrtc/MediaEngineCameraVideoSource.cpp index e1e572724f..e63a9afded 100644 --- a/dom/media/webrtc/MediaEngineCameraVideoSource.cpp +++ b/dom/media/webrtc/MediaEngineCameraVideoSource.cpp @@ -339,13 +339,6 @@ MediaEngineCameraVideoSource::SetName(nsString aName) facingMode = VideoFacingModeEnum::User; } #endif // ANDROID -#ifdef XP_MACOSX - // Kludge to test user-facing cameras on OSX. - if (aName.Find(NS_LITERAL_STRING("Face")) != -1) { - hasFacingMode = true; - facingMode = VideoFacingModeEnum::User; - } -#endif #ifdef XP_WIN // The cameras' name of Surface book are "Microsoft Camera Front" and // "Microsoft Camera Rear" respectively. diff --git a/dom/plugins/base/PluginPRLibrary.cpp b/dom/plugins/base/PluginPRLibrary.cpp index 57c6c57ab3..e6a202c244 100644 --- a/dom/plugins/base/PluginPRLibrary.cpp +++ b/dom/plugins/base/PluginPRLibrary.cpp @@ -24,7 +24,7 @@ static int gNotOptimized; using namespace mozilla::layers; namespace mozilla { -#if defined(XP_UNIX) && !defined(XP_MACOSX) +#if defined(XP_UNIX) nsresult PluginPRLibrary::NP_Initialize(NPNetscapeFuncs* bFuncs, NPPluginFuncs* pFuncs, NPError* error) @@ -110,7 +110,7 @@ nsresult PluginPRLibrary::NP_GetValue(void *future, NPPVariable aVariable, void *aValue, NPError* error) { -#if defined(XP_UNIX) && !defined(XP_MACOSX) +#if defined(XP_UNIX) if (mNP_GetValue) { *error = mNP_GetValue(future, aVariable, aValue); } else { @@ -125,7 +125,7 @@ PluginPRLibrary::NP_GetValue(void *future, NPPVariable aVariable, #endif } -#if defined(XP_WIN) || defined(XP_MACOSX) +#if defined(XP_WIN) nsresult PluginPRLibrary::NP_GetEntryPoints(NPPluginFuncs* pFuncs, NPError* error) { @@ -231,17 +231,7 @@ PluginPRLibrary::GetImageContainer(NPP instance, ImageContainer** aContainer) return NS_ERROR_NOT_IMPLEMENTED; } -#if defined(XP_MACOSX) -nsresult -PluginPRLibrary::IsRemoteDrawingCoreAnimation(NPP instance, bool *aDrawing) -{ - nsNPAPIPluginInstance* inst = (nsNPAPIPluginInstance*)instance->ndata; - NS_ENSURE_TRUE(inst, NS_ERROR_NULL_POINTER); - *aDrawing = false; - return NS_OK; -} -#endif -#if defined(XP_MACOSX) || defined(XP_WIN) +#if defined(XP_WIN) nsresult PluginPRLibrary::ContentsScaleFactorChanged(NPP instance, double aContentsScaleFactor) { diff --git a/dom/plugins/base/PluginPRLibrary.h b/dom/plugins/base/PluginPRLibrary.h index ffd3de934e..4934b37bbb 100644 --- a/dom/plugins/base/PluginPRLibrary.h +++ b/dom/plugins/base/PluginPRLibrary.h @@ -17,17 +17,17 @@ class PluginPRLibrary : public PluginLibrary { public: PluginPRLibrary(const char* aFilePath, PRLibrary* aLibrary) : -#if defined(XP_UNIX) && !defined(XP_MACOSX) +#if defined(XP_UNIX) mNP_Initialize(nullptr), #else mNP_Initialize(nullptr), #endif mNP_Shutdown(nullptr), mNP_GetMIMEDescription(nullptr), -#if defined(XP_UNIX) && !defined(XP_MACOSX) +#if defined(XP_UNIX) mNP_GetValue(nullptr), #endif -#if defined(XP_WIN) || defined(XP_MACOSX) +#if defined(XP_WIN) mNP_GetEntryPoints(nullptr), #endif mNPP_New(nullptr), @@ -60,19 +60,17 @@ public: mNP_GetMIMEDescription = (NP_GetMIMEDescriptionFunc) PR_FindFunctionSymbol(mLibrary, "NP_GetMIMEDescription"); -#ifndef XP_MACOSX if (!mNP_GetMIMEDescription) return false; -#endif -#if defined(XP_UNIX) && !defined(XP_MACOSX) +#if defined(XP_UNIX) mNP_GetValue = (NP_GetValueFunc) PR_FindFunctionSymbol(mLibrary, "NP_GetValue"); if (!mNP_GetValue) return false; #endif -#if defined(XP_WIN) || defined(XP_MACOSX) +#if defined(XP_WIN) mNP_GetEntryPoints = (NP_GetEntryPointsFunc) PR_FindFunctionSymbol(mLibrary, "NP_GetEntryPoints"); if (!mNP_GetEntryPoints) @@ -81,7 +79,7 @@ public: return true; } -#if defined(XP_UNIX) && !defined(XP_MACOSX) +#if defined(XP_UNIX) virtual nsresult NP_Initialize(NPNetscapeFuncs* aNetscapeFuncs, NPPluginFuncs* aFuncs, NPError* aError) override; #else @@ -95,7 +93,7 @@ public: virtual nsresult NP_GetValue(void* aFuture, NPPVariable aVariable, void* aValue, NPError* aError) override; -#if defined(XP_WIN) || defined(XP_MACOSX) +#if defined(XP_WIN) virtual nsresult NP_GetEntryPoints(NPPluginFuncs* aFuncs, NPError* aError) override; #endif @@ -112,10 +110,7 @@ public: virtual nsresult GetImageContainer(NPP aInstance, mozilla::layers::ImageContainer** aContainer) override; virtual nsresult GetImageSize(NPP aInstance, nsIntSize* aSize) override; virtual bool IsOOP() override { return false; } -#if defined(XP_MACOSX) - virtual nsresult IsRemoteDrawingCoreAnimation(NPP aInstance, bool* aDrawing) override; -#endif -#if defined(XP_MACOSX) || defined(XP_WIN) +#if defined(XP_WIN) virtual nsresult ContentsScaleFactorChanged(NPP aInstance, double aContentsScaleFactor) override; #endif virtual nsresult SetBackgroundUnknown(NPP instance) override; @@ -139,10 +134,10 @@ private: NP_InitializeFunc mNP_Initialize; NP_ShutdownFunc mNP_Shutdown; NP_GetMIMEDescriptionFunc mNP_GetMIMEDescription; -#if defined(XP_UNIX) && !defined(XP_MACOSX) +#if defined(XP_UNIX) NP_GetValueFunc mNP_GetValue; #endif -#if defined(XP_WIN) || defined(XP_MACOSX) +#if defined(XP_WIN) NP_GetEntryPointsFunc mNP_GetEntryPoints; #endif NPP_NewProcPtr mNPP_New; diff --git a/dom/plugins/base/npapi.h b/dom/plugins/base/npapi.h index aa6a66b2bd..de58f818c4 100644 --- a/dom/plugins/base/npapi.h +++ b/dom/plugins/base/npapi.h @@ -22,25 +22,6 @@ #endif #endif -#if defined(__APPLE_CC__) && !defined(XP_UNIX) -#ifndef XP_MACOSX -#define XP_MACOSX 1 -#endif -#endif - -#if defined(XP_MACOSX) && defined(__LP64__) -#define NP_NO_QUICKDRAW -#define NP_NO_CARBON -#endif - -#if defined(XP_MACOSX) -#include -#include -#ifndef NP_NO_CARBON -#include -#endif -#endif - #if defined(XP_UNIX) #include #if defined(MOZ_X11) @@ -117,12 +98,6 @@ typedef char* NPMIMEType; /* Structures and definitions */ /*----------------------------------------------------------------------*/ -#if !defined(__LP64__) -#if defined(XP_MACOSX) -#pragma options align=mac68k -#endif -#endif /* __LP64__ */ - /* * NPP is a plug-in's opaque instance handle */ @@ -280,15 +255,6 @@ typedef struct _NPAudioDeviceChangeDetails typedef enum { NPDrawingModelDUMMY -#if defined(XP_MACOSX) -#ifndef NP_NO_QUICKDRAW - , NPDrawingModelQuickDraw = 0 -#endif - , NPDrawingModelCoreGraphics = 1 - , NPDrawingModelOpenGL = 2 - , NPDrawingModelCoreAnimation = 3 - , NPDrawingModelInvalidatingCoreAnimation = 4 -#endif #if defined(XP_WIN) , NPDrawingModelSyncWin = 5 #endif @@ -301,15 +267,6 @@ typedef enum { #endif } NPDrawingModel; -#ifdef XP_MACOSX -typedef enum { -#ifndef NP_NO_CARBON - NPEventModelCarbon = 0, -#endif - NPEventModelCocoa = 1 -} NPEventModel; -#endif - /* * The following masks are applied on certain platforms to NPNV and * NPPV selectors that pass around pointers to COM interfaces. Newer @@ -337,12 +294,7 @@ typedef enum { #define _NP_ABI_MIXIN_FOR_GCC3 0 #endif -#if defined(XP_MACOSX) -#define NP_ABI_MACHO_MASK 0x01000000 -#define _NP_ABI_MIXIN_FOR_MACHO NP_ABI_MACHO_MASK -#else #define _NP_ABI_MIXIN_FOR_MACHO 0 -#endif #define NP_ABI_MASK (_NP_ABI_MIXIN_FOR_GCC3 | _NP_ABI_MIXIN_FOR_MACHO) @@ -393,12 +345,6 @@ typedef enum { /* Used for negotiating drawing models */ NPPVpluginDrawingModel = 1000 -#if defined(XP_MACOSX) - /* Used for negotiating event models */ - , NPPVpluginEventModel = 1001 - /* In the NPDrawingModelCoreAnimation drawing model, the browser asks the plug-in for a Core Animation layer. */ - , NPPVpluginCoreAnimationLayer = 1003 -#endif /* Notification that the plugin just started or stopped playing audio */ , NPPVpluginIsPlayingAudio = 4000 #if defined(XP_WIN) @@ -442,39 +388,18 @@ typedef enum { NPNVCSSZoomFactor = 23, NPNVpluginDrawingModel = 1000 /* Get the current drawing model (NPDrawingModel) */ -#if defined(XP_MACOSX) || defined(XP_WIN) +#if defined(XP_WIN) , NPNVcontentsScaleFactor = 1001 -#endif -#if defined(XP_MACOSX) -#ifndef NP_NO_QUICKDRAW - , NPNVsupportsQuickDrawBool = 2000 -#endif - , NPNVsupportsCoreGraphicsBool = 2001 - , NPNVsupportsOpenGLBool = 2002 - , NPNVsupportsCoreAnimationBool = 2003 - , NPNVsupportsInvalidatingCoreAnimationBool = 2004 #endif , NPNVsupportsAsyncBitmapSurfaceBool = 2007 #if defined(XP_WIN) , NPNVsupportsAsyncWindowsDXGISurfaceBool = 2008 , NPNVpreferredDXGIAdapter = 2009 -#endif -#if defined(XP_MACOSX) -#ifndef NP_NO_CARBON - , NPNVsupportsCarbonBool = 3000 /* TRUE if the browser supports the Carbon event model */ -#endif - , NPNVsupportsCocoaBool = 3001 /* TRUE if the browser supports the Cocoa event model */ - , NPNVsupportsUpdatedCocoaTextInputBool = 3002 /* TRUE if the browser supports the updated - Cocoa text input specification. */ #endif , NPNVmuteAudioBool = 4000 /* Request that the browser wants to mute or unmute the plugin */ #if defined(XP_WIN) , NPNVaudioDeviceChangeDetails = 4001 /* Provides information about the new default audio device */ #endif -#if defined(XP_MACOSX) - , NPNVsupportsCompositingCoreAnimationPluginsBool = 74656 /* TRUE if the browser supports - CA model compositing */ -#endif } NPNVariable; typedef enum { @@ -509,7 +434,7 @@ typedef struct _NPWindow uint32_t width; /* Maximum window size */ uint32_t height; NPRect clipRect; /* Clipping rectangle in port coordinates */ -#if (defined(XP_UNIX) || defined(XP_SYMBIAN)) && !defined(XP_MACOSX) +#if defined(XP_UNIX) || defined(XP_SYMBIAN) void * ws_info; /* Platform-dependent additional data */ #endif /* XP_UNIX */ NPWindowType type; /* Is this a window or a drawable? */ @@ -555,11 +480,7 @@ typedef struct _NPPrint } print; } NPPrint; -#if defined(XP_MACOSX) -#ifndef NP_NO_CARBON -typedef EventRecord NPEvent; -#endif -#elif defined(XP_SYMBIAN) +#if defined(XP_SYMBIAN) typedef QEvent NPEvent; #elif defined(XP_WIN) typedef struct _NPEvent @@ -574,13 +495,7 @@ typedef XEvent NPEvent; typedef void* NPEvent; #endif -#if defined(XP_MACOSX) -typedef void* NPRegion; -#ifndef NP_NO_QUICKDRAW -typedef RgnHandle NPQDRegion; -#endif -typedef CGPathRef NPCGRegion; -#elif defined(XP_WIN) +#if defined(XP_WIN) typedef HRGN NPRegion; #elif defined(XP_UNIX) && defined(MOZ_X11) typedef Region NPRegion; @@ -594,11 +509,7 @@ typedef struct _NPNSString NPNSString; typedef struct _NPNSWindow NPNSWindow; typedef struct _NPNSMenu NPNSMenu; -#if defined(XP_MACOSX) -typedef NPNSMenu NPMenu; -#else typedef void *NPMenu; -#endif typedef enum { NPCoordinateSpacePlugin = 1, @@ -608,112 +519,6 @@ typedef enum { NPCoordinateSpaceFlippedScreen } NPCoordinateSpace; -#if defined(XP_MACOSX) - -#ifndef NP_NO_QUICKDRAW -typedef struct NP_Port -{ - CGrafPtr port; - int32_t portx; /* position inside the topmost window */ - int32_t porty; -} NP_Port; -#endif /* NP_NO_QUICKDRAW */ - -/* - * NP_CGContext is the type of the NPWindow's 'window' when the plugin specifies NPDrawingModelCoreGraphics - * as its drawing model. - */ - -typedef struct NP_CGContext -{ - CGContextRef context; - void *window; /* A WindowRef under the Carbon event model. */ -} NP_CGContext; - -/* - * NP_GLContext is the type of the NPWindow's 'window' when the plugin specifies NPDrawingModelOpenGL as its - * drawing model. - */ - -typedef struct NP_GLContext -{ - CGLContextObj context; -#ifdef NP_NO_CARBON - NPNSWindow *window; -#else - void *window; /* Can be either an NSWindow or a WindowRef depending on the event model */ -#endif -} NP_GLContext; - -typedef enum { - NPCocoaEventDrawRect = 1, - NPCocoaEventMouseDown, - NPCocoaEventMouseUp, - NPCocoaEventMouseMoved, - NPCocoaEventMouseEntered, - NPCocoaEventMouseExited, - NPCocoaEventMouseDragged, - NPCocoaEventKeyDown, - NPCocoaEventKeyUp, - NPCocoaEventFlagsChanged, - NPCocoaEventFocusChanged, - NPCocoaEventWindowFocusChanged, - NPCocoaEventScrollWheel, - NPCocoaEventTextInput -} NPCocoaEventType; - -typedef struct _NPCocoaEvent { - NPCocoaEventType type; - uint32_t version; - union { - struct { - uint32_t modifierFlags; - double pluginX; - double pluginY; - int32_t buttonNumber; - int32_t clickCount; - double deltaX; - double deltaY; - double deltaZ; - } mouse; - struct { - uint32_t modifierFlags; - NPNSString *characters; - NPNSString *charactersIgnoringModifiers; - NPBool isARepeat; - uint16_t keyCode; - } key; - struct { - CGContextRef context; - double x; - double y; - double width; - double height; - } draw; - struct { - NPBool hasFocus; - } focus; - struct { - NPNSString *text; - } text; - } data; -} NPCocoaEvent; - -#ifndef NP_NO_CARBON -/* Non-standard event types that can be passed to HandleEvent */ -enum NPEventType { - NPEventType_GetFocusEvent = (osEvt + 16), - NPEventType_LoseFocusEvent, - NPEventType_AdjustCursorEvent, - NPEventType_MenuCommandEvent, - NPEventType_ClippingChangedEvent, - NPEventType_ScrollingBeginsEvent = 1000, - NPEventType_ScrollingEndsEvent -}; -#endif /* NP_NO_CARBON */ - -#endif /* XP_MACOSX */ - /* * Values for mode passed to NPP_New: */ @@ -736,12 +541,6 @@ enum NPEventType { #define NP_CLEAR_ALL 0 #define NP_CLEAR_CACHE (1 << 0) -#if !defined(__LP64__) -#if defined(XP_MACOSX) -#pragma options align=reset -#endif -#endif /* __LP64__ */ - /*----------------------------------------------------------------------*/ /* Error and Reason Code definitions */ /*----------------------------------------------------------------------*/ diff --git a/dom/plugins/base/npfunctions.h b/dom/plugins/base/npfunctions.h index 73097d115e..7638a64882 100644 --- a/dom/plugins/base/npfunctions.h +++ b/dom/plugins/base/npfunctions.h @@ -182,31 +182,6 @@ typedef struct _NPNetscapeFuncs { NPN_SetCurrentAsyncSurfacePtr setcurrentasyncsurface; } NPNetscapeFuncs; -#ifdef XP_MACOSX -/* - * Mac OS X version(s) of NP_GetMIMEDescription(const char *) - * These can be called to retreive MIME information from the plugin dynamically - * - * Note: For compatibility with Quicktime, BPSupportedMIMEtypes is another way - * to get mime info from the plugin only on OSX and may not be supported - * in furture version -- use NP_GetMIMEDescription instead - */ -enum -{ - kBPSupportedMIMETypesStructVers_1 = 1 -}; -typedef struct _BPSupportedMIMETypes -{ - SInt32 structVersion; /* struct version */ - Handle typeStrings; /* STR# formated handle, allocated by plug-in */ - Handle infoStrings; /* STR# formated handle, allocated by plug-in */ -} BPSupportedMIMETypes; -OSErr BP_GetSupportedMIMETypes(BPSupportedMIMETypes *mimeInfo, UInt32 flags); -#define NP_GETMIMEDESCRIPTION_NAME "NP_GetMIMEDescription" -typedef const char* (*NP_GetMIMEDescriptionProcPtr)(void); -typedef OSErr (*BP_GetSupportedMIMETypesProcPtr)(BPSupportedMIMETypes*, UInt32); -#endif - #if defined(_WIN32) #define OSCALL WINAPI #else @@ -251,15 +226,8 @@ typedef char* (*NP_GetPluginVersionFunc)(void); NP_EXPORT(char*) NP_GetPluginVersion(void); typedef const char* (*NP_GetMIMEDescriptionFunc)(void); NP_EXPORT(const char*) NP_GetMIMEDescription(void); -#ifdef XP_MACOSX -typedef NPError (*NP_InitializeFunc)(NPNetscapeFuncs*); -NP_EXPORT(NPError) NP_Initialize(NPNetscapeFuncs* bFuncs); -typedef NPError (*NP_GetEntryPointsFunc)(NPPluginFuncs*); -NP_EXPORT(NPError) NP_GetEntryPoints(NPPluginFuncs* pFuncs); -#else typedef NPError (*NP_InitializeFunc)(NPNetscapeFuncs*, NPPluginFuncs*); NP_EXPORT(NPError) NP_Initialize(NPNetscapeFuncs* bFuncs, NPPluginFuncs* pFuncs); -#endif typedef NPError (*NP_ShutdownFunc)(void); NP_EXPORT(NPError) NP_Shutdown(void); typedef NPError (*NP_GetValueFunc)(void *, NPPVariable, void *); diff --git a/dom/plugins/base/nsNPAPIPlugin.cpp b/dom/plugins/base/nsNPAPIPlugin.cpp index da4f09914f..b2e931483f 100644 --- a/dom/plugins/base/nsNPAPIPlugin.cpp +++ b/dom/plugins/base/nsNPAPIPlugin.cpp @@ -269,14 +269,6 @@ nsNPAPIPlugin::CreatePlugin(nsPluginTag *aPluginTag, nsNPAPIPlugin** aResult) return NS_ERROR_FAILURE; } -#ifdef XP_MACOSX - if (!pluginLib->HasRequiredFunctions()) { - NS_WARNING("Not all necessary functions exposed by plugin, it will not load."); - delete pluginLib; - return NS_ERROR_FAILURE; - } -#endif - plugin->mLibrary = pluginLib; pluginLib->SetPlugin(plugin); @@ -294,19 +286,6 @@ nsNPAPIPlugin::CreatePlugin(nsPluginTag *aPluginTag, nsNPAPIPlugin** aResult) if (rv != NS_OK || pluginCallError != NPERR_NO_ERROR) { return NS_ERROR_FAILURE; } -#elif defined(XP_MACOSX) - // NP_Initialize must be called before NP_GetEntryPoints on Mac OS X. - // We need to match WebKit's behavior. - NPError pluginCallError; - nsresult rv = pluginLib->NP_Initialize(&sBrowserFuncs, &pluginCallError); - if (rv != NS_OK || pluginCallError != NPERR_NO_ERROR) { - return NS_ERROR_FAILURE; - } - - rv = pluginLib->NP_GetEntryPoints(&plugin->mPluginFuncs, &pluginCallError); - if (rv != NS_OK || pluginCallError != NPERR_NO_ERROR) { - return NS_ERROR_FAILURE; - } #else NPError pluginCallError; nsresult rv = pluginLib->NP_Initialize(&sBrowserFuncs, &plugin->mPluginFuncs, &pluginCallError); @@ -1729,7 +1708,7 @@ _getvalue(NPP npp, NPNVariable variable, void *result) // cases for android_npapi.h's non-standard ANPInterface values. switch (static_cast(variable)) { -#if defined(XP_UNIX) && !defined(XP_MACOSX) +#if defined(XP_UNIX) case NPNVxDisplay : { #if defined(MOZ_X11) if (npp) { @@ -1854,8 +1833,7 @@ _getvalue(NPP npp, NPNVariable variable, void *result) } case NPNVSupportsWindowless: { -#if defined(XP_WIN) || defined(XP_MACOSX) || \ - (defined(MOZ_X11) && defined(MOZ_WIDGET_GTK)) +#if defined(XP_WIN) || (defined(MOZ_X11) && defined(MOZ_WIDGET_GTK)) *(NPBool*)result = true; #else *(NPBool*)result = false; @@ -1923,72 +1901,7 @@ _getvalue(NPP npp, NPNVariable variable, void *result) return *(char**)result ? NPERR_NO_ERROR : NPERR_GENERIC_ERROR; } -#ifdef XP_MACOSX - case NPNVpluginDrawingModel: { - if (npp) { - nsNPAPIPluginInstance *inst = (nsNPAPIPluginInstance*)npp->ndata; - if (inst) { - NPDrawingModel drawingModel; - inst->GetDrawingModel((int32_t*)&drawingModel); - *(NPDrawingModel*)result = drawingModel; - return NPERR_NO_ERROR; - } - } - return NPERR_GENERIC_ERROR; - } - -#ifndef NP_NO_QUICKDRAW - case NPNVsupportsQuickDrawBool: { - *(NPBool*)result = false; - - return NPERR_NO_ERROR; - } -#endif - - case NPNVsupportsCoreGraphicsBool: { - *(NPBool*)result = true; - - return NPERR_NO_ERROR; - } - - case NPNVsupportsCoreAnimationBool: { - *(NPBool*)result = true; - - return NPERR_NO_ERROR; - } - - case NPNVsupportsInvalidatingCoreAnimationBool: { - *(NPBool*)result = true; - - return NPERR_NO_ERROR; - } - - case NPNVsupportsCompositingCoreAnimationPluginsBool: { - *(NPBool*)result = PR_TRUE; - - return NPERR_NO_ERROR; - } - -#ifndef NP_NO_CARBON - case NPNVsupportsCarbonBool: { - *(NPBool*)result = false; - - return NPERR_NO_ERROR; - } -#endif - case NPNVsupportsCocoaBool: { - *(NPBool*)result = true; - - return NPERR_NO_ERROR; - } - - case NPNVsupportsUpdatedCocoaTextInputBool: { - *(NPBool*)result = true; - return NPERR_NO_ERROR; - } -#endif - -#if defined(XP_MACOSX) || defined(XP_WIN) +#if defined(XP_WIN) case NPNVcontentsScaleFactor: { nsNPAPIPluginInstance *inst = (nsNPAPIPluginInstance *) (npp ? npp->ndata : nullptr); @@ -2051,16 +1964,8 @@ _setvalue(NPP npp, NPPVariable variable, void *result) // actual pointer value is checked rather than its content // when passing booleans case NPPVpluginWindowBool: { -#ifdef XP_MACOSX - // This setting doesn't apply to OS X (only to Windows and Unix/Linux). - // See https://developer.mozilla.org/En/NPN_SetValue#section_5. Return - // NPERR_NO_ERROR here to conform to other browsers' behavior on OS X - // (e.g. Safari and Opera). - return NPERR_NO_ERROR; -#else NPBool bWindowless = (result == nullptr); return inst->SetWindowless(bWindowless); -#endif } case NPPVpluginTransparentBool: { NPBool bTransparent = (result != nullptr); @@ -2145,18 +2050,6 @@ _setvalue(NPP npp, NPPVariable variable, void *result) } } -#ifdef XP_MACOSX - case NPPVpluginEventModel: { - if (inst) { - inst->SetEventModel((NPEventModel)NS_PTR_TO_INT32(result)); - return NPERR_NO_ERROR; - } - else { - return NPERR_GENERIC_ERROR; - } - } -#endif - default: return NPERR_GENERIC_ERROR; } diff --git a/dom/plugins/base/nsNPAPIPlugin.h b/dom/plugins/base/nsNPAPIPlugin.h index 96e630b629..7727bf77fb 100644 --- a/dom/plugins/base/nsNPAPIPlugin.h +++ b/dom/plugins/base/nsNPAPIPlugin.h @@ -45,10 +45,6 @@ public: // PluginFuncs() can't fail but results are only valid if GetLibrary() succeeds NPPluginFuncs* PluginFuncs(); -#if defined(XP_MACOSX) && !defined(__LP64__) - void SetPluginRefNum(short aRefNum); -#endif - // The IPC mechanism notifies the nsNPAPIPlugin if the plugin // crashes and is no longer usable. pluginDumpID/browserDumpID are // the IDs of respective minidumps that were written, or empty if no diff --git a/dom/plugins/base/nsNPAPIPluginInstance.cpp b/dom/plugins/base/nsNPAPIPluginInstance.cpp index 7ee71c8f72..203c61a5c8 100644 --- a/dom/plugins/base/nsNPAPIPluginInstance.cpp +++ b/dom/plugins/base/nsNPAPIPluginInstance.cpp @@ -60,9 +60,6 @@ nsNPAPIPluginInstance::nsNPAPIPluginInstance() , mPlugin(nullptr) , mMIMEType(nullptr) , mOwner(nullptr) -#ifdef XP_MACOSX - , mCurrentPluginEvent(nullptr) -#endif , mHaveJavaC2PJSObjectQuirk(false) , mCachedParamLength(0) , mCachedParamNames(nullptr) @@ -503,9 +500,6 @@ nsresult nsNPAPIPluginInstance::HandleEvent(void* event, int16_t* result, int16_t tmpResult = kNPEventNotHandled; if (pluginFunctions->event) { -#ifdef XP_MACOSX - mCurrentPluginEvent = event; -#endif #if defined(XP_WIN) NS_TRY_SAFE_CALL_RETURN(tmpResult, (*pluginFunctions->event)(&mNPP, event), this, aSafeToReenterGecko); @@ -519,9 +513,6 @@ nsresult nsNPAPIPluginInstance::HandleEvent(void* event, int16_t* result, if (result) *result = tmpResult; -#ifdef XP_MACOSX - mCurrentPluginEvent = nullptr; -#endif } return NS_OK; @@ -617,19 +608,6 @@ void nsNPAPIPluginInstance::RedrawPlugin() mOwner->RedrawPlugin(); } -#if defined(XP_MACOSX) -void nsNPAPIPluginInstance::SetEventModel(NPEventModel aModel) -{ - // the event model needs to be set for the object frame immediately - if (!mOwner) { - NS_WARNING("Trying to set event model without a plugin instance owner!"); - return; - } - - mOwner->SetEventModel(aModel); -} -#endif - nsresult nsNPAPIPluginInstance::GetDrawingModel(int32_t* aModel) { *aModel = (int32_t)mDrawingModel; @@ -638,24 +616,14 @@ nsresult nsNPAPIPluginInstance::GetDrawingModel(int32_t* aModel) nsresult nsNPAPIPluginInstance::IsRemoteDrawingCoreAnimation(bool* aDrawing) { -#ifdef XP_MACOSX - if (!mPlugin) - return NS_ERROR_FAILURE; - - PluginLibrary* library = mPlugin->GetLibrary(); - if (!library) - return NS_ERROR_FAILURE; - - return library->IsRemoteDrawingCoreAnimation(&mNPP, aDrawing); -#else + /** Mac Stub **/ return NS_ERROR_FAILURE; -#endif } nsresult nsNPAPIPluginInstance::ContentsScaleFactorChanged(double aContentsScaleFactor) { -#if defined(XP_MACOSX) || defined(XP_WIN) +#if defined(XP_WIN) if (!mPlugin) return NS_ERROR_FAILURE; @@ -732,12 +700,7 @@ nsNPAPIPluginInstance::ShouldCache() nsresult nsNPAPIPluginInstance::IsWindowless(bool* isWindowless) { -#ifdef XP_MACOSX - // All OS X plugins are windowless. - *isWindowless = true; -#else *isWindowless = mWindowless; -#endif return NS_OK; } diff --git a/dom/plugins/base/nsNPAPIPluginInstance.h b/dom/plugins/base/nsNPAPIPluginInstance.h index 48e62517de..c3272e0a87 100644 --- a/dom/plugins/base/nsNPAPIPluginInstance.h +++ b/dom/plugins/base/nsNPAPIPluginInstance.h @@ -34,12 +34,6 @@ class nsPluginInstanceOwner; const NPDrawingModel kDefaultDrawingModel = NPDrawingModelSyncWin; #elif defined(MOZ_X11) const NPDrawingModel kDefaultDrawingModel = NPDrawingModelSyncX; -#elif defined(XP_MACOSX) -#ifndef NP_NO_QUICKDRAW -const NPDrawingModel kDefaultDrawingModel = NPDrawingModelQuickDraw; // Not supported -#else -const NPDrawingModel kDefaultDrawingModel = NPDrawingModelCoreGraphics; -#endif #else const NPDrawingModel kDefaultDrawingModel = static_cast(0); #endif @@ -146,13 +140,6 @@ public: void SetDrawingModel(NPDrawingModel aModel); void RedrawPlugin(); -#ifdef XP_MACOSX - void SetEventModel(NPEventModel aModel); - - void* GetCurrentEvent() { - return mCurrentPluginEvent; - } -#endif nsresult NewStreamListener(const char* aURL, void* notifyData, nsNPAPIPluginStreamListener** listener); @@ -291,11 +278,6 @@ private: nsTArray mTimers; -#ifdef XP_MACOSX - // non-null during a HandleEvent call - void* mCurrentPluginEvent; -#endif - // Timestamp for the last time this plugin was stopped. // This is only valid when the plugin is actually stopped! mozilla::TimeStamp mStopTime; diff --git a/dom/plugins/base/nsPluginHost.cpp b/dom/plugins/base/nsPluginHost.cpp index 1b98855d1f..482a201f8f 100644 --- a/dom/plugins/base/nsPluginHost.cpp +++ b/dom/plugins/base/nsPluginHost.cpp @@ -33,9 +33,6 @@ #include "nsProtocolProxyService.h" #include "nsIStreamConverterService.h" #include "nsIFile.h" -#if defined(XP_MACOSX) -#include "nsILocalFileMac.h" -#endif #include "nsISeekableStream.h" #include "nsNetUtil.h" #include "nsIFileStreams.h" @@ -1925,19 +1922,7 @@ int64_t GetPluginLastModifiedTime(const nsCOMPtr& localfile) { PRTime fileModTime = 0; -#if defined(XP_MACOSX) - // On OS X the date of a bundle's "contents" (i.e. of its Info.plist file) - // is a much better guide to when it was last modified than the date of - // its package directory. See bug 313700. - nsCOMPtr localFileMac = do_QueryInterface(localfile); - if (localFileMac) { - localFileMac->GetBundleContentsLastModifiedTime(&fileModTime); - } else { - localfile->GetLastModifiedTime(&fileModTime); - } -#else localfile->GetLastModifiedTime(&fileModTime); -#endif return fileModTime; } diff --git a/dom/plugins/base/nsPluginInstanceOwner.cpp b/dom/plugins/base/nsPluginInstanceOwner.cpp index 0d4dc68ccc..60a9bc0caa 100644 --- a/dom/plugins/base/nsPluginInstanceOwner.cpp +++ b/dom/plugins/base/nsPluginInstanceOwner.cpp @@ -77,12 +77,6 @@ static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID); #include "mozilla/widget/WinMessages.h" #endif // #ifdef XP_WIN -#ifdef XP_MACOSX -#include "ComplexTextInputPanel.h" -#include "nsIDOMXULDocument.h" -#include "nsIDOMXULCommandDispatcher.h" -#endif - #ifdef MOZ_WIDGET_GTK #include #include @@ -229,27 +223,13 @@ nsPluginInstanceOwner::EndUpdateBackground(const nsIntRect& aRect) bool nsPluginInstanceOwner::UseAsyncRendering() { -#ifdef XP_MACOSX - if (mUseAsyncRendering) { - return true; - } -#endif - bool isOOP; bool result = (mInstance && NS_SUCCEEDED(mInstance->GetIsOOP(&isOOP)) && isOOP -#ifndef XP_MACOSX && (!mPluginWindow || mPluginWindow->type == NPWindowTypeDrawable) -#endif ); -#ifdef XP_MACOSX - if (result) { - mUseAsyncRendering = true; - } -#endif - return result; } @@ -275,13 +255,6 @@ nsPluginInstanceOwner::nsPluginInstanceOwner() mPluginFrame = nullptr; mWidgetCreationComplete = false; -#ifdef XP_MACOSX - mSentInitialTopLevelWindowEvent = false; - mLastWindowIsActive = false; - mLastContentFocused = false; - mLastScaleFactor = 1.0; - mShouldBlurOnActivate = false; -#endif mLastCSSZoomFactor = 1.0; mContentFocused = false; mWidgetVisible = true; @@ -289,16 +262,6 @@ nsPluginInstanceOwner::nsPluginInstanceOwner() mPluginDocumentActiveState = true; mLastMouseDownButtonType = -1; -#ifdef XP_MACOSX -#ifndef NP_NO_CARBON - // We don't support Carbon, but it is still the default model for i386 NPAPI. - mEventModel = NPEventModelCarbon; -#else - mEventModel = NPEventModelCocoa; -#endif - mUseAsyncRendering = false; -#endif - mWaitingForPaint = false; #ifdef XP_WIN @@ -531,15 +494,6 @@ NS_IMETHODIMP nsPluginInstanceOwner::InvalidateRect(NPRect *invalidRect) if (!mPluginFrame || !invalidRect || !mWidgetVisible) return NS_ERROR_FAILURE; -#ifdef XP_MACOSX - // Each time an asynchronously-drawing plugin sends a new surface to display, - // the image in the ImageContainer is updated and InvalidateRect is called. - // There are different side effects for (sync) Android plugins. - RefPtr container; - mInstance->GetImageContainer(getter_AddRefs(container)); -#endif - -#ifndef XP_MACOSX // Silverlight calls invalidate for windowed plugins so this needs to work. if (mWidget) { mWidget->Invalidate( @@ -553,7 +507,6 @@ NS_IMETHODIMP nsPluginInstanceOwner::InvalidateRect(NPRect *invalidRect) return NS_OK; } } -#endif nsIntRect rect(invalidRect->left, invalidRect->top, @@ -964,252 +917,14 @@ nsPluginInstanceOwner::OnWindowedPluginKeyEvent( NS_IMETHODIMP nsPluginInstanceOwner::SetEventModel(int32_t eventModel) { -#ifdef XP_MACOSX - mEventModel = static_cast(eventModel); - return NS_OK; -#else return NS_ERROR_NOT_IMPLEMENTED; -#endif } -#ifdef XP_MACOSX -NPBool nsPluginInstanceOwner::ConvertPointPuppet(PuppetWidget *widget, - nsPluginFrame* pluginFrame, - double sourceX, double sourceY, - NPCoordinateSpace sourceSpace, - double *destX, double *destY, - NPCoordinateSpace destSpace) -{ - NS_ENSURE_TRUE(widget && widget->GetOwningTabChild() && pluginFrame, false); - // Caller has to want a result. - NS_ENSURE_TRUE(destX || destY, false); - - if (sourceSpace == destSpace) { - if (destX) { - *destX = sourceX; - } - if (destY) { - *destY = sourceY; - } - return true; - } - - nsPresContext* presContext = pluginFrame->PresContext(); - double scaleFactor = double(nsPresContext::AppUnitsPerCSSPixel())/ - presContext->DeviceContext()->AppUnitsPerDevPixelAtUnitFullZoom(); - - PuppetWidget *puppetWidget = static_cast(widget); - PuppetWidget *rootWidget = static_cast(widget->GetTopLevelWidget()); - if (!rootWidget) { - return false; - } - nsPoint chromeSize = AsNsPoint(rootWidget->GetChromeDimensions()) / scaleFactor; - nsIntSize intScreenDims = rootWidget->GetScreenDimensions(); - nsSize screenDims = nsSize(intScreenDims.width / scaleFactor, - intScreenDims.height / scaleFactor); - int32_t screenH = screenDims.height; - nsPoint windowPosition = AsNsPoint(rootWidget->GetWindowPosition()) / scaleFactor; - - // Window size is tab size + chrome size. - LayoutDeviceIntRect tabContentBounds = puppetWidget->GetBounds(); - tabContentBounds.ScaleInverseRoundOut(scaleFactor); - int32_t windowH = tabContentBounds.height + int(chromeSize.y); - - nsPoint pluginPosition = AsNsPoint(pluginFrame->GetScreenRect().TopLeft()); - - // Convert (sourceX, sourceY) to 'real' (not PuppetWidget) screen space. - // In OSX, the Y-axis increases upward, which is the reverse of ours. - // We want OSX coordinates for window and screen so those equations are swapped. - nsPoint sourcePoint(sourceX, sourceY); - nsPoint screenPoint; - switch (sourceSpace) { - case NPCoordinateSpacePlugin: - screenPoint = sourcePoint + pluginPosition + - pluginFrame->GetContentRectRelativeToSelf().TopLeft() / nsPresContext::AppUnitsPerCSSPixel(); - break; - case NPCoordinateSpaceWindow: - screenPoint = nsPoint(sourcePoint.x, windowH-sourcePoint.y) + - windowPosition; - break; - case NPCoordinateSpaceFlippedWindow: - screenPoint = sourcePoint + windowPosition; - break; - case NPCoordinateSpaceScreen: - screenPoint = nsPoint(sourcePoint.x, screenH-sourcePoint.y); - break; - case NPCoordinateSpaceFlippedScreen: - screenPoint = sourcePoint; - break; - default: - return false; - } - - // Convert from screen to dest space. - nsPoint destPoint; - switch (destSpace) { - case NPCoordinateSpacePlugin: - destPoint = screenPoint - pluginPosition - - pluginFrame->GetContentRectRelativeToSelf().TopLeft() / nsPresContext::AppUnitsPerCSSPixel(); - break; - case NPCoordinateSpaceWindow: - destPoint = screenPoint - windowPosition; - destPoint.y = windowH - destPoint.y; - break; - case NPCoordinateSpaceFlippedWindow: - destPoint = screenPoint - windowPosition; - break; - case NPCoordinateSpaceScreen: - destPoint = nsPoint(screenPoint.x, screenH-screenPoint.y); - break; - case NPCoordinateSpaceFlippedScreen: - destPoint = screenPoint; - break; - default: - return false; - } - - if (destX) { - *destX = destPoint.x; - } - if (destY) { - *destY = destPoint.y; - } - - return true; -} - -NPBool nsPluginInstanceOwner::ConvertPointNoPuppet(nsIWidget *widget, - nsPluginFrame* pluginFrame, - double sourceX, double sourceY, - NPCoordinateSpace sourceSpace, - double *destX, double *destY, - NPCoordinateSpace destSpace) -{ - NS_ENSURE_TRUE(widget && pluginFrame, false); - // Caller has to want a result. - NS_ENSURE_TRUE(destX || destY, false); - - if (sourceSpace == destSpace) { - if (destX) { - *destX = sourceX; - } - if (destY) { - *destY = sourceY; - } - return true; - } - - nsPresContext* presContext = pluginFrame->PresContext(); - double scaleFactor = double(nsPresContext::AppUnitsPerCSSPixel())/ - presContext->DeviceContext()->AppUnitsPerDevPixelAtUnitFullZoom(); - - nsCOMPtr screenMgr = do_GetService("@mozilla.org/gfx/screenmanager;1"); - if (!screenMgr) { - return false; - } - nsCOMPtr screen; - screenMgr->ScreenForNativeWidget(widget->GetNativeData(NS_NATIVE_WINDOW), getter_AddRefs(screen)); - if (!screen) { - return false; - } - - int32_t screenX, screenY, screenWidth, screenHeight; - screen->GetRect(&screenX, &screenY, &screenWidth, &screenHeight); - screenHeight /= scaleFactor; - - LayoutDeviceIntRect windowScreenBounds = widget->GetScreenBounds(); - windowScreenBounds.ScaleInverseRoundOut(scaleFactor); - int32_t windowX = windowScreenBounds.x; - int32_t windowY = windowScreenBounds.y; - int32_t windowHeight = windowScreenBounds.height; - - nsIntRect pluginScreenRect = pluginFrame->GetScreenRect(); - - double screenXGecko, screenYGecko; - switch (sourceSpace) { - case NPCoordinateSpacePlugin: - screenXGecko = pluginScreenRect.x + sourceX; - screenYGecko = pluginScreenRect.y + sourceY; - break; - case NPCoordinateSpaceWindow: - screenXGecko = windowX + sourceX; - screenYGecko = windowY + (windowHeight - sourceY); - break; - case NPCoordinateSpaceFlippedWindow: - screenXGecko = windowX + sourceX; - screenYGecko = windowY + sourceY; - break; - case NPCoordinateSpaceScreen: - screenXGecko = sourceX; - screenYGecko = screenHeight - sourceY; - break; - case NPCoordinateSpaceFlippedScreen: - screenXGecko = sourceX; - screenYGecko = sourceY; - break; - default: - return false; - } - - double destXCocoa, destYCocoa; - switch (destSpace) { - case NPCoordinateSpacePlugin: - destXCocoa = screenXGecko - pluginScreenRect.x; - destYCocoa = screenYGecko - pluginScreenRect.y; - break; - case NPCoordinateSpaceWindow: - destXCocoa = screenXGecko - windowX; - destYCocoa = windowHeight - (screenYGecko - windowY); - break; - case NPCoordinateSpaceFlippedWindow: - destXCocoa = screenXGecko - windowX; - destYCocoa = screenYGecko - windowY; - break; - case NPCoordinateSpaceScreen: - destXCocoa = screenXGecko; - destYCocoa = screenHeight - screenYGecko; - break; - case NPCoordinateSpaceFlippedScreen: - destXCocoa = screenXGecko; - destYCocoa = screenYGecko; - break; - default: - return false; - } - - if (destX) { - *destX = destXCocoa; - } - if (destY) { - *destY = destYCocoa; - } - - return true; -} -#endif // XP_MACOSX - NPBool nsPluginInstanceOwner::ConvertPoint(double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double *destX, double *destY, NPCoordinateSpace destSpace) { -#ifdef XP_MACOSX - if (!mPluginFrame) { - return false; - } - - MOZ_ASSERT(mPluginFrame->GetNearestWidget()); - - if (nsIWidget::UsePuppetWidgets()) { - return ConvertPointPuppet(static_cast(mPluginFrame->GetNearestWidget()), - mPluginFrame, sourceX, sourceY, sourceSpace, - destX, destY, destSpace); - } - - return ConvertPointNoPuppet(mPluginFrame->GetNearestWidget(), - mPluginFrame, sourceX, sourceY, sourceSpace, - destX, destY, destSpace); -#else + /** Mac Stub **/ return false; -#endif } NPError nsPluginInstanceOwner::InitAsyncSurface(NPSize *size, NPImageFormat format, @@ -1253,133 +968,7 @@ void nsPluginInstanceOwner::GetParameters(nsTArray& paramete loadingContent->GetPluginParameters(parameters); } -#ifdef XP_MACOSX - -static void InitializeNPCocoaEvent(NPCocoaEvent* event) -{ - memset(event, 0, sizeof(NPCocoaEvent)); -} - -NPDrawingModel nsPluginInstanceOwner::GetDrawingModel() -{ -#ifndef NP_NO_QUICKDRAW - // We don't support the Quickdraw drawing model any more but it's still - // the default model for i386 per NPAPI. - NPDrawingModel drawingModel = NPDrawingModelQuickDraw; -#else - NPDrawingModel drawingModel = NPDrawingModelCoreGraphics; -#endif - - if (!mInstance) - return drawingModel; - - mInstance->GetDrawingModel((int32_t*)&drawingModel); - return drawingModel; -} - -bool nsPluginInstanceOwner::IsRemoteDrawingCoreAnimation() -{ - if (!mInstance) - return false; - - bool coreAnimation; - if (!NS_SUCCEEDED(mInstance->IsRemoteDrawingCoreAnimation(&coreAnimation))) - return false; - - return coreAnimation; -} - -NPEventModel nsPluginInstanceOwner::GetEventModel() -{ - return mEventModel; -} - -#define DEFAULT_REFRESH_RATE 20 // 50 FPS - -nsCOMPtr *nsPluginInstanceOwner::sCATimer = nullptr; -nsTArray *nsPluginInstanceOwner::sCARefreshListeners = nullptr; - -void nsPluginInstanceOwner::CARefresh(nsITimer *aTimer, void *aClosure) { - if (!sCARefreshListeners) { - return; - } - for (size_t i = 0; i < sCARefreshListeners->Length(); i++) { - nsPluginInstanceOwner* instanceOwner = (*sCARefreshListeners)[i]; - NPWindow *window; - instanceOwner->GetWindow(window); - if (!window) { - continue; - } - NPRect r; - r.left = 0; - r.top = 0; - r.right = window->width; - r.bottom = window->height; - instanceOwner->InvalidateRect(&r); - } -} - -void nsPluginInstanceOwner::AddToCARefreshTimer() { - if (!mInstance) { - return; - } - - // Flash invokes InvalidateRect for us. - const char* mime = nullptr; - if (NS_SUCCEEDED(mInstance->GetMIMEType(&mime)) && mime && - nsPluginHost::GetSpecialType(nsDependentCString(mime)) == - nsPluginHost::eSpecialType_Flash) { - return; - } - - if (!sCARefreshListeners) { - sCARefreshListeners = new nsTArray(); - } - - if (sCARefreshListeners->Contains(this)) { - return; - } - - sCARefreshListeners->AppendElement(this); - - if (!sCATimer) { - sCATimer = new nsCOMPtr(); - } - - if (sCARefreshListeners->Length() == 1) { - *sCATimer = do_CreateInstance("@mozilla.org/timer;1"); - (*sCATimer)->InitWithFuncCallback(CARefresh, nullptr, - DEFAULT_REFRESH_RATE, nsITimer::TYPE_REPEATING_SLACK); - } -} - -void nsPluginInstanceOwner::RemoveFromCARefreshTimer() { - if (!sCARefreshListeners || sCARefreshListeners->Contains(this) == false) { - return; - } - - sCARefreshListeners->RemoveElement(this); - - if (sCARefreshListeners->Length() == 0) { - if (sCATimer) { - (*sCATimer)->Cancel(); - delete sCATimer; - sCATimer = nullptr; - } - delete sCARefreshListeners; - sCARefreshListeners = nullptr; - } -} - -void nsPluginInstanceOwner::SetPluginPort() -{ - void* pluginPort = GetPluginPort(); - if (!pluginPort || !mPluginWindow) - return; - mPluginWindow->window = pluginPort; -} -#endif -#if defined(XP_MACOSX) || defined(XP_WIN) +#if defined(XP_WIN) nsresult nsPluginInstanceOwner::ContentsScaleFactorChanged(double aContentsScaleFactor) { if (!mInstance) { @@ -1398,11 +987,6 @@ nsPluginInstanceOwner::GetEventloopNestingLevel() uint32_t currentLevel = 0; if (appShell) { appShell->GetEventloopNestingLevel(¤tLevel); -#ifdef XP_MACOSX - // Cocoa widget code doesn't process UI events through the normal - // appshell event loop, so it needs an additional count here. - currentLevel++; -#endif } // No idea how this happens... but Linux doesn't consistently @@ -1427,15 +1011,11 @@ void nsPluginInstanceOwner::NotifyHostCreateWidget() { mPluginHost->CreateWidget(this); -#ifdef XP_MACOSX - FixUpPluginWindow(ePluginPaintEnable); -#else if (mPluginFrame) { mPluginFrame->InvalidateFrame(); } else { CallSetWindow(); } -#endif } void @@ -1457,12 +1037,10 @@ nsPluginInstanceOwner::NotifyDestroyPending() nsresult nsPluginInstanceOwner::DispatchFocusToPlugin(nsIDOMEvent* aFocusEvent) { -#ifndef XP_MACOSX if (!mPluginWindow || (mPluginWindow->type == NPWindowTypeWindow)) { // continue only for cases without child window return aFocusEvent->PreventDefault(); // consume event } -#endif WidgetEvent* theEvent = aFocusEvent->WidgetEventPtr(); if (theEvent) { @@ -1480,9 +1058,6 @@ nsresult nsPluginInstanceOwner::DispatchFocusToPlugin(nsIDOMEvent* aFocusEvent) nsresult nsPluginInstanceOwner::ProcessKeyPress(nsIDOMEvent* aKeyEvent) { -#ifdef XP_MACOSX - return DispatchKeyToPlugin(aKeyEvent); -#else if (SendNativeEvents()) DispatchKeyToPlugin(aKeyEvent); @@ -1493,16 +1068,13 @@ nsresult nsPluginInstanceOwner::ProcessKeyPress(nsIDOMEvent* aKeyEvent) aKeyEvent->StopPropagation(); } return NS_OK; -#endif } nsresult nsPluginInstanceOwner::DispatchKeyToPlugin(nsIDOMEvent* aKeyEvent) { -#if !defined(XP_MACOSX) if (!mPluginWindow || (mPluginWindow->type == NPWindowTypeWindow)) return aKeyEvent->PreventDefault(); // consume event // continue only for cases without child window -#endif if (mInstance) { WidgetKeyboardEvent* keyEvent = @@ -1522,11 +1094,9 @@ nsresult nsPluginInstanceOwner::DispatchKeyToPlugin(nsIDOMEvent* aKeyEvent) nsresult nsPluginInstanceOwner::ProcessMouseDown(nsIDOMEvent* aMouseEvent) { -#if !defined(XP_MACOSX) if (!mPluginWindow || (mPluginWindow->type == NPWindowTypeWindow)) return aMouseEvent->PreventDefault(); // consume event // continue only for cases without child window -#endif // if the plugin is windowless, we need to set focus ourselves // otherwise, we might not get key events @@ -1556,11 +1126,9 @@ nsPluginInstanceOwner::ProcessMouseDown(nsIDOMEvent* aMouseEvent) nsresult nsPluginInstanceOwner::DispatchMouseToPlugin(nsIDOMEvent* aMouseEvent, bool aAllowPropagate) { -#if !defined(XP_MACOSX) if (!mPluginWindow || (mPluginWindow->type == NPWindowTypeWindow)) return aMouseEvent->PreventDefault(); // consume event // continue only for cases without child window -#endif // don't send mouse events if we are hidden if (!mWidgetVisible) return NS_OK; @@ -1770,22 +1338,6 @@ nsPluginInstanceOwner::HandleEvent(nsIDOMEvent* aEvent) nsAutoString eventType; aEvent->GetType(eventType); -#ifdef XP_MACOSX - if (eventType.EqualsLiteral("activate") || - eventType.EqualsLiteral("deactivate")) { - WindowFocusMayHaveChanged(); - return NS_OK; - } - if (eventType.EqualsLiteral("MozPerformDelayedBlur")) { - if (mShouldBlurOnActivate) { - WidgetGUIEvent blurEvent(true, eBlur, nullptr); - ProcessEvent(blurEvent); - mShouldBlurOnActivate = false; - } - return NS_OK; - } -#endif - if (eventType.EqualsLiteral("focus")) { mContentFocused = true; return DispatchFocusToPlugin(aEvent); @@ -1848,191 +1400,6 @@ static unsigned int XInputEventState(const WidgetInputEvent& anEvent) } #endif -#ifdef XP_MACOSX - -// Returns whether or not content is the content that is or would be -// focused if the top-level chrome window was active. -static bool -ContentIsFocusedWithinWindow(nsIContent* aContent) -{ - nsPIDOMWindowOuter* outerWindow = aContent->OwnerDoc()->GetWindow(); - if (!outerWindow) { - return false; - } - - nsPIDOMWindowOuter* rootWindow = outerWindow->GetPrivateRoot(); - if (!rootWindow) { - return false; - } - - nsFocusManager* fm = nsFocusManager::GetFocusManager(); - if (!fm) { - return false; - } - - nsCOMPtr focusedFrame; - nsCOMPtr focusedContent = fm->GetFocusedDescendant(rootWindow, true, getter_AddRefs(focusedFrame)); - return (focusedContent.get() == aContent); -} - -static NPCocoaEventType -CocoaEventTypeForEvent(const WidgetGUIEvent& anEvent, nsIFrame* aObjectFrame) -{ - const NPCocoaEvent* event = static_cast(anEvent.mPluginEvent); - if (event) { - return event->type; - } - - switch (anEvent.mMessage) { - case eMouseOver: - return NPCocoaEventMouseEntered; - case eMouseOut: - return NPCocoaEventMouseExited; - case eMouseMove: { - // We don't know via information on events from the widget code whether or not - // we're dragging. The widget code just generates mouse move events from native - // drag events. If anybody is capturing, this is a drag event. - if (nsIPresShell::GetCapturingContent()) { - return NPCocoaEventMouseDragged; - } - - return NPCocoaEventMouseMoved; - } - case eMouseDown: - return NPCocoaEventMouseDown; - case eMouseUp: - return NPCocoaEventMouseUp; - case eKeyDown: - return NPCocoaEventKeyDown; - case eKeyUp: - return NPCocoaEventKeyUp; - case eFocus: - case eBlur: - return NPCocoaEventFocusChanged; - case eLegacyMouseLineOrPageScroll: - return NPCocoaEventScrollWheel; - default: - return (NPCocoaEventType)0; - } -} - -static NPCocoaEvent -TranslateToNPCocoaEvent(WidgetGUIEvent* anEvent, nsIFrame* aObjectFrame) -{ - NPCocoaEvent cocoaEvent; - InitializeNPCocoaEvent(&cocoaEvent); - cocoaEvent.type = CocoaEventTypeForEvent(*anEvent, aObjectFrame); - - if (anEvent->mMessage == eMouseMove || - anEvent->mMessage == eMouseDown || - anEvent->mMessage == eMouseUp || - anEvent->mMessage == eLegacyMouseLineOrPageScroll || - anEvent->mMessage == eMouseOver || - anEvent->mMessage == eMouseOut) - { - nsPoint pt = nsLayoutUtils::GetEventCoordinatesRelativeTo(anEvent, aObjectFrame) - - aObjectFrame->GetContentRectRelativeToSelf().TopLeft(); - nsPresContext* presContext = aObjectFrame->PresContext(); - // Plugin event coordinates need to be translated from device pixels - // into "display pixels" in HiDPI modes. - double scaleFactor = double(nsPresContext::AppUnitsPerCSSPixel())/ - aObjectFrame->PresContext()->DeviceContext()->AppUnitsPerDevPixelAtUnitFullZoom(); - size_t intScaleFactor = ceil(scaleFactor); - nsIntPoint ptPx(presContext->AppUnitsToDevPixels(pt.x) / intScaleFactor, - presContext->AppUnitsToDevPixels(pt.y) / intScaleFactor); - cocoaEvent.data.mouse.pluginX = double(ptPx.x); - cocoaEvent.data.mouse.pluginY = double(ptPx.y); - } - - switch (anEvent->mMessage) { - case eMouseDown: - case eMouseUp: { - WidgetMouseEvent* mouseEvent = anEvent->AsMouseEvent(); - if (mouseEvent) { - switch (mouseEvent->button) { - case WidgetMouseEvent::eLeftButton: - cocoaEvent.data.mouse.buttonNumber = 0; - break; - case WidgetMouseEvent::eRightButton: - cocoaEvent.data.mouse.buttonNumber = 1; - break; - case WidgetMouseEvent::eMiddleButton: - cocoaEvent.data.mouse.buttonNumber = 2; - break; - default: - NS_WARNING("Mouse button we don't know about?"); - } - cocoaEvent.data.mouse.clickCount = mouseEvent->mClickCount; - } else { - NS_WARNING("eMouseUp/DOWN is not a WidgetMouseEvent?"); - } - break; - } - case eLegacyMouseLineOrPageScroll: { - WidgetWheelEvent* wheelEvent = anEvent->AsWheelEvent(); - if (wheelEvent) { - cocoaEvent.data.mouse.deltaX = wheelEvent->mLineOrPageDeltaX; - cocoaEvent.data.mouse.deltaY = wheelEvent->mLineOrPageDeltaY; - } else { - NS_WARNING("eLegacyMouseLineOrPageScroll is not a WidgetWheelEvent? " - "(could be, haven't checked)"); - } - break; - } - case eKeyDown: - case eKeyUp: - { - WidgetKeyboardEvent* keyEvent = anEvent->AsKeyboardEvent(); - - // That keyEvent->mPluginTextEventString is non-empty is a signal that we should - // create a text event for the plugin, instead of a key event. - if (anEvent->mMessage == eKeyDown && - !keyEvent->mPluginTextEventString.IsEmpty()) { - cocoaEvent.type = NPCocoaEventTextInput; - const char16_t* pluginTextEventString = keyEvent->mPluginTextEventString.get(); - cocoaEvent.data.text.text = (NPNSString*) - ::CFStringCreateWithCharacters(NULL, - reinterpret_cast(pluginTextEventString), - keyEvent->mPluginTextEventString.Length()); - } else { - cocoaEvent.data.key.keyCode = keyEvent->mNativeKeyCode; - cocoaEvent.data.key.isARepeat = keyEvent->mIsRepeat; - cocoaEvent.data.key.modifierFlags = keyEvent->mNativeModifierFlags; - const char16_t* nativeChars = keyEvent->mNativeCharacters.get(); - cocoaEvent.data.key.characters = (NPNSString*) - ::CFStringCreateWithCharacters(NULL, - reinterpret_cast(nativeChars), - keyEvent->mNativeCharacters.Length()); - const char16_t* nativeCharsIgnoringModifiers = keyEvent->mNativeCharactersIgnoringModifiers.get(); - cocoaEvent.data.key.charactersIgnoringModifiers = (NPNSString*) - ::CFStringCreateWithCharacters(NULL, - reinterpret_cast(nativeCharsIgnoringModifiers), - keyEvent->mNativeCharactersIgnoringModifiers.Length()); - } - break; - } - case eFocus: - case eBlur: - cocoaEvent.data.focus.hasFocus = (anEvent->mMessage == eFocus); - break; - default: - break; - } - return cocoaEvent; -} - -void nsPluginInstanceOwner::PerformDelayedBlurs() -{ - nsCOMPtr content = do_QueryReferent(mContent); - nsCOMPtr windowRoot = content->OwnerDoc()->GetWindow()->GetTopWindowRoot(); - nsContentUtils::DispatchTrustedEvent(content->OwnerDoc(), - windowRoot, - NS_LITERAL_STRING("MozPerformDelayedBlur"), - false, false, nullptr); -} - -#endif - nsEventStatus nsPluginInstanceOwner::ProcessEvent(const WidgetGUIEvent& anEvent) { nsEventStatus rv = nsEventStatus_eIgnore; @@ -2041,85 +1408,6 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const WidgetGUIEvent& anEvent) return nsEventStatus_eIgnore; } -#ifdef XP_MACOSX - NPEventModel eventModel = GetEventModel(); - if (eventModel != NPEventModelCocoa) { - return nsEventStatus_eIgnore; - } - - // In the Cocoa event model, focus is per-window. Don't tell a plugin it lost - // focus unless it lost focus within the window. For example, ignore a blur - // event if it's coming due to the plugin's window deactivating. - nsCOMPtr content = do_QueryReferent(mContent); - if (anEvent.mMessage == eBlur && ContentIsFocusedWithinWindow(content)) { - mShouldBlurOnActivate = true; - return nsEventStatus_eIgnore; - } - - // Also, don't tell the plugin it gained focus again after we've already given - // it focus. This might happen if it has focus, its window is blurred, then the - // window is made active again. The plugin never lost in-window focus, so it - // shouldn't get a focus event again. - if (anEvent.mMessage == eFocus && mLastContentFocused == true) { - mShouldBlurOnActivate = false; - return nsEventStatus_eIgnore; - } - - // Now, if we're going to send a focus event, update mLastContentFocused and - // tell any plugins in our window that we have taken focus, so they should - // perform any delayed blurs. - if (anEvent.mMessage == eFocus || anEvent.mMessage == eBlur) { - mLastContentFocused = (anEvent.mMessage == eFocus); - mShouldBlurOnActivate = false; - PerformDelayedBlurs(); - } - - NPCocoaEvent cocoaEvent = TranslateToNPCocoaEvent(const_cast(&anEvent), mPluginFrame); - if (cocoaEvent.type == (NPCocoaEventType)0) { - return nsEventStatus_eIgnore; - } - - if (cocoaEvent.type == NPCocoaEventTextInput) { - mInstance->HandleEvent(&cocoaEvent, nullptr); - return nsEventStatus_eConsumeNoDefault; - } - - int16_t response = kNPEventNotHandled; - mInstance->HandleEvent(&cocoaEvent, - &response, - NS_PLUGIN_CALL_SAFE_TO_REENTER_GECKO); - if ((response == kNPEventStartIME) && (cocoaEvent.type == NPCocoaEventKeyDown)) { - nsIWidget* widget = mPluginFrame->GetNearestWidget(); - if (widget) { - const WidgetKeyboardEvent* keyEvent = anEvent.AsKeyboardEvent(); - double screenX, screenY; - ConvertPoint(0.0, mPluginFrame->GetScreenRect().height, - NPCoordinateSpacePlugin, &screenX, &screenY, - NPCoordinateSpaceScreen); - nsAutoString outText; - if (NS_SUCCEEDED(widget->StartPluginIME(*keyEvent, screenX, screenY, outText)) && - !outText.IsEmpty()) { - CFStringRef cfString = - ::CFStringCreateWithCharacters(kCFAllocatorDefault, - reinterpret_cast(outText.get()), - outText.Length()); - NPCocoaEvent textEvent; - InitializeNPCocoaEvent(&textEvent); - textEvent.type = NPCocoaEventTextInput; - textEvent.data.text.text = (NPNSString*)cfString; - mInstance->HandleEvent(&textEvent, nullptr); - } - } - } - - bool handled = (response == kNPEventHandled || response == kNPEventStartIME); - bool leftMouseButtonDown = (anEvent.mMessage == eMouseDown) && - (anEvent.AsMouseEvent()->button == WidgetMouseEvent::eLeftButton); - if (handled && !(leftMouseButtonDown && !mContentFocused)) { - rv = nsEventStatus_eConsumeNoDefault; - } -#endif - #ifdef XP_WIN // this code supports windowless plugins const NPEvent *pPluginEvent = static_cast(anEvent.mPluginEvent); @@ -2525,10 +1813,6 @@ nsPluginInstanceOwner::Destroy() { SetFrame(nullptr); -#ifdef XP_MACOSX - RemoveFromCARefreshTimer(); -#endif - nsCOMPtr content = do_QueryReferent(mContent); // unregister context menu listener @@ -2580,44 +1864,6 @@ nsPluginInstanceOwner::Destroy() // Paints are handled differently, so we just simulate an update event. -#ifdef XP_MACOSX -void nsPluginInstanceOwner::Paint(const gfxRect& aDirtyRect, CGContextRef cgContext) -{ - if (!mInstance || !mPluginFrame) - return; - - gfxRect dirtyRectCopy = aDirtyRect; - double scaleFactor = 1.0; - GetContentsScaleFactor(&scaleFactor); - if (scaleFactor != 1.0) { - ::CGContextScaleCTM(cgContext, scaleFactor, scaleFactor); - // Convert aDirtyRect from device pixels to "display pixels" - // for HiDPI modes - dirtyRectCopy.ScaleRoundOut(1.0 / scaleFactor); - } - - DoCocoaEventDrawRect(dirtyRectCopy, cgContext); -} - -void nsPluginInstanceOwner::DoCocoaEventDrawRect(const gfxRect& aDrawRect, CGContextRef cgContext) -{ - if (!mInstance || !mPluginFrame) - return; - - // The context given here is only valid during the HandleEvent call. - NPCocoaEvent updateEvent; - InitializeNPCocoaEvent(&updateEvent); - updateEvent.type = NPCocoaEventDrawRect; - updateEvent.data.draw.context = cgContext; - updateEvent.data.draw.x = aDrawRect.X(); - updateEvent.data.draw.y = aDrawRect.Y(); - updateEvent.data.draw.width = aDrawRect.Width(); - updateEvent.data.draw.height = aDrawRect.Height(); - - mInstance->HandleEvent(&updateEvent, nullptr); -} -#endif - #ifdef XP_WIN void nsPluginInstanceOwner::Paint(const RECT& aDirty, HDC aDC) { @@ -2934,7 +2180,6 @@ NS_IMETHODIMP nsPluginInstanceOwner::CreateWidget(void) if (content) { doc = content->OwnerDoc(); parentWidget = nsContentUtils::WidgetForDocument(doc); -#ifndef XP_MACOSX // If we're running in the content process, we need a remote widget created in chrome. if (XRE_IsContentProcess()) { if (nsCOMPtr window = doc->GetWindow()) { @@ -2950,16 +2195,13 @@ NS_IMETHODIMP nsPluginInstanceOwner::CreateWidget(void) } } } -#endif // XP_MACOSX } -#ifndef XP_MACOSX // A failure here is terminal since we can't fall back on the non-e10s code // path below. if (!mWidget && XRE_IsContentProcess()) { return NS_ERROR_UNEXPECTED; } -#endif // XP_MACOSX if (!mWidget) { // native (single process) @@ -3022,136 +2264,11 @@ NS_IMETHODIMP nsPluginInstanceOwner::CreateWidget(void) } } -#ifdef XP_MACOSX - if (GetDrawingModel() == NPDrawingModelCoreAnimation) { - AddToCARefreshTimer(); - } -#endif - mWidgetCreationComplete = true; return NS_OK; } -// Mac specific code to fix up the port location and clipping region -#ifdef XP_MACOSX - -void nsPluginInstanceOwner::FixUpPluginWindow(int32_t inPaintState) -{ - if (!mPluginWindow || !mInstance || !mPluginFrame) { - return; - } - - SetPluginPort(); - - LayoutDeviceIntSize widgetClip = mPluginFrame->GetWidgetlessClipRect().Size(); - - mPluginWindow->x = 0; - mPluginWindow->y = 0; - - NPRect oldClipRect = mPluginWindow->clipRect; - - // fix up the clipping region - mPluginWindow->clipRect.top = 0; - mPluginWindow->clipRect.left = 0; - - if (inPaintState == ePluginPaintDisable) { - mPluginWindow->clipRect.bottom = mPluginWindow->clipRect.top; - mPluginWindow->clipRect.right = mPluginWindow->clipRect.left; - } - else if (inPaintState == ePluginPaintEnable) - { - mPluginWindow->clipRect.bottom = mPluginWindow->clipRect.top + widgetClip.height; - mPluginWindow->clipRect.right = mPluginWindow->clipRect.left + widgetClip.width; - } - - // if the clip rect changed, call SetWindow() - // (RealPlayer needs this to draw correctly) - if (mPluginWindow->clipRect.left != oldClipRect.left || - mPluginWindow->clipRect.top != oldClipRect.top || - mPluginWindow->clipRect.right != oldClipRect.right || - mPluginWindow->clipRect.bottom != oldClipRect.bottom) - { - if (UseAsyncRendering()) { - mInstance->AsyncSetWindow(mPluginWindow); - } - else { - mPluginWindow->CallSetWindow(mInstance); - } - } - - // After the first NPP_SetWindow call we need to send an initial - // top-level window focus event. - if (!mSentInitialTopLevelWindowEvent) { - // Set this before calling ProcessEvent to avoid endless recursion. - mSentInitialTopLevelWindowEvent = true; - - bool isActive = WindowIsActive(); - SendWindowFocusChanged(isActive); - mLastWindowIsActive = isActive; - } -} - -void -nsPluginInstanceOwner::WindowFocusMayHaveChanged() -{ - if (!mSentInitialTopLevelWindowEvent) { - return; - } - - bool isActive = WindowIsActive(); - if (isActive != mLastWindowIsActive) { - SendWindowFocusChanged(isActive); - mLastWindowIsActive = isActive; - } -} - -bool -nsPluginInstanceOwner::WindowIsActive() -{ - if (!mPluginFrame) { - return false; - } - - EventStates docState = mPluginFrame->GetContent()->OwnerDoc()->GetDocumentState(); - return !docState.HasState(NS_DOCUMENT_STATE_WINDOW_INACTIVE); -} - -void -nsPluginInstanceOwner::SendWindowFocusChanged(bool aIsActive) -{ - if (!mInstance) { - return; - } - - NPCocoaEvent cocoaEvent; - InitializeNPCocoaEvent(&cocoaEvent); - cocoaEvent.type = NPCocoaEventWindowFocusChanged; - cocoaEvent.data.focus.hasFocus = aIsActive; - mInstance->HandleEvent(&cocoaEvent, - nullptr, - NS_PLUGIN_CALL_SAFE_TO_REENTER_GECKO); -} - -void -nsPluginInstanceOwner::HidePluginWindow() -{ - if (!mPluginWindow || !mInstance) { - return; - } - - mPluginWindow->clipRect.bottom = mPluginWindow->clipRect.top; - mPluginWindow->clipRect.right = mPluginWindow->clipRect.left; - mWidgetVisible = false; - if (UseAsyncRendering()) { - mInstance->AsyncSetWindow(mPluginWindow); - } else { - mInstance->SetWindow(mPluginWindow); - } -} - -#else // XP_MACOSX - void nsPluginInstanceOwner::UpdateWindowPositionAndClipRect(bool aSetWindow) { if (!mPluginWindow) @@ -3201,12 +2318,11 @@ nsPluginInstanceOwner::UpdateWindowVisibility(bool aVisible) mPluginWindowVisible = aVisible; UpdateWindowPositionAndClipRect(true); } -#endif // XP_MACOSX void nsPluginInstanceOwner::ResolutionMayHaveChanged() { -#if defined(XP_MACOSX) || defined(XP_WIN) +#if defined(XP_WIN) double scaleFactor = 1.0; GetContentsScaleFactor(&scaleFactor); if (scaleFactor != mLastScaleFactor) { @@ -3231,7 +2347,6 @@ nsPluginInstanceOwner::UpdateDocumentActiveState(bool aIsActive) PROFILER_LABEL_FUNC(js::ProfileEntry::Category::OTHER); mPluginDocumentActiveState = aIsActive; -#ifndef XP_MACOSX UpdateWindowPositionAndClipRect(true); // We don't have a connection to PluginWidgetParent in the chrome @@ -3243,7 +2358,6 @@ nsPluginInstanceOwner::UpdateDocumentActiveState(bool aIsActive) mWidget->Show(aIsActive); mWidget->Enable(aIsActive); } -#endif // #ifndef XP_MACOSX } NS_IMETHODIMP @@ -3271,10 +2385,10 @@ nsPluginInstanceOwner::GetContentsScaleFactor(double *result) { NS_ENSURE_ARG_POINTER(result); double scaleFactor = 1.0; - // On Mac, device pixels need to be translated to (and from) "display pixels" + // On Windows, device pixels need to be translated to (and from) "display pixels" // for plugins. On other platforms, plugin coordinates are always in device // pixels. -#if defined(XP_MACOSX) || defined(XP_WIN) +#if defined(XP_WIN) nsCOMPtr content = do_QueryReferent(mContent); nsIPresShell* presShell = nsContentUtils::FindPresShellForDocument(content->OwnerDoc()); if (presShell) { diff --git a/dom/plugins/base/nsPluginInstanceOwner.h b/dom/plugins/base/nsPluginInstanceOwner.h index 2fa67c86e0..ba16cf288c 100644 --- a/dom/plugins/base/nsPluginInstanceOwner.h +++ b/dom/plugins/base/nsPluginInstanceOwner.h @@ -19,11 +19,6 @@ #include "nsWeakReference.h" #include "gfxRect.h" -#ifdef XP_MACOSX -#include "mozilla/gfx/QuartzSupport.h" -#include -#endif - class nsIInputStream; class nsPluginDOMContextMenuListener; class nsPluginFrame; @@ -104,10 +99,6 @@ public: #ifdef XP_WIN void Paint(const RECT& aDirty, HDC aDC); -#elif defined(XP_MACOSX) - void Paint(const gfxRect& aDirtyRect, CGContextRef cgContext); - void RenderCoreAnimation(CGContextRef aCGContext, int aWidth, int aHeight); - void DoCocoaEventDrawRect(const gfxRect& aDrawRect, CGContextRef cgContext); #elif defined(MOZ_X11) void Paint(gfxContext* aContext, const gfxRect& aFrameRect, @@ -132,33 +123,11 @@ public: nsresult SetNetscapeWindowAsParent(HWND aWindowToAdopt); #endif -#ifdef XP_MACOSX - enum { ePluginPaintEnable, ePluginPaintDisable }; - - void WindowFocusMayHaveChanged(); - - bool WindowIsActive(); - void SendWindowFocusChanged(bool aIsActive); - NPDrawingModel GetDrawingModel(); - bool IsRemoteDrawingCoreAnimation(); - - NPEventModel GetEventModel(); - static void CARefresh(nsITimer *aTimer, void *aClosure); - void AddToCARefreshTimer(); - void RemoveFromCARefreshTimer(); - // This calls into the plugin (NPP_SetWindow) and can run script. - void FixUpPluginWindow(int32_t inPaintState); - void HidePluginWindow(); - // Set plugin port info in the plugin (in the 'window' member of the - // NPWindow structure passed to the plugin by SetWindow()). - void SetPluginPort(); -#else // XP_MACOSX void UpdateWindowPositionAndClipRect(bool aSetWindow); void UpdateWindowVisibility(bool aVisible); -#endif // XP_MACOSX void ResolutionMayHaveChanged(); -#if defined(XP_MACOSX) || defined(XP_WIN) +#if defined(XP_WIN) nsresult ContentsScaleFactorChanged(double aContentsScaleFactor); #endif @@ -214,7 +183,7 @@ public: return mPluginWindow->type == NPWindowTypeDrawable && (MatchPluginName("Shockwave Flash") || MatchPluginName("Test Plug-in")); -#elif defined(MOZ_X11) || defined(XP_MACOSX) +#elif defined(MOZ_X11) return true; #else return false; @@ -311,15 +280,6 @@ private: nsCOMPtr mWidget; RefPtr mPluginHost; -#ifdef XP_MACOSX - static nsCOMPtr *sCATimer; - static nsTArray *sCARefreshListeners; - bool mSentInitialTopLevelWindowEvent; - bool mLastWindowIsActive; - bool mLastContentFocused; - // True if, the next time the window is activated, we should blur ourselves. - bool mShouldBlurOnActivate; -#endif double mLastScaleFactor; double mLastCSSZoomFactor; // Initially, the event loop nesting level we were created on, it's updated @@ -335,15 +295,6 @@ private: bool mPluginWindowVisible; bool mPluginDocumentActiveState; -#ifdef XP_MACOSX - NPEventModel mEventModel; - // This is a hack! UseAsyncRendering() can incorrectly return false - // when we don't have an object frame (possible as of bug 90268). - // We hack around this by always returning true if we've ever - // returned true. - bool mUseAsyncRendering; -#endif - // pointer to wrapper for nsIDOMContextMenuListener RefPtr mCXMenuListener; @@ -357,16 +308,6 @@ private: void CallDefaultProc(const mozilla::WidgetGUIEvent* aEvent); #endif -#ifdef XP_MACOSX - static NPBool ConvertPointPuppet(PuppetWidget *widget, nsPluginFrame* pluginFrame, - double sourceX, double sourceY, NPCoordinateSpace sourceSpace, - double *destX, double *destY, NPCoordinateSpace destSpace); - static NPBool ConvertPointNoPuppet(nsIWidget *widget, nsPluginFrame* pluginFrame, - double sourceX, double sourceY, NPCoordinateSpace sourceSpace, - double *destX, double *destY, NPCoordinateSpace destSpace); - void PerformDelayedBlurs(); -#endif // XP_MACOSX - int mLastMouseDownButtonType; #ifdef MOZ_X11 diff --git a/dom/plugins/base/nsPluginNativeWindow.cpp b/dom/plugins/base/nsPluginNativeWindow.cpp index f9baf5b813..1c251936a5 100644 --- a/dom/plugins/base/nsPluginNativeWindow.cpp +++ b/dom/plugins/base/nsPluginNativeWindow.cpp @@ -27,7 +27,7 @@ nsPluginNativeWindowPLATFORM::nsPluginNativeWindowPLATFORM() : nsPluginNativeWin width = 0; height = 0; memset(&clipRect, 0, sizeof(clipRect)); -#if defined(XP_UNIX) && !defined(XP_MACOSX) +#if defined(XP_UNIX) ws_info = nullptr; #endif type = NPWindowTypeWindow; diff --git a/dom/plugins/base/nsPluginTags.cpp b/dom/plugins/base/nsPluginTags.cpp index 5fd63f3773..3f845b5cd4 100644 --- a/dom/plugins/base/nsPluginTags.cpp +++ b/dom/plugins/base/nsPluginTags.cpp @@ -424,7 +424,7 @@ void nsPluginTag::InitMime(const char* const* aMimeTypes, } } -#if !defined(XP_WIN) && !defined(XP_MACOSX) +#if !defined(XP_WIN) static nsresult ConvertToUTF8(nsIUnicodeDecoder *aUnicodeDecoder, nsAFlatCString& aString) { @@ -448,7 +448,7 @@ static nsresult ConvertToUTF8(nsIUnicodeDecoder *aUnicodeDecoder, nsresult nsPluginTag::EnsureMembersAreUTF8() { -#if defined(XP_WIN) || defined(XP_MACOSX) +#if defined(XP_WIN) return NS_OK; #else nsresult rv; diff --git a/dom/plugins/ipc/NPEventOSX.h b/dom/plugins/ipc/NPEventOSX.h deleted file mode 100644 index efb6845d04..0000000000 --- a/dom/plugins/ipc/NPEventOSX.h +++ /dev/null @@ -1,193 +0,0 @@ -/* -*- Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 8 -*- */ -/* 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_dom_plugins_NPEventOSX_h -#define mozilla_dom_plugins_NPEventOSX_h 1 - - -#include "npapi.h" - -namespace mozilla { - -namespace plugins { - -struct NPRemoteEvent { - NPCocoaEvent event; - double contentsScaleFactor; -}; - -} // namespace plugins - -} // namespace mozilla - -namespace IPC { - -template <> -struct ParamTraits -{ - typedef mozilla::plugins::NPRemoteEvent paramType; - - static void Write(Message* aMsg, const paramType& aParam) - { - aMsg->WriteInt(aParam.event.type); - aMsg->WriteUInt32(aParam.event.version); - switch (aParam.event.type) { - case NPCocoaEventMouseDown: - case NPCocoaEventMouseUp: - case NPCocoaEventMouseMoved: - case NPCocoaEventMouseEntered: - case NPCocoaEventMouseExited: - case NPCocoaEventMouseDragged: - case NPCocoaEventScrollWheel: - aMsg->WriteUInt32(aParam.event.data.mouse.modifierFlags); - aMsg->WriteDouble(aParam.event.data.mouse.pluginX); - aMsg->WriteDouble(aParam.event.data.mouse.pluginY); - aMsg->WriteInt32(aParam.event.data.mouse.buttonNumber); - aMsg->WriteInt32(aParam.event.data.mouse.clickCount); - aMsg->WriteDouble(aParam.event.data.mouse.deltaX); - aMsg->WriteDouble(aParam.event.data.mouse.deltaY); - aMsg->WriteDouble(aParam.event.data.mouse.deltaZ); - break; - case NPCocoaEventKeyDown: - case NPCocoaEventKeyUp: - case NPCocoaEventFlagsChanged: - aMsg->WriteUInt32(aParam.event.data.key.modifierFlags); - WriteParam(aMsg, aParam.event.data.key.characters); - WriteParam(aMsg, aParam.event.data.key.charactersIgnoringModifiers); - aMsg->WriteUnsignedChar(aParam.event.data.key.isARepeat); - aMsg->WriteUInt16(aParam.event.data.key.keyCode); - break; - case NPCocoaEventFocusChanged: - case NPCocoaEventWindowFocusChanged: - aMsg->WriteUnsignedChar(aParam.event.data.focus.hasFocus); - break; - case NPCocoaEventDrawRect: - // We don't write out the context pointer, it would always be - // nullptr and is just filled in as such on the read. - aMsg->WriteDouble(aParam.event.data.draw.x); - aMsg->WriteDouble(aParam.event.data.draw.y); - aMsg->WriteDouble(aParam.event.data.draw.width); - aMsg->WriteDouble(aParam.event.data.draw.height); - break; - case NPCocoaEventTextInput: - WriteParam(aMsg, aParam.event.data.text.text); - break; - default: - NS_NOTREACHED("Attempted to serialize unknown event type."); - return; - } - aMsg->WriteDouble(aParam.contentsScaleFactor); - } - - static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult) - { - int type = 0; - if (!aMsg->ReadInt(aIter, &type)) { - return false; - } - aResult->event.type = static_cast(type); - - if (!aMsg->ReadUInt32(aIter, &aResult->event.version)) { - return false; - } - - switch (aResult->event.type) { - case NPCocoaEventMouseDown: - case NPCocoaEventMouseUp: - case NPCocoaEventMouseMoved: - case NPCocoaEventMouseEntered: - case NPCocoaEventMouseExited: - case NPCocoaEventMouseDragged: - case NPCocoaEventScrollWheel: - if (!aMsg->ReadUInt32(aIter, &aResult->event.data.mouse.modifierFlags)) { - return false; - } - if (!aMsg->ReadDouble(aIter, &aResult->event.data.mouse.pluginX)) { - return false; - } - if (!aMsg->ReadDouble(aIter, &aResult->event.data.mouse.pluginY)) { - return false; - } - if (!aMsg->ReadInt32(aIter, &aResult->event.data.mouse.buttonNumber)) { - return false; - } - if (!aMsg->ReadInt32(aIter, &aResult->event.data.mouse.clickCount)) { - return false; - } - if (!aMsg->ReadDouble(aIter, &aResult->event.data.mouse.deltaX)) { - return false; - } - if (!aMsg->ReadDouble(aIter, &aResult->event.data.mouse.deltaY)) { - return false; - } - if (!aMsg->ReadDouble(aIter, &aResult->event.data.mouse.deltaZ)) { - return false; - } - break; - case NPCocoaEventKeyDown: - case NPCocoaEventKeyUp: - case NPCocoaEventFlagsChanged: - if (!aMsg->ReadUInt32(aIter, &aResult->event.data.key.modifierFlags)) { - return false; - } - if (!ReadParam(aMsg, aIter, &aResult->event.data.key.characters)) { - return false; - } - if (!ReadParam(aMsg, aIter, &aResult->event.data.key.charactersIgnoringModifiers)) { - return false; - } - if (!aMsg->ReadUnsignedChar(aIter, &aResult->event.data.key.isARepeat)) { - return false; - } - if (!aMsg->ReadUInt16(aIter, &aResult->event.data.key.keyCode)) { - return false; - } - break; - case NPCocoaEventFocusChanged: - case NPCocoaEventWindowFocusChanged: - if (!aMsg->ReadUnsignedChar(aIter, &aResult->event.data.focus.hasFocus)) { - return false; - } - break; - case NPCocoaEventDrawRect: - aResult->event.data.draw.context = nullptr; - if (!aMsg->ReadDouble(aIter, &aResult->event.data.draw.x)) { - return false; - } - if (!aMsg->ReadDouble(aIter, &aResult->event.data.draw.y)) { - return false; - } - if (!aMsg->ReadDouble(aIter, &aResult->event.data.draw.width)) { - return false; - } - if (!aMsg->ReadDouble(aIter, &aResult->event.data.draw.height)) { - return false; - } - break; - case NPCocoaEventTextInput: - if (!ReadParam(aMsg, aIter, &aResult->event.data.text.text)) { - return false; - } - break; - default: - NS_NOTREACHED("Attempted to de-serialize unknown event type."); - return false; - } - if (!aMsg->ReadDouble(aIter, &aResult->contentsScaleFactor)) { - return false; - } - - return true; - } - - static void Log(const paramType& aParam, std::wstring* aLog) - { - aLog->append(L"(NPCocoaEvent)"); - } -}; - -} // namespace IPC - -#endif // ifndef mozilla_dom_plugins_NPEventOSX_h diff --git a/dom/plugins/ipc/PluginInstanceChild.cpp b/dom/plugins/ipc/PluginInstanceChild.cpp index 628753871b..1d1a22360b 100644 --- a/dom/plugins/ipc/PluginInstanceChild.cpp +++ b/dom/plugins/ipc/PluginInstanceChild.cpp @@ -103,11 +103,7 @@ using mozilla::gfx::SharedDIB; const int kFlashWMUSERMessageThrottleDelayMs = 5; static const TCHAR kPluginIgnoreSubclassProperty[] = TEXT("PluginIgnoreSubclassProperty"); - -#elif defined(XP_MACOSX) -#include -#include "PluginUtilsOSX.h" -#endif // defined(XP_MACOSX) +#endif /** * We can't use gfxPlatform::CreateDrawTargetForSurface() because calling @@ -141,7 +137,7 @@ PluginInstanceChild::PluginInstanceChild(const NPPluginFuncs* aPluginIface, , mMode(aMode) , mNames(aNames) , mValues(aValues) -#if defined(XP_DARWIN) || defined (XP_WIN) +#if defined (XP_WIN) , mContentsScaleFactor(1.0) #endif , mPostingKeyEvents(0) @@ -198,7 +194,7 @@ PluginInstanceChild::PluginInstanceChild(const NPPluginFuncs* aPluginIface, mWindow.type = NPWindowTypeWindow; mData.ndata = (void*) this; mData.pdata = nullptr; -#if defined(MOZ_X11) && defined(XP_UNIX) && !defined(XP_MACOSX) +#if defined(MOZ_X11) && defined(XP_UNIX) mWindow.ws_info = &mWsInfo; memset(&mWsInfo, 0, sizeof(mWsInfo)); #ifdef MOZ_WIDGET_GTK @@ -207,7 +203,7 @@ PluginInstanceChild::PluginInstanceChild(const NPPluginFuncs* aPluginIface, #else mWsInfo.display = DefaultXDisplay(); #endif -#endif // MOZ_X11 && XP_UNIX && !XP_MACOSX +#endif // MOZ_X11 && XP_UNIX #if defined(OS_WIN) InitPopupMenuHook(); if (GetQuirks() & QUIRK_UNITY_FIXUP_MOUSE_CAPTURE) { @@ -274,23 +270,6 @@ PluginInstanceChild::DoNPP_New() Initialize(); -#if defined(XP_MACOSX) && defined(__i386__) - // If an i386 Mac OS X plugin has selected the Carbon event model then - // we have to fail. We do not support putting Carbon event model plugins - // out of process. Note that Carbon is the default model so out of process - // plugins need to actively negotiate something else in order to work - // out of process. - if (EventModel() == NPEventModelCarbon) { - // Send notification that a plugin tried to negotiate Carbon NPAPI so that - // users can be notified that restarting the browser in i386 mode may allow - // them to use the plugin. - SendNegotiatedCarbon(); - - // Fail to instantiate. - rv = NPERR_MODULE_LOAD_FAILED_ERROR; - } -#endif - return rv; } @@ -498,58 +477,12 @@ PluginInstanceChild::NPN_GetValue(NPNVariable aVar, } #endif -#ifdef XP_MACOSX - case NPNVsupportsCoreGraphicsBool: { - *((NPBool*)aValue) = true; - return NPERR_NO_ERROR; - } - - case NPNVsupportsCoreAnimationBool: { - *((NPBool*)aValue) = true; - return NPERR_NO_ERROR; - } - - case NPNVsupportsInvalidatingCoreAnimationBool: { - *((NPBool*)aValue) = true; - return NPERR_NO_ERROR; - } - - case NPNVsupportsCompositingCoreAnimationPluginsBool: { - *((NPBool*)aValue) = true; - return NPERR_NO_ERROR; - } - - case NPNVsupportsCocoaBool: { - *((NPBool*)aValue) = true; - return NPERR_NO_ERROR; - } - -#ifndef NP_NO_CARBON - case NPNVsupportsCarbonBool: { - *((NPBool*)aValue) = false; - return NPERR_NO_ERROR; - } -#endif - - case NPNVsupportsUpdatedCocoaTextInputBool: { - *static_cast(aValue) = true; - return NPERR_NO_ERROR; - } - -#ifndef NP_NO_QUICKDRAW - case NPNVsupportsQuickDrawBool: { - *((NPBool*)aValue) = false; - return NPERR_NO_ERROR; - } -#endif /* NP_NO_QUICKDRAW */ -#endif /* XP_MACOSX */ - -#if defined(XP_MACOSX) || defined(XP_WIN) +#if defined(XP_WIN) case NPNVcontentsScaleFactor: { *static_cast(aValue) = mContentsScaleFactor; return NPERR_NO_ERROR; } -#endif /* defined(XP_MACOSX) || defined(XP_WIN) */ +#endif /* defined(XP_WIN) */ case NPNVCSSZoomFactor: { *static_cast(aValue) = mCSSZoomFactor; @@ -654,36 +587,12 @@ PluginInstanceChild::NPN_SetValue(NPPVariable aVar, void* aValue) mDrawingModel = drawingModel; -#ifdef XP_MACOSX - if (drawingModel == NPDrawingModelCoreAnimation) { - mCARefreshTimer = ScheduleTimer(DEFAULT_REFRESH_MS, true, CAUpdate); - } -#endif - PLUGIN_LOG_DEBUG((" Plugin requested drawing model id #%i\n", mDrawingModel)); return rv; } -#ifdef XP_MACOSX - case NPPVpluginEventModel: { - NPError rv; - int eventModel = (int16_t) (intptr_t) aValue; - - if (!CallNPN_SetValue_NPPVpluginEventModel(eventModel, &rv)) - return NPERR_GENERIC_ERROR; -#if defined(__i386__) - mEventModel = static_cast(eventModel); -#endif - - PLUGIN_LOG_DEBUG((" Plugin requested event model id # %i\n", - eventModel)); - - return rv; - } -#endif - case NPPVpluginIsPlayingAudio: { NPError rv = NPERR_GENERIC_ERROR; if (!CallNPN_SetValue_NPPVpluginIsPlayingAudio((NPBool)(intptr_t)aValue, &rv)) { @@ -907,21 +816,10 @@ PluginInstanceChild::AnswerNPP_HandleEvent(const NPRemoteEvent& event, event.event.xgraphicsexpose.drawable)); #endif -#ifdef XP_MACOSX - // Mac OS X does not define an NPEvent structure. It defines more specific types. - NPCocoaEvent evcopy = event.event; - - // Make sure we reset mCurrentEvent in case of an exception - AutoRestore savePreviousEvent(mCurrentEvent); - - // Track the current event for NPN_PopUpContextMenu. - mCurrentEvent = &event.event; -#else // Make a copy since we may modify values. NPEvent evcopy = event.event; -#endif -#if defined(XP_MACOSX) || defined(XP_WIN) +#if defined(XP_WIN) // event.contentsScaleFactor <= 0 is a signal we shouldn't use it, // for example when AnswerNPP_HandleEvent() is called from elsewhere // in the child process (not via rpc code from the parent process). @@ -947,18 +845,6 @@ PluginInstanceChild::AnswerNPP_HandleEvent(const NPRemoteEvent& event, else *handled = mPluginIface->event(&mData, reinterpret_cast(&evcopy)); -#ifdef XP_MACOSX - // Release any reference counted objects created in the child process. - if (evcopy.type == NPCocoaEventKeyDown || - evcopy.type == NPCocoaEventKeyUp) { - ::CFRelease((CFStringRef)evcopy.data.key.characters); - ::CFRelease((CFStringRef)evcopy.data.key.charactersIgnoringModifiers); - } - else if (evcopy.type == NPCocoaEventTextInput) { - ::CFRelease((CFStringRef)evcopy.data.text.text); - } -#endif - #ifdef MOZ_X11 if (GraphicsExpose == event.event.type) { // Make sure the X server completes the drawing before the parent @@ -975,73 +861,6 @@ PluginInstanceChild::AnswerNPP_HandleEvent(const NPRemoteEvent& event, return true; } -#ifdef XP_MACOSX - -bool -PluginInstanceChild::AnswerNPP_HandleEvent_Shmem(const NPRemoteEvent& event, - Shmem&& mem, - int16_t* handled, - Shmem* rtnmem) -{ - PLUGIN_LOG_DEBUG_FUNCTION; - AssertPluginThread(); - AutoStackHelper guard(this); - - PaintTracker pt; - - NPCocoaEvent evcopy = event.event; - mContentsScaleFactor = event.contentsScaleFactor; - - if (evcopy.type == NPCocoaEventDrawRect) { - int scaleFactor = ceil(mContentsScaleFactor); - if (!mShColorSpace) { - mShColorSpace = CreateSystemColorSpace(); - if (!mShColorSpace) { - PLUGIN_LOG_DEBUG(("Could not allocate ColorSpace.")); - *handled = false; - *rtnmem = mem; - return true; - } - } - if (!mShContext) { - void* cgContextByte = mem.get(); - mShContext = ::CGBitmapContextCreate(cgContextByte, - mWindow.width * scaleFactor, - mWindow.height * scaleFactor, 8, - mWindow.width * 4 * scaleFactor, mShColorSpace, - kCGImageAlphaPremultipliedFirst | - kCGBitmapByteOrder32Host); - - if (!mShContext) { - PLUGIN_LOG_DEBUG(("Could not allocate CGBitmapContext.")); - *handled = false; - *rtnmem = mem; - return true; - } - } - CGRect clearRect = ::CGRectMake(0, 0, mWindow.width, mWindow.height); - ::CGContextClearRect(mShContext, clearRect); - evcopy.data.draw.context = mShContext; - } else { - PLUGIN_LOG_DEBUG(("Invalid event type for AnswerNNP_HandleEvent_Shmem.")); - *handled = false; - *rtnmem = mem; - return true; - } - - if (!mPluginIface->event) { - *handled = false; - } else { - ::CGContextSaveGState(evcopy.data.draw.context); - *handled = mPluginIface->event(&mData, reinterpret_cast(&evcopy)); - ::CGContextRestoreGState(evcopy.data.draw.context); - } - - *rtnmem = mem; - return true; -} - -#else bool PluginInstanceChild::AnswerNPP_HandleEvent_Shmem(const NPRemoteEvent& event, Shmem&& mem, @@ -1052,101 +871,7 @@ PluginInstanceChild::AnswerNPP_HandleEvent_Shmem(const NPRemoteEvent& event, *rtnmem = mem; return true; } -#endif -#ifdef XP_MACOSX - -void CallCGDraw(CGContextRef ref, void* aPluginInstance, nsIntRect aUpdateRect) { - PluginInstanceChild* pluginInstance = (PluginInstanceChild*)aPluginInstance; - - pluginInstance->CGDraw(ref, aUpdateRect); -} - -bool -PluginInstanceChild::CGDraw(CGContextRef ref, nsIntRect aUpdateRect) { - - NPCocoaEvent drawEvent; - drawEvent.type = NPCocoaEventDrawRect; - drawEvent.version = 0; - drawEvent.data.draw.x = aUpdateRect.x; - drawEvent.data.draw.y = aUpdateRect.y; - drawEvent.data.draw.width = aUpdateRect.width; - drawEvent.data.draw.height = aUpdateRect.height; - drawEvent.data.draw.context = ref; - - NPRemoteEvent remoteDrawEvent = {drawEvent}; - // Signal to AnswerNPP_HandleEvent() not to use this value - remoteDrawEvent.contentsScaleFactor = -1.0; - - int16_t handled; - AnswerNPP_HandleEvent(remoteDrawEvent, &handled); - return handled == true; -} - -bool -PluginInstanceChild::AnswerNPP_HandleEvent_IOSurface(const NPRemoteEvent& event, - const uint32_t &surfaceid, - int16_t* handled) -{ - PLUGIN_LOG_DEBUG_FUNCTION; - AssertPluginThread(); - AutoStackHelper guard(this); - - PaintTracker pt; - - NPCocoaEvent evcopy = event.event; - mContentsScaleFactor = event.contentsScaleFactor; - RefPtr surf = MacIOSurface::LookupSurface(surfaceid, - mContentsScaleFactor); - if (!surf) { - NS_ERROR("Invalid IOSurface."); - *handled = false; - return false; - } - - if (!mCARenderer) { - mCARenderer = new nsCARenderer(); - } - - if (evcopy.type == NPCocoaEventDrawRect) { - mCARenderer->AttachIOSurface(surf); - if (!mCARenderer->isInit()) { - void *caLayer = nullptr; - NPError result = mPluginIface->getvalue(GetNPP(), - NPPVpluginCoreAnimationLayer, - &caLayer); - - if (result != NPERR_NO_ERROR || !caLayer) { - PLUGIN_LOG_DEBUG(("Plugin requested CoreAnimation but did not " - "provide CALayer.")); - *handled = false; - return false; - } - - mCARenderer->SetupRenderer(caLayer, mWindow.width, mWindow.height, - mContentsScaleFactor, - GetQuirks() & QUIRK_ALLOW_OFFLINE_RENDERER ? - ALLOW_OFFLINE_RENDERER : DISALLOW_OFFLINE_RENDERER); - - // Flash needs to have the window set again after this step - if (mPluginIface->setwindow) - (void) mPluginIface->setwindow(&mData, &mWindow); - } - } else { - PLUGIN_LOG_DEBUG(("Invalid event type for " - "AnswerNNP_HandleEvent_IOSurface.")); - *handled = false; - return false; - } - - mCARenderer->Render(mWindow.width, mWindow.height, - mContentsScaleFactor, nullptr); - - return true; - -} - -#else bool PluginInstanceChild::AnswerNPP_HandleEvent_IOSurface(const NPRemoteEvent& event, const uint32_t &surfaceid, @@ -1155,7 +880,6 @@ PluginInstanceChild::AnswerNPP_HandleEvent_IOSurface(const NPRemoteEvent& event, NS_RUNTIMEABORT("NPP_HandleEvent_IOSurface is a OSX-only message"); return false; } -#endif bool PluginInstanceChild::RecvWindowPosChanged(const NPRemoteEvent& event) @@ -1175,24 +899,16 @@ PluginInstanceChild::RecvWindowPosChanged(const NPRemoteEvent& event) bool PluginInstanceChild::RecvContentsScaleFactorChanged(const double& aContentsScaleFactor) { -#if defined(XP_MACOSX) || defined(XP_WIN) +#if defined(XP_WIN) mContentsScaleFactor = aContentsScaleFactor; -#if defined(XP_MACOSX) - if (mShContext) { - // Release the shared context so that it is reallocated - // with the new size. - ::CGContextRelease(mShContext); - mShContext = nullptr; - } -#endif return true; #else - NS_RUNTIMEABORT("ContentsScaleFactorChanged is an Windows or OSX only message"); + NS_RUNTIMEABORT("ContentsScaleFactorChanged is a Windows-only message"); return false; #endif } -#if defined(MOZ_X11) && defined(XP_UNIX) && !defined(XP_MACOSX) +#if defined(MOZ_X11) && defined(XP_UNIX) // Create a new window from NPWindow bool PluginInstanceChild::CreateWindow(const NPRemoteWindow& aWindow) { @@ -1290,7 +1006,7 @@ PluginInstanceChild::AnswerNPP_SetWindow(const NPRemoteWindow& aWindow) AssertPluginThread(); AutoStackHelper guard(this); -#if defined(MOZ_X11) && defined(XP_UNIX) && !defined(XP_MACOSX) +#if defined(MOZ_X11) && defined(XP_UNIX) NS_ASSERTION(mWsInfo.display, "We should have a valid display!"); // The minimum info is sent over IPC to allow this @@ -1407,26 +1123,6 @@ PluginInstanceChild::AnswerNPP_SetWindow(const NPRemoteWindow& aWindow) break; } -#elif defined(XP_MACOSX) - - mWindow.x = aWindow.x; - mWindow.y = aWindow.y; - mWindow.width = aWindow.width; - mWindow.height = aWindow.height; - mWindow.clipRect = aWindow.clipRect; - mWindow.type = aWindow.type; - mContentsScaleFactor = aWindow.contentsScaleFactor; - - if (mShContext) { - // Release the shared context so that it is reallocated - // with the new size. - ::CGContextRelease(mShContext); - mShContext = nullptr; - } - - if (mPluginIface->setwindow) - (void) mPluginIface->setwindow(&mData, &mWindow); - #elif defined(MOZ_WIDGET_UIKIT) // Don't care #else @@ -3372,7 +3068,7 @@ PluginInstanceChild::DoAsyncSetWindow(const gfxSurfaceType& aSurfaceType, mWindow.height = aWindow.height; mWindow.clipRect = aWindow.clipRect; mWindow.type = aWindow.type; -#if defined(XP_MACOSX) || defined(XP_WIN) +#if defined(XP_WIN) mContentsScaleFactor = aWindow.contentsScaleFactor; #endif @@ -3520,7 +3216,6 @@ PluginInstanceChild::MaybeCreatePlatformHelperSurface(void) bool PluginInstanceChild::EnsureCurrentBuffer(void) { -#ifndef XP_DARWIN nsIntRect toInvalidate(0, 0, 0, 0); IntSize winSize = IntSize(mWindow.width, mWindow.height); @@ -3564,61 +3259,6 @@ PluginInstanceChild::EnsureCurrentBuffer(void) NS_ERROR("Cannot create helper surface"); return false; } - - return true; -#elif defined(XP_MACOSX) - - if (!mDoubleBufferCARenderer.HasCALayer()) { - void *caLayer = nullptr; - if (mDrawingModel == NPDrawingModelCoreGraphics) { - if (!mCGLayer) { - caLayer = mozilla::plugins::PluginUtilsOSX::GetCGLayer(CallCGDraw, - this, - mContentsScaleFactor); - - if (!caLayer) { - PLUGIN_LOG_DEBUG(("GetCGLayer failed.")); - return false; - } - } - mCGLayer = caLayer; - } else { - NPError result = mPluginIface->getvalue(GetNPP(), - NPPVpluginCoreAnimationLayer, - &caLayer); - if (result != NPERR_NO_ERROR || !caLayer) { - PLUGIN_LOG_DEBUG(("Plugin requested CoreAnimation but did not " - "provide CALayer.")); - return false; - } - } - mDoubleBufferCARenderer.SetCALayer(caLayer); - } - - if (mDoubleBufferCARenderer.HasFrontSurface() && - (mDoubleBufferCARenderer.GetFrontSurfaceWidth() != mWindow.width || - mDoubleBufferCARenderer.GetFrontSurfaceHeight() != mWindow.height || - mDoubleBufferCARenderer.GetContentsScaleFactor() != mContentsScaleFactor)) { - mDoubleBufferCARenderer.ClearFrontSurface(); - } - - if (!mDoubleBufferCARenderer.HasFrontSurface()) { - bool allocSurface = mDoubleBufferCARenderer.InitFrontSurface( - mWindow.width, mWindow.height, mContentsScaleFactor, - GetQuirks() & QUIRK_ALLOW_OFFLINE_RENDERER ? - ALLOW_OFFLINE_RENDERER : DISALLOW_OFFLINE_RENDERER); - if (!allocSurface) { - PLUGIN_LOG_DEBUG(("Fail to allocate front IOSurface")); - return false; - } - - if (mPluginIface->setwindow) - (void) mPluginIface->setwindow(&mData, &mWindow); - - nsIntRect toInvalidate(0, 0, mWindow.width, mWindow.height); - mAccumulatedInvalidRect.UnionRect(mAccumulatedInvalidRect, toInvalidate); - } -#endif return true; } @@ -3662,8 +3302,6 @@ PluginInstanceChild::UpdateWindowAttributes(bool aForceSetWindow) return; } -#ifndef XP_MACOSX - // Adjusting the window isn't needed for OSX #ifndef XP_WIN // On Windows, we translate the device context, in order for the window // origin to be correct. @@ -3684,7 +3322,6 @@ PluginInstanceChild::UpdateWindowAttributes(bool aForceSetWindow) mWindow.clipRect.right = clipRect.XMost(); mWindow.clipRect.bottom = clipRect.YMost(); } -#endif // XP_MACOSX #ifdef XP_WIN // Windowless plugins on Windows need a WM_WINDOWPOSCHANGED event to update @@ -4655,7 +4292,7 @@ PluginInstanceChild::Destroy() xt_client_xloop_destroy(); } #endif -#if defined(MOZ_X11) && defined(XP_UNIX) && !defined(XP_MACOSX) +#if defined(MOZ_X11) && defined(XP_UNIX) DeleteWindow(); #endif } diff --git a/dom/plugins/ipc/PluginInstanceChild.h b/dom/plugins/ipc/PluginInstanceChild.h index 0ad6e145d7..627d37c367 100644 --- a/dom/plugins/ipc/PluginInstanceChild.h +++ b/dom/plugins/ipc/PluginInstanceChild.h @@ -206,7 +206,7 @@ protected: virtual bool RecvNPP_DidComposite() override; -#if defined(MOZ_X11) && defined(XP_UNIX) && !defined(XP_MACOSX) +#if defined(MOZ_X11) && defined(XP_UNIX) bool CreateWindow(const NPRemoteWindow& aWindow); void DeleteWindow(); #endif @@ -414,7 +414,7 @@ private: InfallibleTArray mValues; NPP_t mData; NPWindow mWindow; -#if defined(XP_DARWIN) || defined(XP_WIN) +#if defined(XP_WIN) double mContentsScaleFactor; #endif double mCSSZoomFactor; @@ -456,7 +456,7 @@ private: PluginScriptableObjectChild* mCachedWindowActor; PluginScriptableObjectChild* mCachedElementActor; -#if defined(MOZ_X11) && defined(XP_UNIX) && !defined(XP_MACOSX) +#if defined(MOZ_X11) && defined(XP_UNIX) NPSetWindowCallbackStruct mWsInfo; #ifdef MOZ_WIDGET_GTK bool mXEmbed; @@ -520,15 +520,10 @@ private: bool CanPaintOnBackground(); bool IsVisible() { -#ifdef XP_MACOSX - return mWindow.clipRect.top != mWindow.clipRect.bottom && - mWindow.clipRect.left != mWindow.clipRect.right; -#else return mWindow.clipRect.top != 0 || mWindow.clipRect.left != 0 || mWindow.clipRect.bottom != 0 || mWindow.clipRect.right != 0; -#endif } // ShowPluginFrame - in general does four things: @@ -609,12 +604,6 @@ private: // surface which is on ParentProcess side RefPtr mBackSurface; -#ifdef XP_MACOSX - // Current IOSurface available for rendering - // We can't use thebes gfxASurface like other platforms. - PluginUtilsOSX::nsDoubleBufferCARenderer mDoubleBufferCARenderer; -#endif - // (Not to be confused with mBackSurface). This is a recent copy // of the opaque pixels under our object frame, if // |mIsTransparent|. We ask the plugin render directly onto a diff --git a/dom/plugins/ipc/PluginInstanceParent.cpp b/dom/plugins/ipc/PluginInstanceParent.cpp index 523dc5c803..a2d93f74df 100644 --- a/dom/plugins/ipc/PluginInstanceParent.cpp +++ b/dom/plugins/ipc/PluginInstanceParent.cpp @@ -50,10 +50,6 @@ # include "mozilla/layers/TextureD3D11.h" #endif -#ifdef XP_MACOSX -#include "MacIOSurfaceImage.h" -#endif - #if defined(OS_WIN) #include #include "gfxWindowsPlatform.h" @@ -67,9 +63,7 @@ extern const wchar_t* kFlashFullscreenClass; #elif defined(MOZ_WIDGET_GTK) #include "mozilla/dom/ContentChild.h" #include -#elif defined(XP_MACOSX) -#include -#endif // defined(XP_MACOSX) +#endif using namespace mozilla; using namespace mozilla::plugins; @@ -134,11 +128,6 @@ PluginInstanceParent::PluginInstanceParent(PluginModuleParent* parent, , mPluginWndProc(nullptr) , mNestedEventState(false) #endif // defined(XP_WIN) -#if defined(XP_MACOSX) - , mShWidth(0) - , mShHeight(0) - , mShColorSpace(nullptr) -#endif { #if defined(OS_WIN) if (!sPluginInstanceList) { @@ -267,8 +256,6 @@ PluginInstanceParent::AnswerNPN_GetValue_NPNVnetscapeWindow(NativeWindowHandle* HWND id; #elif defined(MOZ_X11) XID id; -#elif defined(XP_DARWIN) - intptr_t id; #else #warning Implement me #endif @@ -458,14 +445,7 @@ PluginInstanceParent::AnswerNPN_SetValue_NPPVpluginDrawingModel( bool allowed = false; switch (drawingModel) { -#if defined(XP_MACOSX) - case NPDrawingModelCoreAnimation: - case NPDrawingModelInvalidatingCoreAnimation: - case NPDrawingModelOpenGL: - case NPDrawingModelCoreGraphics: - allowed = true; - break; -#elif defined(XP_WIN) +#if defined(XP_WIN) case NPDrawingModelSyncWin: allowed = true; break; @@ -494,16 +474,6 @@ PluginInstanceParent::AnswerNPN_SetValue_NPPVpluginDrawingModel( int requestModel = drawingModel; -#ifdef XP_MACOSX - if (drawingModel == NPDrawingModelCoreAnimation || - drawingModel == NPDrawingModelInvalidatingCoreAnimation) { - // We need to request CoreGraphics otherwise - // the nsPluginFrame will try to draw a CALayer - // that can not be shared across process. - requestModel = NPDrawingModelCoreGraphics; - } -#endif - *result = mNPNIface->setvalue(mNPP, NPPVpluginDrawingModel, (void*)(intptr_t)requestModel); @@ -514,14 +484,8 @@ bool PluginInstanceParent::AnswerNPN_SetValue_NPPVpluginEventModel( const int& eventModel, NPError* result) { -#ifdef XP_MACOSX - *result = mNPNIface->setvalue(mNPP, NPPVpluginEventModel, - (void*)(intptr_t)eventModel); - return true; -#else *result = NPERR_GENERIC_ERROR; return true; -#endif } bool @@ -877,35 +841,6 @@ PluginInstanceParent::RecvShow(const NPRect& updatedRect, } surface = gfxSharedImageSurface::Open(newSurface.get_Shmem()); } -#ifdef XP_MACOSX - else if (newSurface.type() == SurfaceDescriptor::TIOSurfaceDescriptor) { - IOSurfaceDescriptor iodesc = newSurface.get_IOSurfaceDescriptor(); - - RefPtr newIOSurface = - MacIOSurface::LookupSurface(iodesc.surfaceId(), - iodesc.contentsScaleFactor()); - - if (!newIOSurface) { - NS_WARNING("Got bad IOSurfaceDescriptor in RecvShow"); - return false; - } - - if (mFrontIOSurface) - *prevSurface = IOSurfaceDescriptor(mFrontIOSurface->GetIOSurfaceID(), - mFrontIOSurface->GetContentsScaleFactor()); - else - *prevSurface = null_t(); - - mFrontIOSurface = newIOSurface; - - RecvNPN_InvalidateRect(updatedRect); - - PLUGIN_LOG_DEBUG((" (RecvShow invalidated for surface %p)", - mFrontSurface.get())); - - return true; - } -#endif #ifdef MOZ_X11 else if (newSurface.type() == SurfaceDescriptor::TSurfaceDescriptorX11) { surface = newSurface.get_SurfaceDescriptorX11().OpenForeign(); @@ -988,7 +923,7 @@ PluginInstanceParent::AsyncSetWindow(NPWindow* aWindow) window.height = aWindow->height; window.clipRect = aWindow->clipRect; window.type = aWindow->type; -#if defined(XP_MACOSX) || defined(XP_WIN) +#if defined(XP_WIN) double scaleFactor = 1.0; mNPNIface->getvalue(mNPP, NPNVcontentsScaleFactor, &scaleFactor); window.contentsScaleFactor = scaleFactor; @@ -1018,19 +953,7 @@ PluginInstanceParent::GetImageContainer(ImageContainer** aContainer) return NS_OK; } -#ifdef XP_MACOSX - MacIOSurface* ioSurface = nullptr; - - if (mFrontIOSurface) { - ioSurface = mFrontIOSurface; - } else if (mIOSurface) { - ioSurface = mIOSurface; - } - - if (!mFrontSurface && !ioSurface) -#else if (!mFrontSurface) -#endif return NS_ERROR_NOT_AVAILABLE; ImageContainer *container = GetImageContainer(); @@ -1039,17 +962,6 @@ PluginInstanceParent::GetImageContainer(ImageContainer** aContainer) return NS_ERROR_FAILURE; } -#ifdef XP_MACOSX - if (ioSurface) { - RefPtr image = new MacIOSurfaceImage(ioSurface); - container->SetCurrentImageInTransaction(image); - - NS_IF_ADDREF(container); - *aContainer = container; - return NS_OK; - } -#endif - NS_IF_ADDREF(container); *aContainer = container; return NS_OK; @@ -1072,16 +984,6 @@ PluginInstanceParent::GetImageSize(nsIntSize* aSize) return NS_OK; } -#ifdef XP_MACOSX - if (mFrontIOSurface) { - *aSize = nsIntSize(mFrontIOSurface->GetWidth(), mFrontIOSurface->GetHeight()); - return NS_OK; - } else if (mIOSurface) { - *aSize = nsIntSize(mIOSurface->GetWidth(), mIOSurface->GetHeight()); - return NS_OK; - } -#endif - return NS_ERROR_NOT_AVAILABLE; } @@ -1094,23 +996,14 @@ PluginInstanceParent::DidComposite() Unused << SendNPP_DidComposite(); } -#ifdef XP_MACOSX -nsresult -PluginInstanceParent::IsRemoteDrawingCoreAnimation(bool *aDrawing) -{ - *aDrawing = (NPDrawingModelCoreAnimation == (NPDrawingModel)mDrawingModel || - NPDrawingModelInvalidatingCoreAnimation == (NPDrawingModel)mDrawingModel); - return NS_OK; -} -#endif -#if defined(XP_MACOSX) || defined(XP_WIN) +#if defined(XP_WIN) nsresult PluginInstanceParent::ContentsScaleFactorChanged(double aContentsScaleFactor) { bool rv = SendContentsScaleFactorChanged(aContentsScaleFactor); return rv ? NS_OK : NS_ERROR_FAILURE; } -#endif // #ifdef XP_MACOSX +#endif // #ifdef XP_WIN nsresult PluginInstanceParent::SetBackgroundUnknown() @@ -1362,40 +1255,14 @@ PluginInstanceParent::NPP_SetWindow(const NPWindow* aWindow) window.type = aWindow->type; #endif -#if defined(XP_MACOSX) || defined(XP_WIN) +#if defined(XP_WIN) double floatScaleFactor = 1.0; mNPNIface->getvalue(mNPP, NPNVcontentsScaleFactor, &floatScaleFactor); int scaleFactor = ceil(floatScaleFactor); window.contentsScaleFactor = floatScaleFactor; #endif -#if defined(XP_MACOSX) - if (mShWidth != window.width * scaleFactor || mShHeight != window.height * scaleFactor) { - if (mDrawingModel == NPDrawingModelCoreAnimation || - mDrawingModel == NPDrawingModelInvalidatingCoreAnimation) { - mIOSurface = MacIOSurface::CreateIOSurface(window.width, window.height, - floatScaleFactor); - } else if (uint32_t(mShWidth * mShHeight) != - window.width * scaleFactor * window.height * scaleFactor) { - if (mShWidth != 0 && mShHeight != 0) { - DeallocShmem(mShSurface); - mShWidth = 0; - mShHeight = 0; - } - if (window.width != 0 && window.height != 0) { - if (!AllocShmem(window.width * scaleFactor * window.height*4 * scaleFactor, - SharedMemory::TYPE_BASIC, &mShSurface)) { - PLUGIN_LOG_DEBUG(("Shared memory could not be allocated.")); - return NPERR_GENERIC_ERROR; - } - } - } - mShWidth = window.width * scaleFactor; - mShHeight = window.height * scaleFactor; - } -#endif - -#if defined(MOZ_X11) && defined(XP_UNIX) && !defined(XP_MACOSX) +#if defined(MOZ_X11) && defined(XP_UNIX) const NPSetWindowCallbackStruct* ws_info = static_cast(aWindow->ws_info); window.visualID = ws_info->visual ? ws_info->visual->visualid : 0; @@ -1556,14 +1423,10 @@ PluginInstanceParent::NPP_HandleEvent(void* event) { PLUGIN_LOG_DEBUG_FUNCTION; -#if defined(XP_MACOSX) - NPCocoaEvent* npevent = reinterpret_cast(event); -#else NPEvent* npevent = reinterpret_cast(event); -#endif NPRemoteEvent npremoteevent; npremoteevent.event = *npevent; -#if defined(XP_MACOSX) || defined(XP_WIN) +#if defined(XP_WIN) double scaleFactor = 1.0; mNPNIface->getvalue(mNPP, NPNVcontentsScaleFactor, &scaleFactor); npremoteevent.contentsScaleFactor = scaleFactor; @@ -1653,111 +1516,6 @@ PluginInstanceParent::NPP_HandleEvent(void* event) } #endif -#ifdef XP_MACOSX - if (npevent->type == NPCocoaEventDrawRect) { - if (mDrawingModel == NPDrawingModelCoreAnimation || - mDrawingModel == NPDrawingModelInvalidatingCoreAnimation) { - if (!mIOSurface) { - NS_ERROR("No IOSurface allocated."); - return false; - } - if (!CallNPP_HandleEvent_IOSurface(npremoteevent, - mIOSurface->GetIOSurfaceID(), - &handled)) - return false; // no good way to handle errors here... - - CGContextRef cgContext = npevent->data.draw.context; - if (!mShColorSpace) { - mShColorSpace = CreateSystemColorSpace(); - } - if (!mShColorSpace) { - PLUGIN_LOG_DEBUG(("Could not allocate ColorSpace.")); - return false; - } - if (cgContext) { - nsCARenderer::DrawSurfaceToCGContext(cgContext, mIOSurface, - mShColorSpace, - npevent->data.draw.x, - npevent->data.draw.y, - npevent->data.draw.width, - npevent->data.draw.height); - } - return true; - } else if (mFrontIOSurface) { - CGContextRef cgContext = npevent->data.draw.context; - if (!mShColorSpace) { - mShColorSpace = CreateSystemColorSpace(); - } - if (!mShColorSpace) { - PLUGIN_LOG_DEBUG(("Could not allocate ColorSpace.")); - return false; - } - if (cgContext) { - nsCARenderer::DrawSurfaceToCGContext(cgContext, mFrontIOSurface, - mShColorSpace, - npevent->data.draw.x, - npevent->data.draw.y, - npevent->data.draw.width, - npevent->data.draw.height); - } - return true; - } else { - if (mShWidth == 0 && mShHeight == 0) { - PLUGIN_LOG_DEBUG(("NPCocoaEventDrawRect on window of size 0.")); - return false; - } - if (!mShSurface.IsReadable()) { - PLUGIN_LOG_DEBUG(("Shmem is not readable.")); - return false; - } - - if (!CallNPP_HandleEvent_Shmem(npremoteevent, mShSurface, - &handled, &mShSurface)) - return false; // no good way to handle errors here... - - if (!mShSurface.IsReadable()) { - PLUGIN_LOG_DEBUG(("Shmem not returned. Either the plugin crashed " - "or we have a bug.")); - return false; - } - - char* shContextByte = mShSurface.get(); - - if (!mShColorSpace) { - mShColorSpace = CreateSystemColorSpace(); - } - if (!mShColorSpace) { - PLUGIN_LOG_DEBUG(("Could not allocate ColorSpace.")); - return false; - } - CGContextRef shContext = ::CGBitmapContextCreate(shContextByte, - mShWidth, mShHeight, 8, - mShWidth*4, mShColorSpace, - kCGImageAlphaPremultipliedFirst | - kCGBitmapByteOrder32Host); - if (!shContext) { - PLUGIN_LOG_DEBUG(("Could not allocate CGBitmapContext.")); - return false; - } - - CGImageRef shImage = ::CGBitmapContextCreateImage(shContext); - if (shImage) { - CGContextRef cgContext = npevent->data.draw.context; - - ::CGContextDrawImage(cgContext, - CGRectMake(0,0,mShWidth,mShHeight), - shImage); - ::CGImageRelease(shImage); - } else { - ::CGContextRelease(shContext); - return false; - } - ::CGContextRelease(shContext); - return true; - } - } -#endif - if (!CallNPP_HandleEvent(npremoteevent, &handled)) return 0; // no good way to handle errors here... diff --git a/dom/plugins/ipc/PluginInstanceParent.h b/dom/plugins/ipc/PluginInstanceParent.h index b2feafacc6..80d04242ca 100644 --- a/dom/plugins/ipc/PluginInstanceParent.h +++ b/dom/plugins/ipc/PluginInstanceParent.h @@ -322,10 +322,7 @@ public: nsresult AsyncSetWindow(NPWindow* window); nsresult GetImageContainer(mozilla::layers::ImageContainer** aContainer); nsresult GetImageSize(nsIntSize* aSize); -#ifdef XP_MACOSX - nsresult IsRemoteDrawingCoreAnimation(bool *aDrawing); -#endif -#if defined(XP_MACOSX) || defined(XP_WIN) +#if defined(XP_WIN) nsresult ContentsScaleFactorChanged(double aContentsScaleFactor); #endif nsresult SetBackgroundUnknown(); diff --git a/dom/plugins/ipc/PluginInterposeOSX.h b/dom/plugins/ipc/PluginInterposeOSX.h deleted file mode 100644 index 2a742b8aa2..0000000000 --- a/dom/plugins/ipc/PluginInterposeOSX.h +++ /dev/null @@ -1,137 +0,0 @@ -// vim:set ts=2 sts=2 sw=2 et cin: -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#ifndef DOM_PLUGINS_IPC_PLUGININTERPOSEOSX_H -#define DOM_PLUGINS_IPC_PLUGININTERPOSEOSX_H - -#include "base/basictypes.h" -#include "nsPoint.h" -#include "npapi.h" - -// Make this includable from non-Objective-C code. -#ifndef __OBJC__ -class NSCursor; -#else -#import -#endif - -// The header file QuickdrawAPI.h is missing on OS X 10.7 and up (though the -// QuickDraw APIs defined in it are still present) -- so we need to supply the -// relevant parts of its contents here. It's likely that Apple will eventually -// remove the APIs themselves (probably in OS X 10.8), so we need to make them -// weak imports, and test for their presence before using them. -#if !defined(__QUICKDRAWAPI__) - -typedef short Bits16[16]; -struct Cursor { - Bits16 data; - Bits16 mask; - Point hotSpot; -}; -typedef struct Cursor Cursor; - -#endif /* __QUICKDRAWAPI__ */ - -namespace mac_plugin_interposing { - -// Class used to serialize NSCursor objects over IPC between processes. -class NSCursorInfo { -public: - enum Type { - TypeCustom, - TypeArrow, - TypeClosedHand, - TypeContextualMenu, // Only supported on OS X 10.6 and up - TypeCrosshair, - TypeDisappearingItem, - TypeDragCopy, // Only supported on OS X 10.6 and up - TypeDragLink, // Only supported on OS X 10.6 and up - TypeIBeam, - TypeNotAllowed, // Only supported on OS X 10.6 and up - TypeOpenHand, - TypePointingHand, - TypeResizeDown, - TypeResizeLeft, - TypeResizeLeftRight, - TypeResizeRight, - TypeResizeUp, - TypeResizeUpDown, - TypeTransparent // Special type - }; - - NSCursorInfo(); - explicit NSCursorInfo(NSCursor* aCursor); - explicit NSCursorInfo(const Cursor* aCursor); - ~NSCursorInfo(); - - NSCursor* GetNSCursor() const; - Type GetType() const; - const char* GetTypeName() const; - nsPoint GetHotSpot() const; - uint8_t* GetCustomImageData() const; - uint32_t GetCustomImageDataLength() const; - - void SetType(Type aType); - void SetHotSpot(nsPoint aHotSpot); - void SetCustomImageData(uint8_t* aData, uint32_t aDataLength); - - static bool GetNativeCursorsSupported(); - -private: - NSCursor* GetTransparentCursor() const; - - Type mType; - // The hot spot's coordinate system is the cursor's coordinate system, and - // has an upper-left origin (in both Cocoa and pre-Cocoa systems). - nsPoint mHotSpot; - uint8_t* mCustomImageData; - uint32_t mCustomImageDataLength; - static int32_t mNativeCursorsSupported; -}; - -namespace parent { - -void OnPluginShowWindow(uint32_t window_id, CGRect window_bounds, bool modal); -void OnPluginHideWindow(uint32_t window_id, pid_t aPluginPid); -void OnSetCursor(const NSCursorInfo& cursorInfo); -void OnShowCursor(bool show); -void OnPushCursor(const NSCursorInfo& cursorInfo); -void OnPopCursor(); - -} // namespace parent - -namespace child { - -void SetUpCocoaInterposing(); - -} // namespace child - -} // namespace mac_plugin_interposing - -#endif /* DOM_PLUGINS_IPC_PLUGININTERPOSEOSX_H */ diff --git a/dom/plugins/ipc/PluginInterposeOSX.mm b/dom/plugins/ipc/PluginInterposeOSX.mm deleted file mode 100644 index bf24d2b0d8..0000000000 --- a/dom/plugins/ipc/PluginInterposeOSX.mm +++ /dev/null @@ -1,1158 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -// vim:set ts=2 sts=2 sw=2 et cin: -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#include "base/basictypes.h" -#include "nsCocoaUtils.h" -#include "PluginModuleChild.h" -#include "nsDebug.h" -#include "PluginInterposeOSX.h" -#include -#import -#import -#import - -using namespace mozilla::plugins; - -namespace mac_plugin_interposing { - -int32_t NSCursorInfo::mNativeCursorsSupported = -1; - -// This constructor may be called from the browser process or the plugin -// process. -NSCursorInfo::NSCursorInfo() - : mType(TypeArrow) - , mHotSpot(nsPoint(0, 0)) - , mCustomImageData(NULL) - , mCustomImageDataLength(0) -{ -} - -NSCursorInfo::NSCursorInfo(NSCursor* aCursor) - : mType(TypeArrow) - , mHotSpot(nsPoint(0, 0)) - , mCustomImageData(NULL) - , mCustomImageDataLength(0) -{ - // This constructor is only ever called from the plugin process, so the - // following is safe. - if (!GetNativeCursorsSupported()) { - return; - } - - NSPoint hotSpotCocoa = [aCursor hotSpot]; - mHotSpot = nsPoint(hotSpotCocoa.x, hotSpotCocoa.y); - - Class nsCursorClass = [NSCursor class]; - if ([aCursor isEqual:[NSCursor arrowCursor]]) { - mType = TypeArrow; - } else if ([aCursor isEqual:[NSCursor closedHandCursor]]) { - mType = TypeClosedHand; - } else if ([aCursor isEqual:[NSCursor crosshairCursor]]) { - mType = TypeCrosshair; - } else if ([aCursor isEqual:[NSCursor disappearingItemCursor]]) { - mType = TypeDisappearingItem; - } else if ([aCursor isEqual:[NSCursor IBeamCursor]]) { - mType = TypeIBeam; - } else if ([aCursor isEqual:[NSCursor openHandCursor]]) { - mType = TypeOpenHand; - } else if ([aCursor isEqual:[NSCursor pointingHandCursor]]) { - mType = TypePointingHand; - } else if ([aCursor isEqual:[NSCursor resizeDownCursor]]) { - mType = TypeResizeDown; - } else if ([aCursor isEqual:[NSCursor resizeLeftCursor]]) { - mType = TypeResizeLeft; - } else if ([aCursor isEqual:[NSCursor resizeLeftRightCursor]]) { - mType = TypeResizeLeftRight; - } else if ([aCursor isEqual:[NSCursor resizeRightCursor]]) { - mType = TypeResizeRight; - } else if ([aCursor isEqual:[NSCursor resizeUpCursor]]) { - mType = TypeResizeUp; - } else if ([aCursor isEqual:[NSCursor resizeUpDownCursor]]) { - mType = TypeResizeUpDown; - // The following cursor types are only supported on OS X 10.6 and up. - } else if ([nsCursorClass respondsToSelector:@selector(contextualMenuCursor)] && - [aCursor isEqual:[nsCursorClass performSelector:@selector(contextualMenuCursor)]]) { - mType = TypeContextualMenu; - } else if ([nsCursorClass respondsToSelector:@selector(dragCopyCursor)] && - [aCursor isEqual:[nsCursorClass performSelector:@selector(dragCopyCursor)]]) { - mType = TypeDragCopy; - } else if ([nsCursorClass respondsToSelector:@selector(dragLinkCursor)] && - [aCursor isEqual:[nsCursorClass performSelector:@selector(dragLinkCursor)]]) { - mType = TypeDragLink; - } else if ([nsCursorClass respondsToSelector:@selector(operationNotAllowedCursor)] && - [aCursor isEqual:[nsCursorClass performSelector:@selector(operationNotAllowedCursor)]]) { - mType = TypeNotAllowed; - } else { - NSImage* image = [aCursor image]; - NSArray* reps = image ? [image representations] : nil; - NSUInteger repsCount = reps ? [reps count] : 0; - if (!repsCount) { - // If we have a custom cursor with no image representations, assume we - // need a transparent cursor. - mType = TypeTransparent; - } else { - CGImageRef cgImage = nil; - // XXX We don't know how to deal with a cursor that doesn't have a - // bitmap image representation. For now we fall back to an arrow - // cursor. - for (NSUInteger i = 0; i < repsCount; ++i) { - id rep = [reps objectAtIndex:i]; - if ([rep isKindOfClass:[NSBitmapImageRep class]]) { - cgImage = [(NSBitmapImageRep*)rep CGImage]; - break; - } - } - if (cgImage) { - CFMutableDataRef data = ::CFDataCreateMutable(kCFAllocatorDefault, 0); - if (data) { - CGImageDestinationRef dest = ::CGImageDestinationCreateWithData(data, - kUTTypePNG, - 1, - NULL); - if (dest) { - ::CGImageDestinationAddImage(dest, cgImage, NULL); - if (::CGImageDestinationFinalize(dest)) { - uint32_t dataLength = (uint32_t) ::CFDataGetLength(data); - mCustomImageData = (uint8_t*) moz_xmalloc(dataLength); - ::CFDataGetBytes(data, ::CFRangeMake(0, dataLength), mCustomImageData); - mCustomImageDataLength = dataLength; - mType = TypeCustom; - } - ::CFRelease(dest); - } - ::CFRelease(data); - } - } - if (!mCustomImageData) { - mType = TypeArrow; - } - } - } -} - -NSCursorInfo::NSCursorInfo(const Cursor* aCursor) - : mType(TypeArrow) - , mHotSpot(nsPoint(0, 0)) - , mCustomImageData(NULL) - , mCustomImageDataLength(0) -{ - // This constructor is only ever called from the plugin process, so the - // following is safe. - if (!GetNativeCursorsSupported()) { - return; - } - - mHotSpot = nsPoint(aCursor->hotSpot.h, aCursor->hotSpot.v); - - int width = 16, height = 16; - int bytesPerPixel = 4; - int rowBytes = width * bytesPerPixel; - int bitmapSize = height * rowBytes; - - bool isTransparent = true; - - uint8_t* bitmap = (uint8_t*) moz_xmalloc(bitmapSize); - // The way we create 'bitmap' is largely "borrowed" from Chrome's - // WebCursor::InitFromCursor(). - for (int y = 0; y < height; ++y) { - unsigned short data = aCursor->data[y]; - unsigned short mask = aCursor->mask[y]; - // Change 'data' and 'mask' from big-endian to little-endian, but output - // big-endian data below. - data = ((data << 8) & 0xFF00) | ((data >> 8) & 0x00FF); - mask = ((mask << 8) & 0xFF00) | ((mask >> 8) & 0x00FF); - // It'd be nice to use a gray-scale bitmap. But - // CGBitmapContextCreateImage() (used below) won't work with one that also - // has alpha values. - for (int x = 0; x < width; ++x) { - int offset = (y * rowBytes) + (x * bytesPerPixel); - // Color value - if (data & 0x8000) { - bitmap[offset] = 0x0; - bitmap[offset + 1] = 0x0; - bitmap[offset + 2] = 0x0; - } else { - bitmap[offset] = 0xFF; - bitmap[offset + 1] = 0xFF; - bitmap[offset + 2] = 0xFF; - } - // Mask value - if (mask & 0x8000) { - bitmap[offset + 3] = 0xFF; - isTransparent = false; - } else { - bitmap[offset + 3] = 0x0; - } - data <<= 1; - mask <<= 1; - } - } - - if (isTransparent) { - // If aCursor is transparent, we don't need to serialize custom cursor - // data over IPC. - mType = TypeTransparent; - } else { - CGColorSpaceRef color = ::CGColorSpaceCreateDeviceRGB(); - if (color) { - CGContextRef context = - ::CGBitmapContextCreate(bitmap, - width, - height, - 8, - rowBytes, - color, - kCGImageAlphaPremultipliedLast | - kCGBitmapByteOrder32Big); - if (context) { - CGImageRef image = ::CGBitmapContextCreateImage(context); - if (image) { - ::CFMutableDataRef data = ::CFDataCreateMutable(kCFAllocatorDefault, 0); - if (data) { - CGImageDestinationRef dest = - ::CGImageDestinationCreateWithData(data, - kUTTypePNG, - 1, - NULL); - if (dest) { - ::CGImageDestinationAddImage(dest, image, NULL); - if (::CGImageDestinationFinalize(dest)) { - uint32_t dataLength = (uint32_t) ::CFDataGetLength(data); - mCustomImageData = (uint8_t*) moz_xmalloc(dataLength); - ::CFDataGetBytes(data, - ::CFRangeMake(0, dataLength), - mCustomImageData); - mCustomImageDataLength = dataLength; - mType = TypeCustom; - } - ::CFRelease(dest); - } - ::CFRelease(data); - } - ::CGImageRelease(image); - } - ::CGContextRelease(context); - } - ::CGColorSpaceRelease(color); - } - } - - free(bitmap); -} - -NSCursorInfo::~NSCursorInfo() -{ - if (mCustomImageData) { - free(mCustomImageData); - } -} - -NSCursor* NSCursorInfo::GetNSCursor() const -{ - NSCursor* retval = nil; - - Class nsCursorClass = [NSCursor class]; - switch(mType) { - case TypeArrow: - retval = [NSCursor arrowCursor]; - break; - case TypeClosedHand: - retval = [NSCursor closedHandCursor]; - break; - case TypeCrosshair: - retval = [NSCursor crosshairCursor]; - break; - case TypeDisappearingItem: - retval = [NSCursor disappearingItemCursor]; - break; - case TypeIBeam: - retval = [NSCursor IBeamCursor]; - break; - case TypeOpenHand: - retval = [NSCursor openHandCursor]; - break; - case TypePointingHand: - retval = [NSCursor pointingHandCursor]; - break; - case TypeResizeDown: - retval = [NSCursor resizeDownCursor]; - break; - case TypeResizeLeft: - retval = [NSCursor resizeLeftCursor]; - break; - case TypeResizeLeftRight: - retval = [NSCursor resizeLeftRightCursor]; - break; - case TypeResizeRight: - retval = [NSCursor resizeRightCursor]; - break; - case TypeResizeUp: - retval = [NSCursor resizeUpCursor]; - break; - case TypeResizeUpDown: - retval = [NSCursor resizeUpDownCursor]; - break; - // The following four cursor types are only supported on OS X 10.6 and up. - case TypeContextualMenu: { - if ([nsCursorClass respondsToSelector:@selector(contextualMenuCursor)]) { - retval = [nsCursorClass performSelector:@selector(contextualMenuCursor)]; - } - break; - } - case TypeDragCopy: { - if ([nsCursorClass respondsToSelector:@selector(dragCopyCursor)]) { - retval = [nsCursorClass performSelector:@selector(dragCopyCursor)]; - } - break; - } - case TypeDragLink: { - if ([nsCursorClass respondsToSelector:@selector(dragLinkCursor)]) { - retval = [nsCursorClass performSelector:@selector(dragLinkCursor)]; - } - break; - } - case TypeNotAllowed: { - if ([nsCursorClass respondsToSelector:@selector(operationNotAllowedCursor)]) { - retval = [nsCursorClass performSelector:@selector(operationNotAllowedCursor)]; - } - break; - } - case TypeTransparent: - retval = GetTransparentCursor(); - break; - default: - break; - } - - if (!retval && mCustomImageData && mCustomImageDataLength) { - CGDataProviderRef provider = ::CGDataProviderCreateWithData(NULL, - (const void*)mCustomImageData, - mCustomImageDataLength, - NULL); - if (provider) { - CGImageRef cgImage = ::CGImageCreateWithPNGDataProvider(provider, - NULL, - false, - kCGRenderingIntentDefault); - if (cgImage) { - NSBitmapImageRep* rep = [[NSBitmapImageRep alloc] initWithCGImage:cgImage]; - if (rep) { - NSImage* image = [[NSImage alloc] init]; - if (image) { - [image addRepresentation:rep]; - retval = [[[NSCursor alloc] initWithImage:image - hotSpot:NSMakePoint(mHotSpot.x, mHotSpot.y)] - autorelease]; - [image release]; - } - [rep release]; - } - ::CGImageRelease(cgImage); - } - ::CFRelease(provider); - } - } - - // Fall back to an arrow cursor if need be. - if (!retval) { - retval = [NSCursor arrowCursor]; - } - - return retval; -} - -// Get a transparent cursor with the appropriate hot spot. We need one if -// (for example) we have a custom cursor with no image data. -NSCursor* NSCursorInfo::GetTransparentCursor() const -{ - NSCursor* retval = nil; - - int width = 16, height = 16; - int bytesPerPixel = 2; - int rowBytes = width * bytesPerPixel; - int dataSize = height * rowBytes; - - uint8_t* data = (uint8_t*) moz_xmalloc(dataSize); - for (int y = 0; y < height; ++y) { - for (int x = 0; x < width; ++x) { - int offset = (y * rowBytes) + (x * bytesPerPixel); - data[offset] = 0x7E; // Arbitrary gray-scale value - data[offset + 1] = 0; // Alpha value to make us transparent - } - } - - NSBitmapImageRep* imageRep = - [[[NSBitmapImageRep alloc] initWithBitmapDataPlanes:nil - pixelsWide:width - pixelsHigh:height - bitsPerSample:8 - samplesPerPixel:2 - hasAlpha:YES - isPlanar:NO - colorSpaceName:NSCalibratedWhiteColorSpace - bytesPerRow:rowBytes - bitsPerPixel:16] - autorelease]; - if (imageRep) { - uint8_t* repDataPtr = [imageRep bitmapData]; - if (repDataPtr) { - memcpy(repDataPtr, data, dataSize); - NSImage *image = - [[[NSImage alloc] initWithSize:NSMakeSize(width, height)] - autorelease]; - if (image) { - [image addRepresentation:imageRep]; - retval = - [[[NSCursor alloc] initWithImage:image - hotSpot:NSMakePoint(mHotSpot.x, mHotSpot.y)] - autorelease]; - } - } - } - - free(data); - - // Fall back to an arrow cursor if (for some reason) the above code failed. - if (!retval) { - retval = [NSCursor arrowCursor]; - } - - return retval; -} - -NSCursorInfo::Type NSCursorInfo::GetType() const -{ - return mType; -} - -const char* NSCursorInfo::GetTypeName() const -{ - switch(mType) { - case TypeCustom: - return "TypeCustom"; - case TypeArrow: - return "TypeArrow"; - case TypeClosedHand: - return "TypeClosedHand"; - case TypeContextualMenu: - return "TypeContextualMenu"; - case TypeCrosshair: - return "TypeCrosshair"; - case TypeDisappearingItem: - return "TypeDisappearingItem"; - case TypeDragCopy: - return "TypeDragCopy"; - case TypeDragLink: - return "TypeDragLink"; - case TypeIBeam: - return "TypeIBeam"; - case TypeNotAllowed: - return "TypeNotAllowed"; - case TypeOpenHand: - return "TypeOpenHand"; - case TypePointingHand: - return "TypePointingHand"; - case TypeResizeDown: - return "TypeResizeDown"; - case TypeResizeLeft: - return "TypeResizeLeft"; - case TypeResizeLeftRight: - return "TypeResizeLeftRight"; - case TypeResizeRight: - return "TypeResizeRight"; - case TypeResizeUp: - return "TypeResizeUp"; - case TypeResizeUpDown: - return "TypeResizeUpDown"; - case TypeTransparent: - return "TypeTransparent"; - default: - break; - } - return "TypeUnknown"; -} - -nsPoint NSCursorInfo::GetHotSpot() const -{ - return mHotSpot; -} - -uint8_t* NSCursorInfo::GetCustomImageData() const -{ - return mCustomImageData; -} - -uint32_t NSCursorInfo::GetCustomImageDataLength() const -{ - return mCustomImageDataLength; -} - -void NSCursorInfo::SetType(Type aType) -{ - mType = aType; -} - -void NSCursorInfo::SetHotSpot(nsPoint aHotSpot) -{ - mHotSpot = aHotSpot; -} - -void NSCursorInfo::SetCustomImageData(uint8_t* aData, uint32_t aDataLength) -{ - if (mCustomImageData) { - free(mCustomImageData); - } - if (aDataLength) { - mCustomImageData = (uint8_t*) moz_xmalloc(aDataLength); - memcpy(mCustomImageData, aData, aDataLength); - } else { - mCustomImageData = NULL; - } - mCustomImageDataLength = aDataLength; -} - -// This should never be called from the browser process -- only from the -// plugin process. -bool NSCursorInfo::GetNativeCursorsSupported() -{ - if (mNativeCursorsSupported == -1) { - ENSURE_PLUGIN_THREAD(false); - PluginModuleChild *pmc = PluginModuleChild::GetChrome(); - if (pmc) { - bool result = pmc->GetNativeCursorsSupported(); - if (result) { - mNativeCursorsSupported = 1; - } else { - mNativeCursorsSupported = 0; - } - } - } - return (mNativeCursorsSupported == 1); -} - -} // namespace mac_plugin_interposing - -namespace mac_plugin_interposing { -namespace parent { - -// Tracks plugin windows currently visible. -std::set plugin_visible_windows_set_; -// Tracks full screen windows currently visible. -std::set plugin_fullscreen_windows_set_; -// Tracks modal windows currently visible. -std::set plugin_modal_windows_set_; - -void OnPluginShowWindow(uint32_t window_id, - CGRect window_bounds, - bool modal) { - plugin_visible_windows_set_.insert(window_id); - - if (modal) - plugin_modal_windows_set_.insert(window_id); - - CGRect main_display_bounds = ::CGDisplayBounds(CGMainDisplayID()); - - if (CGRectEqualToRect(window_bounds, main_display_bounds) && - (plugin_fullscreen_windows_set_.find(window_id) == - plugin_fullscreen_windows_set_.end())) { - plugin_fullscreen_windows_set_.insert(window_id); - - nsCocoaUtils::HideOSChromeOnScreen(true); - } -} - -static void ActivateProcess(pid_t pid) { - ProcessSerialNumber process; - OSStatus status = ::GetProcessForPID(pid, &process); - - if (status == noErr) { - SetFrontProcess(&process); - } else { - NS_WARNING("Unable to get process for pid."); - } -} - -// Must be called on the UI thread. -// If plugin_pid is -1, the browser will be the active process on return, -// otherwise that process will be given focus back before this function returns. -static void ReleasePluginFullScreen(pid_t plugin_pid) { - // Releasing full screen only works if we are the frontmost process; grab - // focus, but give it back to the plugin process if requested. - ActivateProcess(base::GetCurrentProcId()); - - nsCocoaUtils::HideOSChromeOnScreen(false); - - if (plugin_pid != -1) { - ActivateProcess(plugin_pid); - } -} - -void OnPluginHideWindow(uint32_t window_id, pid_t aPluginPid) { - bool had_windows = !plugin_visible_windows_set_.empty(); - plugin_visible_windows_set_.erase(window_id); - bool browser_needs_activation = had_windows && - plugin_visible_windows_set_.empty(); - - plugin_modal_windows_set_.erase(window_id); - if (plugin_fullscreen_windows_set_.find(window_id) != - plugin_fullscreen_windows_set_.end()) { - plugin_fullscreen_windows_set_.erase(window_id); - pid_t plugin_pid = browser_needs_activation ? -1 : aPluginPid; - browser_needs_activation = false; - ReleasePluginFullScreen(plugin_pid); - } - - if (browser_needs_activation) { - ActivateProcess(getpid()); - } -} - -void OnSetCursor(const NSCursorInfo& cursorInfo) -{ - NSCursor* aCursor = cursorInfo.GetNSCursor(); - if (aCursor) { - [aCursor set]; - } -} - -void OnShowCursor(bool show) -{ - if (show) { - [NSCursor unhide]; - } else { - [NSCursor hide]; - } -} - -void OnPushCursor(const NSCursorInfo& cursorInfo) -{ - NSCursor* aCursor = cursorInfo.GetNSCursor(); - if (aCursor) { - [aCursor push]; - } -} - -void OnPopCursor() -{ - [NSCursor pop]; -} - -} // namespace parent -} // namespace mac_plugin_interposing - -namespace mac_plugin_interposing { -namespace child { - -// TODO(stuartmorgan): Make this an IPC to order the plugin process above the -// browser process only if the browser is current frontmost. -void FocusPluginProcess() { - ProcessSerialNumber this_process, front_process; - if ((GetCurrentProcess(&this_process) != noErr) || - (GetFrontProcess(&front_process) != noErr)) { - return; - } - - Boolean matched = false; - if ((SameProcess(&this_process, &front_process, &matched) == noErr) && - !matched) { - SetFrontProcess(&this_process); - } -} - -void NotifyBrowserOfPluginShowWindow(uint32_t window_id, CGRect bounds, - bool modal) { - ENSURE_PLUGIN_THREAD_VOID(); - - PluginModuleChild *pmc = PluginModuleChild::GetChrome(); - if (pmc) - pmc->PluginShowWindow(window_id, modal, bounds); -} - -void NotifyBrowserOfPluginHideWindow(uint32_t window_id, CGRect bounds) { - ENSURE_PLUGIN_THREAD_VOID(); - - PluginModuleChild *pmc = PluginModuleChild::GetChrome(); - if (pmc) - pmc->PluginHideWindow(window_id); -} - -void NotifyBrowserOfSetCursor(NSCursorInfo& aCursorInfo) -{ - ENSURE_PLUGIN_THREAD_VOID(); - PluginModuleChild *pmc = PluginModuleChild::GetChrome(); - if (pmc) { - pmc->SetCursor(aCursorInfo); - } -} - -void NotifyBrowserOfShowCursor(bool show) -{ - ENSURE_PLUGIN_THREAD_VOID(); - PluginModuleChild *pmc = PluginModuleChild::GetChrome(); - if (pmc) { - pmc->ShowCursor(show); - } -} - -void NotifyBrowserOfPushCursor(NSCursorInfo& aCursorInfo) -{ - ENSURE_PLUGIN_THREAD_VOID(); - PluginModuleChild *pmc = PluginModuleChild::GetChrome(); - if (pmc) { - pmc->PushCursor(aCursorInfo); - } -} - -void NotifyBrowserOfPopCursor() -{ - ENSURE_PLUGIN_THREAD_VOID(); - PluginModuleChild *pmc = PluginModuleChild::GetChrome(); - if (pmc) { - pmc->PopCursor(); - } -} - -struct WindowInfo { - uint32_t window_id; - CGRect bounds; - explicit WindowInfo(NSWindow* aWindow) { - NSInteger window_num = [aWindow windowNumber]; - window_id = window_num > 0 ? window_num : 0; - bounds = NSRectToCGRect([aWindow frame]); - } -}; - -static void OnPluginWindowClosed(const WindowInfo& window_info) { - if (window_info.window_id == 0) - return; - mac_plugin_interposing::child::NotifyBrowserOfPluginHideWindow(window_info.window_id, - window_info.bounds); -} - -static void OnPluginWindowShown(const WindowInfo& window_info, BOOL is_modal) { - // The window id is 0 if it has never been shown (including while it is the - // process of being shown for the first time); when that happens, we'll catch - // it in _setWindowNumber instead. - static BOOL s_pending_display_is_modal = NO; - if (window_info.window_id == 0) { - if (is_modal) - s_pending_display_is_modal = YES; - return; - } - if (s_pending_display_is_modal) { - is_modal = YES; - s_pending_display_is_modal = NO; - } - mac_plugin_interposing::child::NotifyBrowserOfPluginShowWindow( - window_info.window_id, window_info.bounds, is_modal); -} - -static BOOL OnSetCursor(NSCursorInfo &aInfo) -{ - if (NSCursorInfo::GetNativeCursorsSupported()) { - NotifyBrowserOfSetCursor(aInfo); - return YES; - } - return NO; -} - -static BOOL OnHideCursor() -{ - if (NSCursorInfo::GetNativeCursorsSupported()) { - NotifyBrowserOfShowCursor(NO); - return YES; - } - return NO; -} - -static BOOL OnUnhideCursor() -{ - if (NSCursorInfo::GetNativeCursorsSupported()) { - NotifyBrowserOfShowCursor(YES); - return YES; - } - return NO; -} - -static BOOL OnPushCursor(NSCursorInfo &aInfo) -{ - if (NSCursorInfo::GetNativeCursorsSupported()) { - NotifyBrowserOfPushCursor(aInfo); - return YES; - } - return NO; -} - -static BOOL OnPopCursor() -{ - if (NSCursorInfo::GetNativeCursorsSupported()) { - NotifyBrowserOfPopCursor(); - return YES; - } - return NO; -} - -} // namespace child -} // namespace mac_plugin_interposing - -using namespace mac_plugin_interposing::child; - -@interface NSWindow (PluginInterposing) -- (void)pluginInterpose_orderOut:(id)sender; -- (void)pluginInterpose_orderFront:(id)sender; -- (void)pluginInterpose_makeKeyAndOrderFront:(id)sender; -- (void)pluginInterpose_setWindowNumber:(NSInteger)num; -@end - -@implementation NSWindow (PluginInterposing) - -- (void)pluginInterpose_orderOut:(id)sender { - WindowInfo window_info(self); - [self pluginInterpose_orderOut:sender]; - OnPluginWindowClosed(window_info); -} - -- (void)pluginInterpose_orderFront:(id)sender { - mac_plugin_interposing::child::FocusPluginProcess(); - [self pluginInterpose_orderFront:sender]; - OnPluginWindowShown(WindowInfo(self), NO); -} - -- (void)pluginInterpose_makeKeyAndOrderFront:(id)sender { - mac_plugin_interposing::child::FocusPluginProcess(); - [self pluginInterpose_makeKeyAndOrderFront:sender]; - OnPluginWindowShown(WindowInfo(self), NO); -} - -- (void)pluginInterpose_setWindowNumber:(NSInteger)num { - if (num > 0) - mac_plugin_interposing::child::FocusPluginProcess(); - [self pluginInterpose_setWindowNumber:num]; - if (num > 0) - OnPluginWindowShown(WindowInfo(self), NO); -} - -@end - -@interface NSApplication (PluginInterposing) -- (NSInteger)pluginInterpose_runModalForWindow:(NSWindow*)window; -@end - -@implementation NSApplication (PluginInterposing) - -- (NSInteger)pluginInterpose_runModalForWindow:(NSWindow*)window { - mac_plugin_interposing::child::FocusPluginProcess(); - // This is out-of-order relative to the other calls, but runModalForWindow: - // won't return until the window closes, and the order only matters for - // full-screen windows. - OnPluginWindowShown(WindowInfo(window), YES); - return [self pluginInterpose_runModalForWindow:window]; -} - -@end - -// Hook commands to manipulate the current cursor, so that they can be passed -// from the child process to the parent process. These commands have no -// effect unless they're performed in the parent process. -@interface NSCursor (PluginInterposing) -- (void)pluginInterpose_set; -- (void)pluginInterpose_push; -- (void)pluginInterpose_pop; -+ (NSCursor*)pluginInterpose_currentCursor; -+ (void)pluginInterpose_hide; -+ (void)pluginInterpose_unhide; -+ (void)pluginInterpose_pop; -@end - -// Cache the results of [NSCursor set], [NSCursor push] and [NSCursor pop]. -// The last element is always the current cursor. -static NSMutableArray* gCursorStack = nil; - -static BOOL initCursorStack() -{ - if (!gCursorStack) { - gCursorStack = [[NSMutableArray arrayWithCapacity:5] retain]; - } - return (gCursorStack != NULL); -} - -static NSCursor* currentCursorFromCache() -{ - if (!initCursorStack()) - return nil; - return (NSCursor*) [gCursorStack lastObject]; -} - -static void setCursorInCache(NSCursor* aCursor) -{ - if (!initCursorStack() || !aCursor) - return; - NSUInteger count = [gCursorStack count]; - if (count) { - [gCursorStack replaceObjectAtIndex:count - 1 withObject:aCursor]; - } else { - [gCursorStack addObject:aCursor]; - } -} - -static void pushCursorInCache(NSCursor* aCursor) -{ - if (!initCursorStack() || !aCursor) - return; - [gCursorStack addObject:aCursor]; -} - -static void popCursorInCache() -{ - if (!initCursorStack()) - return; - // Apple's doc on the +[NSCursor pop] method says: "If the current cursor - // is the only cursor on the stack, this method does nothing." - if ([gCursorStack count] > 1) { - [gCursorStack removeLastObject]; - } -} - -@implementation NSCursor (PluginInterposing) - -- (void)pluginInterpose_set -{ - NSCursorInfo info(self); - OnSetCursor(info); - setCursorInCache(self); - [self pluginInterpose_set]; -} - -- (void)pluginInterpose_push -{ - NSCursorInfo info(self); - OnPushCursor(info); - pushCursorInCache(self); - [self pluginInterpose_push]; -} - -- (void)pluginInterpose_pop -{ - OnPopCursor(); - popCursorInCache(); - [self pluginInterpose_pop]; -} - -// The currentCursor method always returns nil when running in a background -// process. But this may confuse plugins (notably Flash, see bug 621117). So -// if we get a nil return from the "call to super", we return a cursor that's -// been cached by previous calls to set or push. According to Apple's docs, -// currentCursor "only returns the cursor set by your application using -// NSCursor methods". So we don't need to worry about changes to the cursor -// made by other methods like SetThemeCursor(). -+ (NSCursor*)pluginInterpose_currentCursor -{ - NSCursor* retval = [self pluginInterpose_currentCursor]; - if (!retval) { - retval = currentCursorFromCache(); - } - return retval; -} - -+ (void)pluginInterpose_hide -{ - OnHideCursor(); - [self pluginInterpose_hide]; -} - -+ (void)pluginInterpose_unhide -{ - OnUnhideCursor(); - [self pluginInterpose_unhide]; -} - -+ (void)pluginInterpose_pop -{ - OnPopCursor(); - popCursorInCache(); - [self pluginInterpose_pop]; -} - -@end - -static void ExchangeMethods(Class target_class, - BOOL class_method, - SEL original, - SEL replacement) { - Method m1; - Method m2; - if (class_method) { - m1 = class_getClassMethod(target_class, original); - m2 = class_getClassMethod(target_class, replacement); - } else { - m1 = class_getInstanceMethod(target_class, original); - m2 = class_getInstanceMethod(target_class, replacement); - } - - if (m1 == m2) - return; - - if (m1 && m2) - method_exchangeImplementations(m1, m2); - else - NS_NOTREACHED("Cocoa swizzling failed"); -} - -namespace mac_plugin_interposing { -namespace child { - -void SetUpCocoaInterposing() { - Class nswindow_class = [NSWindow class]; - ExchangeMethods(nswindow_class, NO, @selector(orderOut:), - @selector(pluginInterpose_orderOut:)); - ExchangeMethods(nswindow_class, NO, @selector(orderFront:), - @selector(pluginInterpose_orderFront:)); - ExchangeMethods(nswindow_class, NO, @selector(makeKeyAndOrderFront:), - @selector(pluginInterpose_makeKeyAndOrderFront:)); - ExchangeMethods(nswindow_class, NO, @selector(_setWindowNumber:), - @selector(pluginInterpose_setWindowNumber:)); - - ExchangeMethods([NSApplication class], NO, @selector(runModalForWindow:), - @selector(pluginInterpose_runModalForWindow:)); - - Class nscursor_class = [NSCursor class]; - ExchangeMethods(nscursor_class, NO, @selector(set), - @selector(pluginInterpose_set)); - ExchangeMethods(nscursor_class, NO, @selector(push), - @selector(pluginInterpose_push)); - ExchangeMethods(nscursor_class, NO, @selector(pop), - @selector(pluginInterpose_pop)); - ExchangeMethods(nscursor_class, YES, @selector(currentCursor), - @selector(pluginInterpose_currentCursor)); - ExchangeMethods(nscursor_class, YES, @selector(hide), - @selector(pluginInterpose_hide)); - ExchangeMethods(nscursor_class, YES, @selector(unhide), - @selector(pluginInterpose_unhide)); - ExchangeMethods(nscursor_class, YES, @selector(pop), - @selector(pluginInterpose_pop)); -} - -} // namespace child -} // namespace mac_plugin_interposing - -// Called from plugin_child_interpose.mm, which hooks calls to -// SetCursor() (the QuickDraw call) from the plugin child process. -extern "C" NS_VISIBILITY_DEFAULT BOOL -mac_plugin_interposing_child_OnSetCursor(const Cursor* cursor) -{ - NSCursorInfo info(cursor); - return OnSetCursor(info); -} - -// Called from plugin_child_interpose.mm, which hooks calls to -// SetThemeCursor() (the Appearance Manager call) from the plugin child -// process. -extern "C" NS_VISIBILITY_DEFAULT BOOL -mac_plugin_interposing_child_OnSetThemeCursor(ThemeCursor cursor) -{ - NSCursorInfo info; - switch (cursor) { - case kThemeArrowCursor: - info.SetType(NSCursorInfo::TypeArrow); - break; - case kThemeCopyArrowCursor: - info.SetType(NSCursorInfo::TypeDragCopy); - break; - case kThemeAliasArrowCursor: - info.SetType(NSCursorInfo::TypeDragLink); - break; - case kThemeContextualMenuArrowCursor: - info.SetType(NSCursorInfo::TypeContextualMenu); - break; - case kThemeIBeamCursor: - info.SetType(NSCursorInfo::TypeIBeam); - break; - case kThemeCrossCursor: - case kThemePlusCursor: - info.SetType(NSCursorInfo::TypeCrosshair); - break; - case kThemeWatchCursor: - case kThemeSpinningCursor: - info.SetType(NSCursorInfo::TypeArrow); - break; - case kThemeClosedHandCursor: - info.SetType(NSCursorInfo::TypeClosedHand); - break; - case kThemeOpenHandCursor: - info.SetType(NSCursorInfo::TypeOpenHand); - break; - case kThemePointingHandCursor: - case kThemeCountingUpHandCursor: - case kThemeCountingDownHandCursor: - case kThemeCountingUpAndDownHandCursor: - info.SetType(NSCursorInfo::TypePointingHand); - break; - case kThemeResizeLeftCursor: - info.SetType(NSCursorInfo::TypeResizeLeft); - break; - case kThemeResizeRightCursor: - info.SetType(NSCursorInfo::TypeResizeRight); - break; - case kThemeResizeLeftRightCursor: - info.SetType(NSCursorInfo::TypeResizeLeftRight); - break; - case kThemeNotAllowedCursor: - info.SetType(NSCursorInfo::TypeNotAllowed); - break; - case kThemeResizeUpCursor: - info.SetType(NSCursorInfo::TypeResizeUp); - break; - case kThemeResizeDownCursor: - info.SetType(NSCursorInfo::TypeResizeDown); - break; - case kThemeResizeUpDownCursor: - info.SetType(NSCursorInfo::TypeResizeUpDown); - break; - case kThemePoofCursor: - info.SetType(NSCursorInfo::TypeDisappearingItem); - break; - default: - info.SetType(NSCursorInfo::TypeArrow); - break; - } - return OnSetCursor(info); -} - -extern "C" NS_VISIBILITY_DEFAULT BOOL -mac_plugin_interposing_child_OnHideCursor() -{ - return OnHideCursor(); -} - -extern "C" NS_VISIBILITY_DEFAULT BOOL -mac_plugin_interposing_child_OnShowCursor() -{ - return OnUnhideCursor(); -} diff --git a/dom/plugins/ipc/PluginLibrary.h b/dom/plugins/ipc/PluginLibrary.h index 2f9a3f81b2..50182d0b0d 100644 --- a/dom/plugins/ipc/PluginLibrary.h +++ b/dom/plugins/ipc/PluginLibrary.h @@ -57,7 +57,7 @@ public: virtual bool HasRequiredFunctions() = 0; -#if defined(XP_UNIX) && !defined(XP_MACOSX) +#if defined(XP_UNIX) virtual nsresult NP_Initialize(NPNetscapeFuncs* bFuncs, NPPluginFuncs* pFuncs, NPError* error) = 0; #else virtual nsresult NP_Initialize(NPNetscapeFuncs* bFuncs, NPError* error) = 0; @@ -66,7 +66,7 @@ public: virtual nsresult NP_GetMIMEDescription(const char** mimeDesc) = 0; virtual nsresult NP_GetValue(void *future, NPPVariable aVariable, void *aValue, NPError* error) = 0; -#if defined(XP_WIN) || defined(XP_MACOSX) +#if defined(XP_WIN) virtual nsresult NP_GetEntryPoints(NPPluginFuncs* pFuncs, NPError* error) = 0; #endif virtual nsresult NPP_New(NPMIMEType pluginType, NPP instance, @@ -83,10 +83,7 @@ public: virtual nsresult GetImageSize(NPP instance, nsIntSize* aSize) = 0; virtual void DidComposite(NPP instance) = 0; virtual bool IsOOP() = 0; -#if defined(XP_MACOSX) - virtual nsresult IsRemoteDrawingCoreAnimation(NPP instance, bool *aDrawing) = 0; -#endif -#if defined(XP_MACOSX) || defined(XP_WIN) +#if defined(XP_WIN) virtual nsresult ContentsScaleFactorChanged(NPP instance, double aContentsScaleFactor) = 0; #endif #if defined(XP_WIN) diff --git a/dom/plugins/ipc/PluginMessageUtils.cpp b/dom/plugins/ipc/PluginMessageUtils.cpp index be1b2d15a5..9b27c76d5a 100644 --- a/dom/plugins/ipc/PluginMessageUtils.cpp +++ b/dom/plugins/ipc/PluginMessageUtils.cpp @@ -49,13 +49,10 @@ namespace plugins { NPRemoteWindow::NPRemoteWindow() : window(0), x(0), y(0), width(0), height(0), type(NPWindowTypeDrawable) -#if defined(MOZ_X11) && defined(XP_UNIX) && !defined(XP_MACOSX) +#if defined(MOZ_X11) && defined(XP_UNIX) , visualID(0) , colormap(0) #endif /* XP_UNIX */ -#if defined(XP_MACOSX) - ,contentsScaleFactor(1.0) -#endif { clipRect.top = 0; clipRect.left = 0; diff --git a/dom/plugins/ipc/PluginMessageUtils.h b/dom/plugins/ipc/PluginMessageUtils.h index 5b22f3748e..e06c2cee24 100644 --- a/dom/plugins/ipc/PluginMessageUtils.h +++ b/dom/plugins/ipc/PluginMessageUtils.h @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * vim: sw=4 ts=4 et : * 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/. */ @@ -23,11 +22,7 @@ #include "nsTArray.h" #include "mozilla/Logging.h" #include "nsHashKeys.h" -#ifdef XP_MACOSX -#include "PluginInterposeOSX.h" -#else namespace mac_plugin_interposing { class NSCursorInfo { }; } -#endif using mac_plugin_interposing::NSCursorInfo; namespace mozilla { @@ -87,11 +82,11 @@ struct NPRemoteWindow uint32_t height; NPRect clipRect; NPWindowType type; -#if defined(MOZ_X11) && defined(XP_UNIX) && !defined(XP_MACOSX) +#if defined(MOZ_X11) && defined(XP_UNIX) VisualID visualID; Colormap colormap; #endif /* XP_UNIX */ -#if defined(XP_MACOSX) || defined(XP_WIN) +#if defined(XP_WIN) double contentsScaleFactor; #endif }; @@ -111,8 +106,6 @@ struct NPAudioDeviceChangeDetailsIPC typedef HWND NativeWindowHandle; #elif defined(MOZ_X11) typedef XID NativeWindowHandle; -#elif defined(XP_DARWIN) -typedef intptr_t NativeWindowHandle; // never actually used, will always be 0 #else #error Need NativeWindowHandle for this platform #endif @@ -156,11 +149,6 @@ NPPVariableToString(NPPVariable aVar) VARSTR(NPPVpluginWantsAllNetworkStreams); -#ifdef XP_MACOSX - VARSTR(NPPVpluginDrawingModel); - VARSTR(NPPVpluginEventModel); -#endif - #ifdef XP_WIN VARSTR(NPPVpluginRequiresAudioDeviceChanges); #endif @@ -357,11 +345,11 @@ struct ParamTraits WriteParam(aMsg, aParam.height); WriteParam(aMsg, aParam.clipRect); WriteParam(aMsg, aParam.type); -#if defined(MOZ_X11) && defined(XP_UNIX) && !defined(XP_MACOSX) +#if defined(MOZ_X11) && defined(XP_UNIX) aMsg->WriteULong(aParam.visualID); aMsg->WriteULong(aParam.colormap); #endif -#if defined(XP_MACOSX) || defined(XP_WIN) +#if defined(XP_WIN) aMsg->WriteDouble(aParam.contentsScaleFactor); #endif } @@ -382,7 +370,7 @@ struct ParamTraits ReadParam(aMsg, aIter, &type))) return false; -#if defined(MOZ_X11) && defined(XP_UNIX) && !defined(XP_MACOSX) +#if defined(MOZ_X11) && defined(XP_UNIX) unsigned long visualID; unsigned long colormap; if (!(aMsg->ReadULong(aIter, &visualID) && @@ -390,7 +378,7 @@ struct ParamTraits return false; #endif -#if defined(XP_MACOSX) || defined(XP_WIN) +#if defined(XP_WIN) double contentsScaleFactor; if (!aMsg->ReadDouble(aIter, &contentsScaleFactor)) return false; @@ -403,11 +391,11 @@ struct ParamTraits aResult->height = height; aResult->clipRect = clipRect; aResult->type = type; -#if defined(MOZ_X11) && defined(XP_UNIX) && !defined(XP_MACOSX) +#if defined(MOZ_X11) && defined(XP_UNIX) aResult->visualID = visualID; aResult->colormap = colormap; #endif -#if defined(XP_MACOSX) || defined(XP_WIN) +#if defined(XP_WIN) aResult->contentsScaleFactor = contentsScaleFactor; #endif return true; @@ -422,161 +410,6 @@ struct ParamTraits } }; -#ifdef XP_MACOSX -template <> -struct ParamTraits -{ - typedef NPNSString* paramType; - - // Empty string writes a length of 0 and no buffer. - // We don't write a nullptr terminating character in buffers. - static void Write(Message* aMsg, const paramType& aParam) - { - CFStringRef cfString = (CFStringRef)aParam; - - // Write true if we have a string, false represents nullptr. - aMsg->WriteBool(!!cfString); - if (!cfString) { - return; - } - - long length = ::CFStringGetLength(cfString); - WriteParam(aMsg, length); - if (length == 0) { - return; - } - - // Attempt to get characters without any allocation/conversion. - if (::CFStringGetCharactersPtr(cfString)) { - aMsg->WriteBytes(::CFStringGetCharactersPtr(cfString), length * sizeof(UniChar)); - } else { - UniChar *buffer = (UniChar*)moz_xmalloc(length * sizeof(UniChar)); - ::CFStringGetCharacters(cfString, ::CFRangeMake(0, length), buffer); - aMsg->WriteBytes(buffer, length * sizeof(UniChar)); - free(buffer); - } - } - - static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult) - { - bool haveString = false; - if (!aMsg->ReadBool(aIter, &haveString)) { - return false; - } - if (!haveString) { - *aResult = nullptr; - return true; - } - - long length; - if (!ReadParam(aMsg, aIter, &length)) { - return false; - } - - // Avoid integer multiplication overflow. - if (length > INT_MAX / static_cast(sizeof(UniChar))) { - return false; - } - - auto chars = mozilla::MakeUnique(length); - if (length != 0) { - if (!aMsg->ReadBytesInto(aIter, chars.get(), length * sizeof(UniChar))) { - return false; - } - } - - *aResult = (NPNSString*)::CFStringCreateWithBytes(kCFAllocatorDefault, (UInt8*)chars.get(), - length * sizeof(UniChar), - kCFStringEncodingUTF16, false); - if (!*aResult) { - return false; - } - - return true; - } -}; -#endif - -#ifdef XP_MACOSX -template <> -struct ParamTraits -{ - typedef NSCursorInfo paramType; - - static void Write(Message* aMsg, const paramType& aParam) - { - NSCursorInfo::Type type = aParam.GetType(); - - aMsg->WriteInt(type); - - nsPoint hotSpot = aParam.GetHotSpot(); - WriteParam(aMsg, hotSpot.x); - WriteParam(aMsg, hotSpot.y); - - uint32_t dataLength = aParam.GetCustomImageDataLength(); - WriteParam(aMsg, dataLength); - if (dataLength == 0) { - return; - } - - uint8_t* buffer = (uint8_t*)moz_xmalloc(dataLength); - memcpy(buffer, aParam.GetCustomImageData(), dataLength); - aMsg->WriteBytes(buffer, dataLength); - free(buffer); - } - - static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult) - { - NSCursorInfo::Type type; - if (!aMsg->ReadInt(aIter, (int*)&type)) { - return false; - } - - nscoord hotSpotX, hotSpotY; - if (!ReadParam(aMsg, aIter, &hotSpotX) || - !ReadParam(aMsg, aIter, &hotSpotY)) { - return false; - } - - uint32_t dataLength; - if (!ReadParam(aMsg, aIter, &dataLength)) { - return false; - } - - auto data = mozilla::MakeUnique(dataLength); - if (dataLength != 0) { - if (!aMsg->ReadBytesInto(aIter, data.get(), dataLength)) { - return false; - } - } - - aResult->SetType(type); - aResult->SetHotSpot(nsPoint(hotSpotX, hotSpotY)); - aResult->SetCustomImageData(data.get(), dataLength); - - return true; - } - - static void Log(const paramType& aParam, std::wstring* aLog) - { - const char* typeName = aParam.GetTypeName(); - nsPoint hotSpot = aParam.GetHotSpot(); - int hotSpotX, hotSpotY; -#ifdef NS_COORD_IS_FLOAT - hotSpotX = rint(hotSpot.x); - hotSpotY = rint(hotSpot.y); -#else - hotSpotX = hotSpot.x; - hotSpotY = hotSpot.y; -#endif - uint32_t dataLength = aParam.GetCustomImageDataLength(); - uint8_t* data = aParam.GetCustomImageData(); - - aLog->append(StringPrintf(L"[%s, (%i %i), %u, %p]", - typeName, hotSpotX, hotSpotY, dataLength, data)); - } -}; -#else template<> struct ParamTraits { @@ -589,7 +422,6 @@ struct ParamTraits return false; } }; -#endif // #ifdef XP_MACOSX template <> struct ParamTraits @@ -732,9 +564,7 @@ struct ParamTraits // // NB: these guards are based on those where struct NPEvent is defined // in npapi.h. They should be kept in sync. -#if defined(XP_MACOSX) -# include "mozilla/plugins/NPEventOSX.h" -#elif defined(XP_WIN) +#if defined(XP_WIN) # include "mozilla/plugins/NPEventWindows.h" #elif defined(XP_UNIX) # include "mozilla/plugins/NPEventUnix.h" diff --git a/dom/plugins/ipc/PluginModuleChild.cpp b/dom/plugins/ipc/PluginModuleChild.cpp index 4da9afd81b..9094dee0d7 100644 --- a/dom/plugins/ipc/PluginModuleChild.cpp +++ b/dom/plugins/ipc/PluginModuleChild.cpp @@ -132,12 +132,6 @@ PluginModuleChild::PluginModuleChild(bool aIsChrome) MOZ_ASSERT(!gChromeInstance); gChromeInstance = this; } - -#ifdef XP_MACOSX - if (aIsChrome) { - mac_plugin_interposing::child::SetUpCocoaInterposing(); - } -#endif } PluginModuleChild::~PluginModuleChild() @@ -259,15 +253,9 @@ PluginModuleChild::InitForChrome(const std::string& aPluginFilename, if (StringBeginsWith(nsDependentCString(info.fDescription), flash10Head)) { AddQuirk(QUIRK_FLASH_EXPOSE_COORD_TRANSLATION); } -#endif -#if defined(XP_MACOSX) - const char* namePrefix = "Plugin Content"; - char nameBuffer[80]; - SprintfLiteral(nameBuffer, "%s (%s)", namePrefix, info.fName); - mozilla::plugins::PluginUtilsOSX::SetProcessName(nameBuffer); #endif pluginFile.FreePluginInfo(info); -#if defined(MOZ_X11) || defined(XP_MACOSX) +#if defined(MOZ_X11) if (!mLibrary) #endif { diff --git a/dom/plugins/ipc/PluginModuleParent.cpp b/dom/plugins/ipc/PluginModuleParent.cpp index 6ea205ef0f..f7609bcd5e 100644 --- a/dom/plugins/ipc/PluginModuleParent.cpp +++ b/dom/plugins/ipc/PluginModuleParent.cpp @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * vim: sw=4 ts=4 et : * 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/. */ @@ -48,9 +47,6 @@ #ifdef MOZ_WIDGET_GTK #include -#elif XP_MACOSX -#include "PluginInterposeOSX.h" -#include "PluginUtilsOSX.h" #endif using base::KillProcess; @@ -508,7 +504,7 @@ PluginModuleChromeParent::OnProcessLaunched(const bool aSucceeded) if (NS_SUCCEEDED(mAsyncInitRv)) #endif { -#if defined(XP_UNIX) && !defined(XP_MACOSX) +#if defined(XP_UNIX) mAsyncInitRv = NP_Initialize(mNPNIface, mNPPIface, &mAsyncInitError); @@ -517,13 +513,6 @@ PluginModuleChromeParent::OnProcessLaunched(const bool aSucceeded) &mAsyncInitError); #endif } - -#if defined(XP_MACOSX) - if (NS_SUCCEEDED(mAsyncInitRv)) { - mAsyncInitRv = NP_GetEntryPoints(mNPPIface, - &mAsyncInitError); - } -#endif } } @@ -1668,13 +1657,8 @@ PluginModuleParent::GetSettings(PluginSettings* aSettings) aSettings->supportsWindowless() = GetSetting(NPNVSupportsWindowless); aSettings->userAgent() = NullableString(mNPNIface->uagent(nullptr)); -#if defined(XP_MACOSX) - aSettings->nativeCursorsSupported() = - Preferences::GetBool("dom.ipc.plugins.nativeCursorSupport", false); -#else // Need to initialize this to satisfy IPDL. aSettings->nativeCursorsSupported() = false; -#endif } void @@ -1692,7 +1676,7 @@ PluginModuleChromeParent::CachedSettingChanged(const char* aPref, void* aModule) module->CachedSettingChanged(); } -#if defined(XP_UNIX) && !defined(XP_MACOSX) +#if defined(XP_UNIX) nsresult PluginModuleParent::NP_Initialize(NPNetscapeFuncs* bFuncs, NPPluginFuncs* pFuncs, NPError* error) { @@ -1830,7 +1814,7 @@ PluginModuleParent::NP_Initialize(NPNetscapeFuncs* bFuncs, NPError* error) return NS_OK; } -#if defined(XP_WIN) || defined(XP_MACOSX) +#if defined(XP_WIN) nsresult PluginModuleContentParent::NP_Initialize(NPNetscapeFuncs* bFuncs, NPError* error) @@ -1853,20 +1837,10 @@ PluginModuleChromeParent::NP_Initialize(NPNetscapeFuncs* bFuncs, NPError* error) if (NS_FAILED(rv)) return rv; -#if defined(XP_MACOSX) - if (!mSubprocess->IsConnected()) { - // The subprocess isn't connected yet. Defer NP_Initialize until - // OnProcessLaunched is invoked. - mInitOnAsyncConnect = true; - *error = NPERR_NO_ERROR; - return NS_OK; - } -#else if (mInitOnAsyncConnect) { *error = NPERR_NO_ERROR; return NS_OK; } -#endif PluginSettings settings; GetSettings(&settings); @@ -2058,7 +2032,7 @@ PluginModuleParent::NP_GetValue(void *future, NPPVariable aVariable, return NS_OK; } -#if defined(XP_WIN) || defined(XP_MACOSX) +#if defined(XP_WIN) nsresult PluginModuleParent::NP_GetEntryPoints(NPPluginFuncs* pFuncs, NPError* error) { @@ -2067,16 +2041,7 @@ PluginModuleParent::NP_GetEntryPoints(NPPluginFuncs* pFuncs, NPError* error) *error = NPERR_NO_ERROR; if (mIsStartingAsync && !IsChrome()) { mNPPIface = pFuncs; -#if defined(XP_MACOSX) - if (mNPInitialized) { - SetPluginFuncs(pFuncs); - InitAsyncSurrogates(); - } else { - PluginAsyncSurrogate::NP_GetEntryPoints(pFuncs); - } -#else PluginAsyncSurrogate::NP_GetEntryPoints(pFuncs); -#endif } else { SetPluginFuncs(pFuncs); } @@ -2087,14 +2052,6 @@ PluginModuleParent::NP_GetEntryPoints(NPPluginFuncs* pFuncs, NPError* error) nsresult PluginModuleChromeParent::NP_GetEntryPoints(NPPluginFuncs* pFuncs, NPError* error) { -#if defined(XP_MACOSX) - if (mInitOnAsyncConnect) { - PluginAsyncSurrogate::NP_GetEntryPoints(pFuncs); - mNPPIface = pFuncs; - *error = NPERR_NO_ERROR; - return NS_OK; - } -#else if (mIsStartingAsync) { PluginAsyncSurrogate::NP_GetEntryPoints(pFuncs); } @@ -2104,7 +2061,6 @@ PluginModuleChromeParent::NP_GetEntryPoints(NPPluginFuncs* pFuncs, NPError* erro *error = NPERR_NO_ERROR; return NS_OK; } -#endif // We need to have the plugin process update its function table here by // actually calling NP_GetEntryPoints. The parent's function table will @@ -2325,18 +2281,7 @@ PluginModuleParent::NPP_GetSitesWithData(nsCOMPtr c return NS_OK; } -#if defined(XP_MACOSX) -nsresult -PluginModuleParent::IsRemoteDrawingCoreAnimation(NPP instance, bool *aDrawing) -{ - PluginInstanceParent* i = PluginInstanceParent::Cast(instance); - if (!i) - return NS_ERROR_FAILURE; - - return i->IsRemoteDrawingCoreAnimation(aDrawing); -} -#endif -#if defined(XP_MACOSX) || defined(XP_WIN) +#if defined(XP_WIN) nsresult PluginModuleParent::ContentsScaleFactorChanged(NPP instance, double aContentsScaleFactor) { @@ -2346,17 +2291,9 @@ PluginModuleParent::ContentsScaleFactorChanged(NPP instance, double aContentsSca return i->ContentsScaleFactorChanged(aContentsScaleFactor); } -#endif // #if defined(XP_MACOSX) +#endif // #if defined(XP_WIN) -#if defined(XP_MACOSX) -bool -PluginModuleParent::AnswerProcessSomeEvents() -{ - mozilla::plugins::PluginUtilsOSX::InvokeNativeEventLoop(); - return true; -} - -#elif !defined(MOZ_WIDGET_GTK) +#if !defined(MOZ_WIDGET_GTK) bool PluginModuleParent::AnswerProcessSomeEvents() { @@ -2414,85 +2351,54 @@ PluginModuleParent::RecvPluginShowWindow(const uint32_t& aWindowId, const bool& const size_t& aWidth, const size_t& aHeight) { PLUGIN_LOG_DEBUG(("%s", FULLFUNCTION)); -#if defined(XP_MACOSX) - CGRect windowBound = ::CGRectMake(aX, aY, aWidth, aHeight); - mac_plugin_interposing::parent::OnPluginShowWindow(aWindowId, windowBound, aModal); - return true; -#else NS_NOTREACHED( "PluginInstanceParent::RecvPluginShowWindow not implemented!"); return false; -#endif } bool PluginModuleParent::RecvPluginHideWindow(const uint32_t& aWindowId) { PLUGIN_LOG_DEBUG(("%s", FULLFUNCTION)); -#if defined(XP_MACOSX) - mac_plugin_interposing::parent::OnPluginHideWindow(aWindowId, OtherPid()); - return true; -#else NS_NOTREACHED( "PluginInstanceParent::RecvPluginHideWindow not implemented!"); return false; -#endif } bool PluginModuleParent::RecvSetCursor(const NSCursorInfo& aCursorInfo) { PLUGIN_LOG_DEBUG(("%s", FULLFUNCTION)); -#if defined(XP_MACOSX) - mac_plugin_interposing::parent::OnSetCursor(aCursorInfo); - return true; -#else NS_NOTREACHED( "PluginInstanceParent::RecvSetCursor not implemented!"); return false; -#endif } bool PluginModuleParent::RecvShowCursor(const bool& aShow) { PLUGIN_LOG_DEBUG(("%s", FULLFUNCTION)); -#if defined(XP_MACOSX) - mac_plugin_interposing::parent::OnShowCursor(aShow); - return true; -#else NS_NOTREACHED( "PluginInstanceParent::RecvShowCursor not implemented!"); return false; -#endif } bool PluginModuleParent::RecvPushCursor(const NSCursorInfo& aCursorInfo) { PLUGIN_LOG_DEBUG(("%s", FULLFUNCTION)); -#if defined(XP_MACOSX) - mac_plugin_interposing::parent::OnPushCursor(aCursorInfo); - return true; -#else NS_NOTREACHED( "PluginInstanceParent::RecvPushCursor not implemented!"); return false; -#endif } bool PluginModuleParent::RecvPopCursor() { PLUGIN_LOG_DEBUG(("%s", FULLFUNCTION)); -#if defined(XP_MACOSX) - mac_plugin_interposing::parent::OnPopCursor(); - return true; -#else NS_NOTREACHED( "PluginInstanceParent::RecvPopCursor not implemented!"); return false; -#endif } bool diff --git a/dom/plugins/ipc/PluginModuleParent.h b/dom/plugins/ipc/PluginModuleParent.h index 909e8fe351..11c2a47c65 100644 --- a/dom/plugins/ipc/PluginModuleParent.h +++ b/dom/plugins/ipc/PluginModuleParent.h @@ -247,7 +247,7 @@ protected: const mozilla::NativeEventData& aNativeKeyData, bool aIsConsumed) override; -#if defined(XP_UNIX) && !defined(XP_MACOSX) +#if defined(XP_UNIX) virtual nsresult NP_Initialize(NPNetscapeFuncs* bFuncs, NPPluginFuncs* pFuncs, NPError* error) override; #else virtual nsresult NP_Initialize(NPNetscapeFuncs* bFuncs, NPError* error) override; @@ -257,7 +257,7 @@ protected: virtual nsresult NP_GetMIMEDescription(const char** mimeDesc) override; virtual nsresult NP_GetValue(void *future, NPPVariable aVariable, void *aValue, NPError* error) override; -#if defined(XP_WIN) || defined(XP_MACOSX) +#if defined(XP_WIN) virtual nsresult NP_GetEntryPoints(NPPluginFuncs* pFuncs, NPError* error) override; #endif virtual nsresult NPP_New(NPMIMEType pluginType, NPP instance, @@ -278,10 +278,7 @@ private: public: -#if defined(XP_MACOSX) - virtual nsresult IsRemoteDrawingCoreAnimation(NPP instance, bool *aDrawing) override; -#endif -#if defined(XP_MACOSX) || defined(XP_WIN) +#if defined(XP_WIN) virtual nsresult ContentsScaleFactorChanged(NPP instance, double aContentsScaleFactor) override; #endif @@ -355,7 +352,7 @@ class PluginModuleContentParent : public PluginModuleParent virtual ~PluginModuleContentParent(); -#if defined(XP_WIN) || defined(XP_MACOSX) +#if defined(XP_WIN) nsresult NP_Initialize(NPNetscapeFuncs* bFuncs, NPError* error) override; #endif @@ -479,13 +476,13 @@ private: PluginProcessParent* Process() const { return mSubprocess; } base::ProcessHandle ChildProcessHandle() { return mSubprocess->GetChildProcessHandle(); } -#if defined(XP_UNIX) && !defined(XP_MACOSX) +#if defined(XP_UNIX) virtual nsresult NP_Initialize(NPNetscapeFuncs* bFuncs, NPPluginFuncs* pFuncs, NPError* error) override; #else virtual nsresult NP_Initialize(NPNetscapeFuncs* bFuncs, NPError* error) override; #endif -#if defined(XP_WIN) || defined(XP_MACOSX) +#if defined(XP_WIN) virtual nsresult NP_GetEntryPoints(NPPluginFuncs* pFuncs, NPError* error) override; #endif diff --git a/dom/plugins/ipc/PluginProcessChild.cpp b/dom/plugins/ipc/PluginProcessChild.cpp index 32bf062150..9ba0926636 100644 --- a/dom/plugins/ipc/PluginProcessChild.cpp +++ b/dom/plugins/ipc/PluginProcessChild.cpp @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * vim: sw=4 ts=4 et : * 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/. */ @@ -13,13 +12,6 @@ #include "base/string_util.h" #include "nsDebugImpl.h" -#if defined(XP_MACOSX) -#include "nsCocoaFeatures.h" -// An undocumented CoreGraphics framework method, present in the same form -// since at least OS X 10.5. -extern "C" CGError CGSSetDebugOptions(int options); -#endif - #ifdef XP_WIN bool ShouldProtectPluginCurrentDirectory(char16ptr_t pluginFilePath); #endif @@ -40,42 +32,6 @@ PluginProcessChild::Init() { nsDebugImpl::SetMultiprocessMode("NPAPI"); -#if defined(XP_MACOSX) - // Remove the trigger for "dyld interposing" that we added in - // GeckoChildProcessHost::PerformAsyncLaunchInternal(), in the host - // process just before we were launched. Dyld interposing will still - // happen in our process (the plugin child process). But we don't want - // it to happen in any processes that the plugin might launch from our - // process. - nsCString interpose(PR_GetEnv("DYLD_INSERT_LIBRARIES")); - if (!interpose.IsEmpty()) { - // If we added the path to libplugin_child_interpose.dylib to an - // existing DYLD_INSERT_LIBRARIES, we appended it to the end, after a - // ":" path seperator. - int32_t lastSeparatorPos = interpose.RFind(":"); - int32_t lastTriggerPos = interpose.RFind("libplugin_child_interpose.dylib"); - bool needsReset = false; - if (lastTriggerPos != -1) { - if (lastSeparatorPos == -1) { - interpose.Truncate(); - needsReset = true; - } else if (lastTriggerPos > lastSeparatorPos) { - interpose.SetLength(lastSeparatorPos); - needsReset = true; - } - } - if (needsReset) { - nsCString setInterpose("DYLD_INSERT_LIBRARIES="); - if (!interpose.IsEmpty()) { - setInterpose.Append(interpose); - } - // Values passed to PR_SetEnv() must be seperately allocated. - char* setInterposePtr = strdup(setInterpose.get()); - PR_SetEnv(setInterposePtr); - } - } -#endif - // Certain plugins, such as flash, steal the unhandled exception filter // thus we never get crash reports when they fault. This call fixes it. message_loop()->set_exception_restoration(true); @@ -115,17 +71,6 @@ PluginProcessChild::Init() bool retval = mPlugin.InitForChrome(pluginFilename, ParentPid(), IOThreadChild::message_loop(), IOThreadChild::channel()); -#if defined(XP_MACOSX) - if (nsCocoaFeatures::OnYosemiteOrLater()) { - // Explicitly turn off CGEvent logging. This works around bug 1092855. - // If there are already CGEvents in the log, turning off logging also - // causes those events to be written to disk. But at this point no - // CGEvents have yet been processed. CGEvents are events (usually - // input events) pulled from the WindowServer. An option of 0x80000008 - // turns on CGEvent logging. - CGSSetDebugOptions(0x80000007); - } -#endif return retval; } diff --git a/dom/plugins/ipc/PluginProcessParent.cpp b/dom/plugins/ipc/PluginProcessParent.cpp index fb0e182461..b6efcdc64c 100644 --- a/dom/plugins/ipc/PluginProcessParent.cpp +++ b/dom/plugins/ipc/PluginProcessParent.cpp @@ -49,13 +49,6 @@ PluginProcessParent::Launch(mozilla::UniquePtr aLaunchComple uint32_t containerArchitectures = GetSupportedArchitecturesForProcessType(GeckoProcessType_Plugin); uint32_t pluginLibArchitectures = currentArchitecture; -#ifdef XP_MACOSX - nsresult rv = GetArchitecturesForBinary(mPluginFilePath.c_str(), &pluginLibArchitectures); - if (NS_FAILED(rv)) { - // If the call failed just assume that we want the current architecture. - pluginLibArchitectures = currentArchitecture; - } -#endif ProcessArchitecture selectedArchitecture = currentArchitecture; if (!(pluginLibArchitectures & containerArchitectures & currentArchitecture)) { diff --git a/dom/plugins/ipc/PluginQuirks.cpp b/dom/plugins/ipc/PluginQuirks.cpp index c60cf88362..a8b0f62056 100644 --- a/dom/plugins/ipc/PluginQuirks.cpp +++ b/dom/plugins/ipc/PluginQuirks.cpp @@ -49,16 +49,6 @@ int GetQuirksFromMimeTypeAndFilename(const nsCString& aMimeType, } #endif -#ifdef XP_MACOSX - // Whitelist Flash and Quicktime to support offline renderer - NS_NAMED_LITERAL_CSTRING(quicktime, "QuickTime Plugin.plugin"); - if (specialType == nsPluginHost::eSpecialType_Flash) { - quirks |= QUIRK_ALLOW_OFFLINE_RENDERER; - } else if (FindInReadable(quicktime, aPluginFilename)) { - quirks |= QUIRK_ALLOW_OFFLINE_RENDERER; - } -#endif - #ifdef OS_WIN if (specialType == nsPluginHost::eSpecialType_Unity) { quirks |= QUIRK_UNITY_FIXUP_MOUSE_CAPTURE; diff --git a/dom/plugins/ipc/PluginUtilsOSX.h b/dom/plugins/ipc/PluginUtilsOSX.h deleted file mode 100644 index c201782c0f..0000000000 --- a/dom/plugins/ipc/PluginUtilsOSX.h +++ /dev/null @@ -1,92 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -// vim:set ts=2 sts=2 sw=2 et cin: -/* 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 dom_plugins_PluginUtilsOSX_h -#define dom_plugins_PluginUtilsOSX_h 1 - -#include "npapi.h" -#include "mozilla/gfx/QuartzSupport.h" -#include "nsRect.h" - -namespace mozilla { -namespace plugins { -namespace PluginUtilsOSX { - -// Need to call back into the browser's message loop to process event. -typedef void (*RemoteProcessEvents) (void*); - -NPError ShowCocoaContextMenu(void* aMenu, int aX, int aY, void* pluginModule, RemoteProcessEvents remoteEvent); - -void InvokeNativeEventLoop(); - -// Need to call back and send a cocoa draw event to the plugin. -typedef void (*DrawPluginFunc) (CGContextRef, void*, nsIntRect aUpdateRect); - -void* GetCGLayer(DrawPluginFunc aFunc, void* aPluginInstance, double aContentsScaleFactor); -void ReleaseCGLayer(void* cgLayer); -void Repaint(void* cgLayer, nsIntRect aRect); - -bool SetProcessName(const char* aProcessName); - -/* - * Provides a wrapper around nsCARenderer to manage double buffering - * without having to unbind nsCARenderer on every surface swaps. - * - * The double buffer renderer begins with no initialize surfaces. - * The buffers can be initialized and cleared individually. - * Swapping still occurs regardless if the buffers are initialized. - */ -class nsDoubleBufferCARenderer { -public: - nsDoubleBufferCARenderer() : mCALayer(nullptr), mContentsScaleFactor(1.0) {} - // Returns width in "display pixels". A "display pixel" is the smallest - // fully addressable part of a display. But in HiDPI modes each "display - // pixel" corresponds to more than one device pixel. Multiply display pixels - // by mContentsScaleFactor to get device pixels. - size_t GetFrontSurfaceWidth(); - // Returns height in "display pixels". Multiply by - // mContentsScaleFactor to get device pixels. - size_t GetFrontSurfaceHeight(); - double GetFrontSurfaceContentsScaleFactor(); - // Returns width in "display pixels". Multiply by - // mContentsScaleFactor to get device pixels. - size_t GetBackSurfaceWidth(); - // Returns height in "display pixels". Multiply by - // mContentsScaleFactor to get device pixels. - size_t GetBackSurfaceHeight(); - double GetBackSurfaceContentsScaleFactor(); - IOSurfaceID GetFrontSurfaceID(); - - bool HasBackSurface(); - bool HasFrontSurface(); - bool HasCALayer(); - - void SetCALayer(void *aCALayer); - // aWidth and aHeight are in "display pixels". Multiply by - // aContentsScaleFactor to get device pixels. - bool InitFrontSurface(size_t aWidth, size_t aHeight, - double aContentsScaleFactor, - AllowOfflineRendererEnum aAllowOfflineRenderer); - void Render(); - void SwapSurfaces(); - void ClearFrontSurface(); - void ClearBackSurface(); - - double GetContentsScaleFactor() { return mContentsScaleFactor; } - -private: - void *mCALayer; - RefPtr mCARenderer; - RefPtr mFrontSurface; - RefPtr mBackSurface; - double mContentsScaleFactor; -}; - -} // namespace PluginUtilsOSX -} // namespace plugins -} // namespace mozilla - -#endif //dom_plugins_PluginUtilsOSX_h diff --git a/dom/plugins/ipc/PluginUtilsOSX.mm b/dom/plugins/ipc/PluginUtilsOSX.mm deleted file mode 100644 index 2a920f7f61..0000000000 --- a/dom/plugins/ipc/PluginUtilsOSX.mm +++ /dev/null @@ -1,462 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -// vim:set ts=2 sts=2 sw=2 et cin: -/* 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/. */ - -#include -#import -#import -#include "PluginUtilsOSX.h" - -// Remove definitions for try/catch interfering with ObjCException macros. -#include "nsObjCExceptions.h" -#include "nsCocoaUtils.h" - -#include "nsDebug.h" - -#include "mozilla/Sprintf.h" - -@interface CALayer (ContentsScale) -- (double)contentsScale; -- (void)setContentsScale:(double)scale; -@end - -using namespace mozilla::plugins::PluginUtilsOSX; - -@interface CGBridgeLayer : CALayer { - DrawPluginFunc mDrawFunc; - void* mPluginInstance; - nsIntRect mUpdateRect; -} -- (void)setDrawFunc:(DrawPluginFunc)aFunc - pluginInstance:(void*)aPluginInstance; -- (void)updateRect:(nsIntRect)aRect; - -@end - -// CGBitmapContextSetData() is an undocumented function present (with -// the same signature) since at least OS X 10.5. As the name suggests, -// it's used to replace the "data" in a bitmap context that was -// originally specified in a call to CGBitmapContextCreate() or -// CGBitmapContextCreateWithData(). -typedef void (*CGBitmapContextSetDataFunc) (CGContextRef c, - size_t x, - size_t y, - size_t width, - size_t height, - void* data, - size_t bitsPerComponent, - size_t bitsPerPixel, - size_t bytesPerRow); -CGBitmapContextSetDataFunc CGBitmapContextSetDataPtr = NULL; - -@implementation CGBridgeLayer -- (void) updateRect:(nsIntRect)aRect -{ - mUpdateRect.UnionRect(mUpdateRect, aRect); -} - -- (void) setDrawFunc:(DrawPluginFunc)aFunc - pluginInstance:(void*)aPluginInstance -{ - mDrawFunc = aFunc; - mPluginInstance = aPluginInstance; -} - -- (void)drawInContext:(CGContextRef)aCGContext -{ - ::CGContextSaveGState(aCGContext); - ::CGContextTranslateCTM(aCGContext, 0, self.bounds.size.height); - ::CGContextScaleCTM(aCGContext, (CGFloat) 1, (CGFloat) -1); - - mUpdateRect = nsIntRect::Truncate(0, 0, self.bounds.size.width, self.bounds.size.height); - - mDrawFunc(aCGContext, mPluginInstance, mUpdateRect); - - ::CGContextRestoreGState(aCGContext); - - mUpdateRect.SetEmpty(); -} - -@end - -void* mozilla::plugins::PluginUtilsOSX::GetCGLayer(DrawPluginFunc aFunc, - void* aPluginInstance, - double aContentsScaleFactor) { - CGBridgeLayer *bridgeLayer = [[CGBridgeLayer alloc] init]; - - // We need to make bridgeLayer behave properly when its superlayer changes - // size (in nsCARenderer::SetBounds()). - bridgeLayer.autoresizingMask = kCALayerWidthSizable | kCALayerHeightSizable; - bridgeLayer.needsDisplayOnBoundsChange = YES; - NSNull *nullValue = [NSNull null]; - NSDictionary *actions = [NSDictionary dictionaryWithObjectsAndKeys: - nullValue, @"bounds", - nullValue, @"contents", - nullValue, @"contentsRect", - nullValue, @"position", - nil]; - [bridgeLayer setStyle:[NSDictionary dictionaryWithObject:actions forKey:@"actions"]]; - - // For reasons that aren't clear (perhaps one or more OS bugs), we can only - // use full HiDPI resolution here if the tree is built with the 10.7 SDK or - // up. If we build with the 10.6 SDK, changing the contentsScale property - // of bridgeLayer (even to the same value) causes it to stop working (go - // blank). This doesn't happen with objects that are members of the CALayer - // class (as opposed to one of its subclasses). -#if defined(MAC_OS_X_VERSION_10_7) && \ - MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7 - if ([bridgeLayer respondsToSelector:@selector(setContentsScale:)]) { - bridgeLayer.contentsScale = aContentsScaleFactor; - } -#endif - - [bridgeLayer setDrawFunc:aFunc - pluginInstance:aPluginInstance]; - return bridgeLayer; -} - -void mozilla::plugins::PluginUtilsOSX::ReleaseCGLayer(void *cgLayer) { - CGBridgeLayer *bridgeLayer = (CGBridgeLayer*)cgLayer; - [bridgeLayer release]; -} - -void mozilla::plugins::PluginUtilsOSX::Repaint(void *caLayer, nsIntRect aRect) { - CGBridgeLayer *bridgeLayer = (CGBridgeLayer*)caLayer; - [CATransaction begin]; - [bridgeLayer updateRect:aRect]; - [bridgeLayer setNeedsDisplay]; - [bridgeLayer displayIfNeeded]; - [CATransaction commit]; -} - -@interface EventProcessor : NSObject { - RemoteProcessEvents aRemoteEvents; - void *aPluginModule; -} -- (void)setRemoteEvents:(RemoteProcessEvents) remoteEvents pluginModule:(void*) pluginModule; -- (void)onTick; -@end - -@implementation EventProcessor -- (void) onTick -{ - aRemoteEvents(aPluginModule); -} - -- (void)setRemoteEvents:(RemoteProcessEvents) remoteEvents pluginModule:(void*) pluginModule -{ - aRemoteEvents = remoteEvents; - aPluginModule = pluginModule; -} -@end - -#define EVENT_PROCESS_DELAY 0.05 // 50 ms - -NPError mozilla::plugins::PluginUtilsOSX::ShowCocoaContextMenu(void* aMenu, int aX, int aY, void* pluginModule, RemoteProcessEvents remoteEvent) -{ - NS_OBJC_BEGIN_TRY_ABORT_BLOCK; - - // Set the native cursor to the OS default (an arrow) before displaying the - // context menu. Otherwise (if the plugin has changed the cursor) it may - // stay as the plugin has set it -- which means it may be invisible. We - // need to do this because we display the context menu without making the - // plugin process the foreground process. If we did, the cursor would - // change to an arrow cursor automatically -- as it does in Chrome. - [[NSCursor arrowCursor] set]; - - EventProcessor* eventProcessor = nullptr; - NSTimer *eventTimer = nullptr; - if (pluginModule) { - // Create a timer to process browser events while waiting - // on the menu. This prevents the browser from hanging - // during the lifetime of the menu. - eventProcessor = [[EventProcessor alloc] init]; - [eventProcessor setRemoteEvents:remoteEvent pluginModule:pluginModule]; - eventTimer = [NSTimer timerWithTimeInterval:EVENT_PROCESS_DELAY - target:eventProcessor selector:@selector(onTick) - userInfo:nil repeats:TRUE]; - // Use NSEventTrackingRunLoopMode otherwise the timer will - // not fire during the right click menu. - [[NSRunLoop currentRunLoop] addTimer:eventTimer - forMode:NSEventTrackingRunLoopMode]; - } - - NSMenu* nsmenu = reinterpret_cast(aMenu); - NSPoint screen_point = ::NSMakePoint(aX, aY); - - [nsmenu popUpMenuPositioningItem:nil atLocation:screen_point inView:nil]; - - if (pluginModule) { - [eventTimer invalidate]; - [eventProcessor release]; - } - - return NPERR_NO_ERROR; - - NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(NPERR_GENERIC_ERROR); -} - -void mozilla::plugins::PluginUtilsOSX::InvokeNativeEventLoop() -{ - NS_OBJC_BEGIN_TRY_ABORT_BLOCK; - ::CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.0, true); - NS_OBJC_END_TRY_ABORT_BLOCK; -} - - -#define UNDOCUMENTED_SESSION_CONSTANT ((int)-2) -namespace mozilla { -namespace plugins { -namespace PluginUtilsOSX { - static void *sApplicationASN = NULL; - static void *sApplicationInfoItem = NULL; -} // namespace PluginUtilsOSX -} // namespace plugins -} // namespace mozilla - -bool mozilla::plugins::PluginUtilsOSX::SetProcessName(const char* aProcessName) { - NS_OBJC_BEGIN_TRY_ABORT_BLOCK; - nsAutoreleasePool localPool; - - if (!aProcessName || strcmp(aProcessName, "") == 0) { - return false; - } - - NSString *currentName = [[[NSBundle mainBundle] localizedInfoDictionary] - objectForKey:(NSString *)kCFBundleNameKey]; - - char formattedName[1024]; - SprintfLiteral(formattedName, "%s %s", [currentName UTF8String], aProcessName); - - aProcessName = formattedName; - - // This function is based on Chrome/Webkit's and relies on potentially dangerous SPI. - typedef CFTypeRef (*LSGetASNType)(); - typedef OSStatus (*LSSetInformationItemType)(int, CFTypeRef, - CFStringRef, - CFStringRef, - CFDictionaryRef*); - - CFBundleRef launchServices = ::CFBundleGetBundleWithIdentifier( - CFSTR("com.apple.LaunchServices")); - if (!launchServices) { - NS_WARNING("Failed to set process name: Could not open LaunchServices bundle"); - return false; - } - - if (!sApplicationASN) { - sApplicationASN = ::CFBundleGetFunctionPointerForName(launchServices, - CFSTR("_LSGetCurrentApplicationASN")); - } - - LSGetASNType getASNFunc = reinterpret_cast - (sApplicationASN); - - if (!sApplicationInfoItem) { - sApplicationInfoItem = ::CFBundleGetFunctionPointerForName(launchServices, - CFSTR("_LSSetApplicationInformationItem")); - } - - LSSetInformationItemType setInformationItemFunc - = reinterpret_cast - (sApplicationInfoItem); - - void * displayNameKeyAddr = ::CFBundleGetDataPointerForName(launchServices, - CFSTR("_kLSDisplayNameKey")); - - CFStringRef displayNameKey = nil; - if (displayNameKeyAddr) { - displayNameKey = reinterpret_cast(*(CFStringRef*)displayNameKeyAddr); - } - - // Rename will fail without this - ProcessSerialNumber psn; - if (::GetCurrentProcess(&psn) != noErr) { - return false; - } - - CFTypeRef currentAsn = getASNFunc(); - - if (!getASNFunc || !setInformationItemFunc || - !displayNameKey || !currentAsn) { - NS_WARNING("Failed to set process name: Accessing launchServices failed"); - return false; - } - - CFStringRef processName = ::CFStringCreateWithCString(nil, - aProcessName, - kCFStringEncodingASCII); - if (!processName) { - NS_WARNING("Failed to set process name: Could not create CFStringRef"); - return false; - } - - OSErr err = setInformationItemFunc(UNDOCUMENTED_SESSION_CONSTANT, currentAsn, - displayNameKey, processName, - nil); // Optional out param - ::CFRelease(processName); - if (err != noErr) { - NS_WARNING("Failed to set process name: LSSetInformationItemType err"); - return false; - } - - return true; - NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(false); -} - -namespace mozilla { -namespace plugins { -namespace PluginUtilsOSX { - -size_t nsDoubleBufferCARenderer::GetFrontSurfaceWidth() { - if (!HasFrontSurface()) { - return 0; - } - - return mFrontSurface->GetWidth(); -} - -size_t nsDoubleBufferCARenderer::GetFrontSurfaceHeight() { - if (!HasFrontSurface()) { - return 0; - } - - return mFrontSurface->GetHeight(); -} - -double nsDoubleBufferCARenderer::GetFrontSurfaceContentsScaleFactor() { - if (!HasFrontSurface()) { - return 1.0; - } - - return mFrontSurface->GetContentsScaleFactor(); -} - -size_t nsDoubleBufferCARenderer::GetBackSurfaceWidth() { - if (!HasBackSurface()) { - return 0; - } - - return mBackSurface->GetWidth(); -} - -size_t nsDoubleBufferCARenderer::GetBackSurfaceHeight() { - if (!HasBackSurface()) { - return 0; - } - - return mBackSurface->GetHeight(); -} - -double nsDoubleBufferCARenderer::GetBackSurfaceContentsScaleFactor() { - if (!HasBackSurface()) { - return 1.0; - } - - return mBackSurface->GetContentsScaleFactor(); -} - -IOSurfaceID nsDoubleBufferCARenderer::GetFrontSurfaceID() { - if (!HasFrontSurface()) { - return 0; - } - - return mFrontSurface->GetIOSurfaceID(); -} - -bool nsDoubleBufferCARenderer::HasBackSurface() { - return !!mBackSurface; -} - -bool nsDoubleBufferCARenderer::HasFrontSurface() { - return !!mFrontSurface; -} - -bool nsDoubleBufferCARenderer::HasCALayer() { - return !!mCALayer; -} - -void nsDoubleBufferCARenderer::SetCALayer(void *aCALayer) { - mCALayer = aCALayer; -} - -bool nsDoubleBufferCARenderer::InitFrontSurface(size_t aWidth, size_t aHeight, - double aContentsScaleFactor, - AllowOfflineRendererEnum aAllowOfflineRenderer) { - if (!mCALayer) { - return false; - } - - mContentsScaleFactor = aContentsScaleFactor; - mFrontSurface = MacIOSurface::CreateIOSurface(aWidth, aHeight, mContentsScaleFactor); - if (!mFrontSurface) { - mCARenderer = nullptr; - return false; - } - - if (!mCARenderer) { - mCARenderer = new nsCARenderer(); - if (!mCARenderer) { - mFrontSurface = nullptr; - return false; - } - - mCARenderer->AttachIOSurface(mFrontSurface); - - nsresult result = mCARenderer->SetupRenderer(mCALayer, - mFrontSurface->GetWidth(), - mFrontSurface->GetHeight(), - mContentsScaleFactor, - aAllowOfflineRenderer); - - if (result != NS_OK) { - mCARenderer = nullptr; - mFrontSurface = nullptr; - return false; - } - } else { - mCARenderer->AttachIOSurface(mFrontSurface); - } - - return true; -} - -void nsDoubleBufferCARenderer::Render() { - if (!HasFrontSurface() || !mCARenderer) { - return; - } - - mCARenderer->Render(GetFrontSurfaceWidth(), GetFrontSurfaceHeight(), - mContentsScaleFactor, nullptr); -} - -void nsDoubleBufferCARenderer::SwapSurfaces() { - RefPtr prevFrontSurface = mFrontSurface; - mFrontSurface = mBackSurface; - mBackSurface = prevFrontSurface; - - if (mFrontSurface) { - mCARenderer->AttachIOSurface(mFrontSurface); - } -} - -void nsDoubleBufferCARenderer::ClearFrontSurface() { - mFrontSurface = nullptr; - if (!mFrontSurface && !mBackSurface) { - mCARenderer = nullptr; - } -} - -void nsDoubleBufferCARenderer::ClearBackSurface() { - mBackSurface = nullptr; - if (!mFrontSurface && !mBackSurface) { - mCARenderer = nullptr; - } -} - -} // namespace PluginUtilsOSX -} // namespace plugins -} // namespace mozilla - diff --git a/dom/plugins/ipc/interpose/moz.build b/dom/plugins/ipc/interpose/moz.build deleted file mode 100644 index 319c325a70..0000000000 --- a/dom/plugins/ipc/interpose/moz.build +++ /dev/null @@ -1,12 +0,0 @@ -# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- -# 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/. - -SharedLibrary('plugin_child_interpose') - -SOURCES += [ "%s.mm" % (LIBRARY_NAME) ] - -OS_LIBS += ['-framework Carbon'] - -DIST_INSTALL = True diff --git a/dom/plugins/ipc/interpose/plugin_child_interpose.mm b/dom/plugins/ipc/interpose/plugin_child_interpose.mm deleted file mode 100644 index 58c39b0a1c..0000000000 --- a/dom/plugins/ipc/interpose/plugin_child_interpose.mm +++ /dev/null @@ -1,134 +0,0 @@ -/* -*- 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/. */ - -// Use "dyld interposing" to hook methods imported from other libraries in the -// plugin child process. The basic technique is described at -// http://books.google.com/books?id=K8vUkpOXhN4C&pg=PA73&lpg=PA73&dq=__interpose&source=bl&ots=OJnnXZYpZC&sig=o7I3lXvoduUi13SrPfOON7o3do4&hl=en&ei=AoehS9brCYGQNrvsmeUM&sa=X&oi=book_result&ct=result&resnum=6&ved=0CBsQ6AEwBQ#v=onepage&q=__interpose&f=false. -// The idea of doing it for the plugin child process comes from Chromium code, -// particularly from plugin_carbon_interpose_mac.cc -// (http://codesearch.google.com/codesearch/p?hl=en#OAMlx_jo-ck/src/chrome/browser/plugin_carbon_interpose_mac.cc&q=nscursor&exact_package=chromium&d=1&l=168) -// and from PluginProcessHost::Init() in plugin_process_host.cc -// (http://codesearch.google.com/codesearch/p?hl=en#OAMlx_jo-ck/src/content/browser/plugin_process_host.cc&q=nscursor&exact_package=chromium&d=1&l=222). - -// These hooks are needed to make certain OS calls work from the child process -// (a background process) that would normally only work when called in the -// parent process (the foreground process). They allow us to serialize -// information from the child process to the parent process, so that the same -// (or equivalent) calls can be made from the parent process. - -// This file lives in a seperate module (libplugin_child_interpose.dylib), -// which will get loaded by the OS before any other modules when the plugin -// child process is launched (from GeckoChildProcessHost:: -// PerformAsyncLaunchInternal()). For this reason it shouldn't link in other -// browser modules when loaded. Instead it should use dlsym() to load -// pointers to the methods it wants to call in other modules. - -#if !defined(__LP64__) - -#include -#import - -// The header file QuickdrawAPI.h is missing on OS X 10.7 and up (though the -// QuickDraw APIs defined in it are still present) -- so we need to supply the -// relevant parts of its contents here. It's likely that Apple will eventually -// remove the APIs themselves (probably in OS X 10.8), so we need to make them -// weak imports, and test for their presence before using them. -#if !defined(__QUICKDRAWAPI__) - -struct Cursor; -extern "C" void SetCursor(const Cursor * crsr) __attribute__((weak_import)); - -#endif /* __QUICKDRAWAPI__ */ - -BOOL (*OnSetThemeCursorPtr) (ThemeCursor) = NULL; -BOOL (*OnSetCursorPtr) (const Cursor*) = NULL; -BOOL (*OnHideCursorPtr) () = NULL; -BOOL (*OnShowCursorPtr) () = NULL; - -static BOOL loadXULPtrs() -{ - if (!OnSetThemeCursorPtr) { - // mac_plugin_interposing_child_OnSetThemeCursor(ThemeCursor cursor) is in - // PluginInterposeOSX.mm - OnSetThemeCursorPtr = (BOOL(*)(ThemeCursor)) - dlsym(RTLD_DEFAULT, "mac_plugin_interposing_child_OnSetThemeCursor"); - } - if (!OnSetCursorPtr) { - // mac_plugin_interposing_child_OnSetCursor(const Cursor* cursor) is in - // PluginInterposeOSX.mm - OnSetCursorPtr = (BOOL(*)(const Cursor*)) - dlsym(RTLD_DEFAULT, "mac_plugin_interposing_child_OnSetCursor"); - } - if (!OnHideCursorPtr) { - // mac_plugin_interposing_child_OnHideCursor() is in PluginInterposeOSX.mm - OnHideCursorPtr = (BOOL(*)()) - dlsym(RTLD_DEFAULT, "mac_plugin_interposing_child_OnHideCursor"); - } - if (!OnShowCursorPtr) { - // mac_plugin_interposing_child_OnShowCursor() is in PluginInterposeOSX.mm - OnShowCursorPtr = (BOOL(*)()) - dlsym(RTLD_DEFAULT, "mac_plugin_interposing_child_OnShowCursor"); - } - return (OnSetCursorPtr && OnSetThemeCursorPtr && OnHideCursorPtr && OnShowCursorPtr); -} - -static OSStatus MacPluginChildSetThemeCursor(ThemeCursor cursor) -{ - if (loadXULPtrs()) { - OnSetThemeCursorPtr(cursor); - } - return ::SetThemeCursor(cursor); -} - -static void MacPluginChildSetCursor(const Cursor* cursor) -{ - if (::SetCursor) { - if (loadXULPtrs()) { - OnSetCursorPtr(cursor); - } - ::SetCursor(cursor); - } -} - -static CGError MacPluginChildCGDisplayHideCursor(CGDirectDisplayID display) -{ - if (loadXULPtrs()) { - OnHideCursorPtr(); - } - return ::CGDisplayHideCursor(display); -} - -static CGError MacPluginChildCGDisplayShowCursor(CGDirectDisplayID display) -{ - if (loadXULPtrs()) { - OnShowCursorPtr(); - } - return ::CGDisplayShowCursor(display); -} - -#pragma mark - - -struct interpose_substitution { - const void* replacement; - const void* original; -}; - -#define INTERPOSE_FUNCTION(function) \ - { reinterpret_cast(MacPluginChild##function), \ - reinterpret_cast(function) } - -__attribute__((used)) static const interpose_substitution substitutions[] - __attribute__((section("__DATA, __interpose"))) = { - INTERPOSE_FUNCTION(SetThemeCursor), - INTERPOSE_FUNCTION(CGDisplayHideCursor), - INTERPOSE_FUNCTION(CGDisplayShowCursor), - // SetCursor() and other QuickDraw APIs will probably be removed in OS X - // 10.8. But this will make 'SetCursor' NULL, which will just stop the OS - // from interposing it (tested using an INTERPOSE_FUNCTION_BROKEN macro - // that just sets the second address of each tuple to NULL). - INTERPOSE_FUNCTION(SetCursor), -}; - -#endif // !__LP64__ diff --git a/dom/plugins/ipc/moz.build b/dom/plugins/ipc/moz.build index 9190d19272..00f9a47128 100644 --- a/dom/plugins/ipc/moz.build +++ b/dom/plugins/ipc/moz.build @@ -3,9 +3,6 @@ # 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/. -if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': - DIRS += ['interpose'] - EXPORTS.mozilla += [ 'PluginLibrary.h', ] @@ -16,7 +13,6 @@ EXPORTS.mozilla.plugins += [ 'BrowserStreamParent.h', 'ChildAsyncCall.h', 'ChildTimer.h', - 'NPEventOSX.h', 'NPEventUnix.h', 'NPEventWindows.h', 'PluginAsyncSurrogate.h', @@ -36,7 +32,6 @@ EXPORTS.mozilla.plugins += [ 'PluginScriptableObjectUtils.h', 'PluginStreamChild.h', 'PluginStreamParent.h', - 'PluginUtilsOSX.h', 'PluginWidgetChild.h', 'PluginWidgetParent.h', 'StreamNotifyChild.h', @@ -58,11 +53,6 @@ if CONFIG['OS_ARCH'] == 'WINNT': 'hangui', ] -if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': - EXPORTS.mozilla.plugins += [ - 'PluginInterposeOSX.h', - ] - SOURCES += [ 'BrowserStreamChild.cpp', 'BrowserStreamParent.cpp', @@ -86,12 +76,6 @@ SOURCES += [ 'PluginWidgetParent.cpp', ] -if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': - SOURCES += [ - 'PluginInterposeOSX.mm', - 'PluginUtilsOSX.mm', - ] - if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows': SOURCES += [ 'D3D11SurfaceHolder.cpp', diff --git a/dom/system/OSFileConstants.cpp b/dom/system/OSFileConstants.cpp index 7fde5824cb..c18d9aa6de 100644 --- a/dom/system/OSFileConstants.cpp +++ b/dom/system/OSFileConstants.cpp @@ -29,10 +29,6 @@ #include #endif // defined(XP_LINUX) -#if defined(XP_MACOSX) -#include "copyfile.h" -#endif // defined(XP_MACOSX) - #if defined(XP_WIN) #include #include @@ -131,22 +127,6 @@ struct Paths { nsString winStartMenuProgsDir; #endif // defined(XP_WIN) -#if defined(XP_MACOSX) - /** - * The user's Library directory. - */ - nsString macUserLibDir; - /** - * The Application directory, that stores applications installed in the - * system. - */ - nsString macLocalApplicationsDir; - /** - * The user's trash directory. - */ - nsString macTrashDir; -#endif // defined(XP_MACOSX) - Paths() { libDir.SetIsVoid(true); @@ -161,12 +141,6 @@ struct Paths { winAppDataDir.SetIsVoid(true); winStartMenuProgsDir.SetIsVoid(true); #endif // defined(XP_WIN) - -#if defined(XP_MACOSX) - macUserLibDir.SetIsVoid(true); - macLocalApplicationsDir.SetIsVoid(true); - macTrashDir.SetIsVoid(true); -#endif // defined(XP_MACOSX) } }; @@ -311,12 +285,6 @@ nsresult InitOSFileConstants() GetPathToSpecialDir(NS_WIN_PROGRAMS_DIR, paths->winStartMenuProgsDir); #endif // defined(XP_WIN) -#if defined(XP_MACOSX) - GetPathToSpecialDir(NS_MAC_USER_LIB_DIR, paths->macUserLibDir); - GetPathToSpecialDir(NS_OSX_LOCAL_APPLICATIONS_DIR, paths->macLocalApplicationsDir); - GetPathToSpecialDir(NS_MAC_TRASH_DIR, paths->macTrashDir); -#endif // defined(XP_MACOSX) - gPaths = paths.forget(); // Get the umask from the system-info service. @@ -972,20 +940,12 @@ bool DefineOSFileConstants(JSContext *cx, JS::Handle global) // Note that we don't actually provide the full path, only the name of the // library, which is sufficient to link to the library using js-ctypes. -#if defined(XP_MACOSX) - // Under MacOS X, for some reason, libxul is called simply "XUL", - // and we need to provide the full path. - nsAutoString libxul; - libxul.Append(gPaths->libDir); - libxul.AppendLiteral("/XUL"); -#else - // On other platforms, libxul is a library "xul" with regular + // On all supported platforms, libxul is a library "xul" with regular // library prefix/suffix. nsAutoString libxul; libxul.AppendLiteral(DLL_PREFIX); libxul.AppendLiteral("xul"); libxul.AppendLiteral(DLL_SUFFIX); -#endif // defined(XP_MACOSX) if (!SetStringProperty(cx, objPath, "libxul", libxul)) { return false; @@ -1033,20 +993,6 @@ bool DefineOSFileConstants(JSContext *cx, JS::Handle global) } #endif // defined(XP_WIN) -#if defined(XP_MACOSX) - if (!SetStringProperty(cx, objPath, "macUserLibDir", gPaths->macUserLibDir)) { - return false; - } - - if (!SetStringProperty(cx, objPath, "macLocalApplicationsDir", gPaths->macLocalApplicationsDir)) { - return false; - } - - if (!SetStringProperty(cx, objPath, "macTrashDir", gPaths->macTrashDir)) { - return false; - } -#endif // defined(XP_MACOSX) - // sqlite3 is always a shared lib nsAutoString libsqlite3; libsqlite3.AppendLiteral(DLL_PREFIX); diff --git a/dom/xbl/nsXBLPrototypeHandler.cpp b/dom/xbl/nsXBLPrototypeHandler.cpp index 963e6835c6..4872a850d7 100644 --- a/dom/xbl/nsXBLPrototypeHandler.cpp +++ b/dom/xbl/nsXBLPrototypeHandler.cpp @@ -167,13 +167,8 @@ nsXBLPrototypeHandler::InitAccessKeys() return; } - // Compiled-in defaults, in case we can't get the pref -- - // mac doesn't have menu shortcuts, other platforms use alt. -#ifdef XP_MACOSX - kMenuAccessKey = 0; -#else + // Compiled-in defaults, in case we can't get the pref kMenuAccessKey = nsIDOMKeyEvent::DOM_VK_ALT; -#endif // Get the menu access key value from prefs, overriding the default: kMenuAccessKey = diff --git a/dom/xul/nsXULElement.cpp b/dom/xul/nsXULElement.cpp index 2ae03e0b17..93d422d1e9 100644 --- a/dom/xul/nsXULElement.cpp +++ b/dom/xul/nsXULElement.cpp @@ -523,18 +523,6 @@ nsXULElement::IsFocusableInternal(int32_t *aTabIndex, bool aWithMouse) // elements are not focusable by default bool shouldFocus = false; -#ifdef XP_MACOSX - // on Mac, mouse interactions only focus the element if it's a list, - // or if it's a remote target, since the remote target must handle - // the focus. - if (aWithMouse && - IsNonList(mNodeInfo) && - !EventStateManager::IsRemoteTarget(this)) - { - return false; - } -#endif - nsCOMPtr xulControl = do_QueryObject(this); if (xulControl) { // a disabled element cannot be focused and is not part of the tab order diff --git a/gfx/2d/2D.h b/gfx/2d/2D.h index e2020dc9e6..89de5630c6 100644 --- a/gfx/2d/2D.h +++ b/gfx/2d/2D.h @@ -1481,11 +1481,6 @@ public: static already_AddRefed CreateDrawTargetWithSkCanvas(SkCanvas* aCanvas); #endif -#ifdef XP_DARWIN - static already_AddRefed - CreateCGGlyphRenderingOptions(const Color &aFontSmoothingBackgroundColor); -#endif - #ifdef WIN32 static already_AddRefed CreateDrawTargetForD3D11Texture(ID3D11Texture2D *aTexture, SurfaceFormat aFormat); diff --git a/gfx/2d/Factory.cpp b/gfx/2d/Factory.cpp index 5cd5d14eab..5bec8e9ad8 100644 --- a/gfx/2d/Factory.cpp +++ b/gfx/2d/Factory.cpp @@ -25,11 +25,6 @@ #include "NativeFontResourceGDI.h" #endif -#ifdef XP_DARWIN -#include "ScaledFontMac.h" -#include "NativeFontResourceMac.h" -#endif - #ifdef MOZ_WIDGET_GTK #include "ScaledFontFontconfig.h" #endif @@ -265,15 +260,6 @@ Factory::CheckSurfaceSize(const IntSize &sz, return false; } -#if defined(XP_MACOSX) - // CoreGraphics is limited to images < 32K in *height*, - // so clamp all surfaces on the Mac to that height - if (sz.height > SHRT_MAX) { - gfxDebug() << "Surface size too large (exceeds CoreGraphics limit)!"; - return false; - } -#endif - // assuming 4 bytes per pixel, make sure the allocation size // doesn't overflow a int32_t either CheckedInt stride = GetAlignedStride<16>(sz.width, 4); @@ -481,12 +467,6 @@ Factory::CreateScaledFontForNativeFont(const NativeFont &aNativeFont, Float aSiz } #endif #endif -#ifdef XP_DARWIN - case NativeFontType::MAC_FONT_FACE: - { - return MakeAndAddRef(static_cast(aNativeFont.mFont), aSize); - } -#endif #if defined(USE_CAIRO) || defined(USE_SKIA_FREETYPE) case NativeFontType::CAIRO_FONT_FACE: { @@ -524,8 +504,6 @@ Factory::CreateNativeFontResource(uint8_t *aData, uint32_t aSize, return NativeFontResourceGDI::Create(aData, aSize, /* aNeedsCairo = */ true); } -#elif XP_DARWIN - return NativeFontResourceMac::Create(aData, aSize); #else gfxWarning() << "Unable to create cairo scaled font from truetype data"; return nullptr; @@ -802,14 +780,6 @@ Factory::CreateWrappingDataSourceSurface(uint8_t *aData, return newSurf.forget(); } -#ifdef XP_DARWIN -already_AddRefed -Factory::CreateCGGlyphRenderingOptions(const Color &aFontSmoothingBackgroundColor) -{ - return MakeAndAddRef(aFontSmoothingBackgroundColor); -} -#endif - already_AddRefed Factory::CreateDataSourceSurface(const IntSize &aSize, SurfaceFormat aFormat, diff --git a/gfx/2d/JobScheduler_posix.cpp b/gfx/2d/JobScheduler_posix.cpp index e41388f21c..5446df6118 100644 --- a/gfx/2d/JobScheduler_posix.cpp +++ b/gfx/2d/JobScheduler_posix.cpp @@ -31,9 +31,7 @@ public: // XXX - temporarily disabled, see bug 1209039 // // // Call this from the thread itself because of Mac. -//#ifdef XP_MACOSX -// pthread_setname_np(aName); -//#elif defined(__DragonFly__) || defined(__FreeBSD__) || defined(__OpenBSD__) +//#if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__OpenBSD__) // pthread_set_name_np(mThread, aName); //#elif defined(__NetBSD__) // pthread_setname_np(mThread, "%s", (void*)aName); diff --git a/gfx/2d/MacIOSurface.cpp b/gfx/2d/MacIOSurface.cpp deleted file mode 100644 index 759de8575b..0000000000 --- a/gfx/2d/MacIOSurface.cpp +++ /dev/null @@ -1,615 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -// vim:set ts=2 sts=2 sw=2 et cin: -/* 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/. */ - -#include "MacIOSurface.h" -#include -#include -#include -#include "mozilla/RefPtr.h" -#include "mozilla/Assertions.h" -#include "GLConsts.h" - -using namespace mozilla; -// IOSurface signatures -#define IOSURFACE_FRAMEWORK_PATH \ - "/System/Library/Frameworks/IOSurface.framework/IOSurface" -#define OPENGL_FRAMEWORK_PATH \ - "/System/Library/Frameworks/OpenGL.framework/OpenGL" -#define COREGRAPHICS_FRAMEWORK_PATH \ - "/System/Library/Frameworks/ApplicationServices.framework/Frameworks/" \ - "CoreGraphics.framework/CoreGraphics" -#define COREVIDEO_FRAMEWORK_PATH \ - "/System/Library/Frameworks/ApplicationServices.framework/Frameworks/" \ - "CoreVideo.framework/CoreVideo" - -#define GET_CONST(const_name) \ - ((CFStringRef*) dlsym(sIOSurfaceFramework, const_name)) -#define GET_IOSYM(dest,sym_name) \ - (typeof(dest)) dlsym(sIOSurfaceFramework, sym_name) -#define GET_CGLSYM(dest,sym_name) \ - (typeof(dest)) dlsym(sOpenGLFramework, sym_name) -#define GET_CGSYM(dest,sym_name) \ - (typeof(dest)) dlsym(sCoreGraphicsFramework, sym_name) -#define GET_CVSYM(dest, sym_name) \ - (typeof(dest)) dlsym(sCoreVideoFramework, sym_name) - -MacIOSurfaceLib::LibraryUnloader MacIOSurfaceLib::sLibraryUnloader; -bool MacIOSurfaceLib::isLoaded = false; -void* MacIOSurfaceLib::sIOSurfaceFramework; -void* MacIOSurfaceLib::sOpenGLFramework; -void* MacIOSurfaceLib::sCoreGraphicsFramework; -void* MacIOSurfaceLib::sCoreVideoFramework; -IOSurfaceCreateFunc MacIOSurfaceLib::sCreate; -IOSurfaceGetIDFunc MacIOSurfaceLib::sGetID; -IOSurfaceLookupFunc MacIOSurfaceLib::sLookup; -IOSurfaceGetBaseAddressFunc MacIOSurfaceLib::sGetBaseAddress; -IOSurfaceGetBaseAddressOfPlaneFunc MacIOSurfaceLib::sGetBaseAddressOfPlane; -IOSurfaceSizePlaneTFunc MacIOSurfaceLib::sWidth; -IOSurfaceSizePlaneTFunc MacIOSurfaceLib::sHeight; -IOSurfaceSizeTFunc MacIOSurfaceLib::sPlaneCount; -IOSurfaceSizePlaneTFunc MacIOSurfaceLib::sBytesPerRow; -IOSurfaceGetPropertyMaximumFunc MacIOSurfaceLib::sGetPropertyMaximum; -IOSurfaceVoidFunc MacIOSurfaceLib::sIncrementUseCount; -IOSurfaceVoidFunc MacIOSurfaceLib::sDecrementUseCount; -IOSurfaceLockFunc MacIOSurfaceLib::sLock; -IOSurfaceUnlockFunc MacIOSurfaceLib::sUnlock; -CGLTexImageIOSurface2DFunc MacIOSurfaceLib::sTexImage; -IOSurfaceContextCreateFunc MacIOSurfaceLib::sIOSurfaceContextCreate; -IOSurfaceContextCreateImageFunc MacIOSurfaceLib::sIOSurfaceContextCreateImage; -IOSurfaceContextGetSurfaceFunc MacIOSurfaceLib::sIOSurfaceContextGetSurface; -CVPixelBufferGetIOSurfaceFunc MacIOSurfaceLib::sCVPixelBufferGetIOSurface; -unsigned int (*MacIOSurfaceLib::sCGContextGetTypePtr) (CGContextRef) = nullptr; -IOSurfacePixelFormatFunc MacIOSurfaceLib::sPixelFormat; - -CFStringRef MacIOSurfaceLib::kPropWidth; -CFStringRef MacIOSurfaceLib::kPropHeight; -CFStringRef MacIOSurfaceLib::kPropBytesPerElem; -CFStringRef MacIOSurfaceLib::kPropBytesPerRow; -CFStringRef MacIOSurfaceLib::kPropIsGlobal; - -bool MacIOSurfaceLib::isInit() { - // Guard against trying to reload the library - // if it is not available. - if (!isLoaded) - LoadLibrary(); - MOZ_ASSERT(sIOSurfaceFramework); - return sIOSurfaceFramework; -} - -IOSurfacePtr MacIOSurfaceLib::IOSurfaceCreate(CFDictionaryRef properties) { - return sCreate(properties); -} - -IOSurfacePtr MacIOSurfaceLib::IOSurfaceLookup(IOSurfaceID aIOSurfaceID) { - return sLookup(aIOSurfaceID); -} - -IOSurfaceID MacIOSurfaceLib::IOSurfaceGetID(IOSurfacePtr aIOSurfacePtr) { - return sGetID(aIOSurfacePtr); -} - -void* MacIOSurfaceLib::IOSurfaceGetBaseAddress(IOSurfacePtr aIOSurfacePtr) { - return sGetBaseAddress(aIOSurfacePtr); -} - -void* MacIOSurfaceLib::IOSurfaceGetBaseAddressOfPlane(IOSurfacePtr aIOSurfacePtr, - size_t planeIndex) { - return sGetBaseAddressOfPlane(aIOSurfacePtr, planeIndex); -} - -size_t MacIOSurfaceLib::IOSurfaceGetPlaneCount(IOSurfacePtr aIOSurfacePtr) { - return sPlaneCount(aIOSurfacePtr); -} - -size_t MacIOSurfaceLib::IOSurfaceGetWidth(IOSurfacePtr aIOSurfacePtr, size_t plane) { - return sWidth(aIOSurfacePtr, plane); -} - -size_t MacIOSurfaceLib::IOSurfaceGetHeight(IOSurfacePtr aIOSurfacePtr, size_t plane) { - return sHeight(aIOSurfacePtr, plane); -} - -size_t MacIOSurfaceLib::IOSurfaceGetBytesPerRow(IOSurfacePtr aIOSurfacePtr, size_t plane) { - return sBytesPerRow(aIOSurfacePtr, plane); -} - -size_t MacIOSurfaceLib::IOSurfaceGetPropertyMaximum(CFStringRef property) { - return sGetPropertyMaximum(property); -} - -OSType MacIOSurfaceLib::IOSurfaceGetPixelFormat(IOSurfacePtr aIOSurfacePtr) { - return sPixelFormat(aIOSurfacePtr); -} - -IOReturn MacIOSurfaceLib::IOSurfaceLock(IOSurfacePtr aIOSurfacePtr, - uint32_t options, uint32_t* seed) { - return sLock(aIOSurfacePtr, options, seed); -} - -IOReturn MacIOSurfaceLib::IOSurfaceUnlock(IOSurfacePtr aIOSurfacePtr, - uint32_t options, uint32_t *seed) { - return sUnlock(aIOSurfacePtr, options, seed); -} - -void MacIOSurfaceLib::IOSurfaceIncrementUseCount(IOSurfacePtr aIOSurfacePtr) { - sIncrementUseCount(aIOSurfacePtr); -} - -void MacIOSurfaceLib::IOSurfaceDecrementUseCount(IOSurfacePtr aIOSurfacePtr) { - sDecrementUseCount(aIOSurfacePtr); -} - -CGLError MacIOSurfaceLib::CGLTexImageIOSurface2D(CGLContextObj ctxt, - GLenum target, GLenum internalFormat, - GLsizei width, GLsizei height, - GLenum format, GLenum type, - IOSurfacePtr ioSurface, GLuint plane) { - return sTexImage(ctxt, target, internalFormat, width, height, - format, type, ioSurface, plane); -} - -IOSurfacePtr MacIOSurfaceLib::CVPixelBufferGetIOSurface(CVPixelBufferRef aPixelBuffer) { - return sCVPixelBufferGetIOSurface(aPixelBuffer); -} - -CGContextRef MacIOSurfaceLib::IOSurfaceContextCreate(IOSurfacePtr aIOSurfacePtr, - unsigned aWidth, unsigned aHeight, - unsigned aBitsPerComponent, unsigned aBytes, - CGColorSpaceRef aColorSpace, CGBitmapInfo bitmapInfo) { - if (!sIOSurfaceContextCreate) - return nullptr; - return sIOSurfaceContextCreate(aIOSurfacePtr, aWidth, aHeight, aBitsPerComponent, aBytes, aColorSpace, bitmapInfo); -} - -CGImageRef MacIOSurfaceLib::IOSurfaceContextCreateImage(CGContextRef aContext) { - if (!sIOSurfaceContextCreateImage) - return nullptr; - return sIOSurfaceContextCreateImage(aContext); -} - -IOSurfacePtr MacIOSurfaceLib::IOSurfaceContextGetSurface(CGContextRef aContext) { - if (!sIOSurfaceContextGetSurface) - return nullptr; - return sIOSurfaceContextGetSurface(aContext); -} - -CFStringRef MacIOSurfaceLib::GetIOConst(const char* symbole) { - CFStringRef *address = (CFStringRef*)dlsym(sIOSurfaceFramework, symbole); - if (!address) - return nullptr; - - return *address; -} - -void MacIOSurfaceLib::LoadLibrary() { - if (isLoaded) { - return; - } - isLoaded = true; - sIOSurfaceFramework = dlopen(IOSURFACE_FRAMEWORK_PATH, - RTLD_LAZY | RTLD_LOCAL); - sOpenGLFramework = dlopen(OPENGL_FRAMEWORK_PATH, - RTLD_LAZY | RTLD_LOCAL); - - sCoreGraphicsFramework = dlopen(COREGRAPHICS_FRAMEWORK_PATH, - RTLD_LAZY | RTLD_LOCAL); - - sCoreVideoFramework = dlopen(COREVIDEO_FRAMEWORK_PATH, - RTLD_LAZY | RTLD_LOCAL); - - if (!sIOSurfaceFramework || !sOpenGLFramework || !sCoreGraphicsFramework || - !sCoreVideoFramework) { - if (sIOSurfaceFramework) - dlclose(sIOSurfaceFramework); - if (sOpenGLFramework) - dlclose(sOpenGLFramework); - if (sCoreGraphicsFramework) - dlclose(sCoreGraphicsFramework); - if (sCoreVideoFramework) - dlclose(sCoreVideoFramework); - sIOSurfaceFramework = nullptr; - sOpenGLFramework = nullptr; - sCoreGraphicsFramework = nullptr; - sCoreVideoFramework = nullptr; - return; - } - - kPropWidth = GetIOConst("kIOSurfaceWidth"); - kPropHeight = GetIOConst("kIOSurfaceHeight"); - kPropBytesPerElem = GetIOConst("kIOSurfaceBytesPerElement"); - kPropBytesPerRow = GetIOConst("kIOSurfaceBytesPerRow"); - kPropIsGlobal = GetIOConst("kIOSurfaceIsGlobal"); - sCreate = GET_IOSYM(sCreate, "IOSurfaceCreate"); - sGetID = GET_IOSYM(sGetID, "IOSurfaceGetID"); - sWidth = GET_IOSYM(sWidth, "IOSurfaceGetWidthOfPlane"); - sHeight = GET_IOSYM(sHeight, "IOSurfaceGetHeightOfPlane"); - sBytesPerRow = GET_IOSYM(sBytesPerRow, "IOSurfaceGetBytesPerRowOfPlane"); - sGetPropertyMaximum = GET_IOSYM(sGetPropertyMaximum, "IOSurfaceGetPropertyMaximum"); - sLookup = GET_IOSYM(sLookup, "IOSurfaceLookup"); - sLock = GET_IOSYM(sLock, "IOSurfaceLock"); - sUnlock = GET_IOSYM(sUnlock, "IOSurfaceUnlock"); - sIncrementUseCount = - GET_IOSYM(sIncrementUseCount, "IOSurfaceIncrementUseCount"); - sDecrementUseCount = - GET_IOSYM(sDecrementUseCount, "IOSurfaceDecrementUseCount"); - sGetBaseAddress = GET_IOSYM(sGetBaseAddress, "IOSurfaceGetBaseAddress"); - sGetBaseAddressOfPlane = - GET_IOSYM(sGetBaseAddressOfPlane, "IOSurfaceGetBaseAddressOfPlane"); - sPlaneCount = GET_IOSYM(sPlaneCount, "IOSurfaceGetPlaneCount"); - sPixelFormat = GET_IOSYM(sPixelFormat, "IOSurfaceGetPixelFormat"); - - sTexImage = GET_CGLSYM(sTexImage, "CGLTexImageIOSurface2D"); - sCGContextGetTypePtr = (unsigned int (*)(CGContext*))dlsym(RTLD_DEFAULT, "CGContextGetType"); - - sCVPixelBufferGetIOSurface = - GET_CVSYM(sCVPixelBufferGetIOSurface, "CVPixelBufferGetIOSurface"); - - // Optional symbols - sIOSurfaceContextCreate = GET_CGSYM(sIOSurfaceContextCreate, "CGIOSurfaceContextCreate"); - sIOSurfaceContextCreateImage = GET_CGSYM(sIOSurfaceContextCreateImage, "CGIOSurfaceContextCreateImage"); - sIOSurfaceContextGetSurface = GET_CGSYM(sIOSurfaceContextGetSurface, "CGIOSurfaceContextGetSurface"); - - if (!sCreate || !sGetID || !sLookup || !sTexImage || !sGetBaseAddress || - !sGetBaseAddressOfPlane || !sPlaneCount || - !kPropWidth || !kPropHeight || !kPropBytesPerElem || !kPropIsGlobal || - !sLock || !sUnlock || !sIncrementUseCount || !sDecrementUseCount || - !sWidth || !sHeight || !kPropBytesPerRow || - !sBytesPerRow || !sGetPropertyMaximum || !sCVPixelBufferGetIOSurface) { - CloseLibrary(); - } -} - -void MacIOSurfaceLib::CloseLibrary() { - if (sIOSurfaceFramework) { - dlclose(sIOSurfaceFramework); - } - if (sOpenGLFramework) { - dlclose(sOpenGLFramework); - } - if (sCoreVideoFramework) { - dlclose(sCoreVideoFramework); - } - sIOSurfaceFramework = nullptr; - sOpenGLFramework = nullptr; - sCoreVideoFramework = nullptr; -} - -MacIOSurface::MacIOSurface(const void* aIOSurfacePtr, - double aContentsScaleFactor, bool aHasAlpha) - : mIOSurfacePtr(aIOSurfacePtr) - , mContentsScaleFactor(aContentsScaleFactor) - , mHasAlpha(aHasAlpha) -{ - CFRetain(mIOSurfacePtr); - IncrementUseCount(); -} - -MacIOSurface::~MacIOSurface() { - DecrementUseCount(); - CFRelease(mIOSurfacePtr); -} - -already_AddRefed MacIOSurface::CreateIOSurface(int aWidth, int aHeight, - double aContentsScaleFactor, - bool aHasAlpha) { - if (!MacIOSurfaceLib::isInit() || aContentsScaleFactor <= 0) - return nullptr; - - CFMutableDictionaryRef props = ::CFDictionaryCreateMutable( - kCFAllocatorDefault, 4, - &kCFTypeDictionaryKeyCallBacks, - &kCFTypeDictionaryValueCallBacks); - if (!props) - return nullptr; - - MOZ_ASSERT((size_t)aWidth <= GetMaxWidth()); - MOZ_ASSERT((size_t)aHeight <= GetMaxHeight()); - - int32_t bytesPerElem = 4; - size_t intScaleFactor = ceil(aContentsScaleFactor); - aWidth *= intScaleFactor; - aHeight *= intScaleFactor; - CFNumberRef cfWidth = ::CFNumberCreate(nullptr, kCFNumberSInt32Type, &aWidth); - CFNumberRef cfHeight = ::CFNumberCreate(nullptr, kCFNumberSInt32Type, &aHeight); - CFNumberRef cfBytesPerElem = ::CFNumberCreate(nullptr, kCFNumberSInt32Type, &bytesPerElem); - ::CFDictionaryAddValue(props, MacIOSurfaceLib::kPropWidth, - cfWidth); - ::CFRelease(cfWidth); - ::CFDictionaryAddValue(props, MacIOSurfaceLib::kPropHeight, - cfHeight); - ::CFRelease(cfHeight); - ::CFDictionaryAddValue(props, MacIOSurfaceLib::kPropBytesPerElem, - cfBytesPerElem); - ::CFRelease(cfBytesPerElem); - ::CFDictionaryAddValue(props, MacIOSurfaceLib::kPropIsGlobal, - kCFBooleanTrue); - - IOSurfacePtr surfaceRef = MacIOSurfaceLib::IOSurfaceCreate(props); - ::CFRelease(props); - - if (!surfaceRef) - return nullptr; - - RefPtr ioSurface = new MacIOSurface(surfaceRef, aContentsScaleFactor, aHasAlpha); - if (!ioSurface) { - ::CFRelease(surfaceRef); - return nullptr; - } - - // Release the IOSurface because MacIOSurface retained it - CFRelease(surfaceRef); - - return ioSurface.forget(); -} - -already_AddRefed MacIOSurface::LookupSurface(IOSurfaceID aIOSurfaceID, - double aContentsScaleFactor, - bool aHasAlpha) { - if (!MacIOSurfaceLib::isInit() || aContentsScaleFactor <= 0) - return nullptr; - - IOSurfacePtr surfaceRef = MacIOSurfaceLib::IOSurfaceLookup(aIOSurfaceID); - if (!surfaceRef) - return nullptr; - - RefPtr ioSurface = new MacIOSurface(surfaceRef, aContentsScaleFactor, aHasAlpha); - if (!ioSurface) { - ::CFRelease(surfaceRef); - return nullptr; - } - - // Release the IOSurface because MacIOSurface retained it - CFRelease(surfaceRef); - - return ioSurface.forget(); -} - -IOSurfaceID MacIOSurface::GetIOSurfaceID() { - return MacIOSurfaceLib::IOSurfaceGetID(mIOSurfacePtr); -} - -void* MacIOSurface::GetBaseAddress() { - return MacIOSurfaceLib::IOSurfaceGetBaseAddress(mIOSurfacePtr); -} - -void* MacIOSurface::GetBaseAddressOfPlane(size_t aPlaneIndex) -{ - return MacIOSurfaceLib::IOSurfaceGetBaseAddressOfPlane(mIOSurfacePtr, - aPlaneIndex); -} - -size_t MacIOSurface::GetWidth(size_t plane) { - size_t intScaleFactor = ceil(mContentsScaleFactor); - return GetDevicePixelWidth(plane) / intScaleFactor; -} - -size_t MacIOSurface::GetHeight(size_t plane) { - size_t intScaleFactor = ceil(mContentsScaleFactor); - return GetDevicePixelHeight(plane) / intScaleFactor; -} - -size_t MacIOSurface::GetPlaneCount() { - return MacIOSurfaceLib::IOSurfaceGetPlaneCount(mIOSurfacePtr); -} - -/*static*/ size_t MacIOSurface::GetMaxWidth() { - if (!MacIOSurfaceLib::isInit()) - return -1; - return MacIOSurfaceLib::IOSurfaceGetPropertyMaximum(MacIOSurfaceLib::kPropWidth); -} - -/*static*/ size_t MacIOSurface::GetMaxHeight() { - if (!MacIOSurfaceLib::isInit()) - return -1; - return MacIOSurfaceLib::IOSurfaceGetPropertyMaximum(MacIOSurfaceLib::kPropHeight); -} - -size_t MacIOSurface::GetDevicePixelWidth(size_t plane) { - return MacIOSurfaceLib::IOSurfaceGetWidth(mIOSurfacePtr, plane); -} - -size_t MacIOSurface::GetDevicePixelHeight(size_t plane) { - return MacIOSurfaceLib::IOSurfaceGetHeight(mIOSurfacePtr, plane); -} - -size_t MacIOSurface::GetBytesPerRow(size_t plane) { - return MacIOSurfaceLib::IOSurfaceGetBytesPerRow(mIOSurfacePtr, plane); -} - -OSType MacIOSurface::GetPixelFormat() { - return MacIOSurfaceLib::IOSurfaceGetPixelFormat(mIOSurfacePtr); -} - -void MacIOSurface::IncrementUseCount() { - MacIOSurfaceLib::IOSurfaceIncrementUseCount(mIOSurfacePtr); -} - -void MacIOSurface::DecrementUseCount() { - MacIOSurfaceLib::IOSurfaceDecrementUseCount(mIOSurfacePtr); -} - -#define READ_ONLY 0x1 -void MacIOSurface::Lock(bool aReadOnly) { - MacIOSurfaceLib::IOSurfaceLock(mIOSurfacePtr, aReadOnly ? READ_ONLY : 0, nullptr); -} - -void MacIOSurface::Unlock(bool aReadOnly) { - MacIOSurfaceLib::IOSurfaceUnlock(mIOSurfacePtr, aReadOnly ? READ_ONLY : 0, nullptr); -} - -using mozilla::gfx::SourceSurface; -using mozilla::gfx::IntSize; -using mozilla::gfx::SurfaceFormat; - -void -MacIOSurfaceBufferDeallocator(void* aClosure) -{ - MOZ_ASSERT(aClosure); - - delete [] static_cast(aClosure); -} - -already_AddRefed -MacIOSurface::GetAsSurface() { - Lock(); - size_t bytesPerRow = GetBytesPerRow(); - size_t ioWidth = GetDevicePixelWidth(); - size_t ioHeight = GetDevicePixelHeight(); - - unsigned char* ioData = (unsigned char*)GetBaseAddress(); - unsigned char* dataCpy = - new unsigned char[bytesPerRow * ioHeight / sizeof(unsigned char)]; - for (size_t i = 0; i < ioHeight; i++) { - memcpy(dataCpy + i * bytesPerRow, - ioData + i * bytesPerRow, ioWidth * 4); - } - - Unlock(); - - SurfaceFormat format = HasAlpha() ? mozilla::gfx::SurfaceFormat::B8G8R8A8 : - mozilla::gfx::SurfaceFormat::B8G8R8X8; - - RefPtr surf = - mozilla::gfx::Factory::CreateWrappingDataSourceSurface(dataCpy, - bytesPerRow, - IntSize(ioWidth, ioHeight), - format, - &MacIOSurfaceBufferDeallocator, - static_cast(dataCpy)); - - return surf.forget(); -} - -SurfaceFormat -MacIOSurface::GetFormat() -{ - OSType pixelFormat = GetPixelFormat(); - if (pixelFormat == '420v') { - return SurfaceFormat::NV12; - } else if (pixelFormat == '2vuy') { - return SurfaceFormat::YUV422; - } else { - return HasAlpha() ? SurfaceFormat::R8G8B8A8 : SurfaceFormat::R8G8B8X8; - } -} - -SurfaceFormat -MacIOSurface::GetReadFormat() -{ - OSType pixelFormat = GetPixelFormat(); - if (pixelFormat == '420v') { - return SurfaceFormat::NV12; - } else if (pixelFormat == '2vuy') { - return SurfaceFormat::R8G8B8X8; - } else { - return HasAlpha() ? SurfaceFormat::R8G8B8A8 : SurfaceFormat::R8G8B8X8; - } -} - -CGLError -MacIOSurface::CGLTexImageIOSurface2D(CGLContextObj ctx, size_t plane) -{ - MOZ_ASSERT(plane >= 0); - OSType pixelFormat = GetPixelFormat(); - - GLenum internalFormat; - GLenum format; - GLenum type; - if (pixelFormat == '420v') { - MOZ_ASSERT(GetPlaneCount() == 2); - MOZ_ASSERT(plane < 2); - - if (plane == 0) { - internalFormat = format = GL_LUMINANCE; - } else { - internalFormat = format = GL_LUMINANCE_ALPHA; - } - type = GL_UNSIGNED_BYTE; - } else if (pixelFormat == '2vuy') { - MOZ_ASSERT(plane == 0); - - internalFormat = GL_RGB; - format = LOCAL_GL_YCBCR_422_APPLE; - type = GL_UNSIGNED_SHORT_8_8_APPLE; - } else { - MOZ_ASSERT(plane == 0); - - internalFormat = HasAlpha() ? GL_RGBA : GL_RGB; - format = GL_BGRA; - type = GL_UNSIGNED_INT_8_8_8_8_REV; - } - CGLError temp = MacIOSurfaceLib::CGLTexImageIOSurface2D(ctx, - GL_TEXTURE_RECTANGLE_ARB, - internalFormat, - GetDevicePixelWidth(plane), - GetDevicePixelHeight(plane), - format, - type, - mIOSurfacePtr, plane); - return temp; -} - -static -CGColorSpaceRef CreateSystemColorSpace() { - CGColorSpaceRef cspace = ::CGDisplayCopyColorSpace(::CGMainDisplayID()); - if (!cspace) { - cspace = ::CGColorSpaceCreateDeviceRGB(); - } - return cspace; -} - -CGContextRef MacIOSurface::CreateIOSurfaceContext() { - CGColorSpaceRef cspace = CreateSystemColorSpace(); - CGContextRef ref = MacIOSurfaceLib::IOSurfaceContextCreate(mIOSurfacePtr, - GetDevicePixelWidth(), - GetDevicePixelHeight(), - 8, 32, cspace, 0x2002); - ::CGColorSpaceRelease(cspace); - return ref; -} - -CGImageRef MacIOSurface::CreateImageFromIOSurfaceContext(CGContextRef aContext) { - if (!MacIOSurfaceLib::isInit()) - return nullptr; - - return MacIOSurfaceLib::IOSurfaceContextCreateImage(aContext); -} - -already_AddRefed MacIOSurface::IOSurfaceContextGetSurface(CGContextRef aContext, - double aContentsScaleFactor, - bool aHasAlpha) { - if (!MacIOSurfaceLib::isInit() || aContentsScaleFactor <= 0) - return nullptr; - - IOSurfacePtr surfaceRef = MacIOSurfaceLib::IOSurfaceContextGetSurface(aContext); - if (!surfaceRef) - return nullptr; - - RefPtr ioSurface = new MacIOSurface(surfaceRef, aContentsScaleFactor, aHasAlpha); - if (!ioSurface) { - ::CFRelease(surfaceRef); - return nullptr; - } - return ioSurface.forget(); -} - - -CGContextType GetContextType(CGContextRef ref) -{ - if (!MacIOSurfaceLib::isInit() || !MacIOSurfaceLib::sCGContextGetTypePtr) - return CG_CONTEXT_TYPE_UNKNOWN; - - unsigned int type = MacIOSurfaceLib::sCGContextGetTypePtr(ref); - if (type == CG_CONTEXT_TYPE_BITMAP) { - return CG_CONTEXT_TYPE_BITMAP; - } else if (type == CG_CONTEXT_TYPE_IOSURFACE) { - return CG_CONTEXT_TYPE_IOSURFACE; - } else { - return CG_CONTEXT_TYPE_UNKNOWN; - } -} - - diff --git a/gfx/2d/MacIOSurface.h b/gfx/2d/MacIOSurface.h deleted file mode 100644 index 0d4f79a155..0000000000 --- a/gfx/2d/MacIOSurface.h +++ /dev/null @@ -1,222 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -// vim:set ts=2 sts=2 sw=2 et cin: -/* 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 MacIOSurface_h__ -#define MacIOSurface_h__ -#ifdef XP_DARWIN -#include -#include -#include - -struct _CGLContextObject; - -typedef _CGLContextObject* CGLContextObj; -typedef struct CGContext* CGContextRef; -typedef struct CGImage* CGImageRef; -typedef uint32_t IOSurfaceID; - -#ifdef XP_IOS -typedef kern_return_t IOReturn; -typedef int CGLError; -#endif - -typedef CFTypeRef IOSurfacePtr; -typedef IOSurfacePtr (*IOSurfaceCreateFunc) (CFDictionaryRef properties); -typedef IOSurfacePtr (*IOSurfaceLookupFunc) (uint32_t io_surface_id); -typedef IOSurfaceID (*IOSurfaceGetIDFunc)(IOSurfacePtr io_surface); -typedef void (*IOSurfaceVoidFunc)(IOSurfacePtr io_surface); -typedef IOReturn (*IOSurfaceLockFunc)(IOSurfacePtr io_surface, uint32_t options, - uint32_t *seed); -typedef IOReturn (*IOSurfaceUnlockFunc)(IOSurfacePtr io_surface, - uint32_t options, uint32_t *seed); -typedef void* (*IOSurfaceGetBaseAddressFunc)(IOSurfacePtr io_surface); -typedef void* (*IOSurfaceGetBaseAddressOfPlaneFunc)(IOSurfacePtr io_surface, - size_t planeIndex); -typedef size_t (*IOSurfaceSizeTFunc)(IOSurfacePtr io_surface); -typedef size_t (*IOSurfaceSizePlaneTFunc)(IOSurfacePtr io_surface, size_t plane); -typedef size_t (*IOSurfaceGetPropertyMaximumFunc) (CFStringRef property); -typedef CGLError (*CGLTexImageIOSurface2DFunc) (CGLContextObj ctxt, - GLenum target, GLenum internalFormat, - GLsizei width, GLsizei height, - GLenum format, GLenum type, - IOSurfacePtr ioSurface, GLuint plane); -typedef CGContextRef (*IOSurfaceContextCreateFunc)(CFTypeRef io_surface, - unsigned width, unsigned height, - unsigned bitsPerComponent, unsigned bytes, - CGColorSpaceRef colorSpace, CGBitmapInfo bitmapInfo); -typedef CGImageRef (*IOSurfaceContextCreateImageFunc)(CGContextRef ref); -typedef IOSurfacePtr (*IOSurfaceContextGetSurfaceFunc)(CGContextRef ref); - -typedef IOSurfacePtr (*CVPixelBufferGetIOSurfaceFunc)( - CVPixelBufferRef pixelBuffer); - -typedef OSType (*IOSurfacePixelFormatFunc)(IOSurfacePtr io_surface); - -#ifdef XP_MACOSX -#import -#else -#import -#endif - -#include "2D.h" -#include "mozilla/RefPtr.h" -#include "mozilla/RefCounted.h" - -enum CGContextType { - CG_CONTEXT_TYPE_UNKNOWN = 0, - // These are found by inspection, it's possible they could be changed - CG_CONTEXT_TYPE_BITMAP = 4, - CG_CONTEXT_TYPE_IOSURFACE = 8 -}; - -CGContextType GetContextType(CGContextRef ref); - -class MacIOSurface final : public mozilla::external::AtomicRefCounted { -public: - MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(MacIOSurface) - typedef mozilla::gfx::SourceSurface SourceSurface; - - // The usage count of the IOSurface is increased by 1 during the lifetime - // of the MacIOSurface instance. - // MacIOSurface holds a reference to the corresponding IOSurface. - - static already_AddRefed CreateIOSurface(int aWidth, int aHeight, - double aContentsScaleFactor = 1.0, - bool aHasAlpha = true); - static void ReleaseIOSurface(MacIOSurface *aIOSurface); - static already_AddRefed LookupSurface(IOSurfaceID aSurfaceID, - double aContentsScaleFactor = 1.0, - bool aHasAlpha = true); - - explicit MacIOSurface(const void *aIOSurfacePtr, - double aContentsScaleFactor = 1.0, - bool aHasAlpha = true); - ~MacIOSurface(); - IOSurfaceID GetIOSurfaceID(); - void *GetBaseAddress(); - void *GetBaseAddressOfPlane(size_t planeIndex); - size_t GetPlaneCount(); - OSType GetPixelFormat(); - // GetWidth() and GetHeight() return values in "display pixels". A - // "display pixel" is the smallest fully addressable part of a display. - // But in HiDPI modes each "display pixel" corresponds to more than one - // device pixel. Use GetDevicePixel**() to get device pixels. - size_t GetWidth(size_t plane = 0); - size_t GetHeight(size_t plane = 0); - double GetContentsScaleFactor() { return mContentsScaleFactor; } - size_t GetDevicePixelWidth(size_t plane = 0); - size_t GetDevicePixelHeight(size_t plane = 0); - size_t GetBytesPerRow(size_t plane = 0); - void Lock(bool aReadOnly = true); - void Unlock(bool aReadOnly = true); - void IncrementUseCount(); - void DecrementUseCount(); - bool HasAlpha() { return mHasAlpha; } - mozilla::gfx::SurfaceFormat GetFormat(); - mozilla::gfx::SurfaceFormat GetReadFormat(); - - // We would like to forward declare NSOpenGLContext, but it is an @interface - // and this file is also used from c++, so we use a void *. - CGLError CGLTexImageIOSurface2D(CGLContextObj ctxt, size_t plane = 0); - already_AddRefed GetAsSurface(); - CGContextRef CreateIOSurfaceContext(); - - // FIXME This doesn't really belong here - static CGImageRef CreateImageFromIOSurfaceContext(CGContextRef aContext); - static already_AddRefed IOSurfaceContextGetSurface(CGContextRef aContext, - double aContentsScaleFactor = 1.0, - bool aHasAlpha = true); - static size_t GetMaxWidth(); - static size_t GetMaxHeight(); - -private: - friend class nsCARenderer; - const void* mIOSurfacePtr; - double mContentsScaleFactor; - bool mHasAlpha; -}; - -class MacIOSurfaceLib { -public: - MacIOSurfaceLib() = delete; - static void *sIOSurfaceFramework; - static void *sOpenGLFramework; - static void *sCoreGraphicsFramework; - static void *sCoreVideoFramework; - static bool isLoaded; - static IOSurfaceCreateFunc sCreate; - static IOSurfaceGetIDFunc sGetID; - static IOSurfaceLookupFunc sLookup; - static IOSurfaceGetBaseAddressFunc sGetBaseAddress; - static IOSurfaceGetBaseAddressOfPlaneFunc sGetBaseAddressOfPlane; - static IOSurfaceSizeTFunc sPlaneCount; - static IOSurfaceLockFunc sLock; - static IOSurfaceUnlockFunc sUnlock; - static IOSurfaceVoidFunc sIncrementUseCount; - static IOSurfaceVoidFunc sDecrementUseCount; - static IOSurfaceSizePlaneTFunc sWidth; - static IOSurfaceSizePlaneTFunc sHeight; - static IOSurfaceSizePlaneTFunc sBytesPerRow; - static IOSurfaceGetPropertyMaximumFunc sGetPropertyMaximum; - static CGLTexImageIOSurface2DFunc sTexImage; - static IOSurfaceContextCreateFunc sIOSurfaceContextCreate; - static IOSurfaceContextCreateImageFunc sIOSurfaceContextCreateImage; - static IOSurfaceContextGetSurfaceFunc sIOSurfaceContextGetSurface; - static CVPixelBufferGetIOSurfaceFunc sCVPixelBufferGetIOSurface; - static IOSurfacePixelFormatFunc sPixelFormat; - static CFStringRef kPropWidth; - static CFStringRef kPropHeight; - static CFStringRef kPropBytesPerElem; - static CFStringRef kPropBytesPerRow; - static CFStringRef kPropIsGlobal; - - static bool isInit(); - static CFStringRef GetIOConst(const char* symbole); - static IOSurfacePtr IOSurfaceCreate(CFDictionaryRef properties); - static IOSurfacePtr IOSurfaceLookup(IOSurfaceID aIOSurfaceID); - static IOSurfaceID IOSurfaceGetID(IOSurfacePtr aIOSurfacePtr); - static void* IOSurfaceGetBaseAddress(IOSurfacePtr aIOSurfacePtr); - static void* IOSurfaceGetBaseAddressOfPlane(IOSurfacePtr aIOSurfacePtr, - size_t aPlaneIndex); - static size_t IOSurfaceGetPlaneCount(IOSurfacePtr aIOSurfacePtr); - static size_t IOSurfaceGetWidth(IOSurfacePtr aIOSurfacePtr, size_t plane); - static size_t IOSurfaceGetHeight(IOSurfacePtr aIOSurfacePtr, size_t plane); - static size_t IOSurfaceGetBytesPerRow(IOSurfacePtr aIOSurfacePtr, size_t plane); - static size_t IOSurfaceGetPropertyMaximum(CFStringRef property); - static IOReturn IOSurfaceLock(IOSurfacePtr aIOSurfacePtr, - uint32_t options, uint32_t *seed); - static IOReturn IOSurfaceUnlock(IOSurfacePtr aIOSurfacePtr, - uint32_t options, uint32_t *seed); - static void IOSurfaceIncrementUseCount(IOSurfacePtr aIOSurfacePtr); - static void IOSurfaceDecrementUseCount(IOSurfacePtr aIOSurfacePtr); - static CGLError CGLTexImageIOSurface2D(CGLContextObj ctxt, - GLenum target, GLenum internalFormat, - GLsizei width, GLsizei height, - GLenum format, GLenum type, - IOSurfacePtr ioSurface, GLuint plane); - static CGContextRef IOSurfaceContextCreate(IOSurfacePtr aIOSurfacePtr, - unsigned aWidth, unsigned aHeight, - unsigned aBitsPerCompoent, unsigned aBytes, - CGColorSpaceRef aColorSpace, CGBitmapInfo bitmapInfo); - static CGImageRef IOSurfaceContextCreateImage(CGContextRef ref); - static IOSurfacePtr IOSurfaceContextGetSurface(CGContextRef ref); - static IOSurfacePtr CVPixelBufferGetIOSurface(CVPixelBufferRef apixelBuffer); - static OSType IOSurfaceGetPixelFormat(IOSurfacePtr aIOSurfacePtr); - static unsigned int (*sCGContextGetTypePtr) (CGContextRef); - static void LoadLibrary(); - static void CloseLibrary(); - - // Static deconstructor - static class LibraryUnloader { - public: - ~LibraryUnloader() { - CloseLibrary(); - } - } sLibraryUnloader; -}; - -#endif -#endif diff --git a/gfx/2d/NativeFontResourceMac.cpp b/gfx/2d/NativeFontResourceMac.cpp deleted file mode 100644 index 5747d737ef..0000000000 --- a/gfx/2d/NativeFontResourceMac.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* 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/. */ - -#include "NativeFontResourceMac.h" -#include "Types.h" - -#include "mozilla/RefPtr.h" -#include "mozilla/gfx/Logging.h" - -#ifdef MOZ_WIDGET_UIKIT -#include -#endif - -namespace mozilla { -namespace gfx { - -/* static */ -already_AddRefed -NativeFontResourceMac::Create(uint8_t *aFontData, uint32_t aDataLength) -{ - // copy font data - CFDataRef data = CFDataCreate(kCFAllocatorDefault, aFontData, aDataLength); - if (!data) { - return nullptr; - } - - // create a provider - CGDataProviderRef provider = CGDataProviderCreateWithCFData(data); - - // release our reference to the CFData, provider keeps it alive - CFRelease(data); - - // create the font object - CGFontRef fontRef = CGFontCreateWithDataProvider(provider); - - // release our reference, font will keep it alive as long as needed - CGDataProviderRelease(provider); - - if (!fontRef) { - return nullptr; - } - - // passes ownership of fontRef to the NativeFontResourceMac instance - RefPtr fontResource = - new NativeFontResourceMac(fontRef); - - return fontResource.forget(); -} - -already_AddRefed -NativeFontResourceMac::CreateScaledFont(uint32_t aIndex, Float aGlyphSize, - const uint8_t* aInstanceData, uint32_t aInstanceDataLength) -{ - RefPtr scaledFont = new ScaledFontMac(mFontRef, aGlyphSize); - - if (!scaledFont->PopulateCairoScaledFont()) { - gfxWarning() << "Unable to create cairo scaled Mac font."; - return nullptr; - } - - return scaledFont.forget(); -} - -} // gfx -} // mozilla diff --git a/gfx/2d/NativeFontResourceMac.h b/gfx/2d/NativeFontResourceMac.h deleted file mode 100644 index bba935bc54..0000000000 --- a/gfx/2d/NativeFontResourceMac.h +++ /dev/null @@ -1,42 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* 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_gfx_NativeFontResourceMac_h -#define mozilla_gfx_NativeFontResourceMac_h - -#include "2D.h" -#include "mozilla/AlreadyAddRefed.h" -#include "ScaledFontMac.h" - -namespace mozilla { -namespace gfx { - -class NativeFontResourceMac final : public NativeFontResource -{ -public: - MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(NativeFontResourceMac) - - static already_AddRefed - Create(uint8_t *aFontData, uint32_t aDataLength); - - already_AddRefed - CreateScaledFont(uint32_t aIndex, Float aGlyphSize, - const uint8_t* aInstanceData, uint32_t aInstanceDataLength) final; - - ~NativeFontResourceMac() - { - CFRelease(mFontRef); - } - -private: - explicit NativeFontResourceMac(CGFontRef aFontRef) : mFontRef(aFontRef) {} - - CGFontRef mFontRef; -}; - -} // gfx -} // mozilla - -#endif // mozilla_gfx_NativeFontResourceMac_h diff --git a/gfx/2d/PathCG.cpp b/gfx/2d/PathCG.cpp deleted file mode 100644 index 4d70b2607f..0000000000 --- a/gfx/2d/PathCG.cpp +++ /dev/null @@ -1,435 +0,0 @@ -/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * 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/. */ - -#include "PathCG.h" -#include -#include "Logging.h" -#include "PathHelpers.h" - -namespace mozilla { -namespace gfx { - -static inline Rect -CGRectToRect(CGRect rect) -{ - return Rect(rect.origin.x, - rect.origin.y, - rect.size.width, - rect.size.height); -} - -static inline Point -CGPointToPoint(CGPoint point) -{ - return Point(point.x, point.y); -} - -static inline void -SetStrokeOptions(CGContextRef cg, const StrokeOptions &aStrokeOptions) -{ - switch (aStrokeOptions.mLineCap) - { - case CapStyle::BUTT: - CGContextSetLineCap(cg, kCGLineCapButt); - break; - case CapStyle::ROUND: - CGContextSetLineCap(cg, kCGLineCapRound); - break; - case CapStyle::SQUARE: - CGContextSetLineCap(cg, kCGLineCapSquare); - break; - } - - switch (aStrokeOptions.mLineJoin) - { - case JoinStyle::BEVEL: - CGContextSetLineJoin(cg, kCGLineJoinBevel); - break; - case JoinStyle::ROUND: - CGContextSetLineJoin(cg, kCGLineJoinRound); - break; - case JoinStyle::MITER: - case JoinStyle::MITER_OR_BEVEL: - CGContextSetLineJoin(cg, kCGLineJoinMiter); - break; - } - - CGContextSetLineWidth(cg, aStrokeOptions.mLineWidth); - CGContextSetMiterLimit(cg, aStrokeOptions.mMiterLimit); - - // XXX: rename mDashLength to dashLength - if (aStrokeOptions.mDashLength > 0) { - // we use a regular array instead of a std::vector here because we don't want to leak the include - CGFloat *dashes = new CGFloat[aStrokeOptions.mDashLength]; - for (size_t i=0; i -PathBuilderCG::Finish() -{ - return MakeAndAddRef(mCGPath, mFillRule); -} - -already_AddRefed -PathCG::CopyToBuilder(FillRule aFillRule) const -{ - CGMutablePathRef path = CGPathCreateMutableCopy(mPath); - return MakeAndAddRef(path, aFillRule); -} - - - -already_AddRefed -PathCG::TransformedCopyToBuilder(const Matrix &aTransform, FillRule aFillRule) const -{ - // 10.7 adds CGPathCreateMutableCopyByTransformingPath it might be faster than doing - // this by hand - - struct TransformApplier { - CGMutablePathRef path; - CGAffineTransform transform; - static void - TranformCGPathApplierFunc(void *vinfo, const CGPathElement *element) - { - TransformApplier *info = reinterpret_cast(vinfo); - switch (element->type) { - case kCGPathElementMoveToPoint: - { - CGPoint pt = element->points[0]; - CGPathMoveToPoint(info->path, &info->transform, pt.x, pt.y); - break; - } - case kCGPathElementAddLineToPoint: - { - CGPoint pt = element->points[0]; - CGPathAddLineToPoint(info->path, &info->transform, pt.x, pt.y); - break; - } - case kCGPathElementAddQuadCurveToPoint: - { - CGPoint cpt = element->points[0]; - CGPoint pt = element->points[1]; - CGPathAddQuadCurveToPoint(info->path, &info->transform, cpt.x, cpt.y, pt.x, pt.y); - break; - } - case kCGPathElementAddCurveToPoint: - { - CGPoint cpt1 = element->points[0]; - CGPoint cpt2 = element->points[1]; - CGPoint pt = element->points[2]; - CGPathAddCurveToPoint(info->path, &info->transform, cpt1.x, cpt1.y, cpt2.x, cpt2.y, pt.x, pt.y); - break; - } - case kCGPathElementCloseSubpath: - { - CGPathCloseSubpath(info->path); - break; - } - } - } - }; - - TransformApplier ta; - ta.path = CGPathCreateMutable(); - ta.transform = GfxMatrixToCGAffineTransform(aTransform); - - CGPathApply(mPath, &ta, TransformApplier::TranformCGPathApplierFunc); - return MakeAndAddRef(ta.path, aFillRule); -} - -static void -StreamPathToSinkApplierFunc(void *vinfo, const CGPathElement *element) -{ - PathSink *sink = reinterpret_cast(vinfo); - switch (element->type) { - case kCGPathElementMoveToPoint: - { - CGPoint pt = element->points[0]; - sink->MoveTo(CGPointToPoint(pt)); - break; - } - case kCGPathElementAddLineToPoint: - { - CGPoint pt = element->points[0]; - sink->LineTo(CGPointToPoint(pt)); - break; - } - case kCGPathElementAddQuadCurveToPoint: - { - CGPoint cpt = element->points[0]; - CGPoint pt = element->points[1]; - sink->QuadraticBezierTo(CGPointToPoint(cpt), - CGPointToPoint(pt)); - break; - } - case kCGPathElementAddCurveToPoint: - { - CGPoint cpt1 = element->points[0]; - CGPoint cpt2 = element->points[1]; - CGPoint pt = element->points[2]; - sink->BezierTo(CGPointToPoint(cpt1), - CGPointToPoint(cpt2), - CGPointToPoint(pt)); - break; - } - case kCGPathElementCloseSubpath: - { - sink->Close(); - break; - } - } -} - -void -PathCG::StreamToSink(PathSink *aSink) const -{ - CGPathApply(mPath, aSink, StreamPathToSinkApplierFunc); -} - -bool -PathCG::ContainsPoint(const Point &aPoint, const Matrix &aTransform) const -{ - Matrix inverse = aTransform; - inverse.Invert(); - Point transformedPoint = inverse.TransformPoint(aPoint); - // We could probably drop the input transform and just transform the point at the caller? - CGPoint point = {transformedPoint.x, transformedPoint.y}; - - // The transform parameter of CGPathContainsPoint doesn't seem to work properly on OS X 10.5 - // so we transform aPoint ourselves. - return CGPathContainsPoint(mPath, nullptr, point, mFillRule == FillRule::FILL_EVEN_ODD); -} - -static size_t -PutBytesNull(void *info, const void *buffer, size_t count) -{ - return count; -} - -/* The idea of a scratch context comes from WebKit */ -static CGContextRef -CreateScratchContext() -{ - CGDataConsumerCallbacks callbacks = {PutBytesNull, nullptr}; - CGDataConsumerRef consumer = CGDataConsumerCreate(nullptr, &callbacks); - CGContextRef cg = CGPDFContextCreate(consumer, nullptr, nullptr); - CGDataConsumerRelease(consumer); - return cg; -} - -static CGContextRef -ScratchContext() -{ - static CGContextRef cg = CreateScratchContext(); - return cg; -} - -bool -PathCG::StrokeContainsPoint(const StrokeOptions &aStrokeOptions, - const Point &aPoint, - const Matrix &aTransform) const -{ - Matrix inverse = aTransform; - inverse.Invert(); - Point transformedPoint = inverse.TransformPoint(aPoint); - // We could probably drop the input transform and just transform the point at the caller? - CGPoint point = {transformedPoint.x, transformedPoint.y}; - - CGContextRef cg = ScratchContext(); - - CGContextSaveGState(cg); - - CGContextBeginPath(cg); - CGContextAddPath(cg, mPath); - - SetStrokeOptions(cg, aStrokeOptions); - - CGContextReplacePathWithStrokedPath(cg); - CGContextRestoreGState(cg); - - CGPathRef sPath = CGContextCopyPath(cg); - bool inStroke = CGPathContainsPoint(sPath, nullptr, point, false); - CGPathRelease(sPath); - - return inStroke; -} - -//XXX: what should these functions return for an empty path? -// currently they return CGRectNull {inf,inf, 0, 0} -Rect -PathCG::GetBounds(const Matrix &aTransform) const -{ - //XXX: are these bounds tight enough - Rect bounds = CGRectToRect(CGPathGetBoundingBox(mPath)); - - //XXX: currently this returns the bounds of the transformed bounds - // this is strictly looser than the bounds of the transformed path - return aTransform.TransformBounds(bounds); -} - -Rect -PathCG::GetStrokedBounds(const StrokeOptions &aStrokeOptions, - const Matrix &aTransform) const -{ - // 10.7 has CGPathCreateCopyByStrokingPath which we could use - // instead of this scratch context business - CGContextRef cg = ScratchContext(); - - CGContextSaveGState(cg); - - CGContextBeginPath(cg); - CGContextAddPath(cg, mPath); - - SetStrokeOptions(cg, aStrokeOptions); - - CGContextReplacePathWithStrokedPath(cg); - Rect bounds = CGRectToRect(CGContextGetPathBoundingBox(cg)); - - CGContextRestoreGState(cg); - - if (!bounds.IsFinite()) { - return Rect(); - } - - return aTransform.TransformBounds(bounds); -} - - -} // namespace gfx - -} // namespace mozilla diff --git a/gfx/2d/PathCG.h b/gfx/2d/PathCG.h deleted file mode 100644 index db609cb577..0000000000 --- a/gfx/2d/PathCG.h +++ /dev/null @@ -1,114 +0,0 @@ -/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * 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_GFX_PATHCG_H_ -#define MOZILLA_GFX_PATHCG_H_ - -#ifdef MOZ_WIDGET_COCOA -#include -#else -#include -#endif - -#include "2D.h" - -namespace mozilla { -namespace gfx { - -class PathCG; - -class PathBuilderCG : public PathBuilder -{ -public: - MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(PathBuilderCG) - // absorbs a reference of aPath - PathBuilderCG(CGMutablePathRef aPath, FillRule aFillRule) - : mFillRule(aFillRule) - { - mCGPath = aPath; - } - - explicit PathBuilderCG(FillRule aFillRule) - : mFillRule(aFillRule) - { - mCGPath = CGPathCreateMutable(); - } - - virtual ~PathBuilderCG(); - - virtual void MoveTo(const Point &aPoint); - virtual void LineTo(const Point &aPoint); - virtual void BezierTo(const Point &aCP1, - const Point &aCP2, - const Point &aCP3); - virtual void QuadraticBezierTo(const Point &aCP1, - const Point &aCP2); - virtual void Close(); - virtual void Arc(const Point &aOrigin, Float aRadius, Float aStartAngle, - Float aEndAngle, bool aAntiClockwise = false); - virtual Point CurrentPoint() const; - - virtual already_AddRefed Finish(); - - virtual BackendType GetBackendType() const { return BackendType::SKIA; } - -private: - friend class PathCG; - friend class ScaledFontMac; - - void EnsureActive(const Point &aPoint); - - CGMutablePathRef mCGPath; - Point mCurrentPoint; - Point mBeginPoint; - FillRule mFillRule; -}; - -class PathCG : public Path -{ -public: - MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(PathCG) - PathCG(CGMutablePathRef aPath, FillRule aFillRule) - : mPath(aPath) - , mFillRule(aFillRule) - { - CGPathRetain(mPath); - } - virtual ~PathCG() { CGPathRelease(mPath); } - - // Paths will always return BackendType::COREGRAPHICS, but note that they - // are compatible with BackendType::COREGRAPHICS_ACCELERATED backend. - virtual BackendType GetBackendType() const { return BackendType::SKIA; } - - virtual already_AddRefed CopyToBuilder(FillRule aFillRule) const; - virtual already_AddRefed TransformedCopyToBuilder(const Matrix &aTransform, - FillRule aFillRule) const; - - virtual bool ContainsPoint(const Point &aPoint, const Matrix &aTransform) const; - virtual bool StrokeContainsPoint(const StrokeOptions &aStrokeOptions, - const Point &aPoint, - const Matrix &aTransform) const; - virtual Rect GetBounds(const Matrix &aTransform = Matrix()) const; - virtual Rect GetStrokedBounds(const StrokeOptions &aStrokeOptions, - const Matrix &aTransform = Matrix()) const; - - virtual void StreamToSink(PathSink *aSink) const; - - virtual FillRule GetFillRule() const { return mFillRule; } - - CGMutablePathRef GetPath() const { return mPath; } - -private: - friend class DrawTargetCG; - - CGMutablePathRef mPath; - Point mEndPoint; - FillRule mFillRule; -}; - -} // namespace gfx -} // namespace mozilla - -#endif diff --git a/gfx/2d/QuartzSupport.h b/gfx/2d/QuartzSupport.h deleted file mode 100644 index f56fcb77ca..0000000000 --- a/gfx/2d/QuartzSupport.h +++ /dev/null @@ -1,98 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -// vim:set ts=2 sts=2 sw=2 et cin: -/* 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 nsCoreAnimationSupport_h__ -#define nsCoreAnimationSupport_h__ -#ifdef XP_MACOSX - -#import -#import -#import "ApplicationServices/ApplicationServices.h" -#include "gfxTypes.h" -#include "mozilla/RefPtr.h" -#include "mozilla/gfx/MacIOSurface.h" -#include "nsError.h" - -// Get the system color space. -CGColorSpaceRef CreateSystemColorSpace(); - -// Manages a CARenderer -struct _CGLContextObject; - -enum AllowOfflineRendererEnum { ALLOW_OFFLINE_RENDERER, DISALLOW_OFFLINE_RENDERER }; - -class nsCARenderer : public mozilla::RefCounted { -public: - MOZ_DECLARE_REFCOUNTED_TYPENAME(nsCARenderer) - nsCARenderer() : mCARenderer(nullptr), mWrapperCALayer(nullptr), mFBOTexture(0), - mOpenGLContext(nullptr), mCGImage(nullptr), mCGData(nullptr), - mIOSurface(nullptr), mFBO(0), mIOTexture(0), - mUnsupportedWidth(UINT32_MAX), mUnsupportedHeight(UINT32_MAX), - mAllowOfflineRenderer(DISALLOW_OFFLINE_RENDERER), - mContentsScaleFactor(1.0) {} - ~nsCARenderer(); - // aWidth and aHeight are in "display pixels". A "display pixel" is the - // smallest fully addressable part of a display. But in HiDPI modes each - // "display pixel" corresponds to more than one device pixel. Multiply - // display pixels by aContentsScaleFactor to get device pixels. - nsresult SetupRenderer(void* aCALayer, int aWidth, int aHeight, - double aContentsScaleFactor, - AllowOfflineRendererEnum aAllowOfflineRenderer); - // aWidth and aHeight are in "display pixels". Multiply by - // aContentsScaleFactor to get device pixels. - nsresult Render(int aWidth, int aHeight, - double aContentsScaleFactor, - CGImageRef *aOutCAImage); - bool isInit() { return mCARenderer != nullptr; } - /* - * Render the CALayer to an IOSurface. If no IOSurface - * is attached then an internal pixel buffer will be - * used. - */ - void AttachIOSurface(MacIOSurface *aSurface); - IOSurfaceID GetIOSurfaceID(); - // aX, aY, aWidth and aHeight are in "display pixels". Multiply by - // surf->GetContentsScaleFactor() to get device pixels. - static nsresult DrawSurfaceToCGContext(CGContextRef aContext, - MacIOSurface *surf, - CGColorSpaceRef aColorSpace, - int aX, int aY, - size_t aWidth, size_t aHeight); - - // Remove & Add the layer without destroying - // the renderer for fast back buffer swapping. - void DetachCALayer(); - void AttachCALayer(void *aCALayer); -#ifdef DEBUG - static void SaveToDisk(MacIOSurface *surf); -#endif -private: - // aWidth and aHeight are in "display pixels". Multiply by - // mContentsScaleFactor to get device pixels. - void SetBounds(int aWidth, int aHeight); - // aWidth and aHeight are in "display pixels". Multiply by - // mContentsScaleFactor to get device pixels. - void SetViewport(int aWidth, int aHeight); - void Destroy(); - - void *mCARenderer; - void *mWrapperCALayer; - GLuint mFBOTexture; - _CGLContextObject *mOpenGLContext; - CGImageRef mCGImage; - void *mCGData; - RefPtr mIOSurface; - uint32_t mFBO; - uint32_t mIOTexture; - int mUnsupportedWidth; - int mUnsupportedHeight; - AllowOfflineRendererEnum mAllowOfflineRenderer; - double mContentsScaleFactor; -}; - -#endif // XP_MACOSX -#endif // nsCoreAnimationSupport_h__ - diff --git a/gfx/2d/QuartzSupport.mm b/gfx/2d/QuartzSupport.mm deleted file mode 100644 index 464db5ecee..0000000000 --- a/gfx/2d/QuartzSupport.mm +++ /dev/null @@ -1,625 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -// vim:set ts=2 sts=2 sw=2 et cin: -/* 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/. */ - -#include "QuartzSupport.h" -#include "nsDebug.h" -#include "MacIOSurface.h" -#include "mozilla/Sprintf.h" - -#import -#import -#include -#include "GLDefs.h" - -#define IOSURFACE_FRAMEWORK_PATH \ - "/System/Library/Frameworks/IOSurface.framework/IOSurface" -#define OPENGL_FRAMEWORK_PATH \ - "/System/Library/Frameworks/OpenGL.framework/OpenGL" -#define COREGRAPHICS_FRAMEWORK_PATH \ - "/System/Library/Frameworks/ApplicationServices.framework/Frameworks/CoreGraphics.framework/CoreGraphics" - -@interface CALayer (ContentsScale) -- (double)contentsScale; -- (void)setContentsScale:(double)scale; -@end - - -CGColorSpaceRef CreateSystemColorSpace() { - CGColorSpaceRef cspace = ::CGDisplayCopyColorSpace(::CGMainDisplayID()); - if (!cspace) { - cspace = ::CGColorSpaceCreateDeviceRGB(); - } - return cspace; -} - -nsCARenderer::~nsCARenderer() { - Destroy(); -} - -void cgdata_release_callback(void *aCGData, const void *data, size_t size) { - if (aCGData) { - free(aCGData); - } -} - -void nsCARenderer::Destroy() { - if (mCARenderer) { - CARenderer* caRenderer = (CARenderer*)mCARenderer; - // Bug 556453: - // Explicitly remove the layer from the renderer - // otherwise it does not always happen right away. - caRenderer.layer = nullptr; - [caRenderer release]; - } - if (mWrapperCALayer) { - CALayer* wrapperLayer = (CALayer*)mWrapperCALayer; - [wrapperLayer release]; - } - if (mOpenGLContext) { - if (mFBO || mIOTexture || mFBOTexture) { - // Release these resources with the context that allocated them - CGLContextObj oldContext = ::CGLGetCurrentContext(); - ::CGLSetCurrentContext(mOpenGLContext); - - if (mFBOTexture) { - ::glDeleteTextures(1, &mFBOTexture); - } - if (mIOTexture) { - ::glDeleteTextures(1, &mIOTexture); - } - if (mFBO) { - ::glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); - ::glDeleteFramebuffersEXT(1, &mFBO); - } - - if (oldContext) - ::CGLSetCurrentContext(oldContext); - } - ::CGLDestroyContext((CGLContextObj)mOpenGLContext); - } - if (mCGImage) { - ::CGImageRelease(mCGImage); - } - // mCGData is deallocated by cgdata_release_callback - - mCARenderer = nil; - mWrapperCALayer = nil; - mFBOTexture = 0; - mOpenGLContext = nullptr; - mCGImage = nullptr; - mIOSurface = nullptr; - mFBO = 0; - mIOTexture = 0; -} - -nsresult nsCARenderer::SetupRenderer(void *aCALayer, int aWidth, int aHeight, - double aContentsScaleFactor, - AllowOfflineRendererEnum aAllowOfflineRenderer) { - mAllowOfflineRenderer = aAllowOfflineRenderer; - - if (aWidth == 0 || aHeight == 0 || aContentsScaleFactor <= 0) - return NS_ERROR_FAILURE; - - if (aWidth == mUnsupportedWidth && - aHeight == mUnsupportedHeight) { - return NS_ERROR_FAILURE; - } - - CGLPixelFormatAttribute attributes[] = { - kCGLPFAAccelerated, - kCGLPFADepthSize, (CGLPixelFormatAttribute)24, - kCGLPFAAllowOfflineRenderers, - (CGLPixelFormatAttribute)0 - }; - - if (mAllowOfflineRenderer == DISALLOW_OFFLINE_RENDERER) { - attributes[3] = (CGLPixelFormatAttribute)0; - } - - GLint screen; - CGLPixelFormatObj format; - if (::CGLChoosePixelFormat(attributes, &format, &screen) != kCGLNoError) { - mUnsupportedWidth = aWidth; - mUnsupportedHeight = aHeight; - Destroy(); - return NS_ERROR_FAILURE; - } - - if (::CGLCreateContext(format, nullptr, &mOpenGLContext) != kCGLNoError) { - mUnsupportedWidth = aWidth; - mUnsupportedHeight = aHeight; - Destroy(); - return NS_ERROR_FAILURE; - } - ::CGLDestroyPixelFormat(format); - - CARenderer* caRenderer = [[CARenderer rendererWithCGLContext:mOpenGLContext - options:nil] retain]; - if (caRenderer == nil) { - mUnsupportedWidth = aWidth; - mUnsupportedHeight = aHeight; - Destroy(); - return NS_ERROR_FAILURE; - } - CALayer* wrapperCALayer = [[CALayer layer] retain]; - if (wrapperCALayer == nil) { - [caRenderer release]; - mUnsupportedWidth = aWidth; - mUnsupportedHeight = aHeight; - Destroy(); - return NS_ERROR_FAILURE; - } - - mCARenderer = caRenderer; - mWrapperCALayer = wrapperCALayer; - caRenderer.layer = wrapperCALayer; - [wrapperCALayer addSublayer:(CALayer*)aCALayer]; - mContentsScaleFactor = aContentsScaleFactor; - size_t intScaleFactor = ceil(mContentsScaleFactor); - SetBounds(aWidth, aHeight); - - // We target rendering to a CGImage if no shared IOSurface are given. - if (!mIOSurface) { - mCGData = malloc(aWidth*intScaleFactor*aHeight*4*intScaleFactor); - if (!mCGData) { - mUnsupportedWidth = aWidth; - mUnsupportedHeight = aHeight; - Destroy(); - return NS_ERROR_FAILURE; - } - memset(mCGData, 0, aWidth*intScaleFactor*aHeight*4*intScaleFactor); - - CGDataProviderRef dataProvider = nullptr; - dataProvider = ::CGDataProviderCreateWithData(mCGData, - mCGData, aHeight*intScaleFactor*aWidth*4*intScaleFactor, - cgdata_release_callback); - if (!dataProvider) { - cgdata_release_callback(mCGData, mCGData, - aHeight*intScaleFactor*aWidth*4*intScaleFactor); - mUnsupportedWidth = aWidth; - mUnsupportedHeight = aHeight; - Destroy(); - return NS_ERROR_FAILURE; - } - - CGColorSpaceRef colorSpace = CreateSystemColorSpace(); - - mCGImage = ::CGImageCreate(aWidth * intScaleFactor, aHeight * intScaleFactor, - 8, 32, aWidth * intScaleFactor * 4, colorSpace, - kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host, - dataProvider, nullptr, true, kCGRenderingIntentDefault); - - ::CGDataProviderRelease(dataProvider); - ::CGColorSpaceRelease(colorSpace); - if (!mCGImage) { - mUnsupportedWidth = aWidth; - mUnsupportedHeight = aHeight; - Destroy(); - return NS_ERROR_FAILURE; - } - } - - CGLContextObj oldContext = ::CGLGetCurrentContext(); - ::CGLSetCurrentContext(mOpenGLContext); - - if (mIOSurface) { - // Create the IOSurface mapped texture. - ::glGenTextures(1, &mIOTexture); - ::glBindTexture(GL_TEXTURE_RECTANGLE_ARB, mIOTexture); - ::glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - ::glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - MacIOSurfaceLib::CGLTexImageIOSurface2D(mOpenGLContext, GL_TEXTURE_RECTANGLE_ARB, - GL_RGBA, aWidth * intScaleFactor, - aHeight * intScaleFactor, - GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, - mIOSurface->mIOSurfacePtr, 0); - ::glBindTexture(GL_TEXTURE_RECTANGLE_ARB, 0); - } else { - ::glGenTextures(1, &mFBOTexture); - ::glBindTexture(GL_TEXTURE_RECTANGLE_ARB, mFBOTexture); - ::glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - ::glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - ::glBindTexture(GL_TEXTURE_RECTANGLE_ARB, 0); - } - - // Create the fbo - ::glGenFramebuffersEXT(1, &mFBO); - ::glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, mFBO); - if (mIOSurface) { - ::glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, - GL_TEXTURE_RECTANGLE_ARB, mIOTexture, 0); - } else { - ::glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, - GL_TEXTURE_RECTANGLE_ARB, mFBOTexture, 0); - } - - - // Make sure that the Framebuffer configuration is supported on the client machine - GLenum fboStatus; - fboStatus = ::glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); - if (fboStatus != GL_FRAMEBUFFER_COMPLETE_EXT) { - NS_ERROR("FBO not supported"); - if (oldContext) - ::CGLSetCurrentContext(oldContext); - mUnsupportedWidth = aWidth; - mUnsupportedHeight = aHeight; - Destroy(); - return NS_ERROR_FAILURE; - } - - SetViewport(aWidth, aHeight); - - GLenum result = ::glGetError(); - if (result != GL_NO_ERROR) { - NS_ERROR("Unexpected OpenGL Error"); - mUnsupportedWidth = aWidth; - mUnsupportedHeight = aHeight; - Destroy(); - if (oldContext) - ::CGLSetCurrentContext(oldContext); - return NS_ERROR_FAILURE; - } - - if (oldContext) - ::CGLSetCurrentContext(oldContext); - - return NS_OK; -} - -void nsCARenderer::SetBounds(int aWidth, int aHeight) { - CARenderer* caRenderer = (CARenderer*)mCARenderer; - CALayer* wrapperLayer = (CALayer*)mWrapperCALayer; - NSArray* sublayers = [wrapperLayer sublayers]; - CALayer* pluginLayer = (CALayer*) [sublayers objectAtIndex:0]; - - // Create a transaction and disable animations - // to make the position update instant. - [CATransaction begin]; - NSMutableDictionary *newActions = - [[NSMutableDictionary alloc] initWithObjectsAndKeys: - [NSNull null], @"onOrderIn", - [NSNull null], @"onOrderOut", - [NSNull null], @"sublayers", - [NSNull null], @"contents", - [NSNull null], @"position", - [NSNull null], @"bounds", - nil]; - wrapperLayer.actions = newActions; - [newActions release]; - - // If we're in HiDPI mode, mContentsScaleFactor will (presumably) be 2.0. - // For some reason, to make things work properly in HiDPI mode we need to - // make caRenderer's 'bounds' and 'layer' different sizes -- to set 'bounds' - // to the size of 'layer's backing store. And to avoid this possibly - // confusing the plugin, we need to hide it's effects from the plugin by - // making pluginLayer (usually the CALayer* provided by the plugin) a - // sublayer of our own wrapperLayer (see bug 829284). - size_t intScaleFactor = ceil(mContentsScaleFactor); - [CATransaction setValue: [NSNumber numberWithFloat:0.0f] forKey: kCATransactionAnimationDuration]; - [CATransaction setValue: (id) kCFBooleanTrue forKey: kCATransactionDisableActions]; - [wrapperLayer setBounds:CGRectMake(0, 0, aWidth, aHeight)]; - [wrapperLayer setPosition:CGPointMake(aWidth/2.0, aHeight/2.0)]; - [pluginLayer setBounds:CGRectMake(0, 0, aWidth, aHeight)]; - [pluginLayer setFrame:CGRectMake(0, 0, aWidth, aHeight)]; - caRenderer.bounds = CGRectMake(0, 0, aWidth * intScaleFactor, aHeight * intScaleFactor); - if (mContentsScaleFactor != 1.0) { - CGAffineTransform affineTransform = [wrapperLayer affineTransform]; - affineTransform.a = mContentsScaleFactor; - affineTransform.d = mContentsScaleFactor; - affineTransform.tx = ((double)aWidth)/mContentsScaleFactor; - affineTransform.ty = ((double)aHeight)/mContentsScaleFactor; - [wrapperLayer setAffineTransform:affineTransform]; - } else { - // These settings are the default values. But they might have been - // changed as above if we were previously running in a HiDPI mode - // (i.e. if we just switched from that to a non-HiDPI mode). - [wrapperLayer setAffineTransform:CGAffineTransformIdentity]; - } - [CATransaction commit]; -} - -void nsCARenderer::SetViewport(int aWidth, int aHeight) { - size_t intScaleFactor = ceil(mContentsScaleFactor); - aWidth *= intScaleFactor; - aHeight *= intScaleFactor; - - ::glViewport(0.0, 0.0, aWidth, aHeight); - ::glMatrixMode(GL_PROJECTION); - ::glLoadIdentity(); - ::glOrtho (0.0, aWidth, 0.0, aHeight, -1, 1); - - // Render upside down to speed up CGContextDrawImage - ::glTranslatef(0.0f, aHeight, 0.0); - ::glScalef(1.0, -1.0, 1.0); -} - -void nsCARenderer::AttachIOSurface(MacIOSurface *aSurface) { - if (mIOSurface && - aSurface->GetIOSurfaceID() == mIOSurface->GetIOSurfaceID()) { - return; - } - - mIOSurface = aSurface; - - // Update the framebuffer and viewport - if (mCARenderer) { - CARenderer* caRenderer = (CARenderer*)mCARenderer; - size_t intScaleFactor = ceil(mContentsScaleFactor); - int width = caRenderer.bounds.size.width / intScaleFactor; - int height = caRenderer.bounds.size.height / intScaleFactor; - - CGLContextObj oldContext = ::CGLGetCurrentContext(); - ::CGLSetCurrentContext(mOpenGLContext); - ::glBindTexture(GL_TEXTURE_RECTANGLE_ARB, mIOTexture); - MacIOSurfaceLib::CGLTexImageIOSurface2D(mOpenGLContext, GL_TEXTURE_RECTANGLE_ARB, - GL_RGBA, mIOSurface->GetDevicePixelWidth(), - mIOSurface->GetDevicePixelHeight(), - GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, - mIOSurface->mIOSurfacePtr, 0); - ::glBindTexture(GL_TEXTURE_RECTANGLE_ARB, 0); - - // Rebind the FBO to make it live - ::glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, mFBO); - - if (static_cast(mIOSurface->GetWidth()) != width || - static_cast(mIOSurface->GetHeight()) != height) { - width = mIOSurface->GetWidth(); - height = mIOSurface->GetHeight(); - SetBounds(width, height); - SetViewport(width, height); - } - - if (oldContext) { - ::CGLSetCurrentContext(oldContext); - } - } -} - -IOSurfaceID nsCARenderer::GetIOSurfaceID() { - if (!mIOSurface) { - return 0; - } - - return mIOSurface->GetIOSurfaceID(); -} - -nsresult nsCARenderer::Render(int aWidth, int aHeight, - double aContentsScaleFactor, - CGImageRef *aOutCGImage) { - if (!aOutCGImage && !mIOSurface) { - NS_ERROR("No target destination for rendering"); - } else if (aOutCGImage) { - // We are expected to return a CGImageRef, we will set - // it to nullptr in case we fail before the image is ready. - *aOutCGImage = nullptr; - } - - if (aWidth == 0 || aHeight == 0 || aContentsScaleFactor <= 0) - return NS_OK; - - if (!mCARenderer || !mWrapperCALayer) { - return NS_ERROR_FAILURE; - } - - CARenderer* caRenderer = (CARenderer*)mCARenderer; - CALayer* wrapperLayer = (CALayer*)mWrapperCALayer; - size_t intScaleFactor = ceil(aContentsScaleFactor); - int renderer_width = caRenderer.bounds.size.width / intScaleFactor; - int renderer_height = caRenderer.bounds.size.height / intScaleFactor; - - if (renderer_width != aWidth || renderer_height != aHeight || - mContentsScaleFactor != aContentsScaleFactor) { - // XXX: This should be optimized to not rescale the buffer - // if we are resizing down. - // caLayer may be the CALayer* provided by the plugin, so we need to - // preserve it across the call to Destroy(). - NSArray* sublayers = [wrapperLayer sublayers]; - CALayer* caLayer = (CALayer*) [sublayers objectAtIndex:0]; - // mIOSurface is set by AttachIOSurface(), not by SetupRenderer(). So - // since it may have been set by a prior call to AttachIOSurface(), we - // need to preserve it across the call to Destroy(). - RefPtr ioSurface = mIOSurface; - Destroy(); - mIOSurface = ioSurface; - if (SetupRenderer(caLayer, aWidth, aHeight, aContentsScaleFactor, - mAllowOfflineRenderer) != NS_OK) { - return NS_ERROR_FAILURE; - } - - caRenderer = (CARenderer*)mCARenderer; - } - - CGLContextObj oldContext = ::CGLGetCurrentContext(); - ::CGLSetCurrentContext(mOpenGLContext); - if (!mIOSurface) { - // If no shared IOSurface is given render to our own - // texture for readback. - ::glGenTextures(1, &mFBOTexture); - } - - GLenum result = ::glGetError(); - if (result != GL_NO_ERROR) { - NS_ERROR("Unexpected OpenGL Error"); - Destroy(); - if (oldContext) - ::CGLSetCurrentContext(oldContext); - return NS_ERROR_FAILURE; - } - - ::glClearColor(0.0, 0.0, 0.0, 0.0); - ::glClear(GL_COLOR_BUFFER_BIT); - - [CATransaction commit]; - double caTime = ::CACurrentMediaTime(); - [caRenderer beginFrameAtTime:caTime timeStamp:nullptr]; - [caRenderer addUpdateRect:CGRectMake(0,0, aWidth * intScaleFactor, - aHeight * intScaleFactor)]; - [caRenderer render]; - [caRenderer endFrame]; - - // Read the data back either to the IOSurface or mCGImage. - if (mIOSurface) { - ::glFlush(); - } else { - ::glPixelStorei(GL_PACK_ALIGNMENT, 4); - ::glPixelStorei(GL_PACK_ROW_LENGTH, 0); - ::glPixelStorei(GL_PACK_SKIP_ROWS, 0); - ::glPixelStorei(GL_PACK_SKIP_PIXELS, 0); - - ::glReadPixels(0.0f, 0.0f, aWidth * intScaleFactor, - aHeight * intScaleFactor, - GL_BGRA, GL_UNSIGNED_BYTE, - mCGData); - - *aOutCGImage = mCGImage; - } - - if (oldContext) { - ::CGLSetCurrentContext(oldContext); - } - - return NS_OK; -} - -nsresult nsCARenderer::DrawSurfaceToCGContext(CGContextRef aContext, - MacIOSurface *surf, - CGColorSpaceRef aColorSpace, - int aX, int aY, - size_t aWidth, size_t aHeight) { - surf->Lock(); - size_t bytesPerRow = surf->GetBytesPerRow(); - size_t ioWidth = surf->GetWidth(); - size_t ioHeight = surf->GetHeight(); - - // We get rendering glitches if we use a width/height that falls - // outside of the IOSurface. - if (aWidth + aX > ioWidth) - aWidth = ioWidth - aX; - if (aHeight + aY > ioHeight) - aHeight = ioHeight - aY; - - if (aX < 0 || static_cast(aX) >= ioWidth || - aY < 0 || static_cast(aY) >= ioHeight) { - surf->Unlock(); - return NS_ERROR_FAILURE; - } - - void* ioData = surf->GetBaseAddress(); - double scaleFactor = surf->GetContentsScaleFactor(); - size_t intScaleFactor = ceil(surf->GetContentsScaleFactor()); - CGDataProviderRef dataProvider = ::CGDataProviderCreateWithData(ioData, - ioData, ioHeight*intScaleFactor*(bytesPerRow)*4, - nullptr); //No release callback - if (!dataProvider) { - surf->Unlock(); - return NS_ERROR_FAILURE; - } - - CGImageRef cgImage = ::CGImageCreate(ioWidth * intScaleFactor, - ioHeight * intScaleFactor, 8, 32, bytesPerRow, aColorSpace, - kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host, - dataProvider, nullptr, true, kCGRenderingIntentDefault); - ::CGDataProviderRelease(dataProvider); - if (!cgImage) { - surf->Unlock(); - return NS_ERROR_FAILURE; - } - CGImageRef subImage = ::CGImageCreateWithImageInRect(cgImage, - ::CGRectMake(aX * scaleFactor, - aY * scaleFactor, - aWidth * scaleFactor, - aHeight * scaleFactor)); - if (!subImage) { - ::CGImageRelease(cgImage); - surf->Unlock(); - return NS_ERROR_FAILURE; - } - - ::CGContextScaleCTM(aContext, 1.0f, -1.0f); - ::CGContextDrawImage(aContext, - CGRectMake(aX * scaleFactor, - (-(CGFloat)aY - (CGFloat)aHeight) * scaleFactor, - aWidth * scaleFactor, - aHeight * scaleFactor), - subImage); - - ::CGImageRelease(subImage); - ::CGImageRelease(cgImage); - surf->Unlock(); - return NS_OK; -} - -void nsCARenderer::DetachCALayer() { - CALayer* wrapperLayer = (CALayer*)mWrapperCALayer; - NSArray* sublayers = [wrapperLayer sublayers]; - CALayer* oldLayer = (CALayer*) [sublayers objectAtIndex:0]; - [oldLayer removeFromSuperlayer]; -} - -void nsCARenderer::AttachCALayer(void *aCALayer) { - CALayer* wrapperLayer = (CALayer*)mWrapperCALayer; - NSArray* sublayers = [wrapperLayer sublayers]; - CALayer* oldLayer = (CALayer*) [sublayers objectAtIndex:0]; - [oldLayer removeFromSuperlayer]; - [wrapperLayer addSublayer:(CALayer*)aCALayer]; -} - -#ifdef DEBUG - -int sSaveToDiskSequence = 0; -void nsCARenderer::SaveToDisk(MacIOSurface *surf) { - surf->Lock(); - size_t bytesPerRow = surf->GetBytesPerRow(); - size_t ioWidth = surf->GetWidth(); - size_t ioHeight = surf->GetHeight(); - void* ioData = surf->GetBaseAddress(); - CGDataProviderRef dataProvider = ::CGDataProviderCreateWithData(ioData, - ioData, ioHeight*(bytesPerRow)*4, - nullptr); //No release callback - if (!dataProvider) { - surf->Unlock(); - return; - } - - CGColorSpaceRef colorSpace = CreateSystemColorSpace(); - CGImageRef cgImage = ::CGImageCreate(ioWidth, ioHeight, 8, 32, bytesPerRow, - colorSpace, kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host, - dataProvider, nullptr, true, kCGRenderingIntentDefault); - ::CGDataProviderRelease(dataProvider); - ::CGColorSpaceRelease(colorSpace); - if (!cgImage) { - surf->Unlock(); - return; - } - - char cstr[1000]; - SprintfLiteral(cstr, "file:///Users/benoitgirard/debug/iosurface_%i.png", ++sSaveToDiskSequence); - - CFStringRef cfStr = ::CFStringCreateWithCString(kCFAllocatorDefault, cstr, kCFStringEncodingMacRoman); - - printf("Exporting: %s\n", cstr); - CFURLRef url = ::CFURLCreateWithString( nullptr, cfStr, nullptr); - ::CFRelease(cfStr); - - CFStringRef type = kUTTypePNG; - size_t count = 1; - CFDictionaryRef options = nullptr; - CGImageDestinationRef dest = ::CGImageDestinationCreateWithURL(url, type, count, options); - ::CFRelease(url); - - ::CGImageDestinationAddImage(dest, cgImage, nullptr); - - ::CGImageDestinationFinalize(dest); - ::CFRelease(dest); - ::CGImageRelease(cgImage); - - surf->Unlock(); - - return; - -} - -#endif diff --git a/gfx/2d/SFNTNameTable.cpp b/gfx/2d/SFNTNameTable.cpp index e187b7f047..e7da2305c9 100644 --- a/gfx/2d/SFNTNameTable.cpp +++ b/gfx/2d/SFNTNameTable.cpp @@ -9,10 +9,6 @@ #include "Logging.h" #include "mozilla/Move.h" -#if defined(XP_MACOSX) -#include -#endif - namespace mozilla { namespace gfx { @@ -61,9 +57,6 @@ struct NameRecord enum ENameDecoder : int { eNameDecoderUTF16, -#if defined(XP_MACOSX) - eNameDecoderMacRoman, -#endif eNameDecoderNone }; @@ -128,19 +121,6 @@ IsUTF16Encoding(const NameRecord *aNameRecord) return false; } -#if defined(XP_MACOSX) -static bool -IsMacRomanEncoding(const NameRecord *aNameRecord) -{ - if (aNameRecord->platformID == PLATFORM_ID_MAC && - aNameRecord->encodingID == ENCODING_ID_MAC_ROMAN) { - return true; - } - - return false; -} -#endif - static NameRecordMatchers* CreateCanonicalMatchers(const BigEndianUint16& aNameID) { @@ -149,37 +129,6 @@ CreateCanonicalMatchers(const BigEndianUint16& aNameID) // records and Mac platform records. NameRecordMatchers *matchers = new NameRecordMatchers(); -#if defined(XP_MACOSX) - // First, look for the English name. - if (!matchers->append( - [=](const NameRecord *aNameRecord) { - if (aNameRecord->nameID == aNameID && - aNameRecord->languageID == LANG_ID_MAC_ENGLISH && - aNameRecord->platformID == PLATFORM_ID_MAC && - IsMacRomanEncoding(aNameRecord)) { - return eNameDecoderMacRoman; - } else { - return eNameDecoderNone; - } - })) { - MOZ_CRASH(); - } - - // Second, look for all languages. - if (!matchers->append( - [=](const NameRecord *aNameRecord) { - if (aNameRecord->nameID == aNameID && - aNameRecord->platformID == PLATFORM_ID_MAC && - IsMacRomanEncoding(aNameRecord)) { - return eNameDecoderMacRoman; - } else { - return eNameDecoderNone; - } - })) { - MOZ_CRASH(); - } -#endif /* defined(XP_MACOSX) */ - // First, look for the English name (this will normally succeed). if (!matchers->append( [=](const NameRecord *aNameRecord) { @@ -273,10 +222,6 @@ SFNTNameTable::ReadU16Name(const NameRecordMatchers& aMatchers, switch (aMatchers[i](record)) { case eNameDecoderUTF16: return ReadU16NameFromU16Record(record, aU16Name); -#if defined(XP_MACOSX) - case eNameDecoderMacRoman: - return ReadU16NameFromMacRomanRecord(record, aU16Name); -#endif case eNameDecoderNone: break; default: @@ -311,46 +256,5 @@ SFNTNameTable::ReadU16NameFromU16Record(const NameRecord *aNameRecord, return true; } -#if defined(XP_MACOSX) -bool -SFNTNameTable::ReadU16NameFromMacRomanRecord(const NameRecord *aNameRecord, - mozilla::u16string& aU16Name) -{ - uint32_t offset = aNameRecord->offset; - uint32_t length = aNameRecord->length; - if (mStringDataLength < offset + length) { - gfxWarning() << "Name data too short to contain name string."; - return false; - } - if (length > INT_MAX) { - gfxWarning() << "Name record too long to decode."; - return false; - } - - // pointer to the Mac Roman encoded string in the name record - const uint8_t *encodedStr = mStringData + offset; - - CFStringRef cfString; - cfString = CFStringCreateWithBytesNoCopy(kCFAllocatorDefault, encodedStr, - length, kCFStringEncodingMacRoman, - false, kCFAllocatorNull); - - // length (in UTF-16 code pairs) of the decoded string - CFIndex decodedLength = CFStringGetLength(cfString); - - // temporary buffer - UniquePtr u16Buffer = MakeUnique(decodedLength); - - CFStringGetCharacters(cfString, CFRangeMake(0, decodedLength), - u16Buffer.get()); - - CFRelease(cfString); - - aU16Name.assign(reinterpret_cast(u16Buffer.get()), decodedLength); - - return true; -} -#endif - } // gfx } // mozilla diff --git a/gfx/2d/SFNTNameTable.h b/gfx/2d/SFNTNameTable.h index a38ef0186e..3fb1ee0bc8 100644 --- a/gfx/2d/SFNTNameTable.h +++ b/gfx/2d/SFNTNameTable.h @@ -55,11 +55,6 @@ private: bool ReadU16NameFromU16Record(const NameRecord *aNameRecord, mozilla::u16string& aU16Name); -#if defined(XP_MACOSX) - bool ReadU16NameFromMacRomanRecord(const NameRecord *aNameRecord, - mozilla::u16string& aU16Name); -#endif - const NameRecord *mFirstRecord; const NameRecord *mEndOfRecords; const uint8_t *mStringData; diff --git a/gfx/2d/ScaledFontMac.cpp b/gfx/2d/ScaledFontMac.cpp deleted file mode 100644 index 6baf257826..0000000000 --- a/gfx/2d/ScaledFontMac.cpp +++ /dev/null @@ -1,247 +0,0 @@ -/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * 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/. */ - -#include "ScaledFontMac.h" -#ifdef USE_SKIA -#include "PathSkia.h" -#include "skia/include/core/SkPaint.h" -#include "skia/include/core/SkPath.h" -#include "skia/include/ports/SkTypeface_mac.h" -#endif -#include -#include -#ifdef MOZ_WIDGET_UIKIT -#include -#endif - -#ifdef MOZ_WIDGET_COCOA -// prototype for private API -extern "C" { -CGPathRef CGFontGetGlyphPath(CGFontRef fontRef, CGAffineTransform *textTransform, int unknown, CGGlyph glyph); -}; -#endif - -#ifdef USE_CAIRO_SCALED_FONT -#include "cairo-quartz.h" -#endif - -namespace mozilla { -namespace gfx { - -ScaledFontMac::CTFontDrawGlyphsFuncT* ScaledFontMac::CTFontDrawGlyphsPtr = nullptr; -bool ScaledFontMac::sSymbolLookupDone = false; - -ScaledFontMac::ScaledFontMac(CGFontRef aFont, Float aSize) - : ScaledFontBase(aSize) -{ - if (!sSymbolLookupDone) { - CTFontDrawGlyphsPtr = - (CTFontDrawGlyphsFuncT*)dlsym(RTLD_DEFAULT, "CTFontDrawGlyphs"); - sSymbolLookupDone = true; - } - - // XXX: should we be taking a reference - mFont = CGFontRetain(aFont); - if (CTFontDrawGlyphsPtr != nullptr) { - // only create mCTFont if we're going to be using the CTFontDrawGlyphs API - mCTFont = CTFontCreateWithGraphicsFont(aFont, aSize, nullptr, nullptr); - } else { - mCTFont = nullptr; - } -} - -ScaledFontMac::~ScaledFontMac() -{ - if (mCTFont) { - CFRelease(mCTFont); - } - CGFontRelease(mFont); -} - -#ifdef USE_SKIA -SkTypeface* ScaledFontMac::GetSkTypeface() -{ - if (!mTypeface) { - if (mCTFont) { - mTypeface = SkCreateTypefaceFromCTFont(mCTFont); - } else { - CTFontRef fontFace = CTFontCreateWithGraphicsFont(mFont, mSize, nullptr, nullptr); - mTypeface = SkCreateTypefaceFromCTFont(fontFace); - CFRelease(fontFace); - } - } - return mTypeface; -} -#endif - -// private API here are the public options on OS X -// CTFontCreatePathForGlyph -// ATSUGlyphGetCubicPaths -// we've used this in cairo sucessfully for some time. -// Note: cairo dlsyms it. We could do that but maybe it's -// safe just to use? - -already_AddRefed -ScaledFontMac::GetPathForGlyphs(const GlyphBuffer &aBuffer, const DrawTarget *aTarget) -{ - return ScaledFontBase::GetPathForGlyphs(aBuffer, aTarget); -} - -uint32_t -CalcTableChecksum(const uint32_t *tableStart, uint32_t length, bool skipChecksumAdjust = false) -{ - uint32_t sum = 0L; - const uint32_t *table = tableStart; - const uint32_t *end = table+((length+3) & ~3) / sizeof(uint32_t); - while (table < end) { - if (skipChecksumAdjust && (table - tableStart) == 2) { - table++; - } else { - sum += CFSwapInt32BigToHost(*table++); - } - } - return sum; -} - -struct TableRecord { - uint32_t tag; - uint32_t checkSum; - uint32_t offset; - uint32_t length; - CFDataRef data; -}; - -int maxPow2LessThan(int a) -{ - int x = 1; - int shift = 0; - while ((x<<(shift+1)) < a) { - shift++; - } - return shift; -} - -struct writeBuf -{ - explicit writeBuf(int size) - { - this->data = new unsigned char [size]; - this->offset = 0; - } - ~writeBuf() { - delete this->data; - } - - template - void writeElement(T a) - { - *reinterpret_cast(&this->data[this->offset]) = a; - this->offset += sizeof(T); - } - - void writeMem(const void *data, unsigned long length) - { - memcpy(&this->data[this->offset], data, length); - this->offset += length; - } - - void align() - { - while (this->offset & 3) { - this->data[this->offset] = 0; - this->offset++; - } - } - - unsigned char *data; - int offset; -}; - -bool -ScaledFontMac::GetFontFileData(FontFileDataOutput aDataCallback, void *aBaton) -{ - // We'll reconstruct a TTF font from the tables we can get from the CGFont - CFArrayRef tags = CGFontCopyTableTags(mFont); - CFIndex count = CFArrayGetCount(tags); - - TableRecord *records = new TableRecord[count]; - uint32_t offset = 0; - offset += sizeof(uint32_t)*3; - offset += sizeof(uint32_t)*4*count; - bool CFF = false; - for (CFIndex i = 0; i(CFDataGetBytePtr(data)), - records[i].length, skipChecksumAdjust); - offset += records[i].length; - // 32 bit align the tables - offset = (offset + 3) & ~3; - } - CFRelease(tags); - - struct writeBuf buf(offset); - // write header/offset table - if (CFF) { - buf.writeElement(CFSwapInt32HostToBig(0x4f54544f)); - } else { - buf.writeElement(CFSwapInt32HostToBig(0x00010000)); - } - buf.writeElement(CFSwapInt16HostToBig(count)); - buf.writeElement(CFSwapInt16HostToBig((1<(buf.data), offset)); - // set checkSumAdjust to the computed checksum - memcpy(&buf.data[checkSumAdjustmentOffset], &fontChecksum, sizeof(fontChecksum)); - - // we always use an index of 0 - aDataCallback(buf.data, buf.offset, 0, mSize, aBaton); - - return true; - -} - -#ifdef USE_CAIRO_SCALED_FONT -cairo_font_face_t* -ScaledFontMac::GetCairoFontFace() -{ - MOZ_ASSERT(mFont); - return cairo_quartz_font_face_create_for_cgfont(mFont); -} -#endif - -} // namespace gfx -} // namespace mozilla diff --git a/gfx/2d/ScaledFontMac.h b/gfx/2d/ScaledFontMac.h deleted file mode 100644 index c141f96b26..0000000000 --- a/gfx/2d/ScaledFontMac.h +++ /dev/null @@ -1,79 +0,0 @@ -/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * 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_GFX_SCALEDFONTMAC_H_ -#define MOZILLA_GFX_SCALEDFONTMAC_H_ - -#ifdef MOZ_WIDGET_COCOA -#include -#else -#include -#include -#endif - -#include "2D.h" - -#include "ScaledFontBase.h" - -namespace mozilla { -namespace gfx { - -class GlyphRenderingOptionsCG : public GlyphRenderingOptions -{ -public: - MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(GlyphRenderingOptionsCG, override) - - explicit GlyphRenderingOptionsCG(const Color &aFontSmoothingBackgroundColor) - : mFontSmoothingBackgroundColor(aFontSmoothingBackgroundColor) - {} - - const Color &FontSmoothingBackgroundColor() const { return mFontSmoothingBackgroundColor; } - - virtual FontType GetType() const override { return FontType::MAC; } - -private: - Color mFontSmoothingBackgroundColor; -}; - -class ScaledFontMac : public ScaledFontBase -{ -public: - MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(ScaledFontMac) - ScaledFontMac(CGFontRef aFont, Float aSize); - virtual ~ScaledFontMac(); - - virtual FontType GetType() const { return FontType::MAC; } -#ifdef USE_SKIA - virtual SkTypeface* GetSkTypeface(); -#endif - virtual already_AddRefed GetPathForGlyphs(const GlyphBuffer &aBuffer, const DrawTarget *aTarget); - virtual bool GetFontFileData(FontFileDataOutput aDataCallback, void *aBaton); - -#ifdef USE_CAIRO_SCALED_FONT - cairo_font_face_t* GetCairoFontFace(); -#endif - -private: - friend class DrawTargetSkia; - CGFontRef mFont; - CTFontRef mCTFont; // only created if CTFontDrawGlyphs is available, otherwise null - - typedef void (CTFontDrawGlyphsFuncT)(CTFontRef, - const CGGlyph[], const CGPoint[], - size_t, CGContextRef); - - static bool sSymbolLookupDone; - -public: - // function pointer for CTFontDrawGlyphs, if available; - // initialized the first time a ScaledFontMac is created, - // so it will be valid by the time DrawTargetCG wants to use it - static CTFontDrawGlyphsFuncT* CTFontDrawGlyphsPtr; -}; - -} // namespace gfx -} // namespace mozilla - -#endif /* MOZILLA_GFX_SCALEDFONTMAC_H_ */ diff --git a/gfx/2d/moz.build b/gfx/2d/moz.build index 4f437d575a..7a80b1de2e 100644 --- a/gfx/2d/moz.build +++ b/gfx/2d/moz.build @@ -58,16 +58,7 @@ EXPORTS.mozilla.gfx += [ EXPORTS.mozilla.gfx += ['ssse3-scaler.h'] -if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('cocoa', 'uikit'): - EXPORTS.mozilla.gfx += [ - 'MacIOSurface.h', - ] - SOURCES += [ - 'NativeFontResourceMac.cpp', - 'PathCG.cpp', - 'ScaledFontMac.cpp', - ] -elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows': +if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows': SOURCES += [ 'DrawTargetD2D1.cpp', 'ExtendInputEffectD2D1.cpp', @@ -181,15 +172,6 @@ if CONFIG['CLANG_CXX']: if CONFIG['GNU_CXX']: CXXFLAGS += ['-Wno-error=shadow'] -if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': - EXPORTS.mozilla.gfx += [ - 'QuartzSupport.h', - ] - SOURCES += [ - 'MacIOSurface.cpp', - 'QuartzSupport.mm', - ] - if CONFIG['CPU_ARCH'] == 'arm' and CONFIG['BUILD_ARM_NEON']: SOURCES += ['BlurNEON.cpp'] SOURCES['BlurNEON.cpp'].flags += CONFIG['NEON_FLAGS'] diff --git a/gfx/gl/GLBlitHelper.cpp b/gfx/gl/GLBlitHelper.cpp index da7f5b462d..12e30c8804 100644 --- a/gfx/gl/GLBlitHelper.cpp +++ b/gfx/gl/GLBlitHelper.cpp @@ -14,11 +14,6 @@ #include "mozilla/gfx/Matrix.h" #include "mozilla/UniquePtr.h" -#ifdef XP_MACOSX -#include "MacIOSurfaceImage.h" -#include "GLContextCGL.h" -#endif - using mozilla::layers::PlanarYCbCrImage; using mozilla::layers::PlanarYCbCrData; @@ -186,34 +181,6 @@ GLBlitHelper::InitTexQuadProgram(BlitType target) } \n\ "; -#ifdef XP_MACOSX - const char kTexNV12PlanarBlit_FragShaderSource[] = "\ - #version 100 \n\ - #extension GL_ARB_texture_rectangle : require \n\ - #ifdef GL_ES \n\ - precision mediump float \n\ - #endif \n\ - varying vec2 vTexCoord; \n\ - uniform sampler2DRect uYTexture; \n\ - uniform sampler2DRect uCbCrTexture; \n\ - uniform vec2 uYTexScale; \n\ - uniform vec2 uCbCrTexScale; \n\ - void main() \n\ - { \n\ - float y = texture2DRect(uYTexture, vTexCoord * uYTexScale).r; \n\ - float cb = texture2DRect(uCbCrTexture, vTexCoord * uCbCrTexScale).r; \n\ - float cr = texture2DRect(uCbCrTexture, vTexCoord * uCbCrTexScale).a; \n\ - y = (y - 0.06275) * 1.16438; \n\ - cb = cb - 0.50196; \n\ - cr = cr - 0.50196; \n\ - gl_FragColor.r = y + cr * 1.59603; \n\ - gl_FragColor.g = y - 0.81297 * cr - 0.39176 * cb; \n\ - gl_FragColor.b = y + cb * 2.01723; \n\ - gl_FragColor.a = 1.0; \n\ - } \n\ - "; -#endif - bool success = false; GLuint* programPtr; @@ -236,13 +203,6 @@ GLBlitHelper::InitTexQuadProgram(BlitType target) fragShaderPtr = &mTexYUVPlanarBlit_FragShader; fragShaderSource = kTexYUVPlanarBlit_FragShaderSource; break; -#ifdef XP_MACOSX - case ConvertMacIOSurfaceImage: - programPtr = &mTexNV12PlanarBlit_Program; - fragShaderPtr = &mTexNV12PlanarBlit_FragShader; - fragShaderSource = kTexNV12PlanarBlit_FragShaderSource; - break; -#endif default: return false; } @@ -393,24 +353,6 @@ GLBlitHelper::InitTexQuadProgram(BlitType target) mGL->fUniform1i(texCr, Channel_Cr); break; } - case ConvertMacIOSurfaceImage: { -#ifdef XP_MACOSX - GLint texY = mGL->fGetUniformLocation(program, "uYTexture"); - GLint texCbCr = mGL->fGetUniformLocation(program, "uCbCrTexture"); - mYTexScaleLoc = mGL->fGetUniformLocation(program, "uYTexScale"); - mCbCrTexScaleLoc= mGL->fGetUniformLocation(program, "uCbCrTexScale"); - - DebugOnly hasUniformLocations = texY != -1 && - texCbCr != -1 && - mYTexScaleLoc != -1 && - mCbCrTexScaleLoc != -1; - MOZ_ASSERT(hasUniformLocations, "uniforms not found"); - - mGL->fUniform1i(texY, Channel_Y); - mGL->fUniform1i(texCbCr, Channel_Cb); -#endif - break; - } default: return false; } @@ -678,47 +620,6 @@ GLBlitHelper::BlitPlanarYCbCrImage(layers::PlanarYCbCrImage* yuvImage) return true; } -#ifdef XP_MACOSX -bool -GLBlitHelper::BlitMacIOSurfaceImage(layers::MacIOSurfaceImage* ioImage) -{ - ScopedBindTextureUnit boundTU(mGL, LOCAL_GL_TEXTURE0); - MacIOSurface* surf = ioImage->GetSurface(); - - GLint oldTex[2]; - for (int i = 0; i < 2; i++) { - mGL->fActiveTexture(LOCAL_GL_TEXTURE0 + i); - mGL->fGetIntegerv(LOCAL_GL_TEXTURE_BINDING_2D, &oldTex[i]); - } - - GLuint textures[2]; - mGL->fGenTextures(2, textures); - - mGL->fActiveTexture(LOCAL_GL_TEXTURE0); - mGL->fBindTexture(LOCAL_GL_TEXTURE_RECTANGLE_ARB, textures[0]); - mGL->fTexParameteri(LOCAL_GL_TEXTURE_RECTANGLE_ARB, LOCAL_GL_TEXTURE_WRAP_T, LOCAL_GL_CLAMP_TO_EDGE); - mGL->fTexParameteri(LOCAL_GL_TEXTURE_RECTANGLE_ARB, LOCAL_GL_TEXTURE_WRAP_S, LOCAL_GL_CLAMP_TO_EDGE); - surf->CGLTexImageIOSurface2D(gl::GLContextCGL::Cast(mGL)->GetCGLContext(), 0); - mGL->fUniform2f(mYTexScaleLoc, surf->GetWidth(0), surf->GetHeight(0)); - - mGL->fActiveTexture(LOCAL_GL_TEXTURE1); - mGL->fBindTexture(LOCAL_GL_TEXTURE_RECTANGLE_ARB, textures[1]); - mGL->fTexParameteri(LOCAL_GL_TEXTURE_RECTANGLE_ARB, LOCAL_GL_TEXTURE_WRAP_T, LOCAL_GL_CLAMP_TO_EDGE); - mGL->fTexParameteri(LOCAL_GL_TEXTURE_RECTANGLE_ARB, LOCAL_GL_TEXTURE_WRAP_S, LOCAL_GL_CLAMP_TO_EDGE); - surf->CGLTexImageIOSurface2D(gl::GLContextCGL::Cast(mGL)->GetCGLContext(), 1); - mGL->fUniform2f(mCbCrTexScaleLoc, surf->GetWidth(1), surf->GetHeight(1)); - - mGL->fDrawArrays(LOCAL_GL_TRIANGLE_STRIP, 0, 4); - for (int i = 0; i < 2; i++) { - mGL->fActiveTexture(LOCAL_GL_TEXTURE0 + i); - mGL->fBindTexture(LOCAL_GL_TEXTURE_2D, oldTex[i]); - } - - mGL->fDeleteTextures(2, textures); - return true; -} -#endif - bool GLBlitHelper::BlitImageToFramebuffer(layers::Image* srcImage, const gfx::IntSize& destSize, @@ -736,13 +637,6 @@ GLBlitHelper::BlitImageToFramebuffer(layers::Image* srcImage, srcOrigin = OriginPos::BottomLeft; break; -#ifdef XP_MACOSX - case ImageFormat::MAC_IOSURFACE: - type = ConvertMacIOSurfaceImage; - srcOrigin = OriginPos::TopLeft; - break; -#endif - default: return false; } @@ -768,11 +662,6 @@ GLBlitHelper::BlitImageToFramebuffer(layers::Image* srcImage, return ret; } -#ifdef XP_MACOSX - case ConvertMacIOSurfaceImage: - return BlitMacIOSurfaceImage(srcImage->AsMacIOSurfaceImage()); -#endif - default: return false; } diff --git a/gfx/gl/GLBlitHelper.h b/gfx/gl/GLBlitHelper.h index c2858f5913..9dd8cd8870 100644 --- a/gfx/gl/GLBlitHelper.h +++ b/gfx/gl/GLBlitHelper.h @@ -107,9 +107,6 @@ class GLBlitHelper final void BindAndUploadEGLImage(EGLImage image, GLuint target); bool BlitPlanarYCbCrImage(layers::PlanarYCbCrImage* yuvImage); -#ifdef XP_MACOSX - bool BlitMacIOSurfaceImage(layers::MacIOSurfaceImage* ioImage); -#endif explicit GLBlitHelper(GLContext* gl); diff --git a/gfx/gl/GLContext.cpp b/gfx/gl/GLContext.cpp index 72a7bea58b..0106f4fd09 100644 --- a/gfx/gl/GLContext.cpp +++ b/gfx/gl/GLContext.cpp @@ -36,10 +36,6 @@ #include "mozilla/DebugOnly.h" -#ifdef XP_MACOSX -#include -#endif - #if defined(MOZ_WIDGET_COCOA) #include "nsCocoaFeatures.h" #endif @@ -877,18 +873,6 @@ GLContext::InitWithPrefixImpl(const char* prefix, bool trygl) // multisampling hardcodes blending with the default blendfunc, which breaks WebGL. MarkUnsupported(GLFeature::framebuffer_multisample); } - -#ifdef XP_MACOSX - // The Mac Nvidia driver, for versions up to and including 10.8, - // don't seem to properly support this. See 814839 - // this has been fixed in Mac OS X 10.9. See 907946 - // and it also works in 10.8.3 and higher. See 1094338. - if (Vendor() == gl::GLVendor::NVIDIA && - !nsCocoaFeatures::IsAtLeastVersion(10,8,3)) - { - MarkUnsupported(GLFeature::depth_texture); - } -#endif } if (IsExtensionSupported(GLContext::ARB_pixel_buffer_object)) { @@ -1009,25 +993,6 @@ GLContext::InitWithPrefixImpl(const char* prefix, bool trygl) raw_fGetIntegerv(LOCAL_GL_MAX_RENDERBUFFER_SIZE, &mMaxRenderbufferSize); raw_fGetIntegerv(LOCAL_GL_MAX_VIEWPORT_DIMS, mMaxViewportDims); -#ifdef XP_MACOSX - if (mWorkAroundDriverBugs) { - if (mVendor == GLVendor::Intel) { - // see bug 737182 for 2D textures, bug 684882 for cube map textures. - mMaxTextureSize = std::min(mMaxTextureSize, 4096); - mMaxCubeMapTextureSize = std::min(mMaxCubeMapTextureSize, 512); - // for good measure, we align renderbuffers on what we do for 2D textures - mMaxRenderbufferSize = std::min(mMaxRenderbufferSize, 4096); - mNeedsTextureSizeChecks = true; - } else if (mVendor == GLVendor::NVIDIA) { - // See bug 879656. 8192 fails, 8191 works. - mMaxTextureSize = std::min(mMaxTextureSize, 8191); - mMaxRenderbufferSize = std::min(mMaxRenderbufferSize, 8191); - - // Part of the bug 879656, but it also doesn't hurt the 877949 - mNeedsTextureSizeChecks = true; - } - } -#endif #ifdef MOZ_X11 if (mWorkAroundDriverBugs) { if (mVendor == GLVendor::Nouveau) { @@ -1800,20 +1765,6 @@ GLContext::InitExtensions() MarkExtensionUnsupported(ANGLE_texture_compression_dxt3); MarkExtensionUnsupported(ANGLE_texture_compression_dxt5); } - -#ifdef XP_MACOSX - // Bug 1009642: On OSX Mavericks (10.9), the driver for Intel HD - // 3000 appears to be buggy WRT updating sub-images of S3TC - // textures with glCompressedTexSubImage2D. Works on Intel HD 4000 - // and Intel HD 5000/Iris that I tested. - // Bug 1124996: Appears to be the same on OSX Yosemite (10.10) - if (nsCocoaFeatures::macOSVersionMajor() == 10 && - nsCocoaFeatures::macOSVersionMinor() >= 9 && - Renderer() == GLRenderer::IntelHD3000) - { - MarkExtensionUnsupported(EXT_texture_compression_s3tc); - } -#endif } if (shouldDumpExts) { @@ -2828,35 +2779,6 @@ GLContext::fReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum f } AfterGLReadCall(); - - // Check if GL is giving back 1.0 alpha for - // RGBA reads to RGBA images from no-alpha buffers. -#ifdef XP_MACOSX - if (WorkAroundDriverBugs() && - Vendor() == gl::GLVendor::NVIDIA && - format == LOCAL_GL_RGBA && - type == LOCAL_GL_UNSIGNED_BYTE && - !IsCoreProfile() && - width && height) - { - GLint alphaBits = 0; - fGetIntegerv(LOCAL_GL_ALPHA_BITS, &alphaBits); - if (!alphaBits) { - const uint32_t alphaMask = 0xff000000; - - uint32_t* itr = (uint32_t*)pixels; - uint32_t testPixel = *itr; - if ((testPixel & alphaMask) != alphaMask) { - // We need to set the alpha channel to 1.0 manually. - uint32_t* itrEnd = itr + width*height; // Stride is guaranteed to be width*4. - - for (; itr != itrEnd; itr++) { - *itr |= alphaMask; - } - } - } - } -#endif } void diff --git a/gfx/gl/GLContextProvider.h b/gfx/gl/GLContextProvider.h index 6e096c1f7e..d9b3f04196 100644 --- a/gfx/gl/GLContextProvider.h +++ b/gfx/gl/GLContextProvider.h @@ -34,13 +34,6 @@ namespace gl { #define DEFAULT_IMPL WGL #endif -#ifdef XP_MACOSX - #define GL_CONTEXT_PROVIDER_NAME GLContextProviderCGL - #include "GLContextProviderImpl.h" - #undef GL_CONTEXT_PROVIDER_NAME - #define GL_CONTEXT_PROVIDER_DEFAULT GLContextProviderCGL -#endif - #if defined(MOZ_X11) #define GL_CONTEXT_PROVIDER_NAME GLContextProviderGLX #include "GLContextProviderImpl.h" diff --git a/gfx/gl/GLScreenBuffer.cpp b/gfx/gl/GLScreenBuffer.cpp index 5d95eb9285..0ac0322be4 100644 --- a/gfx/gl/GLScreenBuffer.cpp +++ b/gfx/gl/GLScreenBuffer.cpp @@ -24,10 +24,6 @@ #include "mozilla/gfx/DeviceManagerDx.h" #endif -#ifdef XP_MACOSX -#include "SharedSurfaceIO.h" -#endif - #ifdef GL_PROVIDER_GLX #include "GLXLibrary.h" #include "SharedSurfaceGLX.h" @@ -84,9 +80,7 @@ GLScreenBuffer::CreateFactory(GLContext* gl, if (!gfxPrefs::WebGLForceLayersReadback()) { switch (backend) { case mozilla::layers::LayersBackend::LAYERS_OPENGL: { -#if defined(XP_MACOSX) - factory = SurfaceFactory_IOSurface::Create(gl, caps, ipcChannel, flags); -#elif defined(GL_PROVIDER_GLX) +#if defined(GL_PROVIDER_GLX) if (sGLXLibrary.UseTextureFromPixmap()) factory = SurfaceFactory_GLXDrawable::Create(gl, caps, ipcChannel, flags); #elif defined(MOZ_WIDGET_UIKIT) diff --git a/gfx/layers/ImageContainer.cpp b/gfx/layers/ImageContainer.cpp index 5e4019e861..ecf2d10b41 100644 --- a/gfx/layers/ImageContainer.cpp +++ b/gfx/layers/ImageContainer.cpp @@ -28,10 +28,6 @@ #include "mozilla/gfx/2D.h" #include "mozilla/CheckedInt.h" -#ifdef XP_MACOSX -#include "mozilla/gfx/QuartzSupport.h" -#endif - #ifdef XP_WIN #include "gfxWindowsPlatform.h" #include diff --git a/gfx/layers/ImageContainer.h b/gfx/layers/ImageContainer.h index 73085ba906..ea619b77b5 100644 --- a/gfx/layers/ImageContainer.h +++ b/gfx/layers/ImageContainer.h @@ -166,9 +166,6 @@ protected: class GLImage; class EGLImageImage; class SharedRGBImage; -#if defined(XP_MACOSX) -class MacIOSurfaceImage; -#endif /** * A class representing a buffer of pixel data. The data can be in one @@ -223,9 +220,6 @@ public: /* Access to derived classes. */ virtual EGLImageImage* AsEGLImageImage() { return nullptr; } virtual GLImage* AsGLImage() { return nullptr; } -#ifdef XP_MACOSX - virtual MacIOSurfaceImage* AsMacIOSurfaceImage() { return nullptr; } -#endif virtual PlanarYCbCrImage* AsPlanarYCbCrImage() { return nullptr; } virtual NVImage* AsNVImage() { return nullptr; } diff --git a/gfx/layers/basic/TextureHostBasic.cpp b/gfx/layers/basic/TextureHostBasic.cpp index 8058e43efc..1d671729e6 100644 --- a/gfx/layers/basic/TextureHostBasic.cpp +++ b/gfx/layers/basic/TextureHostBasic.cpp @@ -4,9 +4,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "TextureHostBasic.h" -#ifdef XP_MACOSX -#include "MacIOSurfaceTextureHostBasic.h" -#endif using namespace mozilla::gl; using namespace mozilla::gfx; @@ -19,13 +16,6 @@ CreateTextureHostBasic(const SurfaceDescriptor& aDesc, ISurfaceAllocator* aDeallocator, TextureFlags aFlags) { -#ifdef XP_MACOSX - if (aDesc.type() == SurfaceDescriptor::TSurfaceDescriptorMacIOSurface) { - const SurfaceDescriptorMacIOSurface& desc = - aDesc.get_SurfaceDescriptorMacIOSurface(); - return MakeAndAddRef(aFlags, desc); - } -#endif return CreateBackendIndependentTextureHost(aDesc, aDeallocator, aFlags); } diff --git a/gfx/layers/client/TextureClient.cpp b/gfx/layers/client/TextureClient.cpp index 7182731bd5..462cd40d43 100644 --- a/gfx/layers/client/TextureClient.cpp +++ b/gfx/layers/client/TextureClient.cpp @@ -48,10 +48,6 @@ #endif #endif -#ifdef XP_MACOSX -#include "mozilla/layers/MacIOSurfaceTextureClientOGL.h" -#endif - #if 0 #define RECYCLE_LOG(...) printf_stderr(__VA_ARGS__) #else @@ -1075,12 +1071,6 @@ TextureClient::CreateForDrawing(TextureForwarder* aAllocator, #endif #endif -#ifdef XP_MACOSX - if (!data && gfxPrefs::UseIOSurfaceTextures()) { - data = MacIOSurfaceTextureData::Create(aSize, aFormat, moz2DBackend); - } -#endif - if (data) { return MakeAndAddRef(data, aTextureFlags, aAllocator); } diff --git a/gfx/layers/composite/LayerManagerComposite.cpp b/gfx/layers/composite/LayerManagerComposite.cpp index 0ee11bdfb1..98bc777e4e 100644 --- a/gfx/layers/composite/LayerManagerComposite.cpp +++ b/gfx/layers/composite/LayerManagerComposite.cpp @@ -24,9 +24,6 @@ #include "UnitTransforms.h" // for ViewAs #include "apz/src/AsyncPanZoomController.h" // for AsyncPanZoomController #include "gfxPrefs.h" // for gfxPrefs -#ifdef XP_MACOSX -#include "gfxPlatformMac.h" -#endif #include "gfxRect.h" // for gfxRect #include "gfxUtils.h" // for frame color util #include "mozilla/Assertions.h" // for MOZ_ASSERT, etc @@ -881,9 +878,6 @@ LayerManagerComposite::Render(const nsIntRegion& aInvalidRegion, const nsIntRegi } mozilla::widget::WidgetRenderingContext widgetContext; -#if defined(XP_MACOSX) - widgetContext.mLayerManager = this; -#endif { PROFILER_LABEL("LayerManagerComposite", "PreRender", diff --git a/gfx/layers/composite/TextureHost.cpp b/gfx/layers/composite/TextureHost.cpp index 8df7af4a80..94e7b5427c 100644 --- a/gfx/layers/composite/TextureHost.cpp +++ b/gfx/layers/composite/TextureHost.cpp @@ -39,10 +39,6 @@ #include "mozilla/layers/X11TextureHost.h" #endif -#ifdef XP_MACOSX -#include "../opengl/MacIOSurfaceTextureHostOGL.h" -#endif - #ifdef XP_WIN #include "mozilla/layers/TextureDIB.h" #endif diff --git a/gfx/layers/ipc/ShadowLayerUtils.h b/gfx/layers/ipc/ShadowLayerUtils.h index 257cee81d1..faa5041e3e 100644 --- a/gfx/layers/ipc/ShadowLayerUtils.h +++ b/gfx/layers/ipc/ShadowLayerUtils.h @@ -1,6 +1,4 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * vim: sw=2 ts=8 et : - */ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* 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/. */ @@ -13,10 +11,6 @@ #include "SurfaceTypes.h" #include "mozilla/WidgetUtils.h" -#if defined(XP_MACOSX) -#define MOZ_HAVE_PLATFORM_SPECIFIC_LAYER_BUFFERS -#endif - #if defined(MOZ_X11) # include "mozilla/layers/ShadowLayerUtilsX11.h" #else diff --git a/gfx/layers/opengl/TextureHostOGL.cpp b/gfx/layers/opengl/TextureHostOGL.cpp index bc06444b0f..35c83686a7 100644 --- a/gfx/layers/opengl/TextureHostOGL.cpp +++ b/gfx/layers/opengl/TextureHostOGL.cpp @@ -20,10 +20,6 @@ #include "GLBlitTextureImageHelper.h" #include "GeckoProfiler.h" -#ifdef XP_MACOSX -#include "mozilla/layers/MacIOSurfaceTextureHostOGL.h" -#endif - using namespace mozilla::gl; using namespace mozilla::gfx; @@ -49,15 +45,6 @@ CreateTextureHostOGL(const SurfaceDescriptor& aDesc, break; } -#ifdef XP_MACOSX - case SurfaceDescriptor::TSurfaceDescriptorMacIOSurface: { - const SurfaceDescriptorMacIOSurface& desc = - aDesc.get_SurfaceDescriptorMacIOSurface(); - result = new MacIOSurfaceTextureHostOGL(aFlags, desc); - break; - } -#endif - case SurfaceDescriptor::TSurfaceDescriptorSharedGLTexture: { const auto& desc = aDesc.get_SurfaceDescriptorSharedGLTexture(); result = new GLTextureHost(aFlags, desc.texture(), diff --git a/gfx/src/nsDeviceContext.cpp b/gfx/src/nsDeviceContext.cpp index db69e21e98..e4288e47e3 100644 --- a/gfx/src/nsDeviceContext.cpp +++ b/gfx/src/nsDeviceContext.cpp @@ -239,11 +239,7 @@ nsDeviceContext::FontMetricsDeleted(const nsFontMetrics* aFontMetrics) bool nsDeviceContext::IsPrinterContext() { - return mPrintTarget != nullptr -#ifdef XP_MACOSX - || mCachedPrintTarget != nullptr -#endif - ; + return mPrintTarget != nullptr; } void @@ -347,17 +343,6 @@ nsDeviceContext::CreateRenderingContextCommon(bool aWantReferenceContext) MOZ_ASSERT(mWidth > 0 && mHeight > 0); RefPtr printingTarget = mPrintTarget; -#ifdef XP_MACOSX - // CreateRenderingContext() can be called (on reflow) after EndPage() - // but before BeginPage(). On OS X (and only there) mPrintTarget - // will in this case be null, because OS X printing surfaces are - // per-page, and therefore only truly valid between calls to BeginPage() - // and EndPage(). But we can get away with fudging things here, if need - // be, by using a cached copy. - if (!printingTarget) { - printingTarget = mCachedPrintTarget; - } -#endif // This will usually be null, depending on the pref print.print_via_parent. RefPtr recorder; @@ -378,9 +363,6 @@ nsDeviceContext::CreateRenderingContextCommon(bool aWantReferenceContext) return nullptr; } -#ifdef XP_MACOSX - dt->AddUserData(&gfxContext::sDontUseAsSourceKey, dt, nullptr); -#endif dt->AddUserData(&sDisablePixelSnapping, (void*)0x1, nullptr); RefPtr pContext = gfxContext::CreateOrNull(dt); @@ -543,12 +525,6 @@ nsDeviceContext::BeginPage(void) if (NS_FAILED(rv)) return rv; -#ifdef XP_MACOSX - // We need to get a new surface for each page on the Mac, as the - // CGContextRefs are only good for one page. - mPrintTarget = mDeviceContextSpec->MakePrintTarget(); -#endif - rv = mPrintTarget->BeginPage(); return rv; @@ -559,18 +535,6 @@ nsDeviceContext::EndPage(void) { nsresult rv = mPrintTarget->EndPage(); -#ifdef XP_MACOSX - // We need to release the CGContextRef in the surface here, plus it's - // not something you would want anyway, as these CGContextRefs are only - // good for one page. But we need to keep a cached reference to it, since - // CreateRenderingContext() may try to access it when mPrintTarget - // would normally be null. See bug 665218. If we just stop nulling out - // mPrintTarget here (and thereby make that our cached copy), we'll - // break all our null checks on mPrintTarget. See bug 684622. - mCachedPrintTarget = mPrintTarget; - mPrintTarget = nullptr; -#endif - if (mDeviceContextSpec) mDeviceContextSpec->EndPage(); diff --git a/gfx/src/nsDeviceContext.h b/gfx/src/nsDeviceContext.h index 1115757eb1..edb3f5d6a8 100644 --- a/gfx/src/nsDeviceContext.h +++ b/gfx/src/nsDeviceContext.h @@ -300,9 +300,6 @@ private: nsCOMPtr mScreenManager; nsCOMPtr mDeviceContextSpec; RefPtr mPrintTarget; -#ifdef XP_MACOSX - RefPtr mCachedPrintTarget; -#endif #ifdef DEBUG bool mIsInitialized; #endif diff --git a/gfx/thebes/PrintTargetCG.cpp b/gfx/thebes/PrintTargetCG.cpp deleted file mode 100644 index 5fe838182a..0000000000 --- a/gfx/thebes/PrintTargetCG.cpp +++ /dev/null @@ -1,120 +0,0 @@ -/* -*- Mode: C++; tab-width: 20; 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/. */ - -#include "PrintTargetCG.h" - -#include "cairo.h" -#include "cairo-quartz.h" -#include "mozilla/gfx/HelpersCairo.h" - -namespace mozilla { -namespace gfx { - -PrintTargetCG::PrintTargetCG(cairo_surface_t* aCairoSurface, - const IntSize& aSize) - : PrintTarget(aCairoSurface, aSize) -{ - // TODO: Add memory reporting like gfxQuartzSurface. - //RecordMemoryUsed(mSize.height * 4 + sizeof(gfxQuartzSurface)); -} - -/* static */ already_AddRefed -PrintTargetCG::CreateOrNull(const IntSize& aSize, gfxImageFormat aFormat) -{ - if (!Factory::CheckSurfaceSize(aSize)) { - return nullptr; - } - - unsigned int width = static_cast(aSize.width); - unsigned int height = static_cast(aSize.height); - - cairo_format_t cformat = GfxFormatToCairoFormat(aFormat); - cairo_surface_t* surface = - cairo_quartz_surface_create(cformat, width, height); - - if (cairo_surface_status(surface)) { - return nullptr; - } - - // The new object takes ownership of our surface reference. - RefPtr target = new PrintTargetCG(surface, aSize); - - return target.forget(); -} - -/* static */ already_AddRefed -PrintTargetCG::CreateOrNull(CGContextRef aContext, const IntSize& aSize) -{ - if (!Factory::CheckSurfaceSize(aSize)) { - return nullptr; - } - - unsigned int width = static_cast(aSize.width); - unsigned int height = static_cast(aSize.height); - - cairo_surface_t* surface = - cairo_quartz_surface_create_for_cg_context(aContext, width, height); - - if (cairo_surface_status(surface)) { - return nullptr; - } - - // The new object takes ownership of our surface reference. - RefPtr target = new PrintTargetCG(surface, aSize); - - return target.forget(); -} - -static size_t -PutBytesNull(void* info, const void* buffer, size_t count) -{ - return count; -} - -already_AddRefed -PrintTargetCG::GetReferenceDrawTarget(DrawEventRecorder* aRecorder) -{ - if (!mRefDT) { - const IntSize size(1, 1); - - CGDataConsumerCallbacks callbacks = {PutBytesNull, nullptr}; - CGDataConsumerRef consumer = CGDataConsumerCreate(nullptr, &callbacks); - CGContextRef pdfContext = CGPDFContextCreate(consumer, nullptr, nullptr); - CGDataConsumerRelease(consumer); - - cairo_surface_t* similar = - cairo_quartz_surface_create_for_cg_context( - pdfContext, size.width, size.height); - - CGContextRelease(pdfContext); - - if (cairo_surface_status(similar)) { - return nullptr; - } - - RefPtr dt = - Factory::CreateDrawTargetForCairoSurface(similar, size); - - // The DT addrefs the surface, so we need drop our own reference to it: - cairo_surface_destroy(similar); - - if (!dt || !dt->IsValid()) { - return nullptr; - } - - if (aRecorder) { - dt = CreateRecordingDrawTarget(aRecorder, dt); - if (!dt || !dt->IsValid()) { - return nullptr; - } - } - - mRefDT = dt.forget(); - } - return do_AddRef(mRefDT); -} - -} // namespace gfx -} // namespace mozilla diff --git a/gfx/thebes/PrintTargetCG.h b/gfx/thebes/PrintTargetCG.h deleted file mode 100644 index 87dbdbc2c7..0000000000 --- a/gfx/thebes/PrintTargetCG.h +++ /dev/null @@ -1,42 +0,0 @@ -/* -*- Mode: C++; tab-width: 20; 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_GFX_PRINTTARGETCG_H -#define MOZILLA_GFX_PRINTTARGETCG_H - -#include -#include "PrintTarget.h" - -namespace mozilla { -namespace gfx { - -/** - * CoreGraphics printing target. - * - * Note that a CGContextRef obtained from PMSessionGetCGGraphicsContext is - * valid only for the current page. As a consequence instances of this class - * should only be used to print a single page. - */ -class PrintTargetCG final : public PrintTarget -{ -public: - static already_AddRefed - CreateOrNull(const IntSize& aSize, gfxImageFormat aFormat); - - static already_AddRefed - CreateOrNull(CGContextRef aContext, const IntSize& aSize); - - virtual already_AddRefed - GetReferenceDrawTarget(DrawEventRecorder* aRecorder) final; - -private: - PrintTargetCG(cairo_surface_t* aCairoSurface, - const IntSize& aSize); -}; - -} // namespace gfx -} // namespace mozilla - -#endif /* MOZILLA_GFX_PRINTTARGETCG_H */ diff --git a/gfx/thebes/gfxCoreTextShaper.cpp b/gfx/thebes/gfxCoreTextShaper.cpp deleted file mode 100644 index 08217b82f9..0000000000 --- a/gfx/thebes/gfxCoreTextShaper.cpp +++ /dev/null @@ -1,800 +0,0 @@ -/* -*- Mode: C++; tab-width: 20; 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/. */ - -#include "mozilla/ArrayUtils.h" -#include "gfxCoreTextShaper.h" -#include "gfxMacFont.h" -#include "gfxFontUtils.h" -#include "gfxTextRun.h" -#include "mozilla/gfx/2D.h" -#include "mozilla/UniquePtrExtensions.h" - -#include - -#include - -using namespace mozilla; - -// standard font descriptors that we construct the first time they're needed -CTFontDescriptorRef gfxCoreTextShaper::sDefaultFeaturesDescriptor = nullptr; -CTFontDescriptorRef gfxCoreTextShaper::sDisableLigaturesDescriptor = nullptr; -CTFontDescriptorRef gfxCoreTextShaper::sIndicFeaturesDescriptor = nullptr; -CTFontDescriptorRef gfxCoreTextShaper::sIndicDisableLigaturesDescriptor = nullptr; - -static CFStringRef sCTWritingDirectionAttributeName = nullptr; - -// See CTStringAttributes.h -enum { - kMyCTWritingDirectionEmbedding = (0 << 1), - kMyCTWritingDirectionOverride = (1 << 1) -}; - -// Helper to create a CFDictionary with the right attributes for shaping our -// text, including imposing the given directionality. -// This will only be called if we're on 10.8 or later. -CFDictionaryRef -gfxCoreTextShaper::CreateAttrDict(bool aRightToLeft) -{ - // Because we always shape unidirectional runs, and may have applied - // directional overrides, we want to force a direction rather than - // allowing CoreText to do its own unicode-based bidi processing. - SInt16 dirOverride = kMyCTWritingDirectionOverride | - (aRightToLeft ? kCTWritingDirectionRightToLeft - : kCTWritingDirectionLeftToRight); - CFNumberRef dirNumber = - ::CFNumberCreate(kCFAllocatorDefault, - kCFNumberSInt16Type, &dirOverride); - CFArrayRef dirArray = - ::CFArrayCreate(kCFAllocatorDefault, - (const void **) &dirNumber, 1, - &kCFTypeArrayCallBacks); - ::CFRelease(dirNumber); - CFTypeRef attrs[] = { kCTFontAttributeName, sCTWritingDirectionAttributeName }; - CFTypeRef values[] = { mCTFont, dirArray }; - CFDictionaryRef attrDict = - ::CFDictionaryCreate(kCFAllocatorDefault, - attrs, values, ArrayLength(attrs), - &kCFTypeDictionaryKeyCallBacks, - &kCFTypeDictionaryValueCallBacks); - ::CFRelease(dirArray); - return attrDict; -} - -CFDictionaryRef -gfxCoreTextShaper::CreateAttrDictWithoutDirection() -{ - CFTypeRef attrs[] = { kCTFontAttributeName }; - CFTypeRef values[] = { mCTFont }; - CFDictionaryRef attrDict = - ::CFDictionaryCreate(kCFAllocatorDefault, - attrs, values, ArrayLength(attrs), - &kCFTypeDictionaryKeyCallBacks, - &kCFTypeDictionaryValueCallBacks); - return attrDict; -} - -gfxCoreTextShaper::gfxCoreTextShaper(gfxMacFont *aFont) - : gfxFontShaper(aFont) - , mAttributesDictLTR(nullptr) - , mAttributesDictRTL(nullptr) -{ - static bool sInitialized = false; - if (!sInitialized) { - CFStringRef* pstr = (CFStringRef*) - dlsym(RTLD_DEFAULT, "kCTWritingDirectionAttributeName"); - if (pstr) { - sCTWritingDirectionAttributeName = *pstr; - } - sInitialized = true; - } - - // Create our CTFontRef - mCTFont = CreateCTFontWithFeatures(aFont->GetAdjustedSize(), - GetDefaultFeaturesDescriptor()); -} - -gfxCoreTextShaper::~gfxCoreTextShaper() -{ - if (mAttributesDictLTR) { - ::CFRelease(mAttributesDictLTR); - } - if (mAttributesDictRTL) { - ::CFRelease(mAttributesDictRTL); - } - if (mCTFont) { - ::CFRelease(mCTFont); - } -} - -static bool -IsBuggyIndicScript(unicode::Script aScript) -{ - return aScript == unicode::Script::BENGALI || - aScript == unicode::Script::KANNADA; -} - -bool -gfxCoreTextShaper::ShapeText(DrawTarget *aDrawTarget, - const char16_t *aText, - uint32_t aOffset, - uint32_t aLength, - Script aScript, - bool aVertical, - gfxShapedText *aShapedText) -{ - // Create a CFAttributedString with text and style info, so we can use CoreText to lay it out. - bool isRightToLeft = aShapedText->IsRightToLeft(); - const UniChar* text = reinterpret_cast(aText); - uint32_t length = aLength; - - uint32_t startOffset; - CFStringRef stringObj; - CFDictionaryRef attrObj; - - if (sCTWritingDirectionAttributeName) { - startOffset = 0; - stringObj = ::CFStringCreateWithCharactersNoCopy(kCFAllocatorDefault, - text, length, - kCFAllocatorNull); - - // Get an attributes dictionary suitable for shaping text in the - // current direction, creating it if necessary. - attrObj = isRightToLeft ? mAttributesDictRTL : mAttributesDictLTR; - if (!attrObj) { - attrObj = CreateAttrDict(isRightToLeft); - (isRightToLeft ? mAttributesDictRTL : mAttributesDictLTR) = attrObj; - } - } else { - // OS is too old to support kCTWritingDirectionAttributeName: - // we need to bidi-wrap the text if the run is RTL, - // or if it is an LTR run but may contain (overridden) RTL chars - bool bidiWrap = isRightToLeft; - if (!bidiWrap && !aShapedText->TextIs8Bit()) { - uint32_t i; - for (i = 0; i < length; ++i) { - if (gfxFontUtils::PotentialRTLChar(aText[i])) { - bidiWrap = true; - break; - } - } - } - - // If there's a possibility of any bidi, we wrap the text with - // direction overrides to ensure neutrals or characters that were - // bidi-overridden in HTML behave properly. - static const UniChar beginLTR[] = { 0x202d, 0x20 }; - static const UniChar beginRTL[] = { 0x202e, 0x20 }; - static const UniChar endBidiWrap[] = { 0x20, 0x2e, 0x202c }; - - if (bidiWrap) { - startOffset = isRightToLeft ? ArrayLength(beginRTL) - : ArrayLength(beginLTR); - CFMutableStringRef mutableString = - ::CFStringCreateMutable(kCFAllocatorDefault, - length + startOffset + - ArrayLength(endBidiWrap)); - ::CFStringAppendCharacters(mutableString, - isRightToLeft ? beginRTL : beginLTR, - startOffset); - ::CFStringAppendCharacters(mutableString, text, length); - ::CFStringAppendCharacters(mutableString, endBidiWrap, - ArrayLength(endBidiWrap)); - stringObj = mutableString; - } else { - startOffset = 0; - stringObj = - ::CFStringCreateWithCharactersNoCopy(kCFAllocatorDefault, - text, length, - kCFAllocatorNull); - } - - // Get an attributes dictionary suitable for shaping text, - // creating it if necessary. (This dict is not LTR-specific, - // but we use that field to store it anyway.) - if (!mAttributesDictLTR) { - mAttributesDictLTR = CreateAttrDictWithoutDirection(); - } - attrObj = mAttributesDictLTR; - } - - CTFontRef tempCTFont = nullptr; - if (IsBuggyIndicScript(aScript)) { - // To work around buggy Indic AAT fonts shipped with OS X, - // we re-enable the Line Initial Smart Swashes feature that is needed - // for "split vowels" to work in at least Bengali and Kannada fonts. - // Affected fonts include Bangla MN, Bangla Sangam MN, Kannada MN, - // Kannada Sangam MN. See bugs 686225, 728557, 953231, 1145515. - tempCTFont = - CreateCTFontWithFeatures(::CTFontGetSize(mCTFont), - aShapedText->DisableLigatures() - ? GetIndicDisableLigaturesDescriptor() - : GetIndicFeaturesDescriptor()); - } else if (aShapedText->DisableLigatures()) { - // For letterspacing (or maybe other situations) we need to make - // a copy of the CTFont with the ligature feature disabled. - tempCTFont = - CreateCTFontWithFeatures(::CTFontGetSize(mCTFont), - GetDisableLigaturesDescriptor()); - } - - // For the disabled-ligature or buggy-indic-font case, we need to replace - // the standard CTFont in the attribute dictionary with a tweaked version. - CFMutableDictionaryRef mutableAttr = nullptr; - if (tempCTFont) { - mutableAttr = ::CFDictionaryCreateMutableCopy(kCFAllocatorDefault, 2, - attrObj); - ::CFDictionaryReplaceValue(mutableAttr, - kCTFontAttributeName, tempCTFont); - // Having created the dict, we're finished with our temporary - // Indic and/or ligature-disabled CTFontRef. - ::CFRelease(tempCTFont); - attrObj = mutableAttr; - } - - // Now we can create an attributed string - CFAttributedStringRef attrStringObj = - ::CFAttributedStringCreate(kCFAllocatorDefault, stringObj, attrObj); - ::CFRelease(stringObj); - - // Create the CoreText line from our string, then we're done with it - CTLineRef line = ::CTLineCreateWithAttributedString(attrStringObj); - ::CFRelease(attrStringObj); - - // and finally retrieve the glyph data and store into the gfxTextRun - CFArrayRef glyphRuns = ::CTLineGetGlyphRuns(line); - uint32_t numRuns = ::CFArrayGetCount(glyphRuns); - - // Iterate through the glyph runs. - // Note that this includes the bidi wrapper, so we have to be careful - // not to include the extra glyphs from there - bool success = true; - for (uint32_t runIndex = 0; runIndex < numRuns; runIndex++) { - CTRunRef aCTRun = - (CTRunRef)::CFArrayGetValueAtIndex(glyphRuns, runIndex); - // If the range is purely within bidi-wrapping text, ignore it. - CFRange range = ::CTRunGetStringRange(aCTRun); - if (uint32_t(range.location + range.length) <= startOffset || - range.location - startOffset >= aLength) { - continue; - } - CFDictionaryRef runAttr = ::CTRunGetAttributes(aCTRun); - if (runAttr != attrObj) { - // If Core Text manufactured a new dictionary, this may indicate - // unexpected font substitution. In that case, we fail (and fall - // back to harfbuzz shaping)... - const void* font1 = - ::CFDictionaryGetValue(attrObj, kCTFontAttributeName); - const void* font2 = - ::CFDictionaryGetValue(runAttr, kCTFontAttributeName); - if (font1 != font2) { - // ...except that if the fallback was only for a variation - // selector or join control that is otherwise unsupported, - // we just ignore it. - if (range.length == 1) { - char16_t ch = aText[range.location - startOffset]; - if (gfxFontUtils::IsJoinControl(ch) || - gfxFontUtils::IsVarSelector(ch)) { - continue; - } - } - NS_WARNING("unexpected font fallback in Core Text"); - success = false; - break; - } - } - if (SetGlyphsFromRun(aShapedText, aOffset, aLength, aCTRun, - startOffset) != NS_OK) { - success = false; - break; - } - } - - if (mutableAttr) { - ::CFRelease(mutableAttr); - } - ::CFRelease(line); - - return success; -} - -#define SMALL_GLYPH_RUN 128 // preallocated size of our auto arrays for per-glyph data; - // some testing indicates that 90%+ of glyph runs will fit - // without requiring a separate allocation - -nsresult -gfxCoreTextShaper::SetGlyphsFromRun(gfxShapedText *aShapedText, - uint32_t aOffset, - uint32_t aLength, - CTRunRef aCTRun, - int32_t aStringOffset) -{ - // The word has been bidi-wrapped; aStringOffset is the number - // of chars at the beginning of the CTLine that we should skip. - // aCTRun is a glyph run from the CoreText layout process. - - int32_t direction = aShapedText->IsRightToLeft() ? -1 : 1; - - int32_t numGlyphs = ::CTRunGetGlyphCount(aCTRun); - if (numGlyphs == 0) { - return NS_OK; - } - - int32_t wordLength = aLength; - - // character offsets get really confusing here, as we have to keep track of - // (a) the text in the actual textRun we're constructing - // (c) the string that was handed to CoreText, which contains the text of the font run - // plus directional-override padding - // (d) the CTRun currently being processed, which may be a sub-run of the CoreText line - // (but may extend beyond the actual font run into the bidi wrapping text). - // aStringOffset tells us how many initial characters of the line to ignore. - - // get the source string range within the CTLine's text - CFRange stringRange = ::CTRunGetStringRange(aCTRun); - // skip the run if it is entirely outside the actual range of the font run - if (stringRange.location - aStringOffset + stringRange.length <= 0 || - stringRange.location - aStringOffset >= wordLength) { - return NS_OK; - } - - // retrieve the laid-out glyph data from the CTRun - UniquePtr glyphsArray; - UniquePtr positionsArray; - UniquePtr glyphToCharArray; - const CGGlyph* glyphs = nullptr; - const CGPoint* positions = nullptr; - const CFIndex* glyphToChar = nullptr; - - // Testing indicates that CTRunGetGlyphsPtr (almost?) always succeeds, - // and so allocating a new array and copying data with CTRunGetGlyphs - // will be extremely rare. - // If this were not the case, we could use an AutoTArray<> to - // try and avoid the heap allocation for small runs. - // It's possible that some future change to CoreText will mean that - // CTRunGetGlyphsPtr fails more often; if this happens, AutoTArray<> - // may become an attractive option. - glyphs = ::CTRunGetGlyphsPtr(aCTRun); - if (!glyphs) { - glyphsArray = MakeUniqueFallible(numGlyphs); - if (!glyphsArray) { - return NS_ERROR_OUT_OF_MEMORY; - } - ::CTRunGetGlyphs(aCTRun, ::CFRangeMake(0, 0), glyphsArray.get()); - glyphs = glyphsArray.get(); - } - - positions = ::CTRunGetPositionsPtr(aCTRun); - if (!positions) { - positionsArray = MakeUniqueFallible(numGlyphs); - if (!positionsArray) { - return NS_ERROR_OUT_OF_MEMORY; - } - ::CTRunGetPositions(aCTRun, ::CFRangeMake(0, 0), positionsArray.get()); - positions = positionsArray.get(); - } - - // Remember that the glyphToChar indices relate to the CoreText line, - // not to the beginning of the textRun, the font run, - // or the stringRange of the glyph run - glyphToChar = ::CTRunGetStringIndicesPtr(aCTRun); - if (!glyphToChar) { - glyphToCharArray = MakeUniqueFallible(numGlyphs); - if (!glyphToCharArray) { - return NS_ERROR_OUT_OF_MEMORY; - } - ::CTRunGetStringIndices(aCTRun, ::CFRangeMake(0, 0), glyphToCharArray.get()); - glyphToChar = glyphToCharArray.get(); - } - - double runWidth = ::CTRunGetTypographicBounds(aCTRun, ::CFRangeMake(0, 0), - nullptr, nullptr, nullptr); - - AutoTArray detailedGlyphs; - gfxShapedText::CompressedGlyph *charGlyphs = - aShapedText->GetCharacterGlyphs() + aOffset; - - // CoreText gives us the glyphindex-to-charindex mapping, which relates each glyph - // to a source text character; we also need the charindex-to-glyphindex mapping to - // find the glyph for a given char. Note that some chars may not map to any glyph - // (ligature continuations), and some may map to several glyphs (eg Indic split vowels). - // We set the glyph index to NO_GLYPH for chars that have no associated glyph, and we - // record the last glyph index for cases where the char maps to several glyphs, - // so that our clumping will include all the glyph fragments for the character. - - // The charToGlyph array is indexed by char position within the stringRange of the glyph run. - - static const int32_t NO_GLYPH = -1; - AutoTArray charToGlyphArray; - if (!charToGlyphArray.SetLength(stringRange.length, fallible)) { - return NS_ERROR_OUT_OF_MEMORY; - } - int32_t *charToGlyph = charToGlyphArray.Elements(); - for (int32_t offset = 0; offset < stringRange.length; ++offset) { - charToGlyph[offset] = NO_GLYPH; - } - for (int32_t i = 0; i < numGlyphs; ++i) { - int32_t loc = glyphToChar[i] - stringRange.location; - if (loc >= 0 && loc < stringRange.length) { - charToGlyph[loc] = i; - } - } - - // Find character and glyph clumps that correspond, allowing for ligatures, - // indic reordering, split glyphs, etc. - // - // The idea is that we'll find a character sequence starting at the first char of stringRange, - // and extend it until it includes the character associated with the first glyph; - // we also extend it as long as there are "holes" in the range of glyphs. So we - // will eventually have a contiguous sequence of characters, starting at the beginning - // of the range, that map to a contiguous sequence of glyphs, starting at the beginning - // of the glyph array. That's a clump; then we update the starting positions and repeat. - // - // NB: In the case of RTL layouts, we iterate over the stringRange in reverse. - // - - // This may find characters that fall outside the range 0:wordLength, - // so we won't necessarily use everything we find here. - - bool isRightToLeft = aShapedText->IsRightToLeft(); - int32_t glyphStart = 0; // looking for a clump that starts at this glyph index - int32_t charStart = isRightToLeft ? - stringRange.length - 1 : 0; // and this char index (in the stringRange of the glyph run) - - while (glyphStart < numGlyphs) { // keep finding groups until all glyphs are accounted for - bool inOrder = true; - int32_t charEnd = glyphToChar[glyphStart] - stringRange.location; - NS_WARNING_ASSERTION( - charEnd >= 0 && charEnd < stringRange.length, - "glyph-to-char mapping points outside string range"); - // clamp charEnd to the valid range of the string - charEnd = std::max(charEnd, 0); - charEnd = std::min(charEnd, int32_t(stringRange.length)); - - int32_t glyphEnd = glyphStart; - int32_t charLimit = isRightToLeft ? -1 : stringRange.length; - do { - // This is normally executed once for each iteration of the outer loop, - // but in unusual cases where the character/glyph association is complex, - // the initial character range might correspond to a non-contiguous - // glyph range with "holes" in it. If so, we will repeat this loop to - // extend the character range until we have a contiguous glyph sequence. - NS_ASSERTION((direction > 0 && charEnd < charLimit) || - (direction < 0 && charEnd > charLimit), - "no characters left in range?"); - charEnd += direction; - while (charEnd != charLimit && charToGlyph[charEnd] == NO_GLYPH) { - charEnd += direction; - } - - // find the maximum glyph index covered by the clump so far - if (isRightToLeft) { - for (int32_t i = charStart; i > charEnd; --i) { - if (charToGlyph[i] != NO_GLYPH) { - // update extent of glyph range - glyphEnd = std::max(glyphEnd, charToGlyph[i] + 1); - } - } - } else { - for (int32_t i = charStart; i < charEnd; ++i) { - if (charToGlyph[i] != NO_GLYPH) { - // update extent of glyph range - glyphEnd = std::max(glyphEnd, charToGlyph[i] + 1); - } - } - } - - if (glyphEnd == glyphStart + 1) { - // for the common case of a single-glyph clump, we can skip the following checks - break; - } - - if (glyphEnd == glyphStart) { - // no glyphs, try to extend the clump - continue; - } - - // check whether all glyphs in the range are associated with the characters - // in our clump; if not, we have a discontinuous range, and should extend it - // unless we've reached the end of the text - bool allGlyphsAreWithinCluster = true; - int32_t prevGlyphCharIndex = charStart; - for (int32_t i = glyphStart; i < glyphEnd; ++i) { - int32_t glyphCharIndex = glyphToChar[i] - stringRange.location; - if (isRightToLeft) { - if (glyphCharIndex > charStart || glyphCharIndex <= charEnd) { - allGlyphsAreWithinCluster = false; - break; - } - if (glyphCharIndex > prevGlyphCharIndex) { - inOrder = false; - } - prevGlyphCharIndex = glyphCharIndex; - } else { - if (glyphCharIndex < charStart || glyphCharIndex >= charEnd) { - allGlyphsAreWithinCluster = false; - break; - } - if (glyphCharIndex < prevGlyphCharIndex) { - inOrder = false; - } - prevGlyphCharIndex = glyphCharIndex; - } - } - if (allGlyphsAreWithinCluster) { - break; - } - } while (charEnd != charLimit); - - NS_WARNING_ASSERTION(glyphStart < glyphEnd, - "character/glyph clump contains no glyphs!"); - if (glyphStart == glyphEnd) { - ++glyphStart; // make progress - avoid potential infinite loop - charStart = charEnd; - continue; - } - - NS_WARNING_ASSERTION(charStart != charEnd, - "character/glyph clump contains no characters!"); - if (charStart == charEnd) { - glyphStart = glyphEnd; // this is bad - we'll discard the glyph(s), - // as there's nowhere to attach them - continue; - } - - // Now charStart..charEnd is a ligature clump, corresponding to glyphStart..glyphEnd; - // Set baseCharIndex to the char we'll actually attach the glyphs to (1st of ligature), - // and endCharIndex to the limit (position beyond the last char), - // adjusting for the offset of the stringRange relative to the textRun. - int32_t baseCharIndex, endCharIndex; - if (isRightToLeft) { - while (charEnd >= 0 && charToGlyph[charEnd] == NO_GLYPH) { - charEnd--; - } - baseCharIndex = charEnd + stringRange.location - aStringOffset + 1; - endCharIndex = charStart + stringRange.location - aStringOffset + 1; - } else { - while (charEnd < stringRange.length && charToGlyph[charEnd] == NO_GLYPH) { - charEnd++; - } - baseCharIndex = charStart + stringRange.location - aStringOffset; - endCharIndex = charEnd + stringRange.location - aStringOffset; - } - - // Then we check if the clump falls outside our actual string range; if so, just go to the next. - if (endCharIndex <= 0 || baseCharIndex >= wordLength) { - glyphStart = glyphEnd; - charStart = charEnd; - continue; - } - // Ensure we won't try to go beyond the valid length of the word's text - baseCharIndex = std::max(baseCharIndex, 0); - endCharIndex = std::min(endCharIndex, wordLength); - - // Now we're ready to set the glyph info in the textRun; measure the glyph width - // of the first (perhaps only) glyph, to see if it is "Simple" - int32_t appUnitsPerDevUnit = aShapedText->GetAppUnitsPerDevUnit(); - double toNextGlyph; - if (glyphStart < numGlyphs-1) { - toNextGlyph = positions[glyphStart+1].x - positions[glyphStart].x; - } else { - toNextGlyph = positions[0].x + runWidth - positions[glyphStart].x; - } - int32_t advance = int32_t(toNextGlyph * appUnitsPerDevUnit); - - // Check if it's a simple one-to-one mapping - int32_t glyphsInClump = glyphEnd - glyphStart; - if (glyphsInClump == 1 && - gfxTextRun::CompressedGlyph::IsSimpleGlyphID(glyphs[glyphStart]) && - gfxTextRun::CompressedGlyph::IsSimpleAdvance(advance) && - charGlyphs[baseCharIndex].IsClusterStart() && - positions[glyphStart].y == 0.0) - { - charGlyphs[baseCharIndex].SetSimpleGlyph(advance, - glyphs[glyphStart]); - } else { - // collect all glyphs in a list to be assigned to the first char; - // there must be at least one in the clump, and we already measured its advance, - // hence the placement of the loop-exit test and the measurement of the next glyph - while (1) { - gfxTextRun::DetailedGlyph *details = detailedGlyphs.AppendElement(); - details->mGlyphID = glyphs[glyphStart]; - details->mXOffset = 0; - details->mYOffset = -positions[glyphStart].y * appUnitsPerDevUnit; - details->mAdvance = advance; - if (++glyphStart >= glyphEnd) { - break; - } - if (glyphStart < numGlyphs-1) { - toNextGlyph = positions[glyphStart+1].x - positions[glyphStart].x; - } else { - toNextGlyph = positions[0].x + runWidth - positions[glyphStart].x; - } - advance = int32_t(toNextGlyph * appUnitsPerDevUnit); - } - - gfxTextRun::CompressedGlyph textRunGlyph; - textRunGlyph.SetComplex(charGlyphs[baseCharIndex].IsClusterStart(), - true, detailedGlyphs.Length()); - aShapedText->SetGlyphs(aOffset + baseCharIndex, textRunGlyph, - detailedGlyphs.Elements()); - - detailedGlyphs.Clear(); - } - - // the rest of the chars in the group are ligature continuations, no associated glyphs - while (++baseCharIndex != endCharIndex && baseCharIndex < wordLength) { - gfxShapedText::CompressedGlyph &shapedTextGlyph = charGlyphs[baseCharIndex]; - NS_ASSERTION(!shapedTextGlyph.IsSimpleGlyph(), "overwriting a simple glyph"); - shapedTextGlyph.SetComplex(inOrder && shapedTextGlyph.IsClusterStart(), false, 0); - } - - glyphStart = glyphEnd; - charStart = charEnd; - } - - return NS_OK; -} - -#undef SMALL_GLYPH_RUN - -// Construct the font attribute descriptor that we'll apply by default when -// creating a CTFontRef. This will turn off line-edge swashes by default, -// because we don't know the actual line breaks when doing glyph shaping. - -// We also cache feature descriptors for shaping with disabled ligatures, and -// for buggy Indic AAT font workarounds, created on an as-needed basis. - -#define MAX_FEATURES 3 // max used by any of our Get*Descriptor functions - -CTFontDescriptorRef -gfxCoreTextShaper::CreateFontFeaturesDescriptor( - const std::pair aFeatures[], - size_t aCount) -{ - MOZ_ASSERT(aCount <= MAX_FEATURES); - - CFDictionaryRef featureSettings[MAX_FEATURES]; - - for (size_t i = 0; i < aCount; i++) { - CFNumberRef type = ::CFNumberCreate(kCFAllocatorDefault, - kCFNumberSInt16Type, - &aFeatures[i].first); - CFNumberRef selector = ::CFNumberCreate(kCFAllocatorDefault, - kCFNumberSInt16Type, - &aFeatures[i].second); - - CFTypeRef keys[] = { kCTFontFeatureTypeIdentifierKey, - kCTFontFeatureSelectorIdentifierKey }; - CFTypeRef values[] = { type, selector }; - featureSettings[i] = - ::CFDictionaryCreate(kCFAllocatorDefault, - (const void **) keys, - (const void **) values, - ArrayLength(keys), - &kCFTypeDictionaryKeyCallBacks, - &kCFTypeDictionaryValueCallBacks); - - ::CFRelease(selector); - ::CFRelease(type); - } - - CFArrayRef featuresArray = - ::CFArrayCreate(kCFAllocatorDefault, - (const void **) featureSettings, - aCount, // not ArrayLength(featureSettings), as we - // may not have used all the allocated slots - &kCFTypeArrayCallBacks); - - for (size_t i = 0; i < aCount; i++) { - ::CFRelease(featureSettings[i]); - } - - const CFTypeRef attrKeys[] = { kCTFontFeatureSettingsAttribute }; - const CFTypeRef attrValues[] = { featuresArray }; - CFDictionaryRef attributesDict = - ::CFDictionaryCreate(kCFAllocatorDefault, - (const void **) attrKeys, - (const void **) attrValues, - ArrayLength(attrKeys), - &kCFTypeDictionaryKeyCallBacks, - &kCFTypeDictionaryValueCallBacks); - ::CFRelease(featuresArray); - - CTFontDescriptorRef descriptor = - ::CTFontDescriptorCreateWithAttributes(attributesDict); - ::CFRelease(attributesDict); - - return descriptor; -} - -CTFontDescriptorRef -gfxCoreTextShaper::GetDefaultFeaturesDescriptor() -{ - if (sDefaultFeaturesDescriptor == nullptr) { - const std::pair kDefaultFeatures[] = { - { kSmartSwashType, kLineInitialSwashesOffSelector }, - { kSmartSwashType, kLineFinalSwashesOffSelector } - }; - sDefaultFeaturesDescriptor = - CreateFontFeaturesDescriptor(kDefaultFeatures, - ArrayLength(kDefaultFeatures)); - } - return sDefaultFeaturesDescriptor; -} - -CTFontDescriptorRef -gfxCoreTextShaper::GetDisableLigaturesDescriptor() -{ - if (sDisableLigaturesDescriptor == nullptr) { - const std::pair kDisableLigatures[] = { - { kSmartSwashType, kLineInitialSwashesOffSelector }, - { kSmartSwashType, kLineFinalSwashesOffSelector }, - { kLigaturesType, kCommonLigaturesOffSelector } - }; - sDisableLigaturesDescriptor = - CreateFontFeaturesDescriptor(kDisableLigatures, - ArrayLength(kDisableLigatures)); - } - return sDisableLigaturesDescriptor; -} - -CTFontDescriptorRef -gfxCoreTextShaper::GetIndicFeaturesDescriptor() -{ - if (sIndicFeaturesDescriptor == nullptr) { - const std::pair kIndicFeatures[] = { - { kSmartSwashType, kLineFinalSwashesOffSelector } - }; - sIndicFeaturesDescriptor = - CreateFontFeaturesDescriptor(kIndicFeatures, - ArrayLength(kIndicFeatures)); - } - return sIndicFeaturesDescriptor; -} - -CTFontDescriptorRef -gfxCoreTextShaper::GetIndicDisableLigaturesDescriptor() -{ - if (sIndicDisableLigaturesDescriptor == nullptr) { - const std::pair kIndicDisableLigatures[] = { - { kSmartSwashType, kLineFinalSwashesOffSelector }, - { kLigaturesType, kCommonLigaturesOffSelector } - }; - sIndicDisableLigaturesDescriptor = - CreateFontFeaturesDescriptor(kIndicDisableLigatures, - ArrayLength(kIndicDisableLigatures)); - } - return sIndicDisableLigaturesDescriptor; -} - -CTFontRef -gfxCoreTextShaper::CreateCTFontWithFeatures(CGFloat aSize, - CTFontDescriptorRef aDescriptor) -{ - gfxMacFont *f = static_cast(mFont); - return ::CTFontCreateWithGraphicsFont(f->GetCGFontRef(), aSize, nullptr, - aDescriptor); -} - -void -gfxCoreTextShaper::Shutdown() // [static] -{ - if (sIndicDisableLigaturesDescriptor != nullptr) { - ::CFRelease(sIndicDisableLigaturesDescriptor); - sIndicDisableLigaturesDescriptor = nullptr; - } - if (sIndicFeaturesDescriptor != nullptr) { - ::CFRelease(sIndicFeaturesDescriptor); - sIndicFeaturesDescriptor = nullptr; - } - if (sDisableLigaturesDescriptor != nullptr) { - ::CFRelease(sDisableLigaturesDescriptor); - sDisableLigaturesDescriptor = nullptr; - } - if (sDefaultFeaturesDescriptor != nullptr) { - ::CFRelease(sDefaultFeaturesDescriptor); - sDefaultFeaturesDescriptor = nullptr; - } -} diff --git a/gfx/thebes/gfxCoreTextShaper.h b/gfx/thebes/gfxCoreTextShaper.h deleted file mode 100644 index 8e5d24f91f..0000000000 --- a/gfx/thebes/gfxCoreTextShaper.h +++ /dev/null @@ -1,71 +0,0 @@ -/* -*- Mode: C++; tab-width: 20; 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 GFX_CORETEXTSHAPER_H -#define GFX_CORETEXTSHAPER_H - -#include "gfxFont.h" - -#include - -class gfxMacFont; - -class gfxCoreTextShaper : public gfxFontShaper { -public: - explicit gfxCoreTextShaper(gfxMacFont *aFont); - - virtual ~gfxCoreTextShaper(); - - virtual bool ShapeText(DrawTarget *aDrawTarget, - const char16_t *aText, - uint32_t aOffset, - uint32_t aLength, - Script aScript, - bool aVertical, - gfxShapedText *aShapedText); - - // clean up static objects that may have been cached - static void Shutdown(); - -protected: - CTFontRef mCTFont; - - // attributes for shaping text with LTR or RTL directionality - CFDictionaryRef mAttributesDictLTR; - CFDictionaryRef mAttributesDictRTL; - - nsresult SetGlyphsFromRun(gfxShapedText *aShapedText, - uint32_t aOffset, - uint32_t aLength, - CTRunRef aCTRun, - int32_t aStringOffset); - - CTFontRef CreateCTFontWithFeatures(CGFloat aSize, - CTFontDescriptorRef aDescriptor); - - CFDictionaryRef CreateAttrDict(bool aRightToLeft); - CFDictionaryRef CreateAttrDictWithoutDirection(); - - static CTFontDescriptorRef - CreateFontFeaturesDescriptor(const std::pair aFeatures[], - size_t aCount); - - static CTFontDescriptorRef GetDefaultFeaturesDescriptor(); - static CTFontDescriptorRef GetDisableLigaturesDescriptor(); - static CTFontDescriptorRef GetIndicFeaturesDescriptor(); - static CTFontDescriptorRef GetIndicDisableLigaturesDescriptor(); - - // cached font descriptor, created the first time it's needed - static CTFontDescriptorRef sDefaultFeaturesDescriptor; - - // cached descriptor for adding disable-ligatures setting to a font - static CTFontDescriptorRef sDisableLigaturesDescriptor; - - // feature descriptors for buggy Indic AAT font workaround - static CTFontDescriptorRef sIndicFeaturesDescriptor; - static CTFontDescriptorRef sIndicDisableLigaturesDescriptor; -}; - -#endif /* GFX_CORETEXTSHAPER_H */ diff --git a/gfx/thebes/gfxFontUtils.cpp b/gfx/thebes/gfxFontUtils.cpp index 54ca03ff6c..0d4b309f6c 100644 --- a/gfx/thebes/gfxFontUtils.cpp +++ b/gfx/thebes/gfxFontUtils.cpp @@ -379,24 +379,14 @@ gfxFontUtils::ReadCMAPTableFormat14(const uint8_t *aBuf, uint32_t aLength, return NS_OK; } -// For fonts with two format-4 tables, the first one (Unicode platform) is preferred on the Mac; -// on other platforms we allow the Microsoft-platform subtable to replace it. +// For fonts with two format-4 tables, we allow the first one (Unicode platform) +// to be replaced by the Microsoft-platform subtable. -#if defined(XP_MACOSX) - #define acceptableFormat4(p,e,k) (((p) == PLATFORM_ID_MICROSOFT && (e) == EncodingIDMicrosoft && !(k)) || \ - ((p) == PLATFORM_ID_UNICODE)) +#define acceptableFormat4(p,e,k) (((p) == PLATFORM_ID_MICROSOFT && (e) == EncodingIDMicrosoft) || \ + ((p) == PLATFORM_ID_UNICODE)) - #define acceptableUCS4Encoding(p, e, k) \ - (((p) == PLATFORM_ID_MICROSOFT && (e) == EncodingIDUCS4ForMicrosoftPlatform) && (k) != 12 || \ - ((p) == PLATFORM_ID_UNICODE && \ - ((e) != EncodingIDUVSForUnicodePlatform))) -#else - #define acceptableFormat4(p,e,k) (((p) == PLATFORM_ID_MICROSOFT && (e) == EncodingIDMicrosoft) || \ - ((p) == PLATFORM_ID_UNICODE)) - - #define acceptableUCS4Encoding(p, e, k) \ +#define acceptableUCS4Encoding(p, e, k) \ ((p) == PLATFORM_ID_MICROSOFT && (e) == EncodingIDUCS4ForMicrosoftPlatform) -#endif #define acceptablePlatform(p) ((p) == PLATFORM_ID_UNICODE || (p) == PLATFORM_ID_MICROSOFT) #define isSymbol(p,e) ((p) == PLATFORM_ID_MICROSOFT && (e) == EncodingIDSymbol) @@ -1230,13 +1220,8 @@ gfxFontUtils::GetFamilyNameFromTable(hb_blob_t *aNameTable, } enum { -#if defined(XP_MACOSX) - CANONICAL_LANG_ID = gfxFontUtils::LANG_ID_MAC_ENGLISH, - PLATFORM_ID = gfxFontUtils::PLATFORM_ID_MAC -#else CANONICAL_LANG_ID = gfxFontUtils::LANG_ID_MICROSOFT_EN_US, PLATFORM_ID = gfxFontUtils::PLATFORM_ID_MICROSOFT -#endif }; nsresult @@ -1277,22 +1262,6 @@ gfxFontUtils::ReadCanonicalName(const char *aNameData, uint32_t aDataLen, NS_ENSURE_SUCCESS(rv, rv); } -#if defined(XP_MACOSX) - // may be dealing with font that only has Microsoft name entries - if (names.Length() == 0) { - rv = ReadNames(aNameData, aDataLen, aNameID, LANG_ID_MICROSOFT_EN_US, - PLATFORM_ID_MICROSOFT, names); - NS_ENSURE_SUCCESS(rv, rv); - - // getting really desperate now, take anything! - if (names.Length() == 0) { - rv = ReadNames(aNameData, aDataLen, aNameID, LANG_ALL, - PLATFORM_ID_MICROSOFT, names); - NS_ENSURE_SUCCESS(rv, rv); - } - } -#endif - // return the first name (99.9% of the time names will // contain a single English name) if (names.Length()) { diff --git a/gfx/thebes/gfxMacFont.cpp b/gfx/thebes/gfxMacFont.cpp deleted file mode 100644 index f512c689f7..0000000000 --- a/gfx/thebes/gfxMacFont.cpp +++ /dev/null @@ -1,475 +0,0 @@ -/* -*- Mode: C++; tab-width: 20; 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/. */ - -#include "gfxMacFont.h" - -#include "mozilla/MemoryReporting.h" -#include "mozilla/Sprintf.h" - -#include "gfxCoreTextShaper.h" -#include -#include "gfxPlatformMac.h" -#include "gfxContext.h" -#include "gfxFontUtils.h" -#include "gfxMacPlatformFontList.h" -#include "gfxFontConstants.h" -#include "gfxTextRun.h" - -#include "cairo-quartz.h" - -using namespace mozilla; -using namespace mozilla::gfx; - -gfxMacFont::gfxMacFont(MacOSFontEntry *aFontEntry, const gfxFontStyle *aFontStyle, - bool aNeedsBold) - : gfxFont(aFontEntry, aFontStyle), - mCGFont(nullptr), - mCTFont(nullptr), - mFontFace(nullptr) -{ - mApplySyntheticBold = aNeedsBold; - - mCGFont = aFontEntry->GetFontRef(); - if (!mCGFont) { - mIsValid = false; - return; - } - - // InitMetrics will handle the sizeAdjust factor and set mAdjustedSize - InitMetrics(); - if (!mIsValid) { - return; - } - - mFontFace = cairo_quartz_font_face_create_for_cgfont(mCGFont); - - cairo_status_t cairoerr = cairo_font_face_status(mFontFace); - if (cairoerr != CAIRO_STATUS_SUCCESS) { - mIsValid = false; -#ifdef DEBUG - char warnBuf[1024]; - SprintfLiteral(warnBuf, - "Failed to create Cairo font face: %s status: %d", - NS_ConvertUTF16toUTF8(GetName()).get(), cairoerr); - NS_WARNING(warnBuf); -#endif - return; - } - - cairo_matrix_t sizeMatrix, ctm; - cairo_matrix_init_identity(&ctm); - cairo_matrix_init_scale(&sizeMatrix, mAdjustedSize, mAdjustedSize); - - // synthetic oblique by skewing via the font matrix - bool needsOblique = mFontEntry != nullptr && - mFontEntry->IsUpright() && - mStyle.style != NS_FONT_STYLE_NORMAL && - mStyle.allowSyntheticStyle; - - if (needsOblique) { - cairo_matrix_t style; - cairo_matrix_init(&style, - 1, //xx - 0, //yx - -1 * OBLIQUE_SKEW_FACTOR, //xy - 1, //yy - 0, //x0 - 0); //y0 - cairo_matrix_multiply(&sizeMatrix, &sizeMatrix, &style); - } - - cairo_font_options_t *fontOptions = cairo_font_options_create(); - - // turn off font anti-aliasing based on user pref setting - if (mAdjustedSize <= - (gfxFloat)gfxPlatformMac::GetPlatform()->GetAntiAliasingThreshold()) { - cairo_font_options_set_antialias(fontOptions, CAIRO_ANTIALIAS_NONE); - mAntialiasOption = kAntialiasNone; - } else if (mStyle.useGrayscaleAntialiasing) { - cairo_font_options_set_antialias(fontOptions, CAIRO_ANTIALIAS_GRAY); - mAntialiasOption = kAntialiasGrayscale; - } - - mScaledFont = cairo_scaled_font_create(mFontFace, &sizeMatrix, &ctm, - fontOptions); - cairo_font_options_destroy(fontOptions); - - cairoerr = cairo_scaled_font_status(mScaledFont); - if (cairoerr != CAIRO_STATUS_SUCCESS) { - mIsValid = false; -#ifdef DEBUG - char warnBuf[1024]; - SprintfLiteral(warnBuf, "Failed to create scaled font: %s status: %d", - NS_ConvertUTF16toUTF8(GetName()).get(), cairoerr); - NS_WARNING(warnBuf); -#endif - } -} - -gfxMacFont::~gfxMacFont() -{ - if (mCTFont) { - ::CFRelease(mCTFont); - } - if (mScaledFont) { - cairo_scaled_font_destroy(mScaledFont); - } - if (mFontFace) { - cairo_font_face_destroy(mFontFace); - } -} - -bool -gfxMacFont::ShapeText(DrawTarget *aDrawTarget, - const char16_t *aText, - uint32_t aOffset, - uint32_t aLength, - Script aScript, - bool aVertical, - gfxShapedText *aShapedText) -{ - if (!mIsValid) { - NS_WARNING("invalid font! expect incorrect text rendering"); - return false; - } - - // Currently, we don't support vertical shaping via CoreText, - // so we ignore RequiresAATLayout if vertical is requested. - if (static_cast(GetFontEntry())->RequiresAATLayout() && - !aVertical) { - if (!mCoreTextShaper) { - mCoreTextShaper = MakeUnique(this); - } - if (mCoreTextShaper->ShapeText(aDrawTarget, aText, aOffset, aLength, - aScript, aVertical, aShapedText)) { - PostShapingFixup(aDrawTarget, aText, aOffset, - aLength, aVertical, aShapedText); - return true; - } - } - - return gfxFont::ShapeText(aDrawTarget, aText, aOffset, aLength, aScript, - aVertical, aShapedText); -} - -bool -gfxMacFont::SetupCairoFont(DrawTarget* aDrawTarget) -{ - if (cairo_scaled_font_status(mScaledFont) != CAIRO_STATUS_SUCCESS) { - // Don't cairo_set_scaled_font as that would propagate the error to - // the cairo_t, precluding any further drawing. - return false; - } - cairo_set_scaled_font(gfxFont::RefCairo(aDrawTarget), mScaledFont); - return true; -} - -gfxFont::RunMetrics -gfxMacFont::Measure(const gfxTextRun *aTextRun, - uint32_t aStart, uint32_t aEnd, - BoundingBoxType aBoundingBoxType, - DrawTarget *aRefDrawTarget, - Spacing *aSpacing, - uint16_t aOrientation) -{ - gfxFont::RunMetrics metrics = - gfxFont::Measure(aTextRun, aStart, aEnd, - aBoundingBoxType, aRefDrawTarget, aSpacing, - aOrientation); - - // if aBoundingBoxType is not TIGHT_HINTED_OUTLINE_EXTENTS then we need to add - // a pixel column each side of the bounding box in case of antialiasing "bleed" - if (aBoundingBoxType != TIGHT_HINTED_OUTLINE_EXTENTS && - metrics.mBoundingBox.width > 0) { - metrics.mBoundingBox.x -= aTextRun->GetAppUnitsPerDevUnit(); - metrics.mBoundingBox.width += aTextRun->GetAppUnitsPerDevUnit() * 2; - } - - return metrics; -} - -void -gfxMacFont::InitMetrics() -{ - mIsValid = false; - ::memset(&mMetrics, 0, sizeof(mMetrics)); - - uint32_t upem = 0; - - // try to get unitsPerEm from sfnt head table, to avoid calling CGFont - // if possible (bug 574368) and because CGFontGetUnitsPerEm does not - // return the true value for OpenType/CFF fonts (it normalizes to 1000, - // which then leads to metrics errors when we read the 'hmtx' table to - // get glyph advances for HarfBuzz, see bug 580863) - CFDataRef headData = - ::CGFontCopyTableForTag(mCGFont, TRUETYPE_TAG('h','e','a','d')); - if (headData) { - if (size_t(::CFDataGetLength(headData)) >= sizeof(HeadTable)) { - const HeadTable *head = - reinterpret_cast(::CFDataGetBytePtr(headData)); - upem = head->unitsPerEm; - } - ::CFRelease(headData); - } - if (!upem) { - upem = ::CGFontGetUnitsPerEm(mCGFont); - } - - if (upem < 16 || upem > 16384) { - // See http://www.microsoft.com/typography/otspec/head.htm -#ifdef DEBUG - char warnBuf[1024]; - SprintfLiteral(warnBuf, - "Bad font metrics for: %s (invalid unitsPerEm value)", - NS_ConvertUTF16toUTF8(mFontEntry->Name()).get()); - NS_WARNING(warnBuf); -#endif - return; - } - - mAdjustedSize = std::max(mStyle.size, 1.0); - mFUnitsConvFactor = mAdjustedSize / upem; - - // For CFF fonts, when scaling values read from CGFont* APIs, we need to - // use CG's idea of unitsPerEm, which may differ from the "true" value in - // the head table of the font (see bug 580863) - gfxFloat cgConvFactor; - if (static_cast(mFontEntry.get())->IsCFF()) { - cgConvFactor = mAdjustedSize / ::CGFontGetUnitsPerEm(mCGFont); - } else { - cgConvFactor = mFUnitsConvFactor; - } - - // Try to read 'sfnt' metrics; for local, non-sfnt fonts ONLY, fall back to - // platform APIs. The InitMetrics...() functions will set mIsValid on success. - if (!InitMetricsFromSfntTables(mMetrics) && - (!mFontEntry->IsUserFont() || mFontEntry->IsLocalUserFont())) { - InitMetricsFromPlatform(); - } - if (!mIsValid) { - return; - } - - if (mMetrics.xHeight == 0.0) { - mMetrics.xHeight = ::CGFontGetXHeight(mCGFont) * cgConvFactor; - } - - if (mMetrics.capHeight == 0.0) { - mMetrics.capHeight = ::CGFontGetCapHeight(mCGFont) * cgConvFactor; - } - - if (mStyle.sizeAdjust > 0.0 && mStyle.size > 0.0 && - mMetrics.xHeight > 0.0) { - // apply font-size-adjust, and recalculate metrics - gfxFloat aspect = mMetrics.xHeight / mStyle.size; - mAdjustedSize = mStyle.GetAdjustedSize(aspect); - mFUnitsConvFactor = mAdjustedSize / upem; - if (static_cast(mFontEntry.get())->IsCFF()) { - cgConvFactor = mAdjustedSize / ::CGFontGetUnitsPerEm(mCGFont); - } else { - cgConvFactor = mFUnitsConvFactor; - } - mMetrics.xHeight = 0.0; - if (!InitMetricsFromSfntTables(mMetrics) && - (!mFontEntry->IsUserFont() || mFontEntry->IsLocalUserFont())) { - InitMetricsFromPlatform(); - } - if (!mIsValid) { - // this shouldn't happen, as we succeeded earlier before applying - // the size-adjust factor! But check anyway, for paranoia's sake. - return; - } - if (mMetrics.xHeight == 0.0) { - mMetrics.xHeight = ::CGFontGetXHeight(mCGFont) * cgConvFactor; - } - } - - // Once we reach here, we've got basic metrics and set mIsValid = TRUE; - // there should be no further points of actual failure in InitMetrics(). - // (If one is introduced, be sure to reset mIsValid to FALSE!) - - mMetrics.emHeight = mAdjustedSize; - - // Measure/calculate additional metrics, independent of whether we used - // the tables directly or ATS metrics APIs - - CFDataRef cmap = - ::CGFontCopyTableForTag(mCGFont, TRUETYPE_TAG('c','m','a','p')); - - uint32_t glyphID; - if (mMetrics.aveCharWidth <= 0) { - mMetrics.aveCharWidth = GetCharWidth(cmap, 'x', &glyphID, - cgConvFactor); - if (glyphID == 0) { - // we didn't find 'x', so use maxAdvance rather than zero - mMetrics.aveCharWidth = mMetrics.maxAdvance; - } - } - if (IsSyntheticBold()) { - mMetrics.aveCharWidth += GetSyntheticBoldOffset(); - mMetrics.maxAdvance += GetSyntheticBoldOffset(); - } - - mMetrics.spaceWidth = GetCharWidth(cmap, ' ', &glyphID, cgConvFactor); - if (glyphID == 0) { - // no space glyph?! - mMetrics.spaceWidth = mMetrics.aveCharWidth; - } - mSpaceGlyph = glyphID; - - mMetrics.zeroOrAveCharWidth = GetCharWidth(cmap, '0', &glyphID, - cgConvFactor); - if (glyphID == 0) { - mMetrics.zeroOrAveCharWidth = mMetrics.aveCharWidth; - } - - if (cmap) { - ::CFRelease(cmap); - } - - CalculateDerivedMetrics(mMetrics); - - SanitizeMetrics(&mMetrics, mFontEntry->mIsBadUnderlineFont); - -#if 0 - fprintf (stderr, "Font: %p (%s) size: %f\n", this, - NS_ConvertUTF16toUTF8(GetName()).get(), mStyle.size); -// fprintf (stderr, " fbounds.origin.x %f y %f size.width %f height %f\n", fbounds.origin.x, fbounds.origin.y, fbounds.size.width, fbounds.size.height); - fprintf (stderr, " emHeight: %f emAscent: %f emDescent: %f\n", mMetrics.emHeight, mMetrics.emAscent, mMetrics.emDescent); - fprintf (stderr, " maxAscent: %f maxDescent: %f maxAdvance: %f\n", mMetrics.maxAscent, mMetrics.maxDescent, mMetrics.maxAdvance); - fprintf (stderr, " internalLeading: %f externalLeading: %f\n", mMetrics.internalLeading, mMetrics.externalLeading); - fprintf (stderr, " spaceWidth: %f aveCharWidth: %f xHeight: %f capHeight: %f\n", mMetrics.spaceWidth, mMetrics.aveCharWidth, mMetrics.xHeight, mMetrics.capHeight); - fprintf (stderr, " uOff: %f uSize: %f stOff: %f stSize: %f\n", mMetrics.underlineOffset, mMetrics.underlineSize, mMetrics.strikeoutOffset, mMetrics.strikeoutSize); -#endif -} - -gfxFloat -gfxMacFont::GetCharWidth(CFDataRef aCmap, char16_t aUniChar, - uint32_t *aGlyphID, gfxFloat aConvFactor) -{ - CGGlyph glyph = 0; - - if (aCmap) { - glyph = gfxFontUtils::MapCharToGlyph(::CFDataGetBytePtr(aCmap), - ::CFDataGetLength(aCmap), - aUniChar); - } - - if (aGlyphID) { - *aGlyphID = glyph; - } - - if (glyph) { - int advance; - if (::CGFontGetGlyphAdvances(mCGFont, &glyph, 1, &advance)) { - return advance * aConvFactor; - } - } - - return 0; -} - -int32_t -gfxMacFont::GetGlyphWidth(DrawTarget& aDrawTarget, uint16_t aGID) -{ - if (!mCTFont) { - mCTFont = ::CTFontCreateWithGraphicsFont(mCGFont, mAdjustedSize, - nullptr, nullptr); - if (!mCTFont) { // shouldn't happen, but let's be safe - NS_WARNING("failed to create CTFontRef to measure glyph width"); - return 0; - } - } - - CGSize advance; - ::CTFontGetAdvancesForGlyphs(mCTFont, kCTFontDefaultOrientation, &aGID, - &advance, 1); - return advance.width * 0x10000; -} - -// Try to initialize font metrics via platform APIs (CG/CT), -// and set mIsValid = TRUE on success. -// We ONLY call this for local (platform) fonts that are not sfnt format; -// for sfnts, including ALL downloadable fonts, we prefer to use -// InitMetricsFromSfntTables and avoid platform APIs. -void -gfxMacFont::InitMetricsFromPlatform() -{ - CTFontRef ctFont = ::CTFontCreateWithGraphicsFont(mCGFont, - mAdjustedSize, - nullptr, nullptr); - if (!ctFont) { - return; - } - - mMetrics.underlineOffset = ::CTFontGetUnderlinePosition(ctFont); - mMetrics.underlineSize = ::CTFontGetUnderlineThickness(ctFont); - - mMetrics.externalLeading = ::CTFontGetLeading(ctFont); - - mMetrics.maxAscent = ::CTFontGetAscent(ctFont); - mMetrics.maxDescent = ::CTFontGetDescent(ctFont); - - // this is not strictly correct, but neither CTFont nor CGFont seems to - // provide maxAdvance, unless we were to iterate over all the glyphs - // (which isn't worth the cost here) - CGRect r = ::CTFontGetBoundingBox(ctFont); - mMetrics.maxAdvance = r.size.width; - - // aveCharWidth is also not provided, so leave it at zero - // (fallback code in gfxMacFont::InitMetrics will then try measuring 'x'); - // this could lead to less-than-"perfect" text field sizing when width is - // specified as a number of characters, and the font in use is a non-sfnt - // legacy font, but that's a sufficiently obscure edge case that we can - // ignore the potential discrepancy. - mMetrics.aveCharWidth = 0; - - mMetrics.xHeight = ::CTFontGetXHeight(ctFont); - mMetrics.capHeight = ::CTFontGetCapHeight(ctFont); - - ::CFRelease(ctFont); - - mIsValid = true; -} - -already_AddRefed -gfxMacFont::GetScaledFont(DrawTarget *aTarget) -{ - if (!mAzureScaledFont) { - NativeFont nativeFont; - nativeFont.mType = NativeFontType::MAC_FONT_FACE; - nativeFont.mFont = GetCGFontRef(); - mAzureScaledFont = mozilla::gfx::Factory::CreateScaledFontWithCairo(nativeFont, GetAdjustedSize(), mScaledFont); - } - - RefPtr scaledFont(mAzureScaledFont); - return scaledFont.forget(); -} - -already_AddRefed -gfxMacFont::GetGlyphRenderingOptions(const TextRunDrawParams* aRunParams) -{ - if (aRunParams) { - return mozilla::gfx::Factory::CreateCGGlyphRenderingOptions(aRunParams->fontSmoothingBGColor); - } - return nullptr; -} - -void -gfxMacFont::AddSizeOfExcludingThis(MallocSizeOf aMallocSizeOf, - FontCacheSizes* aSizes) const -{ - gfxFont::AddSizeOfExcludingThis(aMallocSizeOf, aSizes); - // mCGFont is shared with the font entry, so not counted here; - // and we don't have APIs to measure the cairo mFontFace object -} - -void -gfxMacFont::AddSizeOfIncludingThis(MallocSizeOf aMallocSizeOf, - FontCacheSizes* aSizes) const -{ - aSizes->mFontInstances += aMallocSizeOf(this); - AddSizeOfExcludingThis(aMallocSizeOf, aSizes); -} diff --git a/gfx/thebes/gfxMacFont.h b/gfx/thebes/gfxMacFont.h deleted file mode 100644 index d12cc717ba..0000000000 --- a/gfx/thebes/gfxMacFont.h +++ /dev/null @@ -1,102 +0,0 @@ -/* -*- Mode: C++; tab-width: 20; 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 GFX_MACFONT_H -#define GFX_MACFONT_H - -#include "mozilla/MemoryReporting.h" -#include "gfxFont.h" -#include "cairo.h" -#include - -class MacOSFontEntry; - -class gfxMacFont : public gfxFont -{ -public: - gfxMacFont(MacOSFontEntry *aFontEntry, const gfxFontStyle *aFontStyle, - bool aNeedsBold); - - virtual ~gfxMacFont(); - - CGFontRef GetCGFontRef() const { return mCGFont; } - - /* overrides for the pure virtual methods in gfxFont */ - virtual uint32_t GetSpaceGlyph() override { - return mSpaceGlyph; - } - - virtual bool SetupCairoFont(DrawTarget* aDrawTarget) override; - - /* override Measure to add padding for antialiasing */ - virtual RunMetrics Measure(const gfxTextRun *aTextRun, - uint32_t aStart, uint32_t aEnd, - BoundingBoxType aBoundingBoxType, - DrawTarget *aDrawTargetForTightBoundingBox, - Spacing *aSpacing, - uint16_t aOrientation) override; - - // We need to provide hinted (non-linear) glyph widths if using a font - // with embedded color bitmaps (Apple Color Emoji), as Core Text renders - // the glyphs with non-linear scaling at small pixel sizes. - virtual bool ProvidesGlyphWidths() const override { - return mFontEntry->HasFontTable(TRUETYPE_TAG('s','b','i','x')); - } - - virtual int32_t GetGlyphWidth(DrawTarget& aDrawTarget, - uint16_t aGID) override; - - virtual already_AddRefed - GetScaledFont(mozilla::gfx::DrawTarget *aTarget) override; - - virtual already_AddRefed - GetGlyphRenderingOptions(const TextRunDrawParams* aRunParams = nullptr) override; - - virtual void AddSizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf, - FontCacheSizes* aSizes) const override; - virtual void AddSizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf, - FontCacheSizes* aSizes) const override; - - virtual FontType GetType() const override { return FONT_TYPE_MAC; } - -protected: - virtual const Metrics& GetHorizontalMetrics() override { - return mMetrics; - } - - // override to prefer CoreText shaping with fonts that depend on AAT - virtual bool ShapeText(DrawTarget *aDrawTarget, - const char16_t *aText, - uint32_t aOffset, - uint32_t aLength, - Script aScript, - bool aVertical, - gfxShapedText *aShapedText) override; - - void InitMetrics(); - void InitMetricsFromPlatform(); - - // Get width and glyph ID for a character; uses aConvFactor - // to convert font units as returned by CG to actual dimensions - gfxFloat GetCharWidth(CFDataRef aCmap, char16_t aUniChar, - uint32_t *aGlyphID, gfxFloat aConvFactor); - - // a weak reference to the CoreGraphics font: this is owned by the - // MacOSFontEntry, it is not retained or released by gfxMacFont - CGFontRef mCGFont; - - // a Core Text font reference, created only if we're using CT to measure - // glyph widths; otherwise null. - CTFontRef mCTFont; - - cairo_font_face_t *mFontFace; - - mozilla::UniquePtr mCoreTextShaper; - - Metrics mMetrics; - uint32_t mSpaceGlyph; -}; - -#endif /* GFX_MACFONT_H */ diff --git a/gfx/thebes/gfxMacPlatformFontList.h b/gfx/thebes/gfxMacPlatformFontList.h deleted file mode 100644 index 0ab062dca4..0000000000 --- a/gfx/thebes/gfxMacPlatformFontList.h +++ /dev/null @@ -1,182 +0,0 @@ -/* -*- Mode: C++; tab-width: 20; 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 gfxMacPlatformFontList_H_ -#define gfxMacPlatformFontList_H_ - -#include - -#include "mozilla/MemoryReporting.h" -#include "nsDataHashtable.h" -#include "nsRefPtrHashtable.h" - -#include "gfxPlatformFontList.h" -#include "gfxPlatform.h" -#include "gfxPlatformMac.h" - -#include "nsUnicharUtils.h" -#include "nsTArray.h" -#include "mozilla/LookAndFeel.h" - -class gfxMacPlatformFontList; - -// a single member of a font family (i.e. a single face, such as Times Italic) -class MacOSFontEntry : public gfxFontEntry -{ -public: - friend class gfxMacPlatformFontList; - - MacOSFontEntry(const nsAString& aPostscriptName, int32_t aWeight, - bool aIsStandardFace = false, - double aSizeHint = 0.0); - - // for use with data fonts - MacOSFontEntry(const nsAString& aPostscriptName, CGFontRef aFontRef, - uint16_t aWeight, uint16_t aStretch, uint8_t aStyle, - bool aIsDataUserFont, bool aIsLocal); - - virtual ~MacOSFontEntry() { - ::CGFontRelease(mFontRef); - } - - virtual CGFontRef GetFontRef(); - - // override gfxFontEntry table access function to bypass table cache, - // use CGFontRef API to get direct access to system font data - virtual hb_blob_t *GetFontTable(uint32_t aTag) override; - - virtual void AddSizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf, - FontListSizes* aSizes) const override; - - nsresult ReadCMAP(FontInfoData *aFontInfoData = nullptr) override; - - bool RequiresAATLayout() const { return mRequiresAAT; } - - bool IsCFF(); - -protected: - virtual gfxFont* CreateFontInstance(const gfxFontStyle *aFontStyle, bool aNeedsBold) override; - - virtual bool HasFontTable(uint32_t aTableTag) override; - - static void DestroyBlobFunc(void* aUserData); - - CGFontRef mFontRef; // owning reference to the CGFont, released on destruction - - double mSizeHint; - - bool mFontRefInitialized; - bool mRequiresAAT; - bool mIsCFF; - bool mIsCFFInitialized; - nsTHashtable mAvailableTables; -}; - -class gfxMacPlatformFontList : public gfxPlatformFontList { -public: - static gfxMacPlatformFontList* PlatformFontList() { - return static_cast(sPlatformFontList); - } - - static int32_t AppleWeightToCSSWeight(int32_t aAppleWeight); - - bool GetStandardFamilyName(const nsAString& aFontName, nsAString& aFamilyName) override; - - gfxFontEntry* LookupLocalFont(const nsAString& aFontName, - uint16_t aWeight, - int16_t aStretch, - uint8_t aStyle) override; - - gfxFontEntry* MakePlatformFont(const nsAString& aFontName, - uint16_t aWeight, - int16_t aStretch, - uint8_t aStyle, - const uint8_t* aFontData, - uint32_t aLength) override; - - bool FindAndAddFamilies(const nsAString& aFamily, - nsTArray* aOutput, - gfxFontStyle* aStyle = nullptr, - gfxFloat aDevToCssSize = 1.0) override; - - // lookup the system font for a particular system font type and set - // the name and style characteristics - void LookupSystemFont(mozilla::LookAndFeel::FontID aSystemFontID, - nsAString& aSystemFontName, - gfxFontStyle &aFontStyle, - float aDevPixPerCSSPixel); - -protected: - virtual gfxFontFamily* - GetDefaultFontForPlatform(const gfxFontStyle* aStyle) override; - -private: - friend class gfxPlatformMac; - - gfxMacPlatformFontList(); - virtual ~gfxMacPlatformFontList(); - - // initialize font lists - virtual nsresult InitFontListForPlatform() override; - - // special case font faces treated as font families (set via prefs) - void InitSingleFaceList(); - - // initialize system fonts - void InitSystemFontNames(); - - // helper function to lookup in both hidden system fonts and normal fonts - gfxFontFamily* FindSystemFontFamily(const nsAString& aFamily); - - static void RegisteredFontsChangedNotificationCallback(CFNotificationCenterRef center, - void *observer, - CFStringRef name, - const void *object, - CFDictionaryRef userInfo); - - // attempt to use platform-specific fallback for the given character - // return null if no usable result found - gfxFontEntry* - PlatformGlobalFontFallback(const uint32_t aCh, - Script aRunScript, - const gfxFontStyle* aMatchStyle, - gfxFontFamily** aMatchedFamily) override; - - bool UsesSystemFallback() override { return true; } - - already_AddRefed CreateFontInfoData() override; - - // Add the specified family to mSystemFontFamilies or mFontFamilies. - // Ideally we'd use NSString* instead of CFStringRef here, but this header - // file is included in .cpp files, so we can't use objective C classes here. - // But CFStringRef and NSString* are the same thing anyway (they're - // toll-free bridged). - void AddFamily(CFStringRef aFamily); - -#ifdef MOZ_BUNDLED_FONTS - void ActivateBundledFonts(); -#endif - - enum { - kATSGenerationInitial = -1 - }; - - // default font for use with system-wide font fallback - CTFontRef mDefaultFont; - - // hidden system fonts used within UI elements, there may be a whole set - // for different locales (e.g. .Helvetica Neue UI, .SF NS Text) - FontFamilyTable mSystemFontFamilies; - - // font families that -apple-system maps to - // Pre-10.11 this was always a single font family, such as Lucida Grande - // or Helvetica Neue. For OSX 10.11, Apple uses pair of families - // for the UI, one for text sizes and another for display sizes - bool mUseSizeSensitiveSystemFont; - nsString mSystemTextFontFamilyName; - nsString mSystemDisplayFontFamilyName; // only used on OSX 10.11 -}; - -#endif /* gfxMacPlatformFontList_H_ */ diff --git a/gfx/thebes/gfxMacPlatformFontList.mm b/gfx/thebes/gfxMacPlatformFontList.mm deleted file mode 100644 index 4536ab527b..0000000000 --- a/gfx/thebes/gfxMacPlatformFontList.mm +++ /dev/null @@ -1,1444 +0,0 @@ -/* -*- Mode: ObjC; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * ***** BEGIN LICENSE BLOCK ***** - * Version: BSD - * - * Copyright (C) 2006-2009 Mozilla Corporation. All rights reserved. - * - * Contributor(s): - * Vladimir Vukicevic - * Masayuki Nakano - * John Daggett - * Jonathan Kew - * - * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * ***** END LICENSE BLOCK ***** */ - -#include "mozilla/Logging.h" - -#include - -#import - -#include "gfxPlatformMac.h" -#include "gfxMacPlatformFontList.h" -#include "gfxMacFont.h" -#include "gfxUserFontSet.h" -#include "harfbuzz/hb.h" - -#include "nsServiceManagerUtils.h" -#include "nsTArray.h" - -#include "nsDirectoryServiceUtils.h" -#include "nsDirectoryServiceDefs.h" -#include "nsAppDirectoryServiceDefs.h" -#include "nsISimpleEnumerator.h" -#include "nsCharTraits.h" -#include "nsCocoaFeatures.h" -#include "nsCocoaUtils.h" -#include "gfxFontConstants.h" - -#include "mozilla/MemoryReporting.h" -#include "mozilla/Preferences.h" -#include "mozilla/Sprintf.h" -#include "mozilla/gfx/2D.h" - -#include -#include -#include - -using namespace mozilla; - -// indexes into the NSArray objects that the Cocoa font manager returns -// as the available members of a family -#define INDEX_FONT_POSTSCRIPT_NAME 0 -#define INDEX_FONT_FACE_NAME 1 -#define INDEX_FONT_WEIGHT 2 -#define INDEX_FONT_TRAITS 3 - -static const int kAppleMaxWeight = 14; -static const int kAppleExtraLightWeight = 3; -static const int kAppleUltraLightWeight = 2; - -static const int gAppleWeightToCSSWeight[] = { - 0, - 1, // 1. - 1, // 2. W1, ultralight - 2, // 3. W2, extralight - 3, // 4. W3, light - 4, // 5. W4, semilight - 5, // 6. W5, medium - 6, // 7. - 6, // 8. W6, semibold - 7, // 9. W7, bold - 8, // 10. W8, extrabold - 8, // 11. - 9, // 12. W9, ultrabold - 9, // 13 - 9 // 14 -}; - -// cache Cocoa's "shared font manager" for performance -static NSFontManager *sFontManager; - -static void GetStringForNSString(const NSString *aSrc, nsAString& aDist) -{ - aDist.SetLength([aSrc length]); - [aSrc getCharacters:reinterpret_cast(aDist.BeginWriting())]; -} - -static NSString* GetNSStringForString(const nsAString& aSrc) -{ - return [NSString stringWithCharacters:reinterpret_cast(aSrc.BeginReading()) - length:aSrc.Length()]; -} - -#define LOG_FONTLIST(args) MOZ_LOG(gfxPlatform::GetLog(eGfxLog_fontlist), \ - mozilla::LogLevel::Debug, args) -#define LOG_FONTLIST_ENABLED() MOZ_LOG_TEST( \ - gfxPlatform::GetLog(eGfxLog_fontlist), \ - mozilla::LogLevel::Debug) -#define LOG_CMAPDATA_ENABLED() MOZ_LOG_TEST( \ - gfxPlatform::GetLog(eGfxLog_cmapdata), \ - mozilla::LogLevel::Debug) - -#pragma mark- - -// Complex scripts will not render correctly unless appropriate AAT or OT -// layout tables are present. -// For OpenType, we also check that the GSUB table supports the relevant -// script tag, to avoid using things like Arial Unicode MS for Lao (it has -// the characters, but lacks OpenType support). - -// TODO: consider whether we should move this to gfxFontEntry and do similar -// cmap-masking on other platforms to avoid using fonts that won't shape -// properly. - -nsresult -MacOSFontEntry::ReadCMAP(FontInfoData *aFontInfoData) -{ - // attempt this once, if errors occur leave a blank cmap - if (mCharacterMap) { - return NS_OK; - } - - RefPtr charmap; - nsresult rv; - bool symbolFont = false; // currently ignored - - if (aFontInfoData && (charmap = GetCMAPFromFontInfo(aFontInfoData, - mUVSOffset, - symbolFont))) { - rv = NS_OK; - } else { - uint32_t kCMAP = TRUETYPE_TAG('c','m','a','p'); - charmap = new gfxCharacterMap(); - AutoTable cmapTable(this, kCMAP); - - if (cmapTable) { - bool unicodeFont = false; // currently ignored - uint32_t cmapLen; - const uint8_t* cmapData = - reinterpret_cast(hb_blob_get_data(cmapTable, - &cmapLen)); - rv = gfxFontUtils::ReadCMAP(cmapData, cmapLen, - *charmap, mUVSOffset, - unicodeFont, symbolFont); - } else { - rv = NS_ERROR_NOT_AVAILABLE; - } - } - - if (NS_SUCCEEDED(rv) && !HasGraphiteTables()) { - // We assume a Graphite font knows what it's doing, - // and provides whatever shaping is needed for the - // characters it supports, so only check/clear the - // complex-script ranges for non-Graphite fonts - - // for layout support, check for the presence of mort/morx and/or - // opentype layout tables - bool hasAATLayout = HasFontTable(TRUETYPE_TAG('m','o','r','x')) || - HasFontTable(TRUETYPE_TAG('m','o','r','t')); - bool hasGSUB = HasFontTable(TRUETYPE_TAG('G','S','U','B')); - bool hasGPOS = HasFontTable(TRUETYPE_TAG('G','P','O','S')); - if (hasAATLayout && !(hasGSUB || hasGPOS)) { - mRequiresAAT = true; // prefer CoreText if font has no OTL tables - } - - for (const ScriptRange* sr = gfxPlatformFontList::sComplexScriptRanges; - sr->rangeStart; sr++) { - // check to see if the cmap includes complex script codepoints - if (charmap->TestRange(sr->rangeStart, sr->rangeEnd)) { - if (hasAATLayout) { - // prefer CoreText for Apple's complex-script fonts, - // even if they also have some OpenType tables - // (e.g. Geeza Pro Bold on 10.6; see bug 614903) - mRequiresAAT = true; - // and don't mask off complex-script ranges, we assume - // the AAT tables will provide the necessary shaping - continue; - } - - // We check for GSUB here, as GPOS alone would not be ok. - if (hasGSUB && SupportsScriptInGSUB(sr->tags)) { - continue; - } - - charmap->ClearRange(sr->rangeStart, sr->rangeEnd); - } - } - - // Bug 1360309, 1393624: several of Apple's Chinese fonts have spurious - // blank glyphs for obscure Tibetan and Arabic-script codepoints. - // Blacklist these so that font fallback will not use them. - if (mRequiresAAT && (FamilyName().EqualsLiteral("Songti SC") || - FamilyName().EqualsLiteral("Songti TC") || - FamilyName().EqualsLiteral("STSong") || - // Bug 1390980: on 10.11, the Kaiti fonts are also affected. - FamilyName().EqualsLiteral("Kaiti SC") || - FamilyName().EqualsLiteral("Kaiti TC") || - FamilyName().EqualsLiteral("STKaiti"))) { - charmap->ClearRange(0x0f6b, 0x0f70); - charmap->ClearRange(0x0f8c, 0x0f8f); - charmap->clear(0x0f98); - charmap->clear(0x0fbd); - charmap->ClearRange(0x0fcd, 0x0fff); - charmap->clear(0x0620); - charmap->clear(0x065f); - charmap->ClearRange(0x06ee, 0x06ef); - charmap->clear(0x06ff); - } - } - - mHasCmapTable = NS_SUCCEEDED(rv); - if (mHasCmapTable) { - gfxPlatformFontList *pfl = gfxPlatformFontList::PlatformFontList(); - mCharacterMap = pfl->FindCharMap(charmap); - } else { - // if error occurred, initialize to null cmap - mCharacterMap = new gfxCharacterMap(); - } - - LOG_FONTLIST(("(fontlist-cmap) name: %s, size: %d hash: %8.8x%s\n", - NS_ConvertUTF16toUTF8(mName).get(), - charmap->SizeOfIncludingThis(moz_malloc_size_of), - charmap->mHash, mCharacterMap == charmap ? " new" : "")); - if (LOG_CMAPDATA_ENABLED()) { - char prefix[256]; - SprintfLiteral(prefix, "(cmapdata) name: %.220s", - NS_ConvertUTF16toUTF8(mName).get()); - charmap->Dump(prefix, eGfxLog_cmapdata); - } - - return rv; -} - -gfxFont* -MacOSFontEntry::CreateFontInstance(const gfxFontStyle *aFontStyle, bool aNeedsBold) -{ - return new gfxMacFont(this, aFontStyle, aNeedsBold); -} - -bool -MacOSFontEntry::IsCFF() -{ - if (!mIsCFFInitialized) { - mIsCFFInitialized = true; - mIsCFF = HasFontTable(TRUETYPE_TAG('C','F','F',' ')); - } - - return mIsCFF; -} - -MacOSFontEntry::MacOSFontEntry(const nsAString& aPostscriptName, - int32_t aWeight, - bool aIsStandardFace, - double aSizeHint) - : gfxFontEntry(aPostscriptName, aIsStandardFace), - mFontRef(NULL), - mSizeHint(aSizeHint), - mFontRefInitialized(false), - mRequiresAAT(false), - mIsCFF(false), - mIsCFFInitialized(false) -{ - mWeight = aWeight; -} - -MacOSFontEntry::MacOSFontEntry(const nsAString& aPostscriptName, - CGFontRef aFontRef, - uint16_t aWeight, uint16_t aStretch, - uint8_t aStyle, - bool aIsDataUserFont, - bool aIsLocalUserFont) - : gfxFontEntry(aPostscriptName, false), - mFontRef(NULL), - mSizeHint(0.0), - mFontRefInitialized(false), - mRequiresAAT(false), - mIsCFF(false), - mIsCFFInitialized(false) -{ - mFontRef = aFontRef; - mFontRefInitialized = true; - ::CFRetain(mFontRef); - - mWeight = aWeight; - mStretch = aStretch; - mFixedPitch = false; // xxx - do we need this for downloaded fonts? - mStyle = aStyle; - - NS_ASSERTION(!(aIsDataUserFont && aIsLocalUserFont), - "userfont is either a data font or a local font"); - mIsDataUserFont = aIsDataUserFont; - mIsLocalUserFont = aIsLocalUserFont; -} - -CGFontRef -MacOSFontEntry::GetFontRef() -{ - if (!mFontRefInitialized) { - mFontRefInitialized = true; - NSString *psname = GetNSStringForString(mName); - mFontRef = ::CGFontCreateWithFontName(CFStringRef(psname)); - if (!mFontRef) { - // This happens on macOS 10.12 for font entry names that start with - // .AppleSystemUIFont. For those fonts, we need to go through NSFont - // to get the correct CGFontRef. - // Both the Text and the Display variant of the display font use - // .AppleSystemUIFontSomethingSomething as their member names. - // That's why we're carrying along mSizeHint to this place so that - // we get the variant that we want for this family. - NSFont* font = [NSFont fontWithName:psname size:mSizeHint]; - if (font) { - mFontRef = CTFontCopyGraphicsFont((CTFontRef)font, nullptr); - } - } - } - return mFontRef; -} - -// For a logging build, we wrap the CFDataRef in a FontTableRec so that we can -// use the MOZ_COUNT_[CD]TOR macros in it. A release build without logging -// does not get this overhead. -class FontTableRec { -public: - explicit FontTableRec(CFDataRef aDataRef) - : mDataRef(aDataRef) - { - MOZ_COUNT_CTOR(FontTableRec); - } - - ~FontTableRec() { - MOZ_COUNT_DTOR(FontTableRec); - ::CFRelease(mDataRef); - } - -private: - CFDataRef mDataRef; -}; - -/*static*/ void -MacOSFontEntry::DestroyBlobFunc(void* aUserData) -{ -#ifdef NS_BUILD_REFCNT_LOGGING - FontTableRec *ftr = static_cast(aUserData); - delete ftr; -#else - ::CFRelease((CFDataRef)aUserData); -#endif -} - -hb_blob_t * -MacOSFontEntry::GetFontTable(uint32_t aTag) -{ - CGFontRef fontRef = GetFontRef(); - if (!fontRef) { - return nullptr; - } - - CFDataRef dataRef = ::CGFontCopyTableForTag(fontRef, aTag); - if (dataRef) { - return hb_blob_create((const char*)::CFDataGetBytePtr(dataRef), - ::CFDataGetLength(dataRef), - HB_MEMORY_MODE_READONLY, -#ifdef NS_BUILD_REFCNT_LOGGING - new FontTableRec(dataRef), -#else - (void*)dataRef, -#endif - DestroyBlobFunc); - } - - return nullptr; -} - -bool -MacOSFontEntry::HasFontTable(uint32_t aTableTag) -{ - if (mAvailableTables.Count() == 0) { - nsAutoreleasePool localPool; - - CGFontRef fontRef = GetFontRef(); - if (!fontRef) { - return false; - } - CFArrayRef tags = ::CGFontCopyTableTags(fontRef); - if (!tags) { - return false; - } - int numTags = (int) ::CFArrayGetCount(tags); - for (int t = 0; t < numTags; t++) { - uint32_t tag = (uint32_t)(uintptr_t)::CFArrayGetValueAtIndex(tags, t); - mAvailableTables.PutEntry(tag); - } - ::CFRelease(tags); - } - - return mAvailableTables.GetEntry(aTableTag); -} - -void -MacOSFontEntry::AddSizeOfIncludingThis(MallocSizeOf aMallocSizeOf, - FontListSizes* aSizes) const -{ - aSizes->mFontListSize += aMallocSizeOf(this); - AddSizeOfExcludingThis(aMallocSizeOf, aSizes); -} - -/* gfxMacFontFamily */ -#pragma mark- - -class gfxMacFontFamily : public gfxFontFamily -{ -public: - explicit gfxMacFontFamily(nsAString& aName, double aSizeHint) : - gfxFontFamily(aName), - mSizeHint(aSizeHint) - {} - - virtual ~gfxMacFontFamily() {} - - virtual void LocalizedName(nsAString& aLocalizedName); - - virtual void FindStyleVariations(FontInfoData *aFontInfoData = nullptr); - -protected: - double mSizeHint; -}; - -void -gfxMacFontFamily::LocalizedName(nsAString& aLocalizedName) -{ - nsAutoreleasePool localPool; - - if (!HasOtherFamilyNames()) { - aLocalizedName = mName; - return; - } - - NSString *family = GetNSStringForString(mName); - NSString *localized = [sFontManager - localizedNameForFamily:family - face:nil]; - - if (localized) { - GetStringForNSString(localized, aLocalizedName); - return; - } - - // failed to get localized name, just use the canonical one - aLocalizedName = mName; -} - -// Return the CSS weight value to use for the given face, overriding what -// AppKit gives us (used to adjust families with bad weight values, see -// bug 931426). -// A return value of 0 indicates no override - use the existing weight. -static inline int -GetWeightOverride(const nsAString& aPSName) -{ - nsAutoCString prefName("font.weight-override."); - // The PostScript name is required to be ASCII; if it's not, the font is - // broken anyway, so we really don't care that this is lossy. - LossyAppendUTF16toASCII(aPSName, prefName); - return Preferences::GetInt(prefName.get(), 0); -} - -void -gfxMacFontFamily::FindStyleVariations(FontInfoData *aFontInfoData) -{ - if (mHasStyles) - return; - - nsAutoreleasePool localPool; - - NSString *family = GetNSStringForString(mName); - - // create a font entry for each face - NSArray *fontfaces = [sFontManager - availableMembersOfFontFamily:family]; // returns an array of [psname, style name, weight, traits] elements, goofy api - int faceCount = [fontfaces count]; - int faceIndex; - - for (faceIndex = 0; faceIndex < faceCount; faceIndex++) { - NSArray *face = [fontfaces objectAtIndex:faceIndex]; - NSString *psname = [face objectAtIndex:INDEX_FONT_POSTSCRIPT_NAME]; - int32_t appKitWeight = [[face objectAtIndex:INDEX_FONT_WEIGHT] unsignedIntValue]; - uint32_t macTraits = [[face objectAtIndex:INDEX_FONT_TRAITS] unsignedIntValue]; - NSString *facename = [face objectAtIndex:INDEX_FONT_FACE_NAME]; - bool isStandardFace = false; - - if (appKitWeight == kAppleExtraLightWeight) { - // if the facename contains UltraLight, set the weight to the ultralight weight value - NSRange range = [facename rangeOfString:@"ultralight" options:NSCaseInsensitiveSearch]; - if (range.location != NSNotFound) { - appKitWeight = kAppleUltraLightWeight; - } - } - - // make a nsString - nsAutoString postscriptFontName; - GetStringForNSString(psname, postscriptFontName); - - int32_t cssWeight = GetWeightOverride(postscriptFontName); - if (cssWeight) { - // scale down and clamp, to get a value from 1..9 - cssWeight = ((cssWeight + 50) / 100); - cssWeight = std::max(1, std::min(cssWeight, 9)); - } else { - cssWeight = - gfxMacPlatformFontList::AppleWeightToCSSWeight(appKitWeight); - } - cssWeight *= 100; // scale up to CSS values - - if ([facename isEqualToString:@"Regular"] || - [facename isEqualToString:@"Bold"] || - [facename isEqualToString:@"Italic"] || - [facename isEqualToString:@"Oblique"] || - [facename isEqualToString:@"Bold Italic"] || - [facename isEqualToString:@"Bold Oblique"]) - { - isStandardFace = true; - } - - // create a font entry - MacOSFontEntry *fontEntry = - new MacOSFontEntry(postscriptFontName, cssWeight, isStandardFace, mSizeHint); - if (!fontEntry) { - break; - } - - // set additional properties based on the traits reported by Cocoa - if (macTraits & (NSCondensedFontMask | NSNarrowFontMask | NSCompressedFontMask)) { - fontEntry->mStretch = NS_FONT_STRETCH_CONDENSED; - } else if (macTraits & NSExpandedFontMask) { - fontEntry->mStretch = NS_FONT_STRETCH_EXPANDED; - } - // Cocoa fails to set the Italic traits bit for HelveticaLightItalic, - // at least (see bug 611855), so check for style name endings as well - if ((macTraits & NSItalicFontMask) || - [facename hasSuffix:@"Italic"] || - [facename hasSuffix:@"Oblique"]) - { - fontEntry->mStyle = NS_FONT_STYLE_ITALIC; - } - if (macTraits & NSFixedPitchFontMask) { - fontEntry->mFixedPitch = true; - } - - if (LOG_FONTLIST_ENABLED()) { - LOG_FONTLIST(("(fontlist) added (%s) to family (%s)" - " with style: %s weight: %d stretch: %d" - " (apple-weight: %d macTraits: %8.8x)", - NS_ConvertUTF16toUTF8(fontEntry->Name()).get(), - NS_ConvertUTF16toUTF8(Name()).get(), - fontEntry->IsItalic() ? "italic" : "normal", - cssWeight, fontEntry->Stretch(), - appKitWeight, macTraits)); - } - - // insert into font entry array of family - AddFontEntry(fontEntry); - } - - SortAvailableFonts(); - SetHasStyles(true); - - if (mIsBadUnderlineFamily) { - SetBadUnderlineFonts(); - } -} - -/* gfxSingleFaceMacFontFamily */ -#pragma mark- - -class gfxSingleFaceMacFontFamily : public gfxFontFamily -{ -public: - explicit gfxSingleFaceMacFontFamily(nsAString& aName) : - gfxFontFamily(aName) - { - mFaceNamesInitialized = true; // omit from face name lists - } - - virtual ~gfxSingleFaceMacFontFamily() {} - - virtual void LocalizedName(nsAString& aLocalizedName); - - virtual void ReadOtherFamilyNames(gfxPlatformFontList *aPlatformFontList); -}; - -void -gfxSingleFaceMacFontFamily::LocalizedName(nsAString& aLocalizedName) -{ - nsAutoreleasePool localPool; - - if (!HasOtherFamilyNames()) { - aLocalizedName = mName; - return; - } - - gfxFontEntry *fe = mAvailableFonts[0]; - NSFont *font = [NSFont fontWithName:GetNSStringForString(fe->Name()) - size:0.0]; - if (font) { - NSString *localized = [font displayName]; - if (localized) { - GetStringForNSString(localized, aLocalizedName); - return; - } - } - - // failed to get localized name, just use the canonical one - aLocalizedName = mName; -} - -void -gfxSingleFaceMacFontFamily::ReadOtherFamilyNames(gfxPlatformFontList *aPlatformFontList) -{ - if (mOtherFamilyNamesInitialized) { - return; - } - - gfxFontEntry *fe = mAvailableFonts[0]; - if (!fe) { - return; - } - - const uint32_t kNAME = TRUETYPE_TAG('n','a','m','e'); - - gfxFontEntry::AutoTable nameTable(fe, kNAME); - if (!nameTable) { - return; - } - - mHasOtherFamilyNames = ReadOtherFamilyNamesForFace(aPlatformFontList, - nameTable, - true); - - mOtherFamilyNamesInitialized = true; -} - -/* gfxMacPlatformFontList */ -#pragma mark- - -gfxMacPlatformFontList::gfxMacPlatformFontList() : - gfxPlatformFontList(false), - mDefaultFont(nullptr), - mUseSizeSensitiveSystemFont(false) -{ -#ifdef MOZ_BUNDLED_FONTS - ActivateBundledFonts(); -#endif - - ::CFNotificationCenterAddObserver(::CFNotificationCenterGetLocalCenter(), - this, - RegisteredFontsChangedNotificationCallback, - kCTFontManagerRegisteredFontsChangedNotification, - 0, - CFNotificationSuspensionBehaviorDeliverImmediately); - - // cache this in a static variable so that MacOSFontFamily objects - // don't have to repeatedly look it up - sFontManager = [NSFontManager sharedFontManager]; -} - -gfxMacPlatformFontList::~gfxMacPlatformFontList() -{ - if (mDefaultFont) { - ::CFRelease(mDefaultFont); - } -} - -void -gfxMacPlatformFontList::AddFamily(CFStringRef aFamily) -{ - NSString* family = (NSString*)aFamily; - - // CTFontManager includes weird internal family names and - // LastResort, skip over those - if (!family || [family caseInsensitiveCompare:@"LastResort"] == NSOrderedSame) { - return; - } - - bool hiddenSystemFont = [family hasPrefix:@"."]; - - FontFamilyTable& table = - hiddenSystemFont ? mSystemFontFamilies : mFontFamilies; - - nsAutoString familyName; - nsCocoaUtils::GetStringForNSString(family, familyName); - - double sizeHint = 0.0; - if (hiddenSystemFont && mUseSizeSensitiveSystemFont && - mSystemDisplayFontFamilyName.Equals(familyName)) { - sizeHint = 128.0; - } - - nsAutoString key; - ToLowerCase(familyName, key); - - RefPtr familyEntry = new gfxMacFontFamily(familyName, sizeHint); - table.Put(key, familyEntry); - - // check the bad underline blacklist - if (mBadUnderlineFamilyNames.Contains(key)) { - familyEntry->SetBadUnderlineFamily(); - } -} - -nsresult -gfxMacPlatformFontList::InitFontListForPlatform() -{ - nsAutoreleasePool localPool; - - // reset system font list - mSystemFontFamilies.Clear(); - - // iterate over available families - - InitSystemFontNames(); - - CFArrayRef familyNames = CTFontManagerCopyAvailableFontFamilyNames(); - - for (NSString* familyName in (NSArray*)familyNames) { - AddFamily((CFStringRef)familyName); - } - - CFRelease(familyNames); - - InitSingleFaceList(); - - // to avoid full search of font name tables, seed the other names table with localized names from - // some of the prefs fonts which are accessed via their localized names. changes in the pref fonts will only cause - // a font lookup miss earlier. this is a simple optimization, it's not required for correctness - PreloadNamesList(); - - // start the delayed cmap loader - GetPrefsAndStartLoader(); - - return NS_OK; -} - -void -gfxMacPlatformFontList::InitSingleFaceList() -{ - AutoTArray singleFaceFonts; - gfxFontUtils::GetPrefsFontList("font.single-face-list", singleFaceFonts); - - for (const auto& singleFaceFamily : singleFaceFonts) { - LOG_FONTLIST(("(fontlist-singleface) face name: %s\n", - NS_ConvertUTF16toUTF8(singleFaceFamily).get())); - // Each entry in the "single face families" list is expected to be a - // colon-separated pair of FaceName:Family, - // where FaceName is the individual face name (psname) of a font - // that should be exposed as a separate family name, - // and Family is the standard family to which that face belongs. - // The only such face listed by default is - // Osaka-Mono:Osaka - nsAutoString familyName(singleFaceFamily); - auto colon = familyName.FindChar(':'); - if (colon == kNotFound) { - continue; - } - - // Look for the parent family in the main font family list, - // and ensure we have loaded its list of available faces. - nsAutoString key(Substring(familyName, colon + 1)); - ToLowerCase(key); - gfxFontFamily* family = mFontFamilies.GetWeak(key); - if (!family) { - continue; - } - family->FindStyleVariations(); - - // Truncate the entry from prefs at the colon, so now it is just the - // desired single-face-family name. - familyName.Truncate(colon); - - // Look through the family's faces to see if this one is present. - const gfxFontEntry* fe = nullptr; - for (const auto& face : family->GetFontList()) { - if (face->Name().Equals(familyName)) { - fe = face; - break; - } - } - if (!fe) { - continue; - } - - // We found the correct face, so create the single-face family record. - GenerateFontListKey(familyName, key); - LOG_FONTLIST(("(fontlist-singleface) family name: %s, key: %s\n", - NS_ConvertUTF16toUTF8(familyName).get(), - NS_ConvertUTF16toUTF8(key).get())); - - // add only if doesn't exist already - if (!mFontFamilies.GetWeak(key)) { - RefPtr familyEntry = - new gfxSingleFaceMacFontFamily(familyName); - // We need a separate font entry, because its family name will - // differ from the one we found in the main list. - MacOSFontEntry* fontEntry = - new MacOSFontEntry(fe->Name(), fe->mWeight, true, - static_cast(fe)-> - mSizeHint); - familyEntry->AddFontEntry(fontEntry); - familyEntry->SetHasStyles(true); - mFontFamilies.Put(key, familyEntry); - LOG_FONTLIST(("(fontlist-singleface) added new family\n", - NS_ConvertUTF16toUTF8(familyName).get(), - NS_ConvertUTF16toUTF8(key).get())); - } - } -} - -// System fonts under OSX may contain weird "meta" names but if we create -// a new font using just the Postscript name, the NSFont api returns an object -// with the actual real family name. For example, under OSX 10.11: -// -// [[NSFont menuFontOfSize:8.0] familyName] ==> .AppleSystemUIFont -// [[NSFont fontWithName:[[[NSFont menuFontOfSize:8.0] fontDescriptor] postscriptName] -// size:8.0] familyName] ==> .SF NS Text - -static NSString* GetRealFamilyName(NSFont* aFont) -{ - NSFont* f = [NSFont fontWithName: [[aFont fontDescriptor] postscriptName] - size: 0.0]; - return [f familyName]; -} - -// System fonts under OSX 10.11 use a combination of two families, one -// for text sizes and another for larger, display sizes. Each has a -// different number of weights. There aren't efficient API's for looking -// this information up, so hard code the logic here but confirm via -// debug assertions that the logic is correct. - -const CGFloat kTextDisplayCrossover = 20.0; // use text family below this size - -void -gfxMacPlatformFontList::InitSystemFontNames() -{ - // system font under 10.11 are two distinct families for text/display sizes - if (nsCocoaFeatures::OnElCapitanOrLater()) { - mUseSizeSensitiveSystemFont = true; - } - - // text font family - NSFont* sys = [NSFont systemFontOfSize: 0.0]; - NSString* textFamilyName = GetRealFamilyName(sys); - nsAutoString familyName; - nsCocoaUtils::GetStringForNSString(textFamilyName, familyName); - mSystemTextFontFamilyName = familyName; - - // display font family, if on OSX 10.11 - if (mUseSizeSensitiveSystemFont) { - NSFont* displaySys = [NSFont systemFontOfSize: 128.0]; - NSString* displayFamilyName = GetRealFamilyName(displaySys); - nsCocoaUtils::GetStringForNSString(displayFamilyName, familyName); - mSystemDisplayFontFamilyName = familyName; - -#if DEBUG - // confirm that the optical size switch is at 20.0 - NS_ASSERTION([textFamilyName compare:displayFamilyName] != NSOrderedSame, - "system text/display fonts are the same!"); - NSString* fam19 = GetRealFamilyName([NSFont systemFontOfSize: - (kTextDisplayCrossover - 1.0)]); - NSString* fam20 = GetRealFamilyName([NSFont systemFontOfSize: - kTextDisplayCrossover]); - NS_ASSERTION(fam19 && fam20 && [fam19 compare:fam20] != NSOrderedSame, - "system text/display font size switch point is not as expected!"); -#endif - } - -#ifdef DEBUG - // different system font API's always map to the same family under OSX, so - // just assume that and emit a warning if that ever changes - NSString *sysFamily = GetRealFamilyName([NSFont systemFontOfSize:0.0]); - if ([sysFamily compare:GetRealFamilyName([NSFont boldSystemFontOfSize:0.0])] != NSOrderedSame || - [sysFamily compare:GetRealFamilyName([NSFont controlContentFontOfSize:0.0])] != NSOrderedSame || - [sysFamily compare:GetRealFamilyName([NSFont menuBarFontOfSize:0.0])] != NSOrderedSame || - [sysFamily compare:GetRealFamilyName([NSFont toolTipsFontOfSize:0.0])] != NSOrderedSame) { - NS_WARNING("system font types map to different font families" - " -- please log a bug!!"); - } -#endif -} - -gfxFontFamily* -gfxMacPlatformFontList::FindSystemFontFamily(const nsAString& aFamily) -{ - nsAutoString key; - GenerateFontListKey(aFamily, key); - - gfxFontFamily* familyEntry; - - // lookup in hidden system family name list - if ((familyEntry = mSystemFontFamilies.GetWeak(key))) { - return CheckFamily(familyEntry); - } - - // lookup in user-exposed family name list - if ((familyEntry = mFontFamilies.GetWeak(key))) { - return CheckFamily(familyEntry); - } - - return nullptr; -} - -bool -gfxMacPlatformFontList::GetStandardFamilyName(const nsAString& aFontName, nsAString& aFamilyName) -{ - gfxFontFamily *family = FindFamily(aFontName); - if (family) { - family->LocalizedName(aFamilyName); - return true; - } - - return false; -} - -void -gfxMacPlatformFontList::RegisteredFontsChangedNotificationCallback(CFNotificationCenterRef center, - void *observer, - CFStringRef name, - const void *object, - CFDictionaryRef userInfo) -{ - if (!::CFEqual(name, kCTFontManagerRegisteredFontsChangedNotification)) { - return; - } - - gfxMacPlatformFontList* fl = static_cast(observer); - - // xxx - should be carefully pruning the list of fonts, not rebuilding it from scratch - fl->UpdateFontList(); - - // modify a preference that will trigger reflow everywhere - fl->ForceGlobalReflow(); -} - -gfxFontEntry* -gfxMacPlatformFontList::PlatformGlobalFontFallback(const uint32_t aCh, - Script aRunScript, - const gfxFontStyle* aMatchStyle, - gfxFontFamily** aMatchedFamily) -{ - CFStringRef str; - UniChar ch[2]; - CFIndex length = 1; - - if (IS_IN_BMP(aCh)) { - ch[0] = aCh; - str = ::CFStringCreateWithCharactersNoCopy(kCFAllocatorDefault, ch, 1, - kCFAllocatorNull); - } else { - ch[0] = H_SURROGATE(aCh); - ch[1] = L_SURROGATE(aCh); - str = ::CFStringCreateWithCharactersNoCopy(kCFAllocatorDefault, ch, 2, - kCFAllocatorNull); - if (!str) { - return nullptr; - } - length = 2; - } - - // use CoreText to find the fallback family - - gfxFontEntry *fontEntry = nullptr; - CTFontRef fallback; - bool cantUseFallbackFont = false; - - if (!mDefaultFont) { - mDefaultFont = ::CTFontCreateWithName(CFSTR("LucidaGrande"), 12.f, - NULL); - } - - fallback = ::CTFontCreateForString(mDefaultFont, str, - ::CFRangeMake(0, length)); - - if (fallback) { - CFStringRef familyNameRef = ::CTFontCopyFamilyName(fallback); - ::CFRelease(fallback); - - if (familyNameRef && - ::CFStringCompare(familyNameRef, CFSTR("LastResort"), - kCFCompareCaseInsensitive) != kCFCompareEqualTo) - { - AutoTArray buffer; - CFIndex familyNameLen = ::CFStringGetLength(familyNameRef); - buffer.SetLength(familyNameLen+1); - ::CFStringGetCharacters(familyNameRef, ::CFRangeMake(0, familyNameLen), - buffer.Elements()); - buffer[familyNameLen] = 0; - nsDependentString familyNameString(reinterpret_cast(buffer.Elements()), familyNameLen); - - bool needsBold; // ignored in the system fallback case - - gfxFontFamily *family = FindFamily(familyNameString); - if (family) { - fontEntry = family->FindFontForStyle(*aMatchStyle, needsBold); - if (fontEntry) { - if (fontEntry->HasCharacter(aCh)) { - *aMatchedFamily = family; - } else { - fontEntry = nullptr; - cantUseFallbackFont = true; - } - } - } - } - - if (familyNameRef) { - ::CFRelease(familyNameRef); - } - } - - ::CFRelease(str); - - return fontEntry; -} - -gfxFontFamily* -gfxMacPlatformFontList::GetDefaultFontForPlatform(const gfxFontStyle* aStyle) -{ - nsAutoreleasePool localPool; - - NSString *defaultFamily = [[NSFont userFontOfSize:aStyle->size] familyName]; - nsAutoString familyName; - - GetStringForNSString(defaultFamily, familyName); - return FindFamily(familyName); -} - -int32_t -gfxMacPlatformFontList::AppleWeightToCSSWeight(int32_t aAppleWeight) -{ - if (aAppleWeight < 1) - aAppleWeight = 1; - else if (aAppleWeight > kAppleMaxWeight) - aAppleWeight = kAppleMaxWeight; - return gAppleWeightToCSSWeight[aAppleWeight]; -} - -gfxFontEntry* -gfxMacPlatformFontList::LookupLocalFont(const nsAString& aFontName, - uint16_t aWeight, - int16_t aStretch, - uint8_t aStyle) -{ - nsAutoreleasePool localPool; - - NSString *faceName = GetNSStringForString(aFontName); - MacOSFontEntry *newFontEntry; - - // lookup face based on postscript or full name - CGFontRef fontRef = ::CGFontCreateWithFontName(CFStringRef(faceName)); - if (!fontRef) { - return nullptr; - } - - NS_ASSERTION(aWeight >= 100 && aWeight <= 900, - "bogus font weight value!"); - - newFontEntry = - new MacOSFontEntry(aFontName, fontRef, aWeight, aStretch, aStyle, - false, true); - ::CFRelease(fontRef); - - return newFontEntry; -} - -static void ReleaseData(void *info, const void *data, size_t size) -{ - free((void*)data); -} - -gfxFontEntry* -gfxMacPlatformFontList::MakePlatformFont(const nsAString& aFontName, - uint16_t aWeight, - int16_t aStretch, - uint8_t aStyle, - const uint8_t* aFontData, - uint32_t aLength) -{ - NS_ASSERTION(aFontData, "MakePlatformFont called with null data"); - - NS_ASSERTION(aWeight >= 100 && aWeight <= 900, "bogus font weight value!"); - - // create the font entry - nsAutoString uniqueName; - - nsresult rv = gfxFontUtils::MakeUniqueUserFontName(uniqueName); - if (NS_FAILED(rv)) { - return nullptr; - } - - CGDataProviderRef provider = - ::CGDataProviderCreateWithData(nullptr, aFontData, aLength, - &ReleaseData); - CGFontRef fontRef = ::CGFontCreateWithDataProvider(provider); - ::CGDataProviderRelease(provider); - - if (!fontRef) { - return nullptr; - } - - auto newFontEntry = - MakeUnique(uniqueName, fontRef, aWeight, aStretch, - aStyle, true, false); - ::CFRelease(fontRef); - - // if succeeded and font cmap is good, return the new font - if (newFontEntry->mIsValid && NS_SUCCEEDED(newFontEntry->ReadCMAP())) { - return newFontEntry.release(); - } - - // if something is funky about this font, delete immediately - -#if DEBUG - NS_WARNING("downloaded font not loaded properly"); -#endif - - return nullptr; -} - -// Webkit code uses a system font meta name, so mimic that here -// WebCore/platform/graphics/mac/FontCacheMac.mm -static const char kSystemFont_system[] = "-apple-system"; - -bool -gfxMacPlatformFontList::FindAndAddFamilies(const nsAString& aFamily, - nsTArray* aOutput, - gfxFontStyle* aStyle, - gfxFloat aDevToCssSize) -{ - // search for special system font name, -apple-system - if (aFamily.EqualsLiteral(kSystemFont_system)) { - if (mUseSizeSensitiveSystemFont && - aStyle && (aStyle->size * aDevToCssSize) >= kTextDisplayCrossover) { - aOutput->AppendElement(FindSystemFontFamily(mSystemDisplayFontFamilyName)); - return true; - } - aOutput->AppendElement(FindSystemFontFamily(mSystemTextFontFamilyName)); - return true; - } - - return gfxPlatformFontList::FindAndAddFamilies(aFamily, aOutput, aStyle, - aDevToCssSize); -} - -void -gfxMacPlatformFontList::LookupSystemFont(LookAndFeel::FontID aSystemFontID, - nsAString& aSystemFontName, - gfxFontStyle &aFontStyle, - float aDevPixPerCSSPixel) -{ - // code moved here from widget/cocoa/nsLookAndFeel.mm - NSFont *font = nullptr; - char* systemFontName = nullptr; - switch (aSystemFontID) { - case LookAndFeel::eFont_MessageBox: - case LookAndFeel::eFont_StatusBar: - case LookAndFeel::eFont_List: - case LookAndFeel::eFont_Field: - case LookAndFeel::eFont_Button: - case LookAndFeel::eFont_Widget: - font = [NSFont systemFontOfSize:[NSFont smallSystemFontSize]]; - systemFontName = (char*) kSystemFont_system; - break; - - case LookAndFeel::eFont_SmallCaption: - font = [NSFont boldSystemFontOfSize:[NSFont smallSystemFontSize]]; - systemFontName = (char*) kSystemFont_system; - break; - - case LookAndFeel::eFont_Icon: // used in urlbar; tried labelFont, but too small - case LookAndFeel::eFont_Workspace: - case LookAndFeel::eFont_Desktop: - case LookAndFeel::eFont_Info: - font = [NSFont controlContentFontOfSize:0.0]; - systemFontName = (char*) kSystemFont_system; - break; - - case LookAndFeel::eFont_PullDownMenu: - font = [NSFont menuBarFontOfSize:0.0]; - systemFontName = (char*) kSystemFont_system; - break; - - case LookAndFeel::eFont_Tooltips: - font = [NSFont toolTipsFontOfSize:0.0]; - systemFontName = (char*) kSystemFont_system; - break; - - case LookAndFeel::eFont_Caption: - case LookAndFeel::eFont_Menu: - case LookAndFeel::eFont_Dialog: - default: - font = [NSFont systemFontOfSize:0.0]; - systemFontName = (char*) kSystemFont_system; - break; - } - NS_ASSERTION(font, "system font not set"); - NS_ASSERTION(systemFontName, "system font name not set"); - - if (systemFontName) { - aSystemFontName.AssignASCII(systemFontName); - } - - NSFontSymbolicTraits traits = [[font fontDescriptor] symbolicTraits]; - aFontStyle.style = - (traits & NSFontItalicTrait) ? NS_FONT_STYLE_ITALIC : NS_FONT_STYLE_NORMAL; - aFontStyle.weight = - (traits & NSFontBoldTrait) ? NS_FONT_WEIGHT_BOLD : NS_FONT_WEIGHT_NORMAL; - aFontStyle.stretch = - (traits & NSFontExpandedTrait) ? - NS_FONT_STRETCH_EXPANDED : (traits & NSFontCondensedTrait) ? - NS_FONT_STRETCH_CONDENSED : NS_FONT_STRETCH_NORMAL; - // convert size from css pixels to device pixels - aFontStyle.size = [font pointSize] * aDevPixPerCSSPixel; - aFontStyle.systemFont = true; -} - -// used to load system-wide font info on off-main thread -class MacFontInfo : public FontInfoData { -public: - MacFontInfo(bool aLoadOtherNames, - bool aLoadFaceNames, - bool aLoadCmaps) : - FontInfoData(aLoadOtherNames, aLoadFaceNames, aLoadCmaps) - {} - - virtual ~MacFontInfo() {} - - virtual void Load() { - nsAutoreleasePool localPool; - FontInfoData::Load(); - } - - // loads font data for all members of a given family - virtual void LoadFontFamilyData(const nsAString& aFamilyName); -}; - -void -MacFontInfo::LoadFontFamilyData(const nsAString& aFamilyName) -{ - // family name ==> CTFontDescriptor - NSString *famName = GetNSStringForString(aFamilyName); - CFStringRef family = CFStringRef(famName); - - CFMutableDictionaryRef attr = - CFDictionaryCreateMutable(NULL, 0, &kCFTypeDictionaryKeyCallBacks, - &kCFTypeDictionaryValueCallBacks); - CFDictionaryAddValue(attr, kCTFontFamilyNameAttribute, family); - CTFontDescriptorRef fd = CTFontDescriptorCreateWithAttributes(attr); - CFRelease(attr); - CFArrayRef matchingFonts = - CTFontDescriptorCreateMatchingFontDescriptors(fd, NULL); - CFRelease(fd); - if (!matchingFonts) { - return; - } - - nsTArray otherFamilyNames; - bool hasOtherFamilyNames = true; - - // iterate over faces in the family - int f, numFaces = (int) CFArrayGetCount(matchingFonts); - for (f = 0; f < numFaces; f++) { - mLoadStats.fonts++; - - CTFontDescriptorRef faceDesc = - (CTFontDescriptorRef)CFArrayGetValueAtIndex(matchingFonts, f); - if (!faceDesc) { - continue; - } - CTFontRef fontRef = CTFontCreateWithFontDescriptor(faceDesc, - 0.0, nullptr); - if (!fontRef) { - NS_WARNING("failed to create a CTFontRef"); - continue; - } - - if (mLoadCmaps) { - // face name - CFStringRef faceName = (CFStringRef) - CTFontDescriptorCopyAttribute(faceDesc, kCTFontNameAttribute); - - AutoTArray buffer; - CFIndex len = CFStringGetLength(faceName); - buffer.SetLength(len+1); - CFStringGetCharacters(faceName, ::CFRangeMake(0, len), - buffer.Elements()); - buffer[len] = 0; - nsAutoString fontName(reinterpret_cast(buffer.Elements()), - len); - - // load the cmap data - FontFaceData fontData; - CFDataRef cmapTable = CTFontCopyTable(fontRef, kCTFontTableCmap, - kCTFontTableOptionNoOptions); - - if (cmapTable) { - const uint8_t *cmapData = - (const uint8_t*)CFDataGetBytePtr(cmapTable); - uint32_t cmapLen = CFDataGetLength(cmapTable); - RefPtr charmap = new gfxCharacterMap(); - uint32_t offset; - bool unicodeFont = false; // ignored - bool symbolFont = false; - nsresult rv; - - rv = gfxFontUtils::ReadCMAP(cmapData, cmapLen, *charmap, offset, - unicodeFont, symbolFont); - if (NS_SUCCEEDED(rv)) { - fontData.mCharacterMap = charmap; - fontData.mUVSOffset = offset; - fontData.mSymbolFont = symbolFont; - mLoadStats.cmaps++; - } - CFRelease(cmapTable); - } - - mFontFaceData.Put(fontName, fontData); - CFRelease(faceName); - } - - if (mLoadOtherNames && hasOtherFamilyNames) { - CFDataRef nameTable = CTFontCopyTable(fontRef, kCTFontTableName, - kCTFontTableOptionNoOptions); - - if (nameTable) { - const char *nameData = (const char*)CFDataGetBytePtr(nameTable); - uint32_t nameLen = CFDataGetLength(nameTable); - gfxFontFamily::ReadOtherFamilyNamesForFace(aFamilyName, - nameData, nameLen, - otherFamilyNames, - false); - hasOtherFamilyNames = otherFamilyNames.Length() != 0; - CFRelease(nameTable); - } - } - - CFRelease(fontRef); - } - CFRelease(matchingFonts); - - // if found other names, insert them in the hash table - if (otherFamilyNames.Length() != 0) { - mOtherFamilyNames.Put(aFamilyName, otherFamilyNames); - mLoadStats.othernames += otherFamilyNames.Length(); - } -} - -already_AddRefed -gfxMacPlatformFontList::CreateFontInfoData() -{ - bool loadCmaps = !UsesSystemFallback() || - gfxPlatform::GetPlatform()->UseCmapsDuringSystemFallback(); - - RefPtr fi = - new MacFontInfo(true, NeedFullnamePostscriptNames(), loadCmaps); - return fi.forget(); -} - -#ifdef MOZ_BUNDLED_FONTS - -void -gfxMacPlatformFontList::ActivateBundledFonts() -{ - nsCOMPtr localDir; - nsresult rv = NS_GetSpecialDirectory(NS_GRE_DIR, getter_AddRefs(localDir)); - if (NS_FAILED(rv)) { - return; - } - if (NS_FAILED(localDir->Append(NS_LITERAL_STRING("fonts")))) { - return; - } - bool isDir; - if (NS_FAILED(localDir->IsDirectory(&isDir)) || !isDir) { - return; - } - - nsCOMPtr e; - rv = localDir->GetDirectoryEntries(getter_AddRefs(e)); - if (NS_FAILED(rv)) { - return; - } - - bool hasMore; - while (NS_SUCCEEDED(e->HasMoreElements(&hasMore)) && hasMore) { - nsCOMPtr entry; - if (NS_FAILED(e->GetNext(getter_AddRefs(entry)))) { - break; - } - nsCOMPtr file = do_QueryInterface(entry); - if (!file) { - continue; - } - nsCString path; - if (NS_FAILED(file->GetNativePath(path))) { - continue; - } - CFURLRef fontURL = - ::CFURLCreateFromFileSystemRepresentation(kCFAllocatorDefault, - (uint8_t*)path.get(), - path.Length(), - false); - if (fontURL) { - CFErrorRef error = nullptr; - ::CTFontManagerRegisterFontsForURL(fontURL, - kCTFontManagerScopeProcess, - &error); - ::CFRelease(fontURL); - } - } -} - -#endif diff --git a/gfx/thebes/gfxPlatform.cpp b/gfx/thebes/gfxPlatform.cpp index e2c2ae7759..28282a90d2 100644 --- a/gfx/thebes/gfxPlatform.cpp +++ b/gfx/thebes/gfxPlatform.cpp @@ -37,9 +37,6 @@ #if defined(XP_WIN) #include "gfxWindowsPlatform.h" -#elif defined(XP_MACOSX) -#include "gfxPlatformMac.h" -#include "gfxQuartzSurface.h" #elif defined(MOZ_WIDGET_GTK) #include "gfxPlatformGtk.h" #elif defined(ANDROID) @@ -579,8 +576,6 @@ gfxPlatform::Init() #if defined(XP_WIN) gPlatform = new gfxWindowsPlatform; -#elif defined(XP_MACOSX) - gPlatform = new gfxPlatformMac; #elif defined(MOZ_WIDGET_GTK) gPlatform = new gfxPlatformGtk; #elif defined(ANDROID) @@ -2157,7 +2152,7 @@ bool gfxPlatform::AccelerateLayersByDefault() { // Note: add any new platform defines here that should get HWA by default. -#if defined(XP_WIN) || defined(XP_MACOSX) || defined(MOZ_WIDGET_GTK) || defined(MOZ_WIDGET_UIKIT) +#if defined(XP_WIN) || defined(MOZ_WIDGET_GTK) || defined(MOZ_WIDGET_UIKIT) return true; #elif defined(MOZ_GL_PROVIDER) // GL provider manually declared diff --git a/gfx/thebes/gfxPlatformMac.cpp b/gfx/thebes/gfxPlatformMac.cpp deleted file mode 100644 index 75c5236a87..0000000000 --- a/gfx/thebes/gfxPlatformMac.cpp +++ /dev/null @@ -1,617 +0,0 @@ -/* -*- Mode: C++; tab-width: 20; 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/. */ - -#include "gfxPlatformMac.h" - -#include "gfxQuartzSurface.h" -#include "mozilla/gfx/2D.h" -#include "mozilla/gfx/MacIOSurface.h" - -#include "gfxMacPlatformFontList.h" -#include "gfxMacFont.h" -#include "gfxCoreTextShaper.h" -#include "gfxTextRun.h" -#include "gfxUserFontSet.h" - -#include "nsTArray.h" -#include "mozilla/Preferences.h" -#include "mozilla/VsyncDispatcher.h" -#include "nsUnicodeProperties.h" -#include "qcms.h" -#include "gfx2DGlue.h" - -#include -#include - -#include "mozilla/layers/CompositorBridgeParent.h" -#include "VsyncSource.h" - -using namespace mozilla; -using namespace mozilla::gfx; -using namespace mozilla::unicode; - -// cribbed from CTFontManager.h -enum { - kAutoActivationDisabled = 1 -}; -typedef uint32_t AutoActivationSetting; - -// bug 567552 - disable auto-activation of fonts - -static void -DisableFontActivation() -{ - // get the main bundle identifier - CFBundleRef mainBundle = ::CFBundleGetMainBundle(); - CFStringRef mainBundleID = nullptr; - - if (mainBundle) { - mainBundleID = ::CFBundleGetIdentifier(mainBundle); - } - - // bug 969388 and bug 922590 - mainBundlID as null is sometimes problematic - if (!mainBundleID) { - NS_WARNING("missing bundle ID, packaging set up incorrectly"); - return; - } - - // if possible, fetch CTFontManagerSetAutoActivationSetting - void (*CTFontManagerSetAutoActivationSettingPtr) - (CFStringRef, AutoActivationSetting); - CTFontManagerSetAutoActivationSettingPtr = - (void (*)(CFStringRef, AutoActivationSetting)) - dlsym(RTLD_DEFAULT, "CTFontManagerSetAutoActivationSetting"); - - // bug 567552 - disable auto-activation of fonts - if (CTFontManagerSetAutoActivationSettingPtr) { - CTFontManagerSetAutoActivationSettingPtr(mainBundleID, - kAutoActivationDisabled); - } -} - -gfxPlatformMac::gfxPlatformMac() -{ - DisableFontActivation(); - mFontAntiAliasingThreshold = ReadAntiAliasingThreshold(); - - uint32_t canvasMask = BackendTypeBit(BackendType::SKIA); - uint32_t contentMask = BackendTypeBit(BackendType::SKIA); - InitBackendPrefs(canvasMask, BackendType::SKIA, - contentMask, BackendType::SKIA); - - // XXX: Bug 1036682 - we run out of fds on Mac when using tiled layers because - // with 256x256 tiles we can easily hit the soft limit of 800 when using double - // buffered tiles in e10s, so let's bump the soft limit to the hard limit for the OS - // up to a new cap of OPEN_MAX. - struct rlimit limits; - if (getrlimit(RLIMIT_NOFILE, &limits) == 0) { - limits.rlim_cur = std::min(rlim_t(OPEN_MAX), limits.rlim_max); - if (setrlimit(RLIMIT_NOFILE, &limits) != 0) { - NS_WARNING("Unable to bump RLIMIT_NOFILE to the maximum number on this OS"); - } - } - - MacIOSurfaceLib::LoadLibrary(); -} - -gfxPlatformMac::~gfxPlatformMac() -{ - gfxCoreTextShaper::Shutdown(); -} - -gfxPlatformFontList* -gfxPlatformMac::CreatePlatformFontList() -{ - gfxPlatformFontList* list = new gfxMacPlatformFontList(); - if (NS_SUCCEEDED(list->InitFontList())) { - return list; - } - gfxPlatformFontList::Shutdown(); - return nullptr; -} - -already_AddRefed -gfxPlatformMac::CreateOffscreenSurface(const IntSize& aSize, - gfxImageFormat aFormat) -{ - if (!Factory::AllowedSurfaceSize(aSize)) { - return nullptr; - } - - RefPtr newSurface = - new gfxQuartzSurface(aSize, aFormat); - return newSurface.forget(); -} - -already_AddRefed -gfxPlatformMac::GetScaledFontForFont(DrawTarget* aTarget, gfxFont *aFont) -{ - gfxMacFont *font = static_cast(aFont); - return font->GetScaledFont(aTarget); -} - -gfxFontGroup * -gfxPlatformMac::CreateFontGroup(const FontFamilyList& aFontFamilyList, - const gfxFontStyle *aStyle, - gfxTextPerfMetrics* aTextPerf, - gfxUserFontSet *aUserFontSet, - gfxFloat aDevToCssSize) -{ - return new gfxFontGroup(aFontFamilyList, aStyle, aTextPerf, - aUserFontSet, aDevToCssSize); -} - -bool -gfxPlatformMac::IsFontFormatSupported(nsIURI *aFontURI, uint32_t aFormatFlags) -{ - // check for strange format flags - NS_ASSERTION(!(aFormatFlags & gfxUserFontSet::FLAG_FORMAT_NOT_USED), - "strange font format hint set"); - - // accept supported formats - if (aFormatFlags & (gfxUserFontSet::FLAG_FORMATS_COMMON | - gfxUserFontSet::FLAG_FORMAT_TRUETYPE_AAT)) { - return true; - } - - // reject all other formats, known and unknown - if (aFormatFlags != 0) { - return false; - } - - // no format hint set, need to look at data - return true; -} - -static const char kFontArialUnicodeMS[] = "Arial Unicode MS"; -static const char kFontAppleBraille[] = "Apple Braille"; -static const char kFontAppleColorEmoji[] = "Apple Color Emoji"; -static const char kFontAppleSymbols[] = "Apple Symbols"; -static const char kFontDevanagariSangamMN[] = "Devanagari Sangam MN"; -static const char kFontEuphemiaUCAS[] = "Euphemia UCAS"; -static const char kFontGeneva[] = "Geneva"; -static const char kFontGeezaPro[] = "Geeza Pro"; -static const char kFontGujaratiSangamMN[] = "Gujarati Sangam MN"; -static const char kFontGurmukhiMN[] = "Gurmukhi MN"; -static const char kFontHiraginoKakuGothic[] = "Hiragino Kaku Gothic ProN"; -static const char kFontHiraginoSansGB[] = "Hiragino Sans GB"; -static const char kFontKefa[] = "Kefa"; -static const char kFontKhmerMN[] = "Khmer MN"; -static const char kFontLaoMN[] = "Lao MN"; -static const char kFontLucidaGrande[] = "Lucida Grande"; -static const char kFontMenlo[] = "Menlo"; -static const char kFontMicrosoftTaiLe[] = "Microsoft Tai Le"; -static const char kFontMingLiUExtB[] = "MingLiU-ExtB"; -static const char kFontMyanmarMN[] = "Myanmar MN"; -static const char kFontPlantagenetCherokee[] = "Plantagenet Cherokee"; -static const char kFontSimSunExtB[] = "SimSun-ExtB"; -static const char kFontSongtiSC[] = "Songti SC"; -static const char kFontSTHeiti[] = "STHeiti"; -static const char kFontSTIXGeneral[] = "STIXGeneral"; -static const char kFontTamilMN[] = "Tamil MN"; - -void -gfxPlatformMac::GetCommonFallbackFonts(uint32_t aCh, uint32_t aNextCh, - Script aRunScript, - nsTArray& aFontList) -{ - EmojiPresentation emoji = GetEmojiPresentation(aCh); - if (emoji != EmojiPresentation::TextOnly) { - if (aNextCh == kVariationSelector16 || - (aNextCh != kVariationSelector15 && - emoji == EmojiPresentation::EmojiDefault)) { - // if char is followed by VS16, try for a color emoji glyph - aFontList.AppendElement(kFontAppleColorEmoji); - } - } - - aFontList.AppendElement(kFontLucidaGrande); - - if (!IS_IN_BMP(aCh)) { - uint32_t p = aCh >> 16; - if (p == 1) { - aFontList.AppendElement(kFontAppleSymbols); - aFontList.AppendElement(kFontSTIXGeneral); - aFontList.AppendElement(kFontGeneva); - } else if (p == 2) { - // OSX installations with MS Office may have these fonts - aFontList.AppendElement(kFontMingLiUExtB); - aFontList.AppendElement(kFontSimSunExtB); - } - } else { - uint32_t b = (aCh >> 8) & 0xff; - - switch (b) { - case 0x03: - case 0x05: - aFontList.AppendElement(kFontGeneva); - break; - case 0x07: - aFontList.AppendElement(kFontGeezaPro); - break; - case 0x09: - aFontList.AppendElement(kFontDevanagariSangamMN); - break; - case 0x0a: - aFontList.AppendElement(kFontGurmukhiMN); - aFontList.AppendElement(kFontGujaratiSangamMN); - break; - case 0x0b: - aFontList.AppendElement(kFontTamilMN); - break; - case 0x0e: - aFontList.AppendElement(kFontLaoMN); - break; - case 0x0f: - aFontList.AppendElement(kFontSongtiSC); - break; - case 0x10: - aFontList.AppendElement(kFontMenlo); - aFontList.AppendElement(kFontMyanmarMN); - break; - case 0x13: // Cherokee - aFontList.AppendElement(kFontPlantagenetCherokee); - aFontList.AppendElement(kFontKefa); - break; - case 0x14: // Unified Canadian Aboriginal Syllabics - case 0x15: - case 0x16: - aFontList.AppendElement(kFontEuphemiaUCAS); - aFontList.AppendElement(kFontGeneva); - break; - case 0x18: // Mongolian, UCAS - aFontList.AppendElement(kFontSTHeiti); - aFontList.AppendElement(kFontEuphemiaUCAS); - break; - case 0x19: // Khmer - aFontList.AppendElement(kFontKhmerMN); - aFontList.AppendElement(kFontMicrosoftTaiLe); - break; - case 0x1d: - case 0x1e: - aFontList.AppendElement(kFontGeneva); - break; - case 0x20: // Symbol ranges - case 0x21: - case 0x22: - case 0x23: - case 0x24: - case 0x25: - case 0x26: - case 0x27: - case 0x29: - case 0x2a: - case 0x2b: - case 0x2e: - aFontList.AppendElement(kFontHiraginoKakuGothic); - aFontList.AppendElement(kFontAppleSymbols); - aFontList.AppendElement(kFontMenlo); - aFontList.AppendElement(kFontSTIXGeneral); - aFontList.AppendElement(kFontGeneva); - aFontList.AppendElement(kFontAppleColorEmoji); - break; - case 0x2c: - aFontList.AppendElement(kFontGeneva); - break; - case 0x2d: - aFontList.AppendElement(kFontKefa); - aFontList.AppendElement(kFontGeneva); - break; - case 0x28: // Braille - aFontList.AppendElement(kFontAppleBraille); - break; - case 0x31: - aFontList.AppendElement(kFontHiraginoSansGB); - break; - case 0x4d: - aFontList.AppendElement(kFontAppleSymbols); - break; - case 0xa0: // Yi - case 0xa1: - case 0xa2: - case 0xa3: - case 0xa4: - aFontList.AppendElement(kFontSTHeiti); - break; - case 0xa6: - case 0xa7: - aFontList.AppendElement(kFontGeneva); - aFontList.AppendElement(kFontAppleSymbols); - break; - case 0xab: - aFontList.AppendElement(kFontKefa); - break; - case 0xfc: - case 0xff: - aFontList.AppendElement(kFontAppleSymbols); - break; - default: - break; - } - } - - // Arial Unicode MS has lots of glyphs for obscure, use it as a last resort - aFontList.AppendElement(kFontArialUnicodeMS); -} - -/*static*/ void -gfxPlatformMac::LookupSystemFont(mozilla::LookAndFeel::FontID aSystemFontID, - nsAString& aSystemFontName, - gfxFontStyle& aFontStyle, - float aDevPixPerCSSPixel) -{ - gfxMacPlatformFontList* pfl = gfxMacPlatformFontList::PlatformFontList(); - return pfl->LookupSystemFont(aSystemFontID, aSystemFontName, aFontStyle, - aDevPixPerCSSPixel); -} - -uint32_t -gfxPlatformMac::ReadAntiAliasingThreshold() -{ - uint32_t threshold = 0; // default == no threshold - - // first read prefs flag to determine whether to use the setting or not - bool useAntiAliasingThreshold = Preferences::GetBool("gfx.use_text_smoothing_setting", false); - - // if the pref setting is disabled, return 0 which effectively disables this feature - if (!useAntiAliasingThreshold) - return threshold; - - // value set via Appearance pref panel, "Turn off text smoothing for font sizes xxx and smaller" - CFNumberRef prefValue = (CFNumberRef)CFPreferencesCopyAppValue(CFSTR("AppleAntiAliasingThreshold"), kCFPreferencesCurrentApplication); - - if (prefValue) { - if (!CFNumberGetValue(prefValue, kCFNumberIntType, &threshold)) { - threshold = 0; - } - CFRelease(prefValue); - } - - return threshold; -} - -// This is the renderer output callback function, called on the vsync thread -static CVReturn VsyncCallback(CVDisplayLinkRef aDisplayLink, - const CVTimeStamp* aNow, - const CVTimeStamp* aOutputTime, - CVOptionFlags aFlagsIn, - CVOptionFlags* aFlagsOut, - void* aDisplayLinkContext); - -class OSXVsyncSource final : public VsyncSource -{ -public: - OSXVsyncSource() - { - } - - virtual Display& GetGlobalDisplay() override - { - return mGlobalDisplay; - } - - class OSXDisplay final : public VsyncSource::Display - { - public: - OSXDisplay() - : mDisplayLink(nullptr) - { - MOZ_ASSERT(NS_IsMainThread()); - mTimer = do_CreateInstance(NS_TIMER_CONTRACTID); - } - - ~OSXDisplay() - { - MOZ_ASSERT(NS_IsMainThread()); - } - - static void RetryEnableVsync(nsITimer* aTimer, void* aOsxDisplay) - { - MOZ_ASSERT(NS_IsMainThread()); - OSXDisplay* osxDisplay = static_cast(aOsxDisplay); - MOZ_ASSERT(osxDisplay); - osxDisplay->EnableVsync(); - } - - virtual void EnableVsync() override - { - MOZ_ASSERT(NS_IsMainThread()); - if (IsVsyncEnabled()) { - return; - } - - // Create a display link capable of being used with all active displays - // TODO: See if we need to create an active DisplayLink for each monitor in multi-monitor - // situations. According to the docs, it is compatible with all displays running on the computer - // But if we have different monitors at different display rates, we may hit issues. - if (CVDisplayLinkCreateWithActiveCGDisplays(&mDisplayLink) != kCVReturnSuccess) { - NS_WARNING("Could not create a display link with all active displays. Retrying"); - CVDisplayLinkRelease(mDisplayLink); - mDisplayLink = nullptr; - - // bug 1142708 - When coming back from sleep, - // or when changing displays, active displays may not be ready yet, - // even if listening for the kIOMessageSystemHasPoweredOn event - // from OS X sleep notifications. - // Active displays are those that are drawable. - // bug 1144638 - When changing display configurations and getting - // notifications from CGDisplayReconfigurationCallBack, the - // callback gets called twice for each active display - // so it's difficult to know when all displays are active. - // Instead, try again soon. The delay is arbitrary. 100ms chosen - // because on a late 2013 15" retina, it takes about that - // long to come back up from sleep. - uint32_t delay = 100; - mTimer->InitWithFuncCallback(RetryEnableVsync, this, delay, nsITimer::TYPE_ONE_SHOT); - return; - } - - if (CVDisplayLinkSetOutputCallback(mDisplayLink, &VsyncCallback, this) != kCVReturnSuccess) { - NS_WARNING("Could not set displaylink output callback"); - CVDisplayLinkRelease(mDisplayLink); - mDisplayLink = nullptr; - return; - } - - mPreviousTimestamp = TimeStamp::Now(); - if (CVDisplayLinkStart(mDisplayLink) != kCVReturnSuccess) { - NS_WARNING("Could not activate the display link"); - CVDisplayLinkRelease(mDisplayLink); - mDisplayLink = nullptr; - } - - CVTime vsyncRate = CVDisplayLinkGetNominalOutputVideoRefreshPeriod(mDisplayLink); - if (vsyncRate.flags & kCVTimeIsIndefinite) { - NS_WARNING("Could not get vsync rate, setting to 60."); - mVsyncRate = TimeDuration::FromMilliseconds(1000.0 / 60.0); - } else { - int64_t timeValue = vsyncRate.timeValue; - int64_t timeScale = vsyncRate.timeScale; - const int milliseconds = 1000; - float rateInMs = ((double) timeValue / (double) timeScale) * milliseconds; - mVsyncRate = TimeDuration::FromMilliseconds(rateInMs); - } - } - - virtual void DisableVsync() override - { - MOZ_ASSERT(NS_IsMainThread()); - if (!IsVsyncEnabled()) { - return; - } - - // Release the display link - if (mDisplayLink) { - CVDisplayLinkRelease(mDisplayLink); - mDisplayLink = nullptr; - } - } - - virtual bool IsVsyncEnabled() override - { - MOZ_ASSERT(NS_IsMainThread()); - return mDisplayLink != nullptr; - } - - virtual TimeDuration GetVsyncRate() override - { - return mVsyncRate; - } - - virtual void Shutdown() override - { - MOZ_ASSERT(NS_IsMainThread()); - mTimer->Cancel(); - mTimer = nullptr; - DisableVsync(); - } - - // The vsync timestamps given by the CVDisplayLinkCallback are - // in the future for the NEXT frame. Large parts of Gecko, such - // as animations assume a timestamp at either now or in the past. - // Normalize the timestamps given to the VsyncDispatchers to the vsync - // that just occured, not the vsync that is upcoming. - TimeStamp mPreviousTimestamp; - - private: - // Manages the display link render thread - CVDisplayLinkRef mDisplayLink; - RefPtr mTimer; - TimeDuration mVsyncRate; - }; // OSXDisplay - -private: - virtual ~OSXVsyncSource() - { - } - - OSXDisplay mGlobalDisplay; -}; // OSXVsyncSource - -static CVReturn VsyncCallback(CVDisplayLinkRef aDisplayLink, - const CVTimeStamp* aNow, - const CVTimeStamp* aOutputTime, - CVOptionFlags aFlagsIn, - CVOptionFlags* aFlagsOut, - void* aDisplayLinkContext) -{ - // Executed on OS X hardware vsync thread - OSXVsyncSource::OSXDisplay* display = (OSXVsyncSource::OSXDisplay*) aDisplayLinkContext; - int64_t nextVsyncTimestamp = aOutputTime->hostTime; - - mozilla::TimeStamp nextVsync = mozilla::TimeStamp::FromSystemTime(nextVsyncTimestamp); - mozilla::TimeStamp previousVsync = display->mPreviousTimestamp; - mozilla::TimeStamp now = TimeStamp::Now(); - - // Snow leopard sometimes sends vsync timestamps very far in the past. - // Normalize the vsync timestamps to now. - if (nextVsync <= previousVsync) { - nextVsync = now; - previousVsync = now; - } else if (now < previousVsync) { - // Bug 1158321 - The VsyncCallback can sometimes execute before the reported - // vsync time. In those cases, normalize the timestamp to Now() as sending - // timestamps in the future has undefined behavior. See the comment above - // OSXDisplay::mPreviousTimestamp - previousVsync = now; - } - - display->mPreviousTimestamp = nextVsync; - - display->NotifyVsync(previousVsync); - return kCVReturnSuccess; -} - -already_AddRefed -gfxPlatformMac::CreateHardwareVsyncSource() -{ - RefPtr osxVsyncSource = new OSXVsyncSource(); - VsyncSource::Display& primaryDisplay = osxVsyncSource->GetGlobalDisplay(); - primaryDisplay.EnableVsync(); - if (!primaryDisplay.IsVsyncEnabled()) { - NS_WARNING("OS X Vsync source not enabled. Falling back to software vsync."); - return gfxPlatform::CreateHardwareVsyncSource(); - } - - primaryDisplay.DisableVsync(); - return osxVsyncSource.forget(); -} - -void -gfxPlatformMac::GetPlatformCMSOutputProfile(void* &mem, size_t &size) -{ - mem = nullptr; - size = 0; - - CGColorSpaceRef cspace = ::CGDisplayCopyColorSpace(::CGMainDisplayID()); - if (!cspace) { - cspace = ::CGColorSpaceCreateDeviceRGB(); - } - if (!cspace) { - return; - } - - CFDataRef iccp = ::CGColorSpaceCopyICCProfile(cspace); - - ::CFRelease(cspace); - - if (!iccp) { - return; - } - - // copy to external buffer - size = static_cast(::CFDataGetLength(iccp)); - if (size > 0) { - void *data = malloc(size); - if (data) { - memcpy(data, ::CFDataGetBytePtr(iccp), size); - mem = data; - } else { - size = 0; - } - } - - ::CFRelease(iccp); -} diff --git a/gfx/thebes/gfxPlatformMac.h b/gfx/thebes/gfxPlatformMac.h deleted file mode 100644 index ea4c1a1011..0000000000 --- a/gfx/thebes/gfxPlatformMac.h +++ /dev/null @@ -1,93 +0,0 @@ -/* -*- Mode: C++; tab-width: 20; 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 GFX_PLATFORM_MAC_H -#define GFX_PLATFORM_MAC_H - -#include "nsTArrayForwardDeclare.h" -#include "gfxPlatform.h" -#include "mozilla/LookAndFeel.h" - -namespace mozilla { -namespace gfx { -class DrawTarget; -class VsyncSource; -} // namespace gfx -} // namespace mozilla - -class gfxPlatformMac : public gfxPlatform { -public: - gfxPlatformMac(); - virtual ~gfxPlatformMac(); - - static gfxPlatformMac *GetPlatform() { - return (gfxPlatformMac*) gfxPlatform::GetPlatform(); - } - - virtual already_AddRefed - CreateOffscreenSurface(const IntSize& aSize, - gfxImageFormat aFormat) override; - - already_AddRefed - GetScaledFontForFont(mozilla::gfx::DrawTarget* aTarget, gfxFont *aFont) override; - - gfxFontGroup* - CreateFontGroup(const mozilla::FontFamilyList& aFontFamilyList, - const gfxFontStyle *aStyle, - gfxTextPerfMetrics* aTextPerf, - gfxUserFontSet *aUserFontSet, - gfxFloat aDevToCssSize) override; - - virtual gfxPlatformFontList* CreatePlatformFontList() override; - - bool IsFontFormatSupported(nsIURI *aFontURI, uint32_t aFormatFlags) override; - - virtual void GetCommonFallbackFonts(uint32_t aCh, uint32_t aNextCh, - Script aRunScript, - nsTArray& aFontList) override; - - // lookup the system font for a particular system font type and set - // the name and style characteristics - static void - LookupSystemFont(mozilla::LookAndFeel::FontID aSystemFontID, - nsAString& aSystemFontName, - gfxFontStyle &aFontStyle, - float aDevPixPerCSSPixel); - - virtual bool CanRenderContentToDataSurface() const override { - return true; - } - - virtual bool SupportsApzWheelInput() const override { - return true; - } - - bool RespectsFontStyleSmoothing() const override { - // gfxMacFont respects the font smoothing hint. - return true; - } - - bool RequiresAcceleratedGLContextForCompositorOGL() const override { - // On OS X in a VM, unaccelerated CompositorOGL shows black flashes, so we - // require accelerated GL for CompositorOGL but allow unaccelerated GL for - // BasicCompositor. - return true; - } - - virtual already_AddRefed CreateHardwareVsyncSource() override; - - // lower threshold on font anti-aliasing - uint32_t GetAntiAliasingThreshold() { return mFontAntiAliasingThreshold; } - -private: - virtual void GetPlatformCMSOutputProfile(void* &mem, size_t &size) override; - - // read in the pref value for the lower threshold on font anti-aliasing - static uint32_t ReadAntiAliasingThreshold(); - - uint32_t mFontAntiAliasingThreshold; -}; - -#endif /* GFX_PLATFORM_MAC_H */ diff --git a/gfx/thebes/gfxPrefs.h b/gfx/thebes/gfxPrefs.h index 5a2bde0792..a0bb7586c7 100644 --- a/gfx/thebes/gfxPrefs.h +++ b/gfx/thebes/gfxPrefs.h @@ -427,9 +427,6 @@ private: DECL_GFX_PREF(Live, "gl.ignore-dx-interop2-blacklist", IgnoreDXInterop2Blacklist, bool, false); DECL_GFX_PREF(Live, "gl.msaa-level", MSAALevel, uint32_t, 2); -#if defined(XP_MACOSX) - DECL_GFX_PREF(Live, "gl.multithreaded", GLMultithreaded, bool, false); -#endif DECL_GFX_PREF(Live, "gl.require-hardware", RequireHardwareGL, bool, false); DECL_GFX_PREF(Once, "image.cache.size", ImageCacheSize, int32_t, 5*1024*1024); diff --git a/gfx/thebes/gfxQuartzNativeDrawing.cpp b/gfx/thebes/gfxQuartzNativeDrawing.cpp deleted file mode 100644 index f14b71d779..0000000000 --- a/gfx/thebes/gfxQuartzNativeDrawing.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* -*- Mode: C++; tab-width: 20; 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/. */ - -#include "gfxQuartzNativeDrawing.h" -#include "gfxPlatform.h" -#include "mozilla/gfx/Helpers.h" - -using namespace mozilla::gfx; -using namespace mozilla; - -gfxQuartzNativeDrawing::gfxQuartzNativeDrawing(DrawTarget& aDrawTarget, - const Rect& nativeRect) - : mDrawTarget(&aDrawTarget) - , mNativeRect(nativeRect) - , mCGContext(nullptr) -{ -} - -CGContextRef -gfxQuartzNativeDrawing::BeginNativeDrawing() -{ - NS_ASSERTION(!mCGContext, "BeginNativeDrawing called when drawing already in progress"); - - DrawTarget *dt = mDrawTarget; - if (dt->IsDualDrawTarget() || dt->IsTiledDrawTarget() || - dt->GetBackendType() != BackendType::SKIA) { - // We need a DrawTarget that we can get a CGContextRef from: - Matrix transform = dt->GetTransform(); - - mNativeRect = transform.TransformBounds(mNativeRect); - mNativeRect.RoundOut(); - // Quartz theme drawing often adjusts drawing rects, so make - // sure our surface is big enough for that. - mNativeRect.Inflate(5); - if (mNativeRect.IsEmpty()) { - return nullptr; - } - - mTempDrawTarget = - Factory::CreateDrawTarget(BackendType::SKIA, - IntSize::Truncate(mNativeRect.width, mNativeRect.height), - SurfaceFormat::B8G8R8A8); - - if (mTempDrawTarget) { - transform.PostTranslate(-mNativeRect.x, -mNativeRect.y); - mTempDrawTarget->SetTransform(transform); - } - dt = mTempDrawTarget; - } - if (dt) { - MOZ_ASSERT(dt->GetBackendType() == BackendType::SKIA); - mCGContext = mBorrowedContext.Init(dt); - MOZ_ASSERT(mCGContext); - } - return mCGContext; -} - -void -gfxQuartzNativeDrawing::EndNativeDrawing() -{ - NS_ASSERTION(mCGContext, "EndNativeDrawing called without BeginNativeDrawing"); - - mBorrowedContext.Finish(); - if (mTempDrawTarget) { - RefPtr source = mTempDrawTarget->Snapshot(); - - AutoRestoreTransform autoRestore(mDrawTarget); - mDrawTarget->SetTransform(Matrix()); - mDrawTarget->DrawSurface(source, mNativeRect, - Rect(0, 0, mNativeRect.width, mNativeRect.height)); - } -} diff --git a/gfx/thebes/gfxQuartzNativeDrawing.h b/gfx/thebes/gfxQuartzNativeDrawing.h deleted file mode 100644 index 736f9ce836..0000000000 --- a/gfx/thebes/gfxQuartzNativeDrawing.h +++ /dev/null @@ -1,71 +0,0 @@ -/* -*- Mode: C++; tab-width: 20; 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 _GFXQUARTZNATIVEDRAWING_H_ -#define _GFXQUARTZNATIVEDRAWING_H_ - -#include "mozilla/Attributes.h" - -#include "mozilla/gfx/2D.h" -#include "mozilla/gfx/BorrowedContext.h" -#include "mozilla/RefPtr.h" - -class gfxQuartzNativeDrawing { - typedef mozilla::gfx::DrawTarget DrawTarget; - typedef mozilla::gfx::Rect Rect; -public: - - /* Create native Quartz drawing for a rectangle bounded by - * nativeRect. - * - * Typical usage looks like: - * - * gfxQuartzNativeDrawing nativeDraw(ctx, nativeRect); - * CGContextRef cgContext = nativeDraw.BeginNativeDrawing(); - * if (!cgContext) - * return NS_ERROR_FAILURE; - * - * ... call Quartz operations on CGContextRef to draw to nativeRect ... - * - * nativeDraw.EndNativeDrawing(); - * - * aNativeRect is the size of the surface (in Quartz/Cocoa points) that - * will be created _if_ the gfxQuartzNativeDrawing decides to create a new - * surface and CGContext for its drawing operations, which it then - * composites into the target DrawTarget. - * - * (Note that aNativeRect will be ignored if the gfxQuartzNativeDrawing - * uses the target DrawTarget directly.) - * - * The optional aBackingScale parameter is a scaling factor that will be - * applied when creating and rendering into such a temporary surface. - */ - gfxQuartzNativeDrawing(DrawTarget& aDrawTarget, - const Rect& aNativeRect); - - /* Returns a CGContextRef which may be used for native drawing. This - * CGContextRef is valid until EndNativeDrawing is called; if it is used - * for drawing after that time, the result is undefined. */ - CGContextRef BeginNativeDrawing(); - - /* Marks the end of native drawing */ - void EndNativeDrawing(); - -private: - // don't allow copying via construction or assignment - gfxQuartzNativeDrawing(const gfxQuartzNativeDrawing&) = delete; - const gfxQuartzNativeDrawing& operator=(const gfxQuartzNativeDrawing&) = delete; - - // Final destination context - RefPtr mDrawTarget; - RefPtr mTempDrawTarget; - mozilla::gfx::BorrowedCGContext mBorrowedContext; - mozilla::gfx::Rect mNativeRect; - - // saved state - CGContextRef mCGContext; -}; - -#endif diff --git a/gfx/thebes/gfxQuartzSurface.cpp b/gfx/thebes/gfxQuartzSurface.cpp deleted file mode 100644 index 99553e0c07..0000000000 --- a/gfx/thebes/gfxQuartzSurface.cpp +++ /dev/null @@ -1,137 +0,0 @@ -/* -*- Mode: C++; tab-width: 20; 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/. */ - -#include "gfxQuartzSurface.h" -#include "gfxContext.h" -#include "gfxImageSurface.h" -#include "mozilla/gfx/2D.h" -#include "mozilla/gfx/HelpersCairo.h" - -#include "cairo-quartz.h" - -void -gfxQuartzSurface::MakeInvalid() -{ - mSize = mozilla::gfx::IntSize(-1, -1); -} - -gfxQuartzSurface::gfxQuartzSurface(const mozilla::gfx::IntSize& desiredSize, - gfxImageFormat format) - : mCGContext(nullptr), mSize(desiredSize) -{ - if (!mozilla::gfx::Factory::CheckSurfaceSize(desiredSize)) - MakeInvalid(); - - unsigned int width = static_cast(mSize.width); - unsigned int height = static_cast(mSize.height); - - cairo_format_t cformat = GfxFormatToCairoFormat(format); - cairo_surface_t *surf = cairo_quartz_surface_create(cformat, width, height); - - mCGContext = cairo_quartz_surface_get_cg_context (surf); - - CGContextRetain(mCGContext); - - Init(surf); - if (mSurfaceValid) { - RecordMemoryUsed(mSize.height * 4 + sizeof(gfxQuartzSurface)); - } -} - -gfxQuartzSurface::gfxQuartzSurface(CGContextRef context, - const mozilla::gfx::IntSize& size) - : mCGContext(context), mSize(size) -{ - if (!mozilla::gfx::Factory::CheckSurfaceSize(size)) - MakeInvalid(); - - unsigned int width = static_cast(mSize.width); - unsigned int height = static_cast(mSize.height); - - cairo_surface_t *surf = - cairo_quartz_surface_create_for_cg_context(context, - width, height); - - CGContextRetain(mCGContext); - - Init(surf); - if (mSurfaceValid) { - RecordMemoryUsed(mSize.height * 4 + sizeof(gfxQuartzSurface)); - } -} - -gfxQuartzSurface::gfxQuartzSurface(cairo_surface_t *csurf, - const mozilla::gfx::IntSize& aSize) : - mSize(aSize) -{ - mCGContext = cairo_quartz_surface_get_cg_context (csurf); - CGContextRetain (mCGContext); - - Init(csurf, true); -} - -gfxQuartzSurface::gfxQuartzSurface(unsigned char *data, - const mozilla::gfx::IntSize& aSize, - long stride, - gfxImageFormat format) - : mCGContext(nullptr), mSize(aSize.width, aSize.height) -{ - if (!mozilla::gfx::Factory::CheckSurfaceSize(aSize)) - MakeInvalid(); - - cairo_format_t cformat = GfxFormatToCairoFormat(format); - cairo_surface_t *surf = cairo_quartz_surface_create_for_data - (data, cformat, aSize.width, aSize.height, stride); - - mCGContext = cairo_quartz_surface_get_cg_context (surf); - - CGContextRetain(mCGContext); - - Init(surf); - if (mSurfaceValid) { - RecordMemoryUsed(mSize.height * stride + sizeof(gfxQuartzSurface)); - } -} - -already_AddRefed -gfxQuartzSurface::CreateSimilarSurface(gfxContentType aType, - const mozilla::gfx::IntSize& aSize) -{ - cairo_surface_t *surface = - cairo_quartz_surface_create_cg_layer(mSurface, (cairo_content_t)aType, - aSize.width, aSize.height); - if (cairo_surface_status(surface)) { - cairo_surface_destroy(surface); - return nullptr; - } - - RefPtr result = Wrap(surface, aSize); - cairo_surface_destroy(surface); - return result.forget(); -} - -already_AddRefed gfxQuartzSurface::GetAsImageSurface() -{ - cairo_surface_t *surface = cairo_quartz_surface_get_image(mSurface); - if (!surface || cairo_surface_status(surface)) - return nullptr; - - RefPtr img = Wrap(surface); - - // cairo_quartz_surface_get_image returns a referenced image, and thebes - // shares the refcounts of Cairo surfaces. However, Wrap also adds a - // reference to the image. We need to remove one of these references - // explicitly so we don't leak. - img.get()->Release(); - - img->SetOpaqueRect(GetOpaqueRect()); - - return img.forget().downcast(); -} - -gfxQuartzSurface::~gfxQuartzSurface() -{ - CGContextRelease(mCGContext); -} diff --git a/gfx/thebes/gfxQuartzSurface.h b/gfx/thebes/gfxQuartzSurface.h deleted file mode 100644 index 50e2bfb2c3..0000000000 --- a/gfx/thebes/gfxQuartzSurface.h +++ /dev/null @@ -1,43 +0,0 @@ -/* -*- Mode: C++; tab-width: 20; 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 GFX_QUARTZSURFACE_H -#define GFX_QUARTZSURFACE_H - -#include "gfxASurface.h" -#include "nsSize.h" -#include "gfxPoint.h" - -#include - -class gfxContext; -class gfxImageSurface; - -class gfxQuartzSurface : public gfxASurface { -public: - gfxQuartzSurface(const mozilla::gfx::IntSize&, gfxImageFormat format); - gfxQuartzSurface(CGContextRef context, const mozilla::gfx::IntSize& size); - gfxQuartzSurface(cairo_surface_t *csurf, const mozilla::gfx::IntSize& aSize); - gfxQuartzSurface(unsigned char *data, const mozilla::gfx::IntSize& size, long stride, gfxImageFormat format); - - virtual ~gfxQuartzSurface(); - - virtual already_AddRefed CreateSimilarSurface(gfxContentType aType, - const mozilla::gfx::IntSize& aSize); - - virtual const mozilla::gfx::IntSize GetSize() const { return mozilla::gfx::IntSize(mSize.width, mSize.height); } - - CGContextRef GetCGContext() { return mCGContext; } - - already_AddRefed GetAsImageSurface(); - -protected: - void MakeInvalid(); - - CGContextRef mCGContext; - mozilla::gfx::IntSize mSize; -}; - -#endif /* GFX_QUARTZSURFACE_H */ diff --git a/gfx/thebes/gfxTextRun.cpp b/gfx/thebes/gfxTextRun.cpp index 1025abbd3e..664514fdd3 100644 --- a/gfx/thebes/gfxTextRun.cpp +++ b/gfx/thebes/gfxTextRun.cpp @@ -518,11 +518,6 @@ HasSyntheticBoldOrColor(const gfxTextRun *aRun, gfxTextRun::Range aRange) if (fe->TryGetSVGData(font) || fe->TryGetColorGlyphs()) { return true; } -#if defined(XP_MACOSX) // sbix fonts only supported via Core Text - if (fe->HasFontTable(TRUETYPE_TAG('s', 'b', 'i', 'x'))) { - return true; - } -#endif } } return false; diff --git a/gfx/thebes/moz.build b/gfx/thebes/moz.build index 06517e3c0c..87bedd5554 100644 --- a/gfx/thebes/moz.build +++ b/gfx/thebes/moz.build @@ -57,24 +57,7 @@ EXPORTS.mozilla.gfx += [ 'PrintTargetThebes.h', ] -if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': - EXPORTS += [ - 'gfxPlatformMac.h', - 'gfxQuartzNativeDrawing.h', - 'gfxQuartzSurface.h', - ] - EXPORTS.mozilla.gfx += [ - 'PrintTargetCG.h', - ] - SOURCES += [ - 'gfxCoreTextShaper.cpp', - 'gfxMacFont.cpp', - 'gfxPlatformMac.cpp', - 'gfxQuartzNativeDrawing.cpp', - 'gfxQuartzSurface.cpp', - 'PrintTargetCG.cpp', - ] -elif 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']: +if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']: EXPORTS += [ 'gfxFontconfigFonts.h', 'gfxFT2FontBase.h', @@ -185,11 +168,7 @@ SOURCES += [ 'VsyncSource.cpp', ] -if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': - SOURCES += [ - 'gfxMacPlatformFontList.mm', - ] -elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows': +if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows': SOURCES += [ 'D3D11Checks.cpp', 'DeviceManagerDx.cpp', diff --git a/gfx/ycbcr/convert.patch b/gfx/ycbcr/convert.patch.outdated similarity index 100% rename from gfx/ycbcr/convert.patch rename to gfx/ycbcr/convert.patch.outdated diff --git a/gfx/ycbcr/yuv_row_posix.cpp b/gfx/ycbcr/yuv_row_posix.cpp index a84792d966..152bfc7788 100644 --- a/gfx/ycbcr/yuv_row_posix.cpp +++ b/gfx/ycbcr/yuv_row_posix.cpp @@ -1,4 +1,5 @@ // Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2021 Moonchild Productions. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -319,9 +320,7 @@ void FastConvertYUVToRGB32Row_SSE(const uint8* y_buf, "2:" "popa\n" "ret\n" -#if !defined(XP_MACOSX) ".previous\n" -#endif ); void FastConvertYUVToRGB32Row(const uint8* y_buf, @@ -412,9 +411,7 @@ void ScaleYUVToRGB32Row_SSE(const uint8* y_buf, "2:" "popa\n" "ret\n" -#if !defined(XP_MACOSX) ".previous\n" -#endif ); void ScaleYUVToRGB32Row(const uint8* y_buf, @@ -544,9 +541,7 @@ void LinearScaleYUVToRGB32Row_SSE(const uint8* y_buf, "movd %mm1, (%ebp)\n" "popa\n" "ret\n" -#if !defined(XP_MACOSX) ".previous\n" -#endif ); void LinearScaleYUVToRGB32Row(const uint8* y_buf, @@ -577,11 +572,7 @@ void PICConvertYUVToRGB32Row_SSE(const uint8* y_buf, asm( ".text\n" -#if defined(XP_MACOSX) -"_PICConvertYUVToRGB32Row_SSE:\n" -#else -"PICConvertYUVToRGB32Row_SSE:\n" -#endif + "PICConvertYUVToRGB32Row_SSE:\n" "pusha\n" "mov 0x24(%esp),%edx\n" "mov 0x28(%esp),%edi\n" @@ -630,9 +621,7 @@ void PICConvertYUVToRGB32Row_SSE(const uint8* y_buf, "2:" "popa\n" "ret\n" -#if !defined(XP_MACOSX) ".previous\n" -#endif ); void FastConvertYUVToRGB32Row(const uint8* y_buf, @@ -660,11 +649,7 @@ void PICScaleYUVToRGB32Row_SSE(const uint8* y_buf, asm( ".text\n" -#if defined(XP_MACOSX) -"_PICScaleYUVToRGB32Row_SSE:\n" -#else -"PICScaleYUVToRGB32Row_SSE:\n" -#endif + "PICScaleYUVToRGB32Row_SSE:\n" "pusha\n" "mov 0x24(%esp),%edx\n" "mov 0x28(%esp),%edi\n" @@ -727,9 +712,7 @@ void PICScaleYUVToRGB32Row_SSE(const uint8* y_buf, "2:" "popa\n" "ret\n" -#if !defined(XP_MACOSX) ".previous\n" -#endif ); void ScaleYUVToRGB32Row(const uint8* y_buf, @@ -758,11 +741,7 @@ void PICLinearScaleYUVToRGB32Row_SSE(const uint8* y_buf, asm( ".text\n" -#if defined(XP_MACOSX) -"_PICLinearScaleYUVToRGB32Row_SSE:\n" -#else -"PICLinearScaleYUVToRGB32Row_SSE:\n" -#endif + "PICLinearScaleYUVToRGB32Row_SSE:\n" "pusha\n" "mov 0x24(%esp),%edx\n" "mov 0x30(%esp),%ebp\n" @@ -865,9 +844,7 @@ void PICLinearScaleYUVToRGB32Row_SSE(const uint8* y_buf, "movd %mm1, (%ebp)\n" "popa\n" "ret\n" -#if !defined(XP_MACOSX) ".previous\n" -#endif ); diff --git a/ipc/glue/SharedMemoryBasic.h b/ipc/glue/SharedMemoryBasic.h index d3c3e62860..9b9668f689 100644 --- a/ipc/glue/SharedMemoryBasic.h +++ b/ipc/glue/SharedMemoryBasic.h @@ -6,10 +6,6 @@ #ifndef mozilla_ipc_SharedMemoryBasic_h #define mozilla_ipc_SharedMemoryBasic_h -#ifdef XP_DARWIN -# include "mozilla/ipc/SharedMemoryBasic_mach.h" -#else # include "mozilla/ipc/SharedMemoryBasic_chromium.h" -#endif #endif // ifndef mozilla_ipc_SharedMemoryBasic_h diff --git a/ipc/glue/SharedMemoryBasic_mach.h b/ipc/glue/SharedMemoryBasic_mach.h deleted file mode 100644 index 2c54652413..0000000000 --- a/ipc/glue/SharedMemoryBasic_mach.h +++ /dev/null @@ -1,83 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* 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_ipc_SharedMemoryBasic_mach_h -#define mozilla_ipc_SharedMemoryBasic_mach_h - -#include "base/file_descriptor_posix.h" -#include "base/process.h" - -#include "SharedMemory.h" -#include - -// -// This is a low-level wrapper around platform shared memory. Don't -// use it directly; use Shmem allocated through IPDL interfaces. -// - -class MachPortSender; -class ReceivePort; - -namespace mozilla { -namespace ipc { - -class SharedMemoryBasic final : public SharedMemoryCommon -{ -public: - static void SetupMachMemory(pid_t pid, - ReceivePort* listen_port, - MachPortSender* listen_port_ack, - MachPortSender* send_port, - ReceivePort* send_port_ack, - bool pidIsParent); - - static void CleanupForPid(pid_t pid); - - static void Shutdown(); - - SharedMemoryBasic(); - - virtual bool SetHandle(const Handle& aHandle) override; - - virtual bool Create(size_t aNbytes) override; - - virtual bool Map(size_t nBytes) override; - - virtual void CloseHandle() override; - - virtual void* memory() const override - { - return mMemory; - } - - virtual SharedMemoryType Type() const override - { - return TYPE_BASIC; - } - - static Handle NULLHandle() - { - return Handle(); - } - - - virtual bool IsHandleValid(const Handle &aHandle) const override; - - virtual bool ShareToProcess(base::ProcessId aProcessId, - Handle* aNewHandle) override; - -private: - ~SharedMemoryBasic(); - - void Unmap(); - mach_port_t mPort; - // Pointer to mapped region, null if unmapped. - void *mMemory; -}; - -} // namespace ipc -} // namespace mozilla - -#endif // ifndef mozilla_ipc_SharedMemoryBasic_mach_h diff --git a/ipc/glue/SharedMemoryBasic_mach.mm b/ipc/glue/SharedMemoryBasic_mach.mm deleted file mode 100644 index 88753ee2e8..0000000000 --- a/ipc/glue/SharedMemoryBasic_mach.mm +++ /dev/null @@ -1,676 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * vim: sw=2 ts=8 et : - */ -/* 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/. */ - -#include - -#include -#include -#if defined(XP_IOS) -#include -#define mach_vm_address_t vm_address_t -#define mach_vm_allocate vm_allocate -#define mach_vm_deallocate vm_deallocate -#define mach_vm_map vm_map -#define mach_vm_read vm_read -#define mach_vm_region_recurse vm_region_recurse_64 -#define mach_vm_size_t vm_size_t -#else -#include -#endif -#include -#include -#include "SharedMemoryBasic.h" -#include "chrome/common/mach_ipc_mac.h" - -#include "mozilla/StaticMutex.h" - -#ifdef DEBUG -#define LOG_ERROR(str, args...) \ - PR_BEGIN_MACRO \ - char *msg = PR_smprintf(str, ## args); \ - NS_WARNING(msg); \ - PR_smprintf_free(msg); \ - PR_END_MACRO -#else -#define LOG_ERROR(str, args...) do { /* nothing */ } while(0) -#endif - -#define CHECK_MACH_ERROR(kr, msg) \ - PR_BEGIN_MACRO \ - if (kr != KERN_SUCCESS) { \ - LOG_ERROR("%s %s (%x)\n", msg, mach_error_string(kr), kr); \ - return false; \ - } \ - PR_END_MACRO - -/* - * This code is responsible for sharing memory between processes. Memory can be - * shared between parent and child or between two children. Each memory region is - * referenced via a Mach port. Mach ports are also used for messaging when - * sharing a memory region. - * - * When the parent starts a child, it starts a thread whose only purpose is to - * communicate with the child about shared memory. Once the child has started, - * it starts a similar thread for communicating with the parent. Each side can - * communicate with the thread on the other side via Mach ports. When either - * side wants to share memory with the other, it sends a Mach message to the - * other side. Attached to the message is the port that references the shared - * memory region. When the other side receives the message, it automatically - * gets access to the region. It sends a reply (also via a Mach port) so that - * the originating side can continue. - * - * The two sides communicate using four ports. Two ports are used when the - * parent shares memory with the child. The other two are used when the child - * shares memory with the parent. One of these two ports is used for sending the - * "share" message and the other is used for the reply. - * - * If a child wants to share memory with another child, it sends a "GetPorts" - * message to the parent. The parent forwards this GetPorts message to the - * target child. The message includes some ports so that the children can talk - * directly. Both children start up a thread to communicate with the other child, - * similar to the way parent and child communicate. In the future, when these - * two children want to communicate, they re-use the channels that were created. - * - * When a child shuts down, the parent notifies all other children. Those - * children then have the opportunity to shut down any threads they might have - * been using to communicate directly with that child. - */ - -namespace mozilla { -namespace ipc { - -struct MemoryPorts { - MachPortSender* mSender; - ReceivePort* mReceiver; - - MemoryPorts() {} - MemoryPorts(MachPortSender* sender, ReceivePort* receiver) - : mSender(sender), mReceiver(receiver) {} -}; - -// Protects gMemoryCommPorts and gThreads. -static StaticMutex gMutex; - -static std::map gMemoryCommPorts; - -enum { - kGetPortsMsg = 1, - kSharePortsMsg, - kReturnIdMsg, - kReturnPortsMsg, - kShutdownMsg, - kCleanupMsg, -}; - -const int kTimeout = 1000; -const int kLongTimeout = 60 * kTimeout; - -pid_t gParentPid = 0; - -struct PIDPair { - pid_t mRequester; - pid_t mRequested; - - PIDPair(pid_t requester, pid_t requested) - : mRequester(requester), mRequested(requested) {} -}; - -struct ListeningThread { - pthread_t mThread; - MemoryPorts* mPorts; - - ListeningThread() {} - ListeningThread(pthread_t thread, MemoryPorts* ports) - : mThread(thread), mPorts(ports) {} -}; - -struct SharePortsReply { - uint64_t serial; - mach_port_t port; -}; - -std::map gThreads; - -static void * -PortServerThread(void *argument); - - -static void -SetupMachMemory(pid_t pid, - ReceivePort* listen_port, - MachPortSender* listen_port_ack, - MachPortSender* send_port, - ReceivePort* send_port_ack, - bool pidIsParent) -{ - if (pidIsParent) { - gParentPid = pid; - } - MemoryPorts* listen_ports = new MemoryPorts(listen_port_ack, listen_port); - pthread_t thread; - pthread_attr_t attr; - pthread_attr_init(&attr); - pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); - int err = pthread_create(&thread, &attr, PortServerThread, listen_ports); - if (err) { - LOG_ERROR("pthread_create failed with %x\n", err); - return; - } - - gMutex.AssertCurrentThreadOwns(); - gThreads[pid] = ListeningThread(thread, listen_ports); - gMemoryCommPorts[pid] = MemoryPorts(send_port, send_port_ack); -} - -// Send two communication ports to another process along with the pid of the process that is -// listening on them. -bool -SendPortsMessage(MachPortSender* sender, - mach_port_t ports_in_receiver, - mach_port_t ports_out_receiver, - PIDPair pid_pair) -{ - MachSendMessage getPortsMsg(kGetPortsMsg); - if (!getPortsMsg.AddDescriptor(MachMsgPortDescriptor(ports_in_receiver))) { - LOG_ERROR("Adding descriptor to message failed"); - return false; - } - if (!getPortsMsg.AddDescriptor(MachMsgPortDescriptor(ports_out_receiver))) { - LOG_ERROR("Adding descriptor to message failed"); - return false; - } - - getPortsMsg.SetData(&pid_pair, sizeof(PIDPair)); - kern_return_t err = sender->SendMessage(getPortsMsg, kTimeout); - if (KERN_SUCCESS != err) { - LOG_ERROR("Error sending get ports message %s (%x)\n", mach_error_string(err), err); - return false; - } - return true; -} - -// Receive two communication ports from another process -bool -RecvPortsMessage(ReceivePort* receiver, mach_port_t* ports_in_sender, mach_port_t* ports_out_sender) -{ - MachReceiveMessage rcvPortsMsg; - kern_return_t err = receiver->WaitForMessage(&rcvPortsMsg, kTimeout); - if (KERN_SUCCESS != err) { - LOG_ERROR("Error receiving get ports message %s (%x)\n", mach_error_string(err), err); - } - if (rcvPortsMsg.GetTranslatedPort(0) == MACH_PORT_NULL) { - LOG_ERROR("GetTranslatedPort(0) failed"); - return false; - } - *ports_in_sender = rcvPortsMsg.GetTranslatedPort(0); - - if (rcvPortsMsg.GetTranslatedPort(1) == MACH_PORT_NULL) { - LOG_ERROR("GetTranslatedPort(1) failed"); - return false; - } - *ports_out_sender = rcvPortsMsg.GetTranslatedPort(1); - return true; -} - -// Send two communication ports to another process and receive two back -bool -RequestPorts(const MemoryPorts& request_ports, - mach_port_t ports_in_receiver, - mach_port_t* ports_in_sender, - mach_port_t* ports_out_sender, - mach_port_t ports_out_receiver, - PIDPair pid_pair) -{ - if (!SendPortsMessage(request_ports.mSender, ports_in_receiver, ports_out_receiver, pid_pair)) { - return false; - } - return RecvPortsMessage(request_ports.mReceiver, ports_in_sender, ports_out_sender); -} - -MemoryPorts* -GetMemoryPortsForPid(pid_t pid) -{ - gMutex.AssertCurrentThreadOwns(); - - if (gMemoryCommPorts.find(pid) == gMemoryCommPorts.end()) { - // We don't have the ports open to communicate with that pid, so we're going to - // ask our parent process over IPC to set them up for us. - if (gParentPid == 0) { - // If we're the top level parent process, we have no parent to ask. - LOG_ERROR("request for ports for pid %d, but we're the chrome process\n", pid); - return nullptr; - } - const MemoryPorts& parent = gMemoryCommPorts[gParentPid]; - - // Create two receiving ports in this process to send to the parent. One will be used for - // for listening for incoming memory to be shared, the other for getting the Handle of - // memory we share to the other process. - ReceivePort* ports_in_receiver = new ReceivePort(); - ReceivePort* ports_out_receiver = new ReceivePort(); - mach_port_t raw_ports_in_sender, raw_ports_out_sender; - if (!RequestPorts(parent, - ports_in_receiver->GetPort(), - &raw_ports_in_sender, - &raw_ports_out_sender, - ports_out_receiver->GetPort(), - PIDPair(getpid(), pid))) { - LOG_ERROR("failed to request ports\n"); - return nullptr; - } - // Our parent process sent us two ports, one is for sending new memory to, the other - // is for replying with the Handle when we receive new memory. - MachPortSender* ports_in_sender = new MachPortSender(raw_ports_in_sender); - MachPortSender* ports_out_sender = new MachPortSender(raw_ports_out_sender); - SetupMachMemory(pid, - ports_in_receiver, - ports_in_sender, - ports_out_sender, - ports_out_receiver, - false); - MOZ_ASSERT(gMemoryCommPorts.find(pid) != gMemoryCommPorts.end()); - } - return &gMemoryCommPorts.at(pid); -} - -// We just received a port representing a region of shared memory, reply to -// the process that set it with the mach_port_t that represents it in this process. -// That will be the Handle to be shared over normal IPC -void -HandleSharePortsMessage(MachReceiveMessage* rmsg, MemoryPorts* ports) -{ - mach_port_t port = rmsg->GetTranslatedPort(0); - uint64_t* serial = reinterpret_cast(rmsg->GetData()); - MachSendMessage msg(kReturnIdMsg); - // Construct the reply message, echoing the serial, and adding the port - SharePortsReply replydata; - replydata.port = port; - replydata.serial = *serial; - msg.SetData(&replydata, sizeof(SharePortsReply)); - kern_return_t err = ports->mSender->SendMessage(msg, kTimeout); - if (KERN_SUCCESS != err) { - LOG_ERROR("SendMessage failed 0x%x %s\n", err, mach_error_string(err)); - } -} - -// We were asked by another process to get communications ports to some process. Return -// those ports via an IPC message. -bool -SendReturnPortsMsg(MachPortSender* sender, - mach_port_t raw_ports_in_sender, - mach_port_t raw_ports_out_sender) -{ - MachSendMessage getPortsMsg(kReturnPortsMsg); - if (!getPortsMsg.AddDescriptor(MachMsgPortDescriptor(raw_ports_in_sender))) { - LOG_ERROR("Adding descriptor to message failed"); - return false; - } - - if (!getPortsMsg.AddDescriptor(MachMsgPortDescriptor(raw_ports_out_sender))) { - LOG_ERROR("Adding descriptor to message failed"); - return false; - } - kern_return_t err = sender->SendMessage(getPortsMsg, kTimeout); - if (KERN_SUCCESS != err) { - LOG_ERROR("Error sending get ports message %s (%x)\n", mach_error_string(err), err); - return false; - } - return true; -} - -// We were asked for communcations ports to a process that isn't us. Assuming that process -// is one of our children, forward that request on. -void -ForwardGetPortsMessage(MachReceiveMessage* rmsg, MemoryPorts* ports, PIDPair* pid_pair) -{ - if (rmsg->GetTranslatedPort(0) == MACH_PORT_NULL) { - LOG_ERROR("GetTranslatedPort(0) failed"); - return; - } - if (rmsg->GetTranslatedPort(1) == MACH_PORT_NULL) { - LOG_ERROR("GetTranslatedPort(1) failed"); - return; - } - mach_port_t raw_ports_in_sender, raw_ports_out_sender; - MemoryPorts* requestedPorts = GetMemoryPortsForPid(pid_pair->mRequested); - if (!requestedPorts) { - LOG_ERROR("failed to find port for process\n"); - return; - } - if (!RequestPorts(*requestedPorts, rmsg->GetTranslatedPort(0), &raw_ports_in_sender, - &raw_ports_out_sender, rmsg->GetTranslatedPort(1), *pid_pair)) { - LOG_ERROR("failed to request ports\n"); - return; - } - SendReturnPortsMsg(ports->mSender, raw_ports_in_sender, raw_ports_out_sender); -} - -// We receieved a message asking us to get communications ports for another process -void -HandleGetPortsMessage(MachReceiveMessage* rmsg, MemoryPorts* ports) -{ - PIDPair* pid_pair; - if (rmsg->GetDataLength() != sizeof(PIDPair)) { - LOG_ERROR("Improperly formatted message\n"); - return; - } - pid_pair = reinterpret_cast(rmsg->GetData()); - if (pid_pair->mRequested != getpid()) { - // This request is for ports to a process that isn't us, forward it to that process - ForwardGetPortsMessage(rmsg, ports, pid_pair); - } else { - if (rmsg->GetTranslatedPort(0) == MACH_PORT_NULL) { - LOG_ERROR("GetTranslatedPort(0) failed"); - return; - } - - if (rmsg->GetTranslatedPort(1) == MACH_PORT_NULL) { - LOG_ERROR("GetTranslatedPort(1) failed"); - return; - } - - MachPortSender* ports_in_sender = new MachPortSender(rmsg->GetTranslatedPort(0)); - MachPortSender* ports_out_sender = new MachPortSender(rmsg->GetTranslatedPort(1)); - - ReceivePort* ports_in_receiver = new ReceivePort(); - ReceivePort* ports_out_receiver = new ReceivePort(); - if (SendReturnPortsMsg(ports->mSender, ports_in_receiver->GetPort(), ports_out_receiver->GetPort())) { - SetupMachMemory(pid_pair->mRequester, - ports_out_receiver, - ports_out_sender, - ports_in_sender, - ports_in_receiver, - false); - } - } -} - -static void * -PortServerThread(void *argument) -{ - MemoryPorts* ports = static_cast(argument); - MachReceiveMessage child_message; - while (true) { - MachReceiveMessage rmsg; - kern_return_t err = ports->mReceiver->WaitForMessage(&rmsg, MACH_MSG_TIMEOUT_NONE); - if (err != KERN_SUCCESS) { - LOG_ERROR("Wait for message failed 0x%x %s\n", err, mach_error_string(err)); - continue; - } - if (rmsg.GetMessageID() == kShutdownMsg) { - delete ports->mSender; - delete ports->mReceiver; - delete ports; - return nullptr; - } - StaticMutexAutoLock smal(gMutex); - switch (rmsg.GetMessageID()) { - case kSharePortsMsg: - HandleSharePortsMessage(&rmsg, ports); - break; - case kGetPortsMsg: - HandleGetPortsMessage(&rmsg, ports); - break; - case kCleanupMsg: - if (gParentPid == 0) { - LOG_ERROR("Cleanup message not valid for parent process"); - continue; - } - - pid_t* pid; - if (rmsg.GetDataLength() != sizeof(pid_t)) { - LOG_ERROR("Improperly formatted message\n"); - continue; - } - pid = reinterpret_cast(rmsg.GetData()); - SharedMemoryBasic::CleanupForPid(*pid); - break; - default: - LOG_ERROR("Unknown message\n"); - } - } -} - -void -SharedMemoryBasic::SetupMachMemory(pid_t pid, - ReceivePort* listen_port, - MachPortSender* listen_port_ack, - MachPortSender* send_port, - ReceivePort* send_port_ack, - bool pidIsParent) -{ - StaticMutexAutoLock smal(gMutex); - mozilla::ipc::SetupMachMemory(pid, listen_port, listen_port_ack, send_port, send_port_ack, pidIsParent); -} - -void -SharedMemoryBasic::Shutdown() -{ - StaticMutexAutoLock smal(gMutex); - - for (auto it = gThreads.begin(); it != gThreads.end(); ++it) { - MachSendMessage shutdownMsg(kShutdownMsg); - it->second.mPorts->mReceiver->SendMessageToSelf(shutdownMsg, kTimeout); - } - gThreads.clear(); - - for (auto it = gMemoryCommPorts.begin(); it != gMemoryCommPorts.end(); ++it) { - delete it->second.mSender; - delete it->second.mReceiver; - } - gMemoryCommPorts.clear(); -} - -void -SharedMemoryBasic::CleanupForPid(pid_t pid) -{ - if (gThreads.find(pid) == gThreads.end()) { - return; - } - const ListeningThread& listeningThread = gThreads[pid]; - MachSendMessage shutdownMsg(kShutdownMsg); - kern_return_t ret = listeningThread.mPorts->mReceiver->SendMessageToSelf(shutdownMsg, kTimeout); - if (ret != KERN_SUCCESS) { - LOG_ERROR("sending shutdown msg failed %s %x\n", mach_error_string(ret), ret); - } - gThreads.erase(pid); - - if (gParentPid == 0) { - // We're the parent. Broadcast the cleanup message to everyone else. - for (auto it = gMemoryCommPorts.begin(); it != gMemoryCommPorts.end(); ++it) { - MachSendMessage msg(kCleanupMsg); - msg.SetData(&pid, sizeof(pid)); - // We don't really care if this fails, we could be trying to send to an already shut down proc - it->second.mSender->SendMessage(msg, kTimeout); - } - } - - MemoryPorts& ports = gMemoryCommPorts[pid]; - delete ports.mSender; - delete ports.mReceiver; - gMemoryCommPorts.erase(pid); -} - -SharedMemoryBasic::SharedMemoryBasic() - : mPort(MACH_PORT_NULL) - , mMemory(nullptr) -{ -} - -SharedMemoryBasic::~SharedMemoryBasic() -{ - Unmap(); - CloseHandle(); -} - -bool -SharedMemoryBasic::SetHandle(const Handle& aHandle) -{ - MOZ_ASSERT(mPort == MACH_PORT_NULL, "already initialized"); - - mPort = aHandle; - return true; -} - -static inline void* -toPointer(mach_vm_address_t address) -{ - return reinterpret_cast(static_cast(address)); -} - -static inline mach_vm_address_t -toVMAddress(void* pointer) -{ - return static_cast(reinterpret_cast(pointer)); -} - -bool -SharedMemoryBasic::Create(size_t size) -{ - mach_vm_address_t address; - - kern_return_t kr = mach_vm_allocate(mach_task_self(), &address, round_page(size), VM_FLAGS_ANYWHERE); - if (kr != KERN_SUCCESS) { - LOG_ERROR("Failed to allocate mach_vm_allocate shared memory (%zu bytes). %s (%x)\n", - size, mach_error_string(kr), kr); - return false; - } - - memory_object_size_t memoryObjectSize = round_page(size); - - kr = mach_make_memory_entry_64(mach_task_self(), - &memoryObjectSize, - address, - VM_PROT_DEFAULT, - &mPort, - MACH_PORT_NULL); - if (kr != KERN_SUCCESS) { - LOG_ERROR("Failed to make memory entry (%zu bytes). %s (%x)\n", - size, mach_error_string(kr), kr); - return false; - } - - mMemory = toPointer(address); - Mapped(size); - return true; -} - -bool -SharedMemoryBasic::Map(size_t size) -{ - if (mMemory) { - return true; - } - - if (MACH_PORT_NULL == mPort) { - return false; - } - - kern_return_t kr; - mach_vm_address_t address = 0; - - vm_prot_t vmProtection = VM_PROT_READ | VM_PROT_WRITE; - - kr = mach_vm_map(mach_task_self(), &address, round_page(size), 0, VM_FLAGS_ANYWHERE, - mPort, 0, false, vmProtection, vmProtection, VM_INHERIT_NONE); - if (kr != KERN_SUCCESS) { - LOG_ERROR("Failed to map shared memory (%zu bytes) into %x, port %x. %s (%x)\n", - size, mach_task_self(), mPort, mach_error_string(kr), kr); - return false; - } - - mMemory = toPointer(address); - Mapped(size); - return true; -} - -bool -SharedMemoryBasic::ShareToProcess(base::ProcessId pid, - Handle* aNewHandle) -{ - if (pid == getpid()) { - *aNewHandle = mPort; - return mach_port_mod_refs(mach_task_self(), *aNewHandle, MACH_PORT_RIGHT_SEND, 1) == KERN_SUCCESS; - } - StaticMutexAutoLock smal(gMutex); - - // Serially number the messages, to check whether - // the reply we get was meant for us. - static uint64_t serial = 0; - uint64_t my_serial = serial; - serial++; - - MemoryPorts* ports = GetMemoryPortsForPid(pid); - if (!ports) { - LOG_ERROR("Unable to get ports for process.\n"); - return false; - } - MachSendMessage smsg(kSharePortsMsg); - smsg.AddDescriptor(MachMsgPortDescriptor(mPort, MACH_MSG_TYPE_COPY_SEND)); - smsg.SetData(&my_serial, sizeof(uint64_t)); - kern_return_t err = ports->mSender->SendMessage(smsg, kTimeout); - if (err != KERN_SUCCESS) { - LOG_ERROR("sending port failed %s %x\n", mach_error_string(err), err); - return false; - } - MachReceiveMessage msg; - err = ports->mReceiver->WaitForMessage(&msg, kTimeout); - if (err != KERN_SUCCESS) { - LOG_ERROR("short timeout didn't get an id %s %x\n", mach_error_string(err), err); - err = ports->mReceiver->WaitForMessage(&msg, kLongTimeout); - - if (err != KERN_SUCCESS) { - LOG_ERROR("long timeout didn't get an id %s %x\n", mach_error_string(err), err); - return false; - } - } - if (msg.GetDataLength() != sizeof(SharePortsReply)) { - LOG_ERROR("Improperly formatted reply\n"); - return false; - } - SharePortsReply* msg_data = reinterpret_cast(msg.GetData()); - mach_port_t id = msg_data->port; - uint64_t serial_check = msg_data->serial; - if (serial_check != my_serial) { - LOG_ERROR("Serials do not match up: %d vs %d", serial_check, my_serial); - return false; - } - *aNewHandle = id; - return true; -} - -void -SharedMemoryBasic::Unmap() -{ - if (!mMemory) { - return; - } - vm_address_t address = toVMAddress(mMemory); - kern_return_t kr = vm_deallocate(mach_task_self(), address, round_page(mMappedSize)); - if (kr != KERN_SUCCESS) { - LOG_ERROR("Failed to deallocate shared memory. %s (%x)\n", mach_error_string(kr), kr); - return; - } - mMemory = nullptr; -} - -void -SharedMemoryBasic::CloseHandle() -{ - if (mPort != MACH_PORT_NULL) { - mach_port_deallocate(mach_task_self(), mPort); - mPort = MACH_PORT_NULL; - } -} - -bool -SharedMemoryBasic::IsHandleValid(const Handle& aHandle) const -{ - return aHandle > 0; -} - -} // namespace ipc -} // namespace mozilla diff --git a/ipc/glue/moz.build b/ipc/glue/moz.build index 426e796668..d882e3fbd1 100644 --- a/ipc/glue/moz.build +++ b/ipc/glue/moz.build @@ -77,13 +77,7 @@ else: 'CrossProcessMutex_unimplemented.cpp', ] -if CONFIG['OS_ARCH'] == 'Darwin': - EXPORTS.mozilla.ipc += ['SharedMemoryBasic_mach.h'] - SOURCES += [ - 'SharedMemoryBasic_mach.mm', - ] -else: - EXPORTS.mozilla.ipc += ['SharedMemoryBasic_chromium.h'] +EXPORTS.mozilla.ipc += ['SharedMemoryBasic_chromium.h'] if CONFIG['OS_ARCH'] == 'Linux': UNIFIED_SOURCES += [ diff --git a/js/src/ds/MemoryProtectionExceptionHandler.cpp b/js/src/ds/MemoryProtectionExceptionHandler.cpp index 06fabb5301..77df1f0d92 100644 --- a/js/src/ds/MemoryProtectionExceptionHandler.cpp +++ b/js/src/ds/MemoryProtectionExceptionHandler.cpp @@ -10,13 +10,10 @@ #if defined(XP_WIN) # include "jswin.h" -#elif defined(XP_UNIX) && !defined(XP_DARWIN) +#elif defined(XP_UNIX) # include # include # include -#elif defined(XP_DARWIN) -# include -# include #endif #ifdef ANDROID @@ -210,7 +207,7 @@ MemoryProtectionExceptionHandler::uninstall() } } -#elif defined(XP_UNIX) && !defined(XP_DARWIN) +#elif defined(XP_UNIX) static struct sigaction sPrevSEGVHandler = {}; @@ -291,465 +288,6 @@ MemoryProtectionExceptionHandler::uninstall() } } -#elif defined(XP_DARWIN) - -/* - * The fact that we need to be able to forward to other exception handlers - * makes this code much more complicated. The forwarding logic and the - * structures required to make it work are heavily based on the code at - * www.ravenbrook.com/project/mps/prototype/2013-06-24/machtest/machtest/main.c - */ - -/* -------------------------------------------------------------------------- */ -/* Begin Mach definitions and helper functions */ -/* -------------------------------------------------------------------------- */ - -/* - * These are the message IDs associated with each exception type. - * We'll be using sIDRequest64, but we need the others for forwarding. - */ -static const mach_msg_id_t sIDRequest32 = 2401; -static const mach_msg_id_t sIDRequestState32 = 2402; -static const mach_msg_id_t sIDRequestStateIdentity32 = 2403; - -static const mach_msg_id_t sIDRequest64 = 2405; -static const mach_msg_id_t sIDRequestState64 = 2406; -static const mach_msg_id_t sIDRequestStateIdentity64 = 2407; - -/* - * Each message ID has an associated Mach message structure. - * We use the preprocessor to make defining them a little less arduous. - */ -# define REQUEST_HEADER_FIELDS\ - mach_msg_header_t header; - -# define REQUEST_IDENTITY_FIELDS\ - mach_msg_body_t msgh_body;\ - mach_msg_port_descriptor_t thread;\ - mach_msg_port_descriptor_t task; - -# define REQUEST_GENERAL_FIELDS(bits)\ - NDR_record_t NDR;\ - exception_type_t exception;\ - mach_msg_type_number_t code_count;\ - int##bits##_t code[2]; - -# define REQUEST_STATE_FIELDS\ - int flavor;\ - mach_msg_type_number_t old_state_count;\ - natural_t old_state[THREAD_STATE_MAX]; - -# define REQUEST_TRAILER_FIELDS\ - mach_msg_trailer_t trailer; - -# define EXCEPTION_REQUEST(bits)\ - struct ExceptionRequest##bits\ - {\ - REQUEST_HEADER_FIELDS\ - REQUEST_IDENTITY_FIELDS\ - REQUEST_GENERAL_FIELDS(bits)\ - REQUEST_TRAILER_FIELDS\ - };\ - -# define EXCEPTION_REQUEST_STATE(bits)\ - struct ExceptionRequestState##bits\ - {\ - REQUEST_HEADER_FIELDS\ - REQUEST_GENERAL_FIELDS(bits)\ - REQUEST_STATE_FIELDS\ - REQUEST_TRAILER_FIELDS\ - };\ - -# define EXCEPTION_REQUEST_STATE_IDENTITY(bits)\ - struct ExceptionRequestStateIdentity##bits\ - {\ - REQUEST_HEADER_FIELDS\ - REQUEST_IDENTITY_FIELDS\ - REQUEST_GENERAL_FIELDS(bits)\ - REQUEST_STATE_FIELDS\ - REQUEST_TRAILER_FIELDS\ - };\ - -/* This is needed because not all fields are naturally aligned on 64-bit. */ -# ifdef __MigPackStructs -# pragma pack(4) -# endif - -EXCEPTION_REQUEST(32) -EXCEPTION_REQUEST(64) -EXCEPTION_REQUEST_STATE(32) -EXCEPTION_REQUEST_STATE(64) -EXCEPTION_REQUEST_STATE_IDENTITY(32) -EXCEPTION_REQUEST_STATE_IDENTITY(64) - -/* We use this as a common base when forwarding to the previous handler. */ -union ExceptionRequestUnion { - mach_msg_header_t header; - ExceptionRequest32 r32; - ExceptionRequest64 r64; - ExceptionRequestState32 rs32; - ExceptionRequestState64 rs64; - ExceptionRequestStateIdentity32 rsi32; - ExceptionRequestStateIdentity64 rsi64; -}; - -/* This isn't really a full Mach message, but it's all we need to send. */ -struct ExceptionReply -{ - mach_msg_header_t header; - NDR_record_t NDR; - kern_return_t RetCode; -}; - -# ifdef __MigPackStructs -# pragma pack() -# endif - -# undef EXCEPTION_REQUEST_STATE_IDENTITY -# undef EXCEPTION_REQUEST_STATE -# undef EXCEPTION_REQUEST -# undef REQUEST_STATE_FIELDS -# undef REQUEST_GENERAL_FIELDS -# undef REQUEST_IDENTITY_FIELDS -# undef REQUEST_HEADER_FIELDS - -/* - * The exception handler we're forwarding to may not have the same behavior - * or thread state flavor as what we're using. These macros help populate - * the fields of the message we're about to send to the previous handler. - */ -# define COPY_REQUEST_COMMON(bits, id)\ - dst.header = src.header;\ - dst.header.msgh_id = id;\ - dst.header.msgh_size = static_cast(sizeof(dst) - sizeof(dst.trailer));\ - dst.NDR = src.NDR;\ - dst.exception = src.exception;\ - dst.code_count = src.code_count;\ - dst.code[0] = int##bits##_t(src.code[0]);\ - dst.code[1] = int##bits##_t(src.code[1]); - -# define COPY_REQUEST_IDENTITY\ - dst.msgh_body = src.msgh_body;\ - dst.thread = src.thread;\ - dst.task = src.task; - -# define COPY_REQUEST_STATE(flavor, stateCount, state)\ - mach_msg_size_t stateSize = stateCount * sizeof(natural_t);\ - dst.header.msgh_size = static_cast(sizeof(dst) - sizeof(dst.trailer) -\ - sizeof(dst.old_state) + stateSize);\ - dst.flavor = flavor;\ - dst.old_state_count = stateCount;\ - memcpy(dst.old_state, state, stateSize); - -# define COPY_EXCEPTION_REQUEST(bits)\ - static void\ - CopyExceptionRequest##bits(ExceptionRequest64& src,\ - ExceptionRequest##bits& dst)\ - {\ - COPY_REQUEST_COMMON(bits, sIDRequest##bits)\ - COPY_REQUEST_IDENTITY\ - } - -# define COPY_EXCEPTION_REQUEST_STATE(bits)\ - static void\ - CopyExceptionRequestState##bits(ExceptionRequest64& src,\ - ExceptionRequestState##bits& dst,\ - thread_state_flavor_t flavor,\ - mach_msg_type_number_t stateCount,\ - thread_state_t state)\ - {\ - COPY_REQUEST_COMMON(bits, sIDRequestState##bits)\ - COPY_REQUEST_STATE(flavor, stateCount, state)\ - } - -# define COPY_EXCEPTION_REQUEST_STATE_IDENTITY(bits)\ - static void\ - CopyExceptionRequestStateIdentity##bits(ExceptionRequest64& src,\ - ExceptionRequestStateIdentity##bits& dst,\ - thread_state_flavor_t flavor,\ - mach_msg_type_number_t stateCount,\ - thread_state_t state)\ - {\ - COPY_REQUEST_COMMON(bits, sIDRequestStateIdentity##bits)\ - COPY_REQUEST_IDENTITY\ - COPY_REQUEST_STATE(flavor, stateCount, state)\ - } - -COPY_EXCEPTION_REQUEST(32) -COPY_EXCEPTION_REQUEST_STATE(32) -COPY_EXCEPTION_REQUEST_STATE_IDENTITY(32) -COPY_EXCEPTION_REQUEST(64) -COPY_EXCEPTION_REQUEST_STATE(64) -COPY_EXCEPTION_REQUEST_STATE_IDENTITY(64) - -# undef COPY_EXCEPTION_REQUEST_STATE_IDENTITY -# undef COPY_EXCEPTION_REQUEST_STATE -# undef COPY_EXCEPTION_REQUEST -# undef COPY_REQUEST_STATE -# undef COPY_REQUEST_IDENTITY -# undef COPY_REQUEST_COMMON - -/* -------------------------------------------------------------------------- */ -/* End Mach definitions and helper functions */ -/* -------------------------------------------------------------------------- */ - -/* Every Mach exception handler is parameterized by these four properties. */ -struct MachExceptionParameters -{ - exception_mask_t mask; - mach_port_t port; - exception_behavior_t behavior; - thread_state_flavor_t flavor; -}; - -struct ExceptionHandlerState -{ - MachExceptionParameters current; - MachExceptionParameters previous; - - /* Each Mach exception handler runs in its own thread. */ - Thread handlerThread; -}; - -/* This choice of ID is arbitrary, but must not match our exception ID. */ -static const mach_msg_id_t sIDQuit = 42; - -static ExceptionHandlerState sMachExceptionState; - -/* - * The meat of our exception handler. This thread waits for an exception - * message, annotates the exception if needed, then forwards it to the - * previously installed handler (which will likely terminate the process). - */ -static void -MachExceptionHandler() -{ - kern_return_t ret; - MachExceptionParameters& current = sMachExceptionState.current; - MachExceptionParameters& previous = sMachExceptionState.previous; - - // We use the simplest kind of 64-bit exception message here. - ExceptionRequest64 request = {}; - request.header.msgh_local_port = current.port; - request.header.msgh_size = static_cast(sizeof(request)); - ret = mach_msg(&request.header, MACH_RCV_MSG, 0, request.header.msgh_size, - current.port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); - - // Restore the previous handler. We're going to forward to it - // anyway, and if we crash while doing so we don't want to hang. - task_set_exception_ports(mach_task_self(), previous.mask, previous.port, - previous.behavior, previous.flavor); - - // If we failed even receiving the message, just give up. - if (ret != MACH_MSG_SUCCESS) - MOZ_CRASH("MachExceptionHandler: mach_msg failed to receive a message!"); - - // Terminate the thread if we're shutting down. - if (request.header.msgh_id == sIDQuit) - return; - - // The only other valid message ID is the one associated with the - // EXCEPTION_DEFAULT | MACH_EXCEPTION_CODES behavior we chose. - if (request.header.msgh_id != sIDRequest64) - MOZ_CRASH("MachExceptionHandler: Unexpected Message ID!"); - - // Make sure we can understand the exception we received. - if (request.exception != EXC_BAD_ACCESS || request.code_count != 2) - MOZ_CRASH("MachExceptionHandler: Unexpected exception type!"); - - // Get the address that the offending code tried to access. - uintptr_t address = uintptr_t(request.code[1]); - - // If the faulting address is inside one of our protected regions, we - // want to annotate the crash to make it stand out from the crowd. - if (sProtectedRegions.isProtected(address)) { - ReportCrashIfDebug("Hit MOZ_CRASH(Tried to access a protected region!)\n"); - MOZ_CRASH_ANNOTATE("MOZ_CRASH(Tried to access a protected region!)"); - } - - // Forward to the previous handler which may be a debugger, the unix - // signal handler, the crash reporter or something else entirely. - if (previous.port != MACH_PORT_NULL) { - mach_msg_type_number_t stateCount; - thread_state_data_t state; - if ((uint32_t(previous.behavior) & ~MACH_EXCEPTION_CODES) != EXCEPTION_DEFAULT) { - // If the previous handler requested thread state, get it here. - stateCount = THREAD_STATE_MAX; - ret = thread_get_state(request.thread.name, previous.flavor, state, &stateCount); - if (ret != KERN_SUCCESS) - MOZ_CRASH("MachExceptionHandler: Could not get the thread state to forward!"); - } - - // Depending on the behavior of the previous handler, the forwarded - // exception message will have a different set of fields. - // Of particular note is that exception handlers that lack - // MACH_EXCEPTION_CODES will get 32-bit fields even on 64-bit - // systems. It appears that OSX simply truncates these fields. - ExceptionRequestUnion forward; - switch (uint32_t(previous.behavior)) { - case EXCEPTION_DEFAULT: - CopyExceptionRequest32(request, forward.r32); - break; - case EXCEPTION_DEFAULT | MACH_EXCEPTION_CODES: - CopyExceptionRequest64(request, forward.r64); - break; - case EXCEPTION_STATE: - CopyExceptionRequestState32(request, forward.rs32, - previous.flavor, stateCount, state); - break; - case EXCEPTION_STATE | MACH_EXCEPTION_CODES: - CopyExceptionRequestState64(request, forward.rs64, - previous.flavor, stateCount, state); - break; - case EXCEPTION_STATE_IDENTITY: - CopyExceptionRequestStateIdentity32(request, forward.rsi32, - previous.flavor, stateCount, state); - break; - case EXCEPTION_STATE_IDENTITY | MACH_EXCEPTION_CODES: - CopyExceptionRequestStateIdentity64(request, forward.rsi64, - previous.flavor, stateCount, state); - break; - default: - MOZ_CRASH("MachExceptionHandler: Unknown previous handler behavior!"); - } - - // Forward the generated message to the old port. The local and remote - // port fields *and their rights* are swapped on arrival, so we need to - // swap them back first. - forward.header.msgh_bits = (request.header.msgh_bits & ~MACH_MSGH_BITS_PORTS_MASK) | - MACH_MSGH_BITS(MACH_MSGH_BITS_LOCAL(request.header.msgh_bits), - MACH_MSGH_BITS_REMOTE(request.header.msgh_bits)); - forward.header.msgh_local_port = forward.header.msgh_remote_port; - forward.header.msgh_remote_port = previous.port; - ret = mach_msg(&forward.header, MACH_SEND_MSG, forward.header.msgh_size, 0, - MACH_PORT_NULL, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); - if (ret != MACH_MSG_SUCCESS) - MOZ_CRASH("MachExceptionHandler: Failed to forward to the previous handler!"); - } else { - // There was no previous task-level exception handler, so defer to the - // host level one instead. We set the return code to KERN_FAILURE to - // indicate that we did not handle the exception. - // The reply message ID is always the request ID + 100. - ExceptionReply reply = {}; - reply.header.msgh_bits = - MACH_MSGH_BITS(MACH_MSGH_BITS_REMOTE(request.header.msgh_bits), 0); - reply.header.msgh_size = static_cast(sizeof(reply)); - reply.header.msgh_remote_port = request.header.msgh_remote_port; - reply.header.msgh_local_port = MACH_PORT_NULL; - reply.header.msgh_id = request.header.msgh_id + 100; - reply.NDR = request.NDR; - reply.RetCode = KERN_FAILURE; - ret = mach_msg(&reply.header, MACH_SEND_MSG, reply.header.msgh_size, 0, - MACH_PORT_NULL, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); - if (ret != MACH_MSG_SUCCESS) - MOZ_CRASH("MachExceptionHandler: Failed to forward to the host level!"); - } -} - -static void -TerminateMachExceptionHandlerThread() -{ - // Send a simple quit message to the exception handler thread. - mach_msg_header_t msg; - msg.msgh_bits = MACH_MSGH_BITS(MACH_MSG_TYPE_COPY_SEND, 0); - msg.msgh_size = static_cast(sizeof(msg)); - msg.msgh_remote_port = sMachExceptionState.current.port; - msg.msgh_local_port = MACH_PORT_NULL; - msg.msgh_reserved = 0; - msg.msgh_id = sIDQuit; - kern_return_t ret = mach_msg(&msg, MACH_SEND_MSG, sizeof(msg), 0, MACH_PORT_NULL, - MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); - - if (ret == MACH_MSG_SUCCESS) - sMachExceptionState.handlerThread.join(); - else - MOZ_CRASH("MachExceptionHandler: Handler thread failed to terminate!"); -} - -bool -MemoryProtectionExceptionHandler::install() -{ - MOZ_ASSERT(!sExceptionHandlerInstalled); - - // If the exception handler is disabled, report success anyway. - if (MemoryProtectionExceptionHandler::isDisabled()) - return true; - - kern_return_t ret; - mach_port_t task = mach_task_self(); - - // Allocate a new exception port with receive rights. - sMachExceptionState.current = {}; - MachExceptionParameters& current = sMachExceptionState.current; - ret = mach_port_allocate(task, MACH_PORT_RIGHT_RECEIVE, ¤t.port); - if (ret != KERN_SUCCESS) - return false; - - // Give the new port send rights as well. - ret = mach_port_insert_right(task, current.port, current.port, MACH_MSG_TYPE_MAKE_SEND); - if (ret != KERN_SUCCESS) { - mach_port_deallocate(task, current.port); - current = {}; - return false; - } - - // Start the thread that will receive the messages from our exception port. - if (!sMachExceptionState.handlerThread.init(MachExceptionHandler)) { - mach_port_deallocate(task, current.port); - current = {}; - return false; - } - - // Set the other properties of our new exception handler. - current.mask = EXC_MASK_BAD_ACCESS; - current.behavior = exception_behavior_t(EXCEPTION_DEFAULT | MACH_EXCEPTION_CODES); - current.flavor = THREAD_STATE_NONE; - - // Tell the task to use our exception handler, and save the previous one. - sMachExceptionState.previous = {}; - MachExceptionParameters& previous = sMachExceptionState.previous; - mach_msg_type_number_t previousCount = 1; - ret = task_swap_exception_ports(task, current.mask, current.port, current.behavior, - current.flavor, &previous.mask, &previousCount, - &previous.port, &previous.behavior, &previous.flavor); - if (ret != KERN_SUCCESS) { - TerminateMachExceptionHandlerThread(); - mach_port_deallocate(task, current.port); - previous = {}; - current = {}; - return false; - } - - // We should have info on the previous exception handler, even if it's null. - MOZ_ASSERT(previousCount == 1); - - sExceptionHandlerInstalled = true; - return sExceptionHandlerInstalled; -} - -void -MemoryProtectionExceptionHandler::uninstall() -{ - if (sExceptionHandlerInstalled) { - mach_port_t task = mach_task_self(); - - // Restore the previous exception handler. - MachExceptionParameters& previous = sMachExceptionState.previous; - task_set_exception_ports(task, previous.mask, previous.port, - previous.behavior, previous.flavor); - - TerminateMachExceptionHandlerThread(); - - // Release the Mach IPC port we used. - mach_port_deallocate(task, sMachExceptionState.current.port); - - sMachExceptionState.current = {}; - sMachExceptionState.previous = {}; - - sExceptionHandlerInstalled = false; - } -} - #else #error "This platform is not supported!" diff --git a/js/src/irregexp/NativeRegExpMacroAssembler.cpp b/js/src/irregexp/NativeRegExpMacroAssembler.cpp index f2bee2dc54..a3756f5fff 100644 --- a/js/src/irregexp/NativeRegExpMacroAssembler.cpp +++ b/js/src/irregexp/NativeRegExpMacroAssembler.cpp @@ -131,14 +131,6 @@ NativeRegExpMacroAssembler::GenerateCode(JSContext* cx, bool match_only) pushedNonVolatileRegisters++; } -#if defined(XP_IOS) && defined(JS_CODEGEN_ARM) - // The stack is 4-byte aligned on iOS, force 8-byte alignment. - masm.movePtr(StackPointer, temp0); - masm.andPtr(Imm32(~7), StackPointer); - masm.push(temp0); - masm.push(temp0); -#endif - #ifndef JS_CODEGEN_X86 // The InputOutputData* is stored as an argument, save it on the stack // above the frame. @@ -405,11 +397,6 @@ NativeRegExpMacroAssembler::GenerateCode(JSContext* cx, bool match_only) masm.freeStack(frameSize); #endif -#if defined(XP_IOS) && defined(JS_CODEGEN_ARM) - masm.pop(temp0); - masm.movePtr(temp0, StackPointer); -#endif - // Restore non-volatile registers which were saved on entry. for (GeneralRegisterBackwardIterator iter(savedNonVolatileRegisters); iter.more(); ++iter) masm.Pop(*iter); diff --git a/js/src/jit/ExecutableAllocator.h b/js/src/jit/ExecutableAllocator.h index 39efd87893..8042ae7a98 100644 --- a/js/src/jit/ExecutableAllocator.h +++ b/js/src/jit/ExecutableAllocator.h @@ -68,10 +68,6 @@ extern "C" void sync_instruction_memory(caddr_t v, u_int len); #include #endif -#if defined(JS_CODEGEN_ARM) && defined(XP_IOS) -#include -#endif - namespace JS { struct CodeSizes; } // namespace JS @@ -255,11 +251,6 @@ class ExecutableAllocator { __clear_cache(code, reinterpret_cast(code) + size); } -#elif (defined(JS_CODEGEN_ARM) || defined(JS_CODEGEN_ARM64)) && defined(XP_IOS) - static void cacheFlush(void* code, size_t size) - { - sys_icache_invalidate(code, size); - } #elif defined(JS_CODEGEN_ARM) && (defined(__linux__) || defined(ANDROID)) && defined(__GNUC__) static void cacheFlush(void* code, size_t size) { diff --git a/js/src/jit/arm/Architecture-arm.h b/js/src/jit/arm/Architecture-arm.h index 1d16a51a81..d2c634798b 100644 --- a/js/src/jit/arm/Architecture-arm.h +++ b/js/src/jit/arm/Architecture-arm.h @@ -14,9 +14,8 @@ #include "js/Utility.h" // GCC versions 4.6 and above define __ARM_PCS_VFP to denote a hard-float -// ABI target. The iOS toolchain doesn't define anything specific here, -// but iOS always supports VFP. -#if defined(__ARM_PCS_VFP) || defined(XP_IOS) +// ABI target. +#if defined(__ARM_PCS_VFP) #define JS_CODEGEN_ARM_HARDFP #endif @@ -113,12 +112,7 @@ class Registers (1 << r0) | (1 << r1) | (1 << Registers::r2) | - (1 << Registers::r3) -#if defined(XP_IOS) - // per https://developer.apple.com/library/ios/documentation/Xcode/Conceptual/iPhoneOSABIReference/Articles/ARMv6FunctionCallingConventions.html#//apple_ref/doc/uid/TP40009021-SW4 - | (1 << Registers::r9) -#endif - ; + (1 << Registers::r3); static const SetType NonVolatileMask = (1 << Registers::r4) | @@ -126,9 +120,7 @@ class Registers (1 << Registers::r6) | (1 << Registers::r7) | (1 << Registers::r8) | -#if !defined(XP_IOS) (1 << Registers::r9) | -#endif (1 << Registers::r10) | (1 << Registers::r11) | (1 << Registers::r12) | diff --git a/js/src/jsmath.cpp b/js/src/jsmath.cpp index ba1d29de0f..78760583db 100644 --- a/js/src/jsmath.cpp +++ b/js/src/jsmath.cpp @@ -49,7 +49,7 @@ # undef SystemFunction036 #endif -#if defined(ANDROID) || defined(XP_DARWIN) || defined(__DragonFly__) || \ +#if defined(ANDROID) || defined(__DragonFly__) || \ defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) # include # define HAVE_ARC4RANDOM diff --git a/js/src/jsnativestack.cpp b/js/src/jsnativestack.cpp index d83e06c241..99c2f6654a 100644 --- a/js/src/jsnativestack.cpp +++ b/js/src/jsnativestack.cpp @@ -8,7 +8,7 @@ #ifdef XP_WIN # include "jswin.h" -#elif defined(XP_DARWIN) || defined(DARWIN) || defined(XP_UNIX) +#elif defined(XP_UNIX) # include # if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) @@ -132,10 +132,6 @@ void* js::GetNativeStackBaseImpl() { pthread_t thread = pthread_self(); -# if defined(XP_DARWIN) || defined(DARWIN) - return pthread_get_stackaddr_np(thread); - -# else pthread_attr_t sattr; pthread_attr_init(&sattr); # if defined(__OpenBSD__) @@ -210,7 +206,6 @@ js::GetNativeStackBaseImpl() # else return static_cast(stackBase) + stackSize; # endif -# endif } #endif /* !XP_WIN */ diff --git a/js/src/jsstr.cpp b/js/src/jsstr.cpp index 6eb11b1cc1..b44fbdebca 100644 --- a/js/src/jsstr.cpp +++ b/js/src/jsstr.cpp @@ -1177,7 +1177,7 @@ FirstCharMatcher8bit(const char* text, uint32_t n, const char pat) static const char16_t* FirstCharMatcher16bit(const char16_t* text, uint32_t n, const char16_t pat) { -#if defined(XP_DARWIN) || defined(XP_WIN) +#if defined(XP_WIN) /* * Performance of memchr is horrible in OSX. Windows is better, * but it is still better to use UnrolledMatcher. diff --git a/js/src/threading/posix/Thread.cpp b/js/src/threading/posix/Thread.cpp index faca05c24d..a5c2d2eacb 100644 --- a/js/src/threading/posix/Thread.cpp +++ b/js/src/threading/posix/Thread.cpp @@ -151,9 +151,7 @@ js::ThisThread::SetName(const char* name) #endif int rv; -#ifdef XP_DARWIN - rv = pthread_setname_np(name); -#elif defined(__DragonFly__) || defined(__FreeBSD__) || defined(__OpenBSD__) +#if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__OpenBSD__) pthread_set_name_np(pthread_self(), name); rv = 0; #elif defined(__NetBSD__) diff --git a/js/src/vm/Runtime.cpp b/js/src/vm/Runtime.cpp index 251c8258cf..23c50814fc 100644 --- a/js/src/vm/Runtime.cpp +++ b/js/src/vm/Runtime.cpp @@ -10,14 +10,12 @@ #include "mozilla/ThreadLocal.h" #include "mozilla/Unused.h" -#if defined(XP_DARWIN) -#include -#elif defined(XP_UNIX) +#if defined(XP_UNIX) #include #elif defined(XP_WIN) #include #include -#endif // defined(XP_DARWIN) || defined(XP_UNIX) || defined(XP_WIN) +#endif // defined(XP_UNIX) || defined(XP_WIN) #include #include diff --git a/js/src/vm/Runtime.h b/js/src/vm/Runtime.h index f1f2e07094..eefc90cb4c 100644 --- a/js/src/vm/Runtime.h +++ b/js/src/vm/Runtime.h @@ -21,9 +21,6 @@ #include "jsclist.h" #include "jsscript.h" -#ifdef XP_DARWIN -# include "wasm/WasmSignalHandlers.h" -#endif #include "builtin/AtomicsObject.h" #include "builtin/Intl.h" #include "builtin/Promise.h" @@ -932,10 +929,6 @@ struct JSRuntime : public JS::shadow::Runtime, */ JSCList onNewGlobalObjectWatchers; -#if defined(XP_DARWIN) - js::wasm::MachExceptionHandler wasmMachExceptionHandler; -#endif - private: js::FreeOp* defaultFreeOp_; diff --git a/js/src/wasm/WasmSignalHandlers.cpp b/js/src/wasm/WasmSignalHandlers.cpp index b7bb024bca..b45d05ebd2 100644 --- a/js/src/wasm/WasmSignalHandlers.cpp +++ b/js/src/wasm/WasmSignalHandlers.cpp @@ -1,6 +1,7 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * Copyright 2014 Mozilla Foundation + * Copyright 2021 Moonchild Productions * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -235,10 +236,6 @@ class AutoSetHandlingSegFault # define EPC_sig(p) ((p)->uc_mcontext.mc_pc) # define RFP_sig(p) ((p)->uc_mcontext.mc_regs[30]) # endif -#elif defined(XP_DARWIN) -# define EIP_sig(p) ((p)->uc_mcontext->__ss.__eip) -# define RIP_sig(p) ((p)->uc_mcontext->__ss.__rip) -# define R15_sig(p) ((p)->uc_mcontext->__ss.__pc) #else # error "Don't know how to read/write to the thread state via the mcontext_t." #endif @@ -348,34 +345,8 @@ enum { REG_EIP = 14 }; #endif // Define a context type for use in the emulator code. This is usually just -// the same as CONTEXT, but on Mac we use a different structure since we call -// into the emulator code from a Mach exception handler rather than a -// sigaction-style signal handler. -#if defined(XP_DARWIN) -# if defined(JS_CPU_X64) -struct macos_x64_context { - x86_thread_state64_t thread; - x86_float_state64_t float_; -}; -# define EMULATOR_CONTEXT macos_x64_context -# elif defined(JS_CPU_X86) -struct macos_x86_context { - x86_thread_state_t thread; - x86_float_state_t float_; -}; -# define EMULATOR_CONTEXT macos_x86_context -# elif defined(JS_CPU_ARM) -struct macos_arm_context { - arm_thread_state_t thread; - arm_neon_state_t float_; -}; -# define EMULATOR_CONTEXT macos_arm_context -# else -# error Unsupported architecture -# endif -#else +// the same as CONTEXT. # define EMULATOR_CONTEXT CONTEXT -#endif #if defined(JS_CPU_X64) # define PC_sig(p) RIP_sig(p) @@ -467,7 +438,6 @@ StoreValueFromGPImm(SharedMem addr, size_t size, int32_t imm) AtomicOperations::memcpySafeWhenRacy(addr, static_cast(&imm), size); } -# if !defined(XP_DARWIN) MOZ_COLD static void* AddressOfFPRegisterSlot(CONTEXT* context, FloatRegisters::Encoding encoding) { @@ -517,57 +487,6 @@ AddressOfGPRegisterSlot(EMULATOR_CONTEXT* context, Registers::Code code) } MOZ_CRASH(); } -# else -MOZ_COLD static void* -AddressOfFPRegisterSlot(EMULATOR_CONTEXT* context, FloatRegisters::Encoding encoding) -{ - switch (encoding) { - case X86Encoding::xmm0: return &context->float_.__fpu_xmm0; - case X86Encoding::xmm1: return &context->float_.__fpu_xmm1; - case X86Encoding::xmm2: return &context->float_.__fpu_xmm2; - case X86Encoding::xmm3: return &context->float_.__fpu_xmm3; - case X86Encoding::xmm4: return &context->float_.__fpu_xmm4; - case X86Encoding::xmm5: return &context->float_.__fpu_xmm5; - case X86Encoding::xmm6: return &context->float_.__fpu_xmm6; - case X86Encoding::xmm7: return &context->float_.__fpu_xmm7; - case X86Encoding::xmm8: return &context->float_.__fpu_xmm8; - case X86Encoding::xmm9: return &context->float_.__fpu_xmm9; - case X86Encoding::xmm10: return &context->float_.__fpu_xmm10; - case X86Encoding::xmm11: return &context->float_.__fpu_xmm11; - case X86Encoding::xmm12: return &context->float_.__fpu_xmm12; - case X86Encoding::xmm13: return &context->float_.__fpu_xmm13; - case X86Encoding::xmm14: return &context->float_.__fpu_xmm14; - case X86Encoding::xmm15: return &context->float_.__fpu_xmm15; - default: break; - } - MOZ_CRASH(); -} - -MOZ_COLD static void* -AddressOfGPRegisterSlot(EMULATOR_CONTEXT* context, Registers::Code code) -{ - switch (code) { - case X86Encoding::rax: return &context->thread.__rax; - case X86Encoding::rcx: return &context->thread.__rcx; - case X86Encoding::rdx: return &context->thread.__rdx; - case X86Encoding::rbx: return &context->thread.__rbx; - case X86Encoding::rsp: return &context->thread.__rsp; - case X86Encoding::rbp: return &context->thread.__rbp; - case X86Encoding::rsi: return &context->thread.__rsi; - case X86Encoding::rdi: return &context->thread.__rdi; - case X86Encoding::r8: return &context->thread.__r8; - case X86Encoding::r9: return &context->thread.__r9; - case X86Encoding::r10: return &context->thread.__r10; - case X86Encoding::r11: return &context->thread.__r11; - case X86Encoding::r12: return &context->thread.__r12; - case X86Encoding::r13: return &context->thread.__r13; - case X86Encoding::r14: return &context->thread.__r14; - case X86Encoding::r15: return &context->thread.__r15; - default: break; - } - MOZ_CRASH(); -} -# endif // !XP_DARWIN MOZ_COLD static void SetRegisterToCoercedUndefined(EMULATOR_CONTEXT* context, size_t size, @@ -873,276 +792,7 @@ WasmFaultHandler(LPEXCEPTION_POINTERS exception) return EXCEPTION_CONTINUE_SEARCH; } -#elif defined(XP_DARWIN) -# include - -static uint8_t** -ContextToPC(EMULATOR_CONTEXT* context) -{ -# if defined(JS_CPU_X64) - static_assert(sizeof(context->thread.__rip) == sizeof(void*), - "stored IP should be compile-time pointer-sized"); - return reinterpret_cast(&context->thread.__rip); -# elif defined(JS_CPU_X86) - static_assert(sizeof(context->thread.uts.ts32.__eip) == sizeof(void*), - "stored IP should be compile-time pointer-sized"); - return reinterpret_cast(&context->thread.uts.ts32.__eip); -# elif defined(JS_CPU_ARM) - static_assert(sizeof(context->thread.__pc) == sizeof(void*), - "stored IP should be compile-time pointer-sized"); - return reinterpret_cast(&context->thread.__pc); -# else -# error Unsupported architecture -# endif -} - -// This definition was generated by mig (the Mach Interface Generator) for the -// routine 'exception_raise' (exc.defs). -#pragma pack(4) -typedef struct { - mach_msg_header_t Head; - /* start of the kernel processed data */ - mach_msg_body_t msgh_body; - mach_msg_port_descriptor_t thread; - mach_msg_port_descriptor_t task; - /* end of the kernel processed data */ - NDR_record_t NDR; - exception_type_t exception; - mach_msg_type_number_t codeCnt; - int64_t code[2]; -} Request__mach_exception_raise_t; -#pragma pack() - -// The full Mach message also includes a trailer. -struct ExceptionRequest -{ - Request__mach_exception_raise_t body; - mach_msg_trailer_t trailer; -}; - -static bool -HandleMachException(JSRuntime* rt, const ExceptionRequest& request) -{ - // Don't allow recursive handling of signals, see AutoSetHandlingSegFault. - if (rt->handlingSegFault) - return false; - AutoSetHandlingSegFault handling(rt); - - // Get the port of the JSRuntime's thread from the message. - mach_port_t rtThread = request.body.thread.name; - - // Read out the JSRuntime thread's register state. - EMULATOR_CONTEXT context; -# if defined(JS_CPU_X64) - unsigned int thread_state_count = x86_THREAD_STATE64_COUNT; - unsigned int float_state_count = x86_FLOAT_STATE64_COUNT; - int thread_state = x86_THREAD_STATE64; - int float_state = x86_FLOAT_STATE64; -# elif defined(JS_CPU_X86) - unsigned int thread_state_count = x86_THREAD_STATE_COUNT; - unsigned int float_state_count = x86_FLOAT_STATE_COUNT; - int thread_state = x86_THREAD_STATE; - int float_state = x86_FLOAT_STATE; -# elif defined(JS_CPU_ARM) - unsigned int thread_state_count = ARM_THREAD_STATE_COUNT; - unsigned int float_state_count = ARM_NEON_STATE_COUNT; - int thread_state = ARM_THREAD_STATE; - int float_state = ARM_NEON_STATE; -# else -# error Unsupported architecture -# endif - kern_return_t kret; - kret = thread_get_state(rtThread, thread_state, - (thread_state_t)&context.thread, &thread_state_count); - if (kret != KERN_SUCCESS) - return false; - kret = thread_get_state(rtThread, float_state, - (thread_state_t)&context.float_, &float_state_count); - if (kret != KERN_SUCCESS) - return false; - - uint8_t** ppc = ContextToPC(&context); - uint8_t* pc = *ppc; - - if (request.body.exception != EXC_BAD_ACCESS || request.body.codeCnt != 2) - return false; - - WasmActivation* activation = rt->wasmActivationStack(); - if (!activation) - return false; - - const Instance* instance = activation->compartment()->wasm.lookupInstanceDeprecated(pc); - if (!instance || !instance->codeSegment().containsFunctionPC(pc)) - return false; - - uint8_t* faultingAddress = reinterpret_cast(request.body.code[1]); - - // This check isn't necessary, but, since we can, check anyway to make - // sure we aren't covering up a real bug. - if (!IsHeapAccessAddress(*instance, faultingAddress)) - return false; - - HandleMemoryAccess(&context, pc, faultingAddress, *instance, ppc); - - // Update the thread state with the new pc and register values. - kret = thread_set_state(rtThread, float_state, (thread_state_t)&context.float_, float_state_count); - if (kret != KERN_SUCCESS) - return false; - kret = thread_set_state(rtThread, thread_state, (thread_state_t)&context.thread, thread_state_count); - if (kret != KERN_SUCCESS) - return false; - - return true; -} - -// Taken from mach_exc in /usr/include/mach/mach_exc.defs. -static const mach_msg_id_t sExceptionId = 2405; - -// The choice of id here is arbitrary, the only constraint is that sQuitId != sExceptionId. -static const mach_msg_id_t sQuitId = 42; - -static void -MachExceptionHandlerThread(JSRuntime* rt) -{ - mach_port_t port = rt->wasmMachExceptionHandler.port(); - kern_return_t kret; - - while(true) { - ExceptionRequest request; - kret = mach_msg(&request.body.Head, MACH_RCV_MSG, 0, sizeof(request), - port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); - - // If we fail even receiving the message, we can't even send a reply! - // Rather than hanging the faulting thread (hanging the browser), crash. - if (kret != KERN_SUCCESS) { - fprintf(stderr, "MachExceptionHandlerThread: mach_msg failed with %d\n", (int)kret); - MOZ_CRASH(); - } - - // There are only two messages we should be receiving: an exception - // message that occurs when the runtime's thread faults and the quit - // message sent when the runtime is shutting down. - if (request.body.Head.msgh_id == sQuitId) - break; - if (request.body.Head.msgh_id != sExceptionId) { - fprintf(stderr, "Unexpected msg header id %d\n", (int)request.body.Head.msgh_bits); - MOZ_CRASH(); - } - - // Some thread just commited an EXC_BAD_ACCESS and has been suspended by - // the kernel. The kernel is waiting for us to reply with instructions. - // Our default is the "not handled" reply (by setting the RetCode field - // of the reply to KERN_FAILURE) which tells the kernel to continue - // searching at the process and system level. If this is an asm.js - // expected exception, we handle it and return KERN_SUCCESS. - bool handled = HandleMachException(rt, request); - kern_return_t replyCode = handled ? KERN_SUCCESS : KERN_FAILURE; - - // This magic incantation to send a reply back to the kernel was derived - // from the exc_server generated by 'mig -v /usr/include/mach/mach_exc.defs'. - __Reply__exception_raise_t reply; - reply.Head.msgh_bits = MACH_MSGH_BITS(MACH_MSGH_BITS_REMOTE(request.body.Head.msgh_bits), 0); - reply.Head.msgh_size = sizeof(reply); - reply.Head.msgh_remote_port = request.body.Head.msgh_remote_port; - reply.Head.msgh_local_port = MACH_PORT_NULL; - reply.Head.msgh_id = request.body.Head.msgh_id + 100; - reply.NDR = NDR_record; - reply.RetCode = replyCode; - mach_msg(&reply.Head, MACH_SEND_MSG, sizeof(reply), 0, MACH_PORT_NULL, - MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); - } -} - -MachExceptionHandler::MachExceptionHandler() - : installed_(false), - thread_(), - port_(MACH_PORT_NULL) -{} - -void -MachExceptionHandler::uninstall() -{ - if (installed_) { - thread_port_t thread = mach_thread_self(); - kern_return_t kret = thread_set_exception_ports(thread, - EXC_MASK_BAD_ACCESS, - MACH_PORT_NULL, - EXCEPTION_DEFAULT | MACH_EXCEPTION_CODES, - THREAD_STATE_NONE); - mach_port_deallocate(mach_task_self(), thread); - if (kret != KERN_SUCCESS) - MOZ_CRASH(); - installed_ = false; - } - if (thread_.joinable()) { - // Break the handler thread out of the mach_msg loop. - mach_msg_header_t msg; - msg.msgh_bits = MACH_MSGH_BITS(MACH_MSG_TYPE_COPY_SEND, 0); - msg.msgh_size = sizeof(msg); - msg.msgh_remote_port = port_; - msg.msgh_local_port = MACH_PORT_NULL; - msg.msgh_reserved = 0; - msg.msgh_id = sQuitId; - kern_return_t kret = mach_msg(&msg, MACH_SEND_MSG, sizeof(msg), 0, MACH_PORT_NULL, - MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); - if (kret != KERN_SUCCESS) { - fprintf(stderr, "MachExceptionHandler: failed to send quit message: %d\n", (int)kret); - MOZ_CRASH(); - } - - // Wait for the handler thread to complete before deallocating the port. - thread_.join(); - } - if (port_ != MACH_PORT_NULL) { - DebugOnly kret = mach_port_destroy(mach_task_self(), port_); - MOZ_ASSERT(kret == KERN_SUCCESS); - port_ = MACH_PORT_NULL; - } -} - -bool -MachExceptionHandler::install(JSRuntime* rt) -{ - MOZ_ASSERT(!installed()); - kern_return_t kret; - mach_port_t thread; - - // Get a port which can send and receive data. - kret = mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &port_); - if (kret != KERN_SUCCESS) - goto error; - kret = mach_port_insert_right(mach_task_self(), port_, port_, MACH_MSG_TYPE_MAKE_SEND); - if (kret != KERN_SUCCESS) - goto error; - - // Create a thread to block on reading port_. - if (!thread_.init(MachExceptionHandlerThread, rt)) - goto error; - - // Direct exceptions on this thread to port_ (and thus our handler thread). - // Note: we are totally clobbering any existing *thread* exception ports and - // not even attempting to forward. Breakpad and gdb both use the *process* - // exception ports which are only called if the thread doesn't handle the - // exception, so we should be fine. - thread = mach_thread_self(); - kret = thread_set_exception_ports(thread, - EXC_MASK_BAD_ACCESS, - port_, - EXCEPTION_DEFAULT | MACH_EXCEPTION_CODES, - THREAD_STATE_NONE); - mach_port_deallocate(mach_task_self(), thread); - if (kret != KERN_SUCCESS) - goto error; - - installed_ = true; - return true; - - error: - uninstall(); - return false; -} - -#else // If not Windows or Mac, assume Unix +#else // If not Windows, assume Unix-like enum class Signal { SegFault, @@ -1246,7 +896,7 @@ WasmFaultHandler(int signum, siginfo_t* info, void* context) else previousSignal->sa_handler(signum); } -# endif // XP_WIN || XP_DARWIN || assume unix +# endif // XP_WIN || assume Unix-like static void RedirectIonBackedgesToInterruptCheck(JSRuntime* rt) @@ -1374,9 +1024,6 @@ ProcessHasSignalHandlers() # if defined(XP_WIN) if (!AddVectoredExceptionHandler(/* FirstHandler = */ true, WasmFaultHandler)) return false; -# elif defined(XP_DARWIN) - // OSX handles seg faults via the Mach exception handler above, so don't - // install WasmFaultHandler. # else // SA_NODEFER allows us to reenter the signal handler if we crash while // handling the signal, and fall through to the Breakpad handler by testing @@ -1412,12 +1059,6 @@ wasm::EnsureSignalHandlers(JSRuntime* rt) if (!ProcessHasSignalHandlers()) return true; -#if defined(XP_DARWIN) - // On OSX, each JSRuntime gets its own handler thread. - if (!rt->wasmMachExceptionHandler.installed() && !rt->wasmMachExceptionHandler.install(rt)) - return false; -#endif - return true; } diff --git a/js/src/wasm/WasmSignalHandlers.h b/js/src/wasm/WasmSignalHandlers.h index 87faa15025..7fe3dd86e6 100644 --- a/js/src/wasm/WasmSignalHandlers.h +++ b/js/src/wasm/WasmSignalHandlers.h @@ -1,6 +1,7 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * Copyright 2014 Mozilla Foundation + * Copyright 2021 Moonchild Productions * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,10 +20,6 @@ #define wasm_signal_handlers_h #include "mozilla/Attributes.h" - -#if defined(XP_DARWIN) -# include -#endif #include "threading/Thread.h" struct JSRuntime; @@ -46,30 +43,6 @@ EnsureSignalHandlers(JSRuntime* rt); bool HaveSignalHandlers(); -#if defined(XP_DARWIN) -// On OSX we are forced to use the lower-level Mach exception mechanism instead -// of Unix signals. Mach exceptions are not handled on the victim's stack but -// rather require an extra thread. For simplicity, we create one such thread -// per JSRuntime (upon the first use of asm.js in the JSRuntime). This thread -// and related resources are owned by AsmJSMachExceptionHandler which is owned -// by JSRuntime. -class MachExceptionHandler -{ - bool installed_; - js::Thread thread_; - mach_port_t port_; - - void uninstall(); - - public: - MachExceptionHandler(); - ~MachExceptionHandler() { uninstall(); } - mach_port_t port() const { return port_; } - bool installed() const { return installed_; } - bool install(JSRuntime* rt); -}; -#endif - // Test whether the given PC is within the innermost wasm activation. Return // false if it is not, or it cannot be determined. bool IsPCInWasmCode(void *pc); diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index 9a0410d737..25a5e58108 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -// vim:cindent:ts=2:et:sw=2: /* 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/. */ @@ -56,9 +55,6 @@ #include "nsXBLBinding.h" #include "nsContentUtils.h" #include "nsIScriptError.h" -#ifdef XP_MACOSX -#include "nsIDocShell.h" -#endif #include "ChildIterator.h" #include "nsError.h" #include "nsLayoutUtils.h" @@ -4334,11 +4330,7 @@ nsCSSFrameConstructor::FindXULTagData(Element* aElement, SIMPLE_XUL_CREATE(menu, NS_NewMenuFrame), SIMPLE_XUL_CREATE(menubutton, NS_NewMenuFrame), SIMPLE_XUL_CREATE(menuitem, NS_NewMenuItemFrame), -#ifdef XP_MACOSX - SIMPLE_TAG_CHAIN(menubar, nsCSSFrameConstructor::FindXULMenubarData), -#else SIMPLE_XUL_CREATE(menubar, NS_NewMenuBarFrame), -#endif /* XP_MACOSX */ SIMPLE_TAG_CHAIN(popupgroup, nsCSSFrameConstructor::FindPopupGroupData), SIMPLE_XUL_CREATE(iframe, NS_NewSubDocumentFrame), SIMPLE_XUL_CREATE(editor, NS_NewSubDocumentFrame), @@ -4413,31 +4405,6 @@ nsCSSFrameConstructor::FindXULDescriptionData(Element* aElement, return &sDescriptionData; } -#ifdef XP_MACOSX -/* static */ -const nsCSSFrameConstructor::FrameConstructionData* -nsCSSFrameConstructor::FindXULMenubarData(Element* aElement, - nsStyleContext* aStyleContext) -{ - nsCOMPtr treeItem = - aStyleContext->PresContext()->GetDocShell(); - if (treeItem && nsIDocShellTreeItem::typeChrome == treeItem->ItemType()) { - nsCOMPtr parent; - treeItem->GetParent(getter_AddRefs(parent)); - if (!parent) { - // This is the root. Suppress the menubar, since on Mac - // window menus are not attached to the window. - static const FrameConstructionData sSuppressData = SUPPRESS_FCDATA(); - return &sSuppressData; - } - } - - static const FrameConstructionData sMenubarData = - SIMPLE_XUL_FCDATA(NS_NewMenuBarFrame); - return &sMenubarData; -} -#endif /* XP_MACOSX */ - /* static */ const nsCSSFrameConstructor::FrameConstructionData* nsCSSFrameConstructor::FindXULListBoxBodyData(Element* aElement, diff --git a/layout/base/nsCSSFrameConstructor.h b/layout/base/nsCSSFrameConstructor.h index abdfbf7ce0..1df38b58a8 100644 --- a/layout/base/nsCSSFrameConstructor.h +++ b/layout/base/nsCSSFrameConstructor.h @@ -1471,10 +1471,6 @@ private: FindXULLabelData(Element* aElement, nsStyleContext* aStyleContext); static const FrameConstructionData* FindXULDescriptionData(Element* aElement, nsStyleContext* aStyleContext); -#ifdef XP_MACOSX - static const FrameConstructionData* - FindXULMenubarData(Element* aElement, nsStyleContext* aStyleContext); -#endif /* XP_MACOSX */ static const FrameConstructionData* FindXULListBoxBodyData(Element* aElement, nsStyleContext* aStyleContext); static const FrameConstructionData* diff --git a/layout/base/nsPresContext.cpp b/layout/base/nsPresContext.cpp index f7be42b5ff..8f3de7f78d 100644 --- a/layout/base/nsPresContext.cpp +++ b/layout/base/nsPresContext.cpp @@ -2895,15 +2895,9 @@ nsRootPresContext::ComputePluginGeometryUpdates(nsIFrame* aFrame, aList->ComputeVisibilityForRoot(aBuilder, ®ion); } -#ifdef XP_MACOSX - // We control painting of Mac plugins, so just apply geometry updates now. - // This is not happening during a paint event. - ApplyPluginGeometryUpdates(); -#else if (XRE_IsParentProcess()) { InitApplyPluginGeometryTimer(); } -#endif } static void @@ -2939,8 +2933,6 @@ nsRootPresContext::CancelApplyPluginGeometryTimer() } } -#ifndef XP_MACOSX - static bool HasOverlap(const LayoutDeviceIntPoint& aOffset1, const nsTArray& aClipRects1, @@ -3025,8 +3017,6 @@ PluginGetGeometryUpdate(nsTHashtable>& aPlugins, } } -#endif // #ifndef XP_MACOSX - static void PluginDidSetGeometry(nsTHashtable>& aPlugins) { @@ -3043,7 +3033,6 @@ PluginDidSetGeometry(nsTHashtable>& aPlugins) void nsRootPresContext::ApplyPluginGeometryUpdates() { -#ifndef XP_MACOSX CancelApplyPluginGeometryTimer(); nsTArray configurations; @@ -3055,7 +3044,6 @@ nsRootPresContext::ApplyPluginGeometryUpdates() SortConfigurations(&configurations); widget->ConfigureChildren(configurations); } -#endif // #ifndef XP_MACOSX PluginDidSetGeometry(mRegisteredPlugins); } @@ -3063,7 +3051,6 @@ nsRootPresContext::ApplyPluginGeometryUpdates() void nsRootPresContext::CollectPluginGeometryUpdates(LayerManager* aLayerManager) { -#ifndef XP_MACOSX // Collect and pass plugin widget configurations down to the compositor // for transmission to the chrome process. NS_ASSERTION(aLayerManager, "layer manager is invalid!"); @@ -3086,7 +3073,6 @@ nsRootPresContext::CollectPluginGeometryUpdates(LayerManager* aLayerManager) clm->StorePluginWidgetConfigurations(configurations); } PluginDidSetGeometry(mRegisteredPlugins); -#endif // #ifndef XP_MACOSX } static void diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index 87435f8cfa..37475d9595 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -8736,9 +8736,7 @@ PresShell::WillPaintWindow() return; } -#ifndef XP_MACOSX rootPresContext->ApplyPluginGeometryUpdates(); -#endif } void diff --git a/layout/forms/nsListControlFrame.cpp b/layout/forms/nsListControlFrame.cpp index 4daa470a9e..12fc4a2dde 100644 --- a/layout/forms/nsListControlFrame.cpp +++ b/layout/forms/nsListControlFrame.cpp @@ -842,11 +842,7 @@ nsListControlFrame::HandleListSelection(nsIDOMEvent* aEvent, nsCOMPtr mouseEvent = do_QueryInterface(aEvent); bool isShift; bool isControl; -#ifdef XP_MACOSX - mouseEvent->GetMetaKey(&isControl); -#else mouseEvent->GetCtrlKey(&isControl); -#endif mouseEvent->GetShiftKey(&isShift); return PerformSelection(aClickedIndex, isShift, isControl); // might destroy us } @@ -1930,11 +1926,7 @@ nsListControlFrame::DragMove(nsIDOMEvent* aMouseEvent) nsCOMPtr mouseEvent = do_QueryInterface(aMouseEvent); NS_ASSERTION(mouseEvent, "aMouseEvent is not an nsIDOMMouseEvent!"); bool isControl; -#ifdef XP_MACOSX - mouseEvent->GetMetaKey(&isControl); -#else mouseEvent->GetCtrlKey(&isControl); -#endif nsWeakFrame weakFrame(this); // Turn SHIFT on when you are dragging, unless control is on. bool wasChanged = PerformSelection(selectedIndex, @@ -2142,14 +2134,8 @@ nsListControlFrame::KeyDown(nsIDOMEvent* aKeyEvent) bool dropDownMenuOnUpDown; bool dropDownMenuOnSpace; -#ifdef XP_MACOSX - dropDownMenuOnUpDown = IsInDropDownMode() && !mComboboxFrame->IsDroppedDown(); - dropDownMenuOnSpace = !keyEvent->IsAlt() && !keyEvent->IsControl() && - !keyEvent->IsMeta(); -#else dropDownMenuOnUpDown = keyEvent->IsAlt(); dropDownMenuOnSpace = IsInDropDownMode() && !mComboboxFrame->IsDroppedDown(); -#endif bool withinIncrementalSearchTime = keyEvent->mTime - gLastKeyTime <= INCREMENTAL_SEARCH_KEYPRESS_TIME; if ((dropDownMenuOnUpDown && diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index 5d05b71037..b8e66ecbcd 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -// vim:cindent:ts=2:et:sw=2: /* 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/. */ @@ -3056,11 +3055,7 @@ nsFrame::GetDataForTableSelection(const nsFrameSelection* aFrameSelection, { // In Browser, special 'table selection' key must be pressed for table selection // or when just Shift is pressed and we're already in table/cell selection mode -#ifdef XP_MACOSX - doTableSelection = aMouseEvent->IsMeta() || (aMouseEvent->IsShift() && selectingTableCells); -#else doTableSelection = aMouseEvent->IsControl() || (aMouseEvent->IsShift() && selectingTableCells); -#endif } if (!doTableSelection) return NS_OK; @@ -3329,13 +3324,7 @@ nsFrame::HandlePress(nsPresContext* aPresContext, if (!frameselection || frameselection->GetDisplaySelection() == nsISelectionController::SELECTION_OFF) return NS_OK;//nothing to do we cannot affect selection from here -#ifdef XP_MACOSX - if (mouseEvent->IsControl()) - return NS_OK;//short circuit. hard coded for mac due to time restraints. - bool control = mouseEvent->IsMeta(); -#else bool control = mouseEvent->IsControl(); -#endif RefPtr fc = const_cast(frameselection); if (mouseEvent->mClickCount > 1) { diff --git a/layout/generic/nsPluginFrame.cpp b/layout/generic/nsPluginFrame.cpp index eee3f46b8b..ea42d9bd37 100644 --- a/layout/generic/nsPluginFrame.cpp +++ b/layout/generic/nsPluginFrame.cpp @@ -69,11 +69,6 @@ #endif /* MOZ_LOGGING */ #include "mozilla/Logging.h" -#ifdef XP_MACOSX -#include "gfxQuartzNativeDrawing.h" -#include "mozilla/gfx/QuartzSupport.h" -#endif - #ifdef MOZ_X11 #include "mozilla/X11Util.h" using mozilla::DefaultXDisplay; @@ -318,15 +313,6 @@ nsPluginFrame::PrepForDrawing(nsIWidget *aWidget) mInnerView->AttachWidgetEventHandler(mWidget); -#ifdef XP_MACOSX - // On Mac, we need to invalidate ourselves since even windowed - // plugins are painted through Thebes and we need to ensure - // the PaintedLayer containing the plugin is updated. - if (parentWidget == GetNearestWidget()) { - InvalidateFrame(); - } -#endif - RegisterPluginForGeometryUpdates(); // Here we set the background color for this widget because some plugins will use @@ -565,27 +551,12 @@ nsPluginFrame::FixupWindow(const nsSize& aSize) nsIntPoint origin = GetWindowOriginInPixels(windowless); // window must be in "display pixels" -#if defined(XP_MACOSX) - // window must be in "display pixels" - double scaleFactor = 1.0; - if (NS_FAILED(mInstanceOwner->GetContentsScaleFactor(&scaleFactor))) { - scaleFactor = 1.0; - } - int intScaleFactor = ceil(scaleFactor); - window->x = origin.x / intScaleFactor; - window->y = origin.y / intScaleFactor; - window->width = presContext->AppUnitsToDevPixels(aSize.width) / intScaleFactor; - window->height = presContext->AppUnitsToDevPixels(aSize.height) / intScaleFactor; -#else window->x = origin.x; window->y = origin.y; window->width = presContext->AppUnitsToDevPixels(aSize.width); window->height = presContext->AppUnitsToDevPixels(aSize.height); -#endif -#ifndef XP_MACOSX mInstanceOwner->UpdateWindowPositionAndClipRect(false); -#endif NotifyPluginReflowObservers(); } @@ -616,13 +587,6 @@ nsPluginFrame::CallSetWindow(bool aCheckIsHidden) RefPtr instanceOwnerRef(mInstanceOwner); // refresh the plugin port as well -#ifdef XP_MACOSX - mInstanceOwner->FixUpPluginWindow(nsPluginInstanceOwner::ePluginPaintEnable); - // Bail now if our frame has been destroyed. - if (!instanceOwnerRef->GetFrame()) { - return NS_ERROR_FAILURE; - } -#endif window->window = mInstanceOwner->GetPluginPort(); // Adjust plugin dimensions according to pixel snap results @@ -642,24 +606,11 @@ nsPluginFrame::CallSetWindow(bool aCheckIsHidden) intBounds.x += intOffset.x; intBounds.y += intOffset.y; -#if defined(XP_MACOSX) - // window must be in "display pixels" - double scaleFactor = 1.0; - if (NS_FAILED(instanceOwnerRef->GetContentsScaleFactor(&scaleFactor))) { - scaleFactor = 1.0; - } - - size_t intScaleFactor = ceil(scaleFactor); - window->x = intBounds.x / intScaleFactor; - window->y = intBounds.y / intScaleFactor; - window->width = intBounds.width / intScaleFactor; - window->height = intBounds.height / intScaleFactor; -#else window->x = intBounds.x; window->y = intBounds.y; window->width = intBounds.width; window->height = intBounds.height; -#endif + // BE CAREFUL: By the time we get here the PluginFrame is sometimes destroyed // and poisoned. If we reference local fields (implicit this deref), // we will crash. @@ -1061,11 +1012,6 @@ nsPluginFrame::NotifyPluginReflowObservers() void nsPluginFrame::DidSetWidgetGeometry() { -#if defined(XP_MACOSX) - if (mInstanceOwner && !IsHidden()) { - mInstanceOwner->FixUpPluginWindow(nsPluginInstanceOwner::ePluginPaintEnable); - } -#else if (!mWidget && mInstanceOwner) { // UpdateWindowVisibility will notify the plugin of position changes // by updating the NPWindow and calling NPP_SetWindow/AsyncSetWindow. @@ -1076,29 +1022,20 @@ nsPluginFrame::DidSetWidgetGeometry() nsLayoutUtils::IsPopup(nsLayoutUtils::GetDisplayRootFrame(this)) || !mNextConfigurationBounds.IsEmpty()); } -#endif } bool nsPluginFrame::IsOpaque() const { -#if defined(XP_MACOSX) - return false; -#else - if (mInstanceOwner && mInstanceOwner->UseAsyncRendering()) { return false; } return !IsTransparentMode(); -#endif } bool nsPluginFrame::IsTransparentMode() const { -#if defined(XP_MACOSX) - return false; -#else if (!mInstanceOwner) return false; @@ -1120,7 +1057,6 @@ nsPluginFrame::IsTransparentMode() const bool transparent = false; pi->IsTransparent(&transparent); return transparent; -#endif } void @@ -1141,27 +1077,20 @@ nsPluginFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, DO_GLOBAL_REFLOW_COUNT_DSP("nsPluginFrame"); -#ifndef XP_MACOSX if (mWidget && aBuilder->IsInTransform()) { // Windowed plugins should not be rendered inside a transform. return; } -#endif if (aBuilder->IsForPainting() && mInstanceOwner) { // Update plugin frame for both content scaling and full zoom changes. mInstanceOwner->ResolutionMayHaveChanged(); -#ifdef XP_MACOSX - mInstanceOwner->WindowFocusMayHaveChanged(); -#endif if (mInstanceOwner->UseAsyncRendering()) { NPWindow* window = nullptr; mInstanceOwner->GetWindow(window); bool isVisible = window && window->width > 0 && window->height > 0; if (isVisible && aBuilder->ShouldSyncDecodeImages()) { -#ifndef XP_MACOSX mInstanceOwner->UpdateWindowVisibility(true); -#endif } mInstanceOwner->NotifyPaintWaiter(aBuilder); @@ -1238,8 +1167,8 @@ nsPluginFrame::PrintPlugin(nsRenderingContext& aRenderingContext, window.clipRect.left = 0; window.clipRect.right = 0; // platform specific printing code -#if defined(XP_UNIX) || defined(XP_MACOSX) - // Doesn't work in a thebes world, or on OS X. +#if defined(XP_UNIX) + // Doesn't work in a thebes world. (void)window; (void)npprint; #elif defined(XP_WIN) @@ -1377,20 +1306,7 @@ nsPluginFrame::BuildLayer(nsDisplayListBuilder* aBuilder, if (window->width <= 0 || window->height <= 0) return nullptr; -#if defined(XP_MACOSX) - // window is in "display pixels", but size needs to be in device pixels - // window must be in "display pixels" - double scaleFactor = 1.0; - if (NS_FAILED(mInstanceOwner->GetContentsScaleFactor(&scaleFactor))) { - scaleFactor = 1.0; - } - - size_t intScaleFactor = ceil(scaleFactor); -#else - size_t intScaleFactor = 1; -#endif - - IntSize size(window->width * intScaleFactor, window->height * intScaleFactor); + IntSize size(window->width, window->height); nsRect area = GetContentRectRelativeToSelf() + aItem->ToReferenceFrame(); gfxRect r = nsLayoutUtils::RectToGfxRect(area, PresContext()->AppUnitsPerDevPixel()); @@ -1420,11 +1336,6 @@ nsPluginFrame::BuildLayer(nsDisplayListBuilder* aBuilder, NS_ASSERTION(layer->GetType() == Layer::TYPE_IMAGE, "Bad layer type"); ImageLayer* imglayer = static_cast(layer.get()); -#ifdef XP_MACOSX - if (!mInstanceOwner->UseAsyncRendering()) { - mInstanceOwner->DoCocoaEventDrawRect(r, nullptr); - } -#endif imglayer->SetScaleToSize(size, ScaleMode::STRETCH); imglayer->SetContainer(container); @@ -1545,37 +1456,11 @@ nsPluginFrame::HandleEvent(nsPresContext* aPresContext, return rv; #endif -#ifdef XP_MACOSX - // we want to process some native mouse events in the cocoa event model - if ((anEvent->mMessage == eMouseEnterIntoWidget || - anEvent->mMessage == eWheel) && - mInstanceOwner->GetEventModel() == NPEventModelCocoa) { - *anEventStatus = mInstanceOwner->ProcessEvent(*anEvent); - // Due to plugin code reentering Gecko, this frame may be dead at this - // point. - return rv; - } - - // These two calls to nsIPresShell::SetCapturingContext() (on mouse-down - // and mouse-up) are needed to make the routing of mouse events while - // dragging conform to standard OS X practice, and to the Cocoa NPAPI spec. - // See bug 525078 and bug 909678. - if (anEvent->mMessage == eMouseDown) { - nsIPresShell::SetCapturingContent(GetContent(), CAPTURE_IGNOREALLOWED); - } -#endif - rv = nsFrame::HandleEvent(aPresContext, anEvent, anEventStatus); // We need to be careful from this point because the call to // nsFrame::HandleEvent() might have killed us. -#ifdef XP_MACOSX - if (anEvent->mMessage == eMouseUp) { - nsIPresShell::SetCapturingContent(nullptr, 0); - } -#endif - return rv; } @@ -1751,11 +1636,7 @@ NS_NewObjectFrame(nsIPresShell* aPresShell, nsStyleContext* aContext) bool nsPluginFrame::IsPaintedByGecko() const { -#ifdef XP_MACOSX - return true; -#else return !mWidget; -#endif } NS_IMPL_FRAMEARENA_HELPERS(nsPluginFrame) diff --git a/layout/generic/nsSelection.cpp b/layout/generic/nsSelection.cpp index ba7f484033..7aca3696b9 100644 --- a/layout/generic/nsSelection.cpp +++ b/layout/generic/nsSelection.cpp @@ -552,10 +552,6 @@ nsFrameSelection::nsFrameSelection() mSelectedCellIndex = 0; nsAutoCopyListener *autoCopy = nullptr; - // On macOS, cache the current selection to send to osx service menu. -#ifdef XP_MACOSX - autoCopy = nsAutoCopyListener::GetInstance(nsIClipboard::kSelectionCache); -#endif // Check to see if the autocopy pref is enabled // and add the autocopy listener if it is @@ -1978,16 +1974,6 @@ nsFrameSelection::RepaintSelection(SelectionType aSelectionType) return NS_ERROR_NULL_POINTER; NS_ENSURE_STATE(mShell); -// On macOS, update the selection cache to the new active selection -// aka the current selection. -#ifdef XP_MACOSX - nsFocusManager* fm = nsFocusManager::GetFocusManager(); - // Check an active window exists otherwise there cannot be a current selection - // and that it's a normal selection. - if (fm->GetActiveWindow() && aSelectionType == SelectionType::eNormal) { - UpdateSelectionCacheOnRepaintSelection(mDomSelections[index]); - } -#endif return mDomSelections[index]->Repaint(mShell->GetPresContext()); } @@ -2711,11 +2697,7 @@ printf("aTarget == %d\n", aTarget); // Any other mouseup actions require that Ctrl or Cmd key is pressed // else stop table selection mode bool doMouseUpAction = false; -#ifdef XP_MACOSX - doMouseUpAction = aMouseEvent->IsMeta(); -#else doMouseUpAction = aMouseEvent->IsControl(); -#endif if (!doMouseUpAction) { #ifdef DEBUG_TABLE_SELECTION diff --git a/layout/printing/nsPrintEngine.cpp b/layout/printing/nsPrintEngine.cpp index d232b669bb..23edeb1fe0 100644 --- a/layout/printing/nsPrintEngine.cpp +++ b/layout/printing/nsPrintEngine.cpp @@ -1004,10 +1004,6 @@ nsPrintEngine::GetCurrentPrintSettings(nsIPrintSettings * *aCurrentPrintSettings nsresult nsPrintEngine::CheckForPrinters(nsIPrintSettings* aPrintSettings) { -#if defined(XP_MACOSX) - // Mac doesn't support retrieving a printer list. - return NS_OK; -#else NS_ENSURE_ARG_POINTER(aPrintSettings); // See if aPrintSettings already has a printer @@ -1027,7 +1023,6 @@ nsPrintEngine::CheckForPrinters(nsIPrintSettings* aPrintSettings) rv = aPrintSettings->SetPrinterName(printerName.get()); } return rv; -#endif } //---------------------------------------------------------------------- diff --git a/layout/style/nsComputedDOMStyle.cpp b/layout/style/nsComputedDOMStyle.cpp index 7ac5fa604e..efa485f613 100644 --- a/layout/style/nsComputedDOMStyle.cpp +++ b/layout/style/nsComputedDOMStyle.cpp @@ -6648,14 +6648,7 @@ nsComputedDOMStyle::DoGetAnimationIterationCount() RefPtr iterationCount = new nsROCSSPrimitiveValue; float f = animation->GetIterationCount(); - /* Need a nasty hack here to work around an optimizer bug in gcc - 4.2 on Mac, which somehow gets confused when directly comparing - a float to the return value of NS_IEEEPositiveInfinity when - building 32-bit builds. */ -#ifdef XP_MACOSX - volatile -#endif - float inf = NS_IEEEPositiveInfinity(); + float inf = NS_IEEEPositiveInfinity(); if (f == inf) { iterationCount->SetIdent(eCSSKeyword_infinite); } else { diff --git a/layout/style/res/forms.css b/layout/style/res/forms.css index db75151d48..281b75d769 100644 --- a/layout/style/res/forms.css +++ b/layout/style/res/forms.css @@ -593,15 +593,11 @@ input[type="checkbox"]:disabled:hover:active { cursor: inherit; } -% On Mac, the native theme takes care of this. -% See nsNativeThemeCocoa::ThemeDrawsFocusForWidget. -%ifndef XP_MACOSX input[type="checkbox"]:-moz-focusring, input[type="radio"]:-moz-focusring { /* Don't specify the outline-color, we should always use initial value. */ outline: 1px dotted; } -%endif input[type="checkbox"]:hover:active, input[type="radio"]:hover:active { @@ -723,12 +719,10 @@ input[type="color"]:-moz-system-metric(color-picker-available):active:hover, input[type="reset"]:active:hover, input[type="button"]:active:hover, input[type="submit"]:active:hover { -%ifndef XP_MACOSX padding-block-start: 0px; padding-inline-end: 5px; padding-block-end: 0px; padding-inline-start: 7px; -%endif border-style: inset; background-color: ButtonFace; } diff --git a/layout/xul/nsButtonBoxFrame.cpp b/layout/xul/nsButtonBoxFrame.cpp index ba0b7fb2ab..3e0529e600 100644 --- a/layout/xul/nsButtonBoxFrame.cpp +++ b/layout/xul/nsButtonBoxFrame.cpp @@ -126,8 +126,6 @@ nsButtonBoxFrame::HandleEvent(nsPresContext* aPresContext, break; } -// On mac, Return fires the default button, not the focused one. -#ifndef XP_MACOSX case eKeyPress: { WidgetKeyboardEvent* keyEvent = aEvent->AsKeyboardEvent(); if (!keyEvent) { @@ -142,7 +140,6 @@ nsButtonBoxFrame::HandleEvent(nsPresContext* aPresContext, } break; } -#endif case eKeyUp: { WidgetKeyboardEvent* keyEvent = aEvent->AsKeyboardEvent(); diff --git a/layout/xul/nsMenuBarListener.cpp b/layout/xul/nsMenuBarListener.cpp index 23df81937a..70955c4301 100644 --- a/layout/xul/nsMenuBarListener.cpp +++ b/layout/xul/nsMenuBarListener.cpp @@ -76,15 +76,9 @@ void nsMenuBarListener::InitAccessKey() if (mAccessKey >= 0) return; - // Compiled-in defaults, in case we can't get LookAndFeel -- - // mac doesn't have menu shortcuts, other platforms use alt. -#ifdef XP_MACOSX - mAccessKey = 0; - mAccessKeyMask = 0; -#else + // Compiled-in defaults, in case we can't get LookAndFeel... mAccessKey = nsIDOMKeyEvent::DOM_VK_ALT; mAccessKeyMask = MODIFIER_ALT; -#endif // Get the menu access key value from prefs, overriding the default: mAccessKey = Preferences::GetInt("ui.key.menuAccessKey", mAccessKey); @@ -254,8 +248,7 @@ nsMenuBarListener::KeyPress(nsIDOMEvent* aKeyEvent) aKeyEvent->PreventDefault(); } } -#ifndef XP_MACOSX - // Also need to handle F10 specially on Non-Mac platform. + // Also need to handle F10 specially. else if (nativeKeyEvent->mMessage == eKeyPress && keyCode == NS_VK_F10) { if ((GetModifiersForAccessKey(keyEvent) & ~MODIFIER_CONTROL) == 0) { // The F10 key just went down by itself or with ctrl pressed. @@ -273,7 +266,6 @@ nsMenuBarListener::KeyPress(nsIDOMEvent* aKeyEvent) } } } -#endif // !XP_MACOSX } return NS_OK; diff --git a/layout/xul/nsMenuFrame.cpp b/layout/xul/nsMenuFrame.cpp index a8e81adb55..087323a875 100644 --- a/layout/xul/nsMenuFrame.cpp +++ b/layout/xul/nsMenuFrame.cpp @@ -404,26 +404,12 @@ nsMenuFrame::HandleEvent(nsPresContext* aPresContext, if (aEvent->mMessage == eKeyPress && !IsDisabled()) { WidgetKeyboardEvent* keyEvent = aEvent->AsKeyboardEvent(); uint32_t keyCode = keyEvent->mKeyCode; -#ifdef XP_MACOSX - // On mac, open menulist on either up/down arrow or space (w/o Cmd pressed) - if (!IsOpen() && ((keyEvent->mCharCode == ' ' && !keyEvent->IsMeta()) || - (keyCode == NS_VK_UP || keyCode == NS_VK_DOWN))) { - - // When pressing space, don't open the menu if performing an incremental search. - if (keyEvent->mCharCode != ' ' || - !nsMenuPopupFrame::IsWithinIncrementalTime(keyEvent->mTime)) { - *aEventStatus = nsEventStatus_eConsumeNoDefault; - OpenMenu(false); - } - } -#else - // On other platforms, toggle menulist on unmodified F4 or Alt arrow + // Toggle menulist on unmodified F4 or Alt arrow if ((keyCode == NS_VK_F4 && !keyEvent->IsAlt()) || ((keyCode == NS_VK_UP || keyCode == NS_VK_DOWN) && keyEvent->IsAlt())) { *aEventStatus = nsEventStatus_eConsumeNoDefault; ToggleMenuState(); } -#endif } else if (aEvent->mMessage == eMouseDown && aEvent->AsMouseEvent()->button == WidgetMouseEvent::eLeftButton && diff --git a/layout/xul/nsMenuPopupFrame.cpp b/layout/xul/nsMenuPopupFrame.cpp index 378d719d44..1d47652dcb 100644 --- a/layout/xul/nsMenuPopupFrame.cpp +++ b/layout/xul/nsMenuPopupFrame.cpp @@ -1502,17 +1502,8 @@ nsMenuPopupFrame::SetPopupPosition(nsIFrame* aAnchorFrame, bool aIsMove, bool aS screenPoint.MoveBy(margin.left + offsetForContextMenu.x, margin.top + offsetForContextMenu.y); -#ifdef XP_MACOSX - // OSX tooltips follow standard flip rule but other popups flip horizontally not vertically - if (mPopupType == ePopupTypeTooltip) { - vFlip = FlipStyle_Outside; - } else { - hFlip = FlipStyle_Outside; - } -#else - // Other OS screen positioned popups can be flipped vertically but never horizontally + // Screen positioned popups can be flipped vertically but never horizontally vFlip = FlipStyle_Outside; -#endif // #ifdef XP_MACOSX } // If a panel is being moved or has flip="none", don't constrain or flip it. But always do this for diff --git a/layout/xul/nsRepeatService.h b/layout/xul/nsRepeatService.h index 81321a4729..c731f8cf59 100644 --- a/layout/xul/nsRepeatService.h +++ b/layout/xul/nsRepeatService.h @@ -14,11 +14,7 @@ #define INITAL_REPEAT_DELAY 250 -#ifdef XP_MACOSX -#define REPEAT_DELAY 25 -#else #define REPEAT_DELAY 50 -#endif class nsITimer; diff --git a/layout/xul/nsSliderFrame.cpp b/layout/xul/nsSliderFrame.cpp index a9e513e2f2..cc933ab37f 100644 --- a/layout/xul/nsSliderFrame.cpp +++ b/layout/xul/nsSliderFrame.cpp @@ -665,11 +665,7 @@ nsSliderFrame::GetScrollToClick() return false; } -#ifdef XP_MACOSX - return true; -#else return false; -#endif } nsIFrame* @@ -1179,8 +1175,8 @@ nsSliderFrame::ShouldScrollToClickForEvent(WidgetGUIEvent* aEvent) return false; } -#if defined(XP_MACOSX) || defined(MOZ_WIDGET_GTK) - // On Mac and Linux, clicking the scrollbar thumb should never scroll to click. +#if defined(MOZ_WIDGET_GTK) + // On Linux, clicking the scrollbar thumb should never scroll to click. if (IsEventOverThumb(aEvent)) { return false; } @@ -1188,11 +1184,7 @@ nsSliderFrame::ShouldScrollToClickForEvent(WidgetGUIEvent* aEvent) WidgetMouseEvent* mouseEvent = aEvent->AsMouseEvent(); if (mouseEvent->button == WidgetMouseEvent::eLeftButton) { -#ifdef XP_MACOSX - bool invertPref = mouseEvent->IsAlt(); -#else bool invertPref = mouseEvent->IsShift(); -#endif return GetScrollToClick() != invertPref; } diff --git a/layout/xul/nsXULPopupManager.cpp b/layout/xul/nsXULPopupManager.cpp index 6e8cc3dda1..5fc533e1b9 100644 --- a/layout/xul/nsXULPopupManager.cpp +++ b/layout/xul/nsXULPopupManager.cpp @@ -712,21 +712,6 @@ nsXULPopupManager::ShowMenu(nsIContent *aMenu, nsAutoString position; -#ifdef XP_MACOSX - nsCOMPtr menulist = do_QueryInterface(aMenu); - bool isNonEditableMenulist = false; - if (menulist) { - bool editable; - menulist->GetEditable(&editable); - isNonEditableMenulist = !editable; - } - - if (isNonEditableMenulist) { - position.AssignLiteral("selection"); - } - else -#endif - if (onMenuBar || !onmenu) position.AssignLiteral("after_start"); else @@ -1814,15 +1799,6 @@ nsXULPopupManager::MayShowPopup(nsMenuPopupFrame* aPopup) return false; } -#ifdef XP_MACOSX - if (rootWin) { - auto globalWin = nsGlobalWindow::Cast(rootWin.get()); - if (globalWin->IsInModalState()) { - return false; - } - } -#endif - // cannot open a popup that is a submenu of a menupopup that isn't open. nsMenuFrame* menuFrame = do_QueryFrame(aPopup->GetParent()); if (menuFrame) { @@ -2328,7 +2304,6 @@ nsXULPopupManager::HandleKeyboardEventWithKeyCode( switch (keyCode) { case nsIDOMKeyEvent::DOM_VK_UP: case nsIDOMKeyEvent::DOM_VK_DOWN: -#ifndef XP_MACOSX // roll up the popup when alt+up/down are pressed within a menulist. bool alt; aKeyEvent->GetAltKey(&alt); @@ -2337,7 +2312,6 @@ nsXULPopupManager::HandleKeyboardEventWithKeyCode( break; } MOZ_FALLTHROUGH; -#endif case nsIDOMKeyEvent::DOM_VK_LEFT: case nsIDOMKeyEvent::DOM_VK_RIGHT: @@ -2366,9 +2340,7 @@ nsXULPopupManager::HandleKeyboardEventWithKeyCode( break; case nsIDOMKeyEvent::DOM_VK_TAB: -#ifndef XP_MACOSX case nsIDOMKeyEvent::DOM_VK_F10: -#endif if (aTopVisibleMenuItem && !aTopVisibleMenuItem->Frame()->GetContent()->AttrValueIs(kNameSpaceID_None, nsGkAtoms::activateontab, nsGkAtoms::_true, eCaseMatters)) { diff --git a/layout/xul/tree/nsTreeBodyFrame.cpp b/layout/xul/tree/nsTreeBodyFrame.cpp index ec054a234e..262884c9a8 100644 --- a/layout/xul/tree/nsTreeBodyFrame.cpp +++ b/layout/xul/tree/nsTreeBodyFrame.cpp @@ -2613,9 +2613,7 @@ nsTreeBodyFrame::HandleEvent(nsPresContext* aPresContext, // Save last values, we will need them. int32_t lastDropRow = mSlots->mDropRow; int16_t lastDropOrient = mSlots->mDropOrient; -#ifndef XP_MACOSX int16_t lastScrollLines = mSlots->mScrollLines; -#endif // Find out the current drag action uint32_t lastDragAction = mSlots->mDragAction; @@ -2633,9 +2631,6 @@ nsTreeBodyFrame::HandleEvent(nsPresContext* aPresContext, mSlots->mDropAllowed = false; InvalidateDropFeedback(lastDropRow, lastDropOrient); } -#ifdef XP_MACOSX - ScrollByLines(mSlots->mScrollLines); -#else if (!lastScrollLines) { // Cancel any previously initialized timer. if (mSlots->mTimer) { @@ -2648,7 +2643,6 @@ nsTreeBodyFrame::HandleEvent(nsPresContext* aPresContext, LazyScrollCallback, nsITimer::TYPE_ONE_SHOT, getter_AddRefs(mSlots->mTimer)); } -#endif // Bail out to prevent spring loaded timer and feedback line settings. return NS_OK; } @@ -2842,53 +2836,6 @@ nsTreeBodyFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, if (!mView || !GetContent ()->GetComposedDoc()->GetWindow()) return; -#ifdef XP_MACOSX - nsIContent* baseElement = GetBaseElement(); - nsIFrame* treeFrame = - baseElement ? baseElement->GetPrimaryFrame() : nullptr; - nsCOMPtr selection; - mView->GetSelection(getter_AddRefs(selection)); - nsITheme* theme = PresContext()->GetTheme(); - // On Mac, we support native theming of selected rows. On 10.10 and higher, - // this means applying vibrancy which require us to register the theme - // geometrics for the row. In order to make the vibrancy effect to work - // properly, we also need the tree to be themed as a source list. - if (selection && treeFrame && theme && - treeFrame->StyleDisplay()->mAppearance == NS_THEME_MAC_SOURCE_LIST) { - // Loop through our onscreen rows. If the row is selected and a - // -moz-appearance is provided, RegisterThemeGeometry might be necessary. - const auto end = std::min(mRowCount, LastVisibleRow() + 1); - for (auto i = FirstVisibleRow(); i < end; i++) { - bool isSelected; - selection->IsSelected(i, &isSelected); - if (isSelected) { - PrefillPropertyArray(i, nullptr); - nsAutoString properties; - mView->GetRowProperties(i, properties); - nsTreeUtils::TokenizeProperties(properties, mScratchArray); - nsStyleContext* rowContext = - GetPseudoStyleContext(nsCSSAnonBoxes::moztreerow); - auto appearance = rowContext->StyleDisplay()->mAppearance; - if (appearance) { - if (theme->ThemeSupportsWidget(PresContext(), this, appearance)) { - nsITheme::ThemeGeometryType type = - theme->ThemeGeometryTypeForWidget(this, appearance); - if (type != nsITheme::eThemeGeometryTypeUnknown) { - nsRect rowRect(mInnerBox.x, mInnerBox.y + mRowHeight * - (i - FirstVisibleRow()), mInnerBox.width, - mRowHeight); - aBuilder->RegisterThemeGeometry(type, - LayoutDeviceIntRect::FromUnknownRect( - (rowRect + aBuilder->ToReferenceFrame(this)).ToNearestPixels( - PresContext()->AppUnitsPerDevPixel()))); - } - } - } - } - } - } -#endif - aLists.Content()->AppendNewToTop(new (aBuilder) nsDisplayTreeBody(aBuilder, this)); } diff --git a/media/ffvpx/config.h b/media/ffvpx/config.h index dab01e05cd..f43da8f284 100644 --- a/media/ffvpx/config.h +++ b/media/ffvpx/config.h @@ -26,12 +26,6 @@ #undef HAVE_LIBC_MSVCRT #define HAVE_LIBC_MSVCRT 0 #endif -#elif defined(XP_DARWIN) -#if defined(HAVE_64BIT_BUILD) -#include "config_darwin64.h" -#else -#include "config_darwin32.h" -#endif #elif defined(XP_UNIX) #if defined(HAVE_64BIT_BUILD) #include "config_unix64.h" diff --git a/media/ffvpx/config_darwin64.asm b/media/ffvpx/config_darwin64.asm deleted file mode 100644 index 8145d9fe54..0000000000 --- a/media/ffvpx/config_darwin64.asm +++ /dev/null @@ -1,2339 +0,0 @@ -%define ARCH_AARCH64 0 -%define ARCH_ALPHA 0 -%define ARCH_ARM 0 -%define ARCH_AVR32 0 -%define ARCH_AVR32_AP 0 -%define ARCH_AVR32_UC 0 -%define ARCH_BFIN 0 -%define ARCH_IA64 0 -%define ARCH_M68K 0 -%define ARCH_MIPS 0 -%define ARCH_MIPS64 0 -%define ARCH_PARISC 0 -%define ARCH_PPC 0 -%define ARCH_PPC64 0 -%define ARCH_S390 0 -%define ARCH_SH4 0 -%define ARCH_SPARC 0 -%define ARCH_SPARC64 0 -%define ARCH_TILEGX 0 -%define ARCH_TILEPRO 0 -%define ARCH_TOMI 0 -%define ARCH_X86 1 -%define ARCH_X86_32 0 -%define ARCH_X86_64 1 -%define HAVE_ARMV5TE 0 -%define HAVE_ARMV6 0 -%define HAVE_ARMV6T2 0 -%define HAVE_ARMV8 0 -%define HAVE_NEON 0 -%define HAVE_VFP 0 -%define HAVE_VFPV3 0 -%define HAVE_SETEND 0 -%define HAVE_ALTIVEC 0 -%define HAVE_DCBZL 0 -%define HAVE_LDBRX 0 -%define HAVE_POWER8 0 -%define HAVE_PPC4XX 0 -%define HAVE_VSX 0 -%define HAVE_AESNI 1 -%define HAVE_AMD3DNOW 1 -%define HAVE_AMD3DNOWEXT 1 -%define HAVE_AVX 1 -%define HAVE_AVX2 1 -%define HAVE_FMA3 1 -%define HAVE_FMA4 1 -%define HAVE_MMX 1 -%define HAVE_MMXEXT 1 -%define HAVE_SSE 1 -%define HAVE_SSE2 1 -%define HAVE_SSE3 1 -%define HAVE_SSE4 1 -%define HAVE_SSE42 1 -%define HAVE_SSSE3 1 -%define HAVE_XOP 1 -%define HAVE_CPUNOP 1 -%define HAVE_I686 1 -%define HAVE_MIPSFPU 0 -%define HAVE_MIPS32R2 0 -%define HAVE_MIPS32R5 0 -%define HAVE_MIPS64R2 0 -%define HAVE_MIPS32R6 0 -%define HAVE_MIPS64R6 0 -%define HAVE_MIPSDSP 0 -%define HAVE_MIPSDSPR2 0 -%define HAVE_MSA 0 -%define HAVE_LOONGSON2 0 -%define HAVE_LOONGSON3 0 -%define HAVE_MMI 0 -%define HAVE_ARMV5TE_EXTERNAL 0 -%define HAVE_ARMV6_EXTERNAL 0 -%define HAVE_ARMV6T2_EXTERNAL 0 -%define HAVE_ARMV8_EXTERNAL 0 -%define HAVE_NEON_EXTERNAL 0 -%define HAVE_VFP_EXTERNAL 0 -%define HAVE_VFPV3_EXTERNAL 0 -%define HAVE_SETEND_EXTERNAL 0 -%define HAVE_ALTIVEC_EXTERNAL 0 -%define HAVE_DCBZL_EXTERNAL 0 -%define HAVE_LDBRX_EXTERNAL 0 -%define HAVE_POWER8_EXTERNAL 0 -%define HAVE_PPC4XX_EXTERNAL 0 -%define HAVE_VSX_EXTERNAL 0 -%define HAVE_AESNI_EXTERNAL 1 -%define HAVE_AMD3DNOW_EXTERNAL 1 -%define HAVE_AMD3DNOWEXT_EXTERNAL 1 -%define HAVE_AVX_EXTERNAL 1 -%define HAVE_AVX2_EXTERNAL 1 -%define HAVE_FMA3_EXTERNAL 1 -%define HAVE_FMA4_EXTERNAL 1 -%define HAVE_MMX_EXTERNAL 1 -%define HAVE_MMXEXT_EXTERNAL 1 -%define HAVE_SSE_EXTERNAL 1 -%define HAVE_SSE2_EXTERNAL 1 -%define HAVE_SSE3_EXTERNAL 1 -%define HAVE_SSE4_EXTERNAL 1 -%define HAVE_SSE42_EXTERNAL 1 -%define HAVE_SSSE3_EXTERNAL 1 -%define HAVE_XOP_EXTERNAL 1 -%define HAVE_CPUNOP_EXTERNAL 0 -%define HAVE_I686_EXTERNAL 0 -%define HAVE_MIPSFPU_EXTERNAL 0 -%define HAVE_MIPS32R2_EXTERNAL 0 -%define HAVE_MIPS32R5_EXTERNAL 0 -%define HAVE_MIPS64R2_EXTERNAL 0 -%define HAVE_MIPS32R6_EXTERNAL 0 -%define HAVE_MIPS64R6_EXTERNAL 0 -%define HAVE_MIPSDSP_EXTERNAL 0 -%define HAVE_MIPSDSPR2_EXTERNAL 0 -%define HAVE_MSA_EXTERNAL 0 -%define HAVE_LOONGSON2_EXTERNAL 0 -%define HAVE_LOONGSON3_EXTERNAL 0 -%define HAVE_MMI_EXTERNAL 0 -%define HAVE_ARMV5TE_INLINE 0 -%define HAVE_ARMV6_INLINE 0 -%define HAVE_ARMV6T2_INLINE 0 -%define HAVE_ARMV8_INLINE 0 -%define HAVE_NEON_INLINE 0 -%define HAVE_VFP_INLINE 0 -%define HAVE_VFPV3_INLINE 0 -%define HAVE_SETEND_INLINE 0 -%define HAVE_ALTIVEC_INLINE 0 -%define HAVE_DCBZL_INLINE 0 -%define HAVE_LDBRX_INLINE 0 -%define HAVE_POWER8_INLINE 0 -%define HAVE_PPC4XX_INLINE 0 -%define HAVE_VSX_INLINE 0 -%define HAVE_AESNI_INLINE 1 -%define HAVE_AMD3DNOW_INLINE 1 -%define HAVE_AMD3DNOWEXT_INLINE 1 -%define HAVE_AVX_INLINE 1 -%define HAVE_AVX2_INLINE 1 -%define HAVE_FMA3_INLINE 1 -%define HAVE_FMA4_INLINE 1 -%define HAVE_MMX_INLINE 1 -%define HAVE_MMXEXT_INLINE 1 -%define HAVE_SSE_INLINE 1 -%define HAVE_SSE2_INLINE 1 -%define HAVE_SSE3_INLINE 1 -%define HAVE_SSE4_INLINE 1 -%define HAVE_SSE42_INLINE 1 -%define HAVE_SSSE3_INLINE 1 -%define HAVE_XOP_INLINE 1 -%define HAVE_CPUNOP_INLINE 0 -%define HAVE_I686_INLINE 0 -%define HAVE_MIPSFPU_INLINE 0 -%define HAVE_MIPS32R2_INLINE 0 -%define HAVE_MIPS32R5_INLINE 0 -%define HAVE_MIPS64R2_INLINE 0 -%define HAVE_MIPS32R6_INLINE 0 -%define HAVE_MIPS64R6_INLINE 0 -%define HAVE_MIPSDSP_INLINE 0 -%define HAVE_MIPSDSPR2_INLINE 0 -%define HAVE_MSA_INLINE 0 -%define HAVE_LOONGSON2_INLINE 0 -%define HAVE_LOONGSON3_INLINE 0 -%define HAVE_MMI_INLINE 0 -%define HAVE_ALIGNED_STACK 1 -%define HAVE_FAST_64BIT 1 -%define HAVE_FAST_CLZ 1 -%define HAVE_FAST_CMOV 1 -%define HAVE_LOCAL_ALIGNED_8 1 -%define HAVE_LOCAL_ALIGNED_16 1 -%define HAVE_LOCAL_ALIGNED_32 1 -%define HAVE_SIMD_ALIGN_16 1 -%define HAVE_SIMD_ALIGN_32 1 -%define HAVE_ATOMICS_GCC 1 -%define HAVE_ATOMICS_SUNCC 0 -%define HAVE_ATOMICS_WIN32 0 -%define HAVE_ATOMIC_CAS_PTR 0 -%define HAVE_MACHINE_RW_BARRIER 0 -%define HAVE_MEMORYBARRIER 0 -%define HAVE_MM_EMPTY 1 -%define HAVE_RDTSC 0 -%define HAVE_SARESTART 1 -%define HAVE_SEM_TIMEDWAIT 0 -%define HAVE_SYNC_VAL_COMPARE_AND_SWAP 1 -%define HAVE_CABS 1 -%define HAVE_CEXP 1 -%define HAVE_INLINE_ASM 1 -%define HAVE_SYMVER 1 -%define HAVE_X86ASM 1 -%define HAVE_BIGENDIAN 0 -%define HAVE_FAST_UNALIGNED 1 -%define HAVE_ALTIVEC_H 0 -%define HAVE_ARPA_INET_H 1 -%define HAVE_ASM_TYPES_H 0 -%define HAVE_CDIO_PARANOIA_H 0 -%define HAVE_CDIO_PARANOIA_PARANOIA_H 0 -%define HAVE_CUDA_H 0 -%define HAVE_D3D11_H 0 -%define HAVE_DISPATCH_DISPATCH_H 1 -%define HAVE_DEV_BKTR_IOCTL_BT848_H 0 -%define HAVE_DEV_BKTR_IOCTL_METEOR_H 0 -%define HAVE_DEV_IC_BT8XX_H 0 -%define HAVE_DEV_VIDEO_BKTR_IOCTL_BT848_H 0 -%define HAVE_DEV_VIDEO_METEOR_IOCTL_METEOR_H 0 -%define HAVE_DIRECT_H 0 -%define HAVE_DIRENT_H 1 -%define HAVE_DLFCN_H 1 -%define HAVE_DXGIDEBUG_H 0 -%define HAVE_DXVA_H 0 -%define HAVE_ES2_GL_H 0 -%define HAVE_GSM_H 0 -%define HAVE_IO_H 0 -%define HAVE_MACH_MACH_TIME_H 1 -%define HAVE_MACHINE_IOCTL_BT848_H 0 -%define HAVE_MACHINE_IOCTL_METEOR_H 0 -%define HAVE_MALLOC_H 1 -%define HAVE_OPENCV2_CORE_CORE_C_H 0 -%define HAVE_OPENJPEG_2_3_OPENJPEG_H 0 -%define HAVE_OPENJPEG_2_2_OPENJPEG_H 0 -%define HAVE_OPENJPEG_2_1_OPENJPEG_H 0 -%define HAVE_OPENJPEG_2_0_OPENJPEG_H 0 -%define HAVE_OPENJPEG_1_5_OPENJPEG_H 0 -%define HAVE_OPENGL_GL3_H 0 -%define HAVE_POLL_H 1 -%define HAVE_SOUNDCARD_H 0 -%define HAVE_STDATOMIC_H 1 -%define HAVE_SYS_MMAN_H 1 -%define HAVE_SYS_PARAM_H 1 -%define HAVE_SYS_RESOURCE_H 1 -%define HAVE_SYS_SELECT_H 1 -%define HAVE_SYS_SOUNDCARD_H 0 -%define HAVE_SYS_TIME_H 1 -%define HAVE_SYS_UN_H 1 -%define HAVE_SYS_VIDEOIO_H 0 -%define HAVE_TERMIOS_H 1 -%define HAVE_UDPLITE_H 0 -%define HAVE_UNISTD_H 1 -%define HAVE_VALGRIND_VALGRIND_H 0 -%define HAVE_WINDOWS_H 0 -%define HAVE_WINSOCK2_H 0 -%define HAVE_INTRINSICS_NEON 0 -%define HAVE_ATANF 1 -%define HAVE_ATAN2F 1 -%define HAVE_CBRT 1 -%define HAVE_CBRTF 1 -%define HAVE_COPYSIGN 1 -%define HAVE_COSF 1 -%define HAVE_ERF 1 -%define HAVE_EXP2 1 -%define HAVE_EXP2F 1 -%define HAVE_EXPF 1 -%define HAVE_HYPOT 1 -%define HAVE_ISFINITE 1 -%define HAVE_ISINF 1 -%define HAVE_ISNAN 1 -%define HAVE_LDEXPF 1 -%define HAVE_LLRINT 1 -%define HAVE_LLRINTF 1 -%define HAVE_LOG2 1 -%define HAVE_LOG2F 1 -%define HAVE_LOG10F 1 -%define HAVE_LRINT 1 -%define HAVE_LRINTF 1 -%define HAVE_POWF 1 -%define HAVE_RINT 1 -%define HAVE_ROUND 1 -%define HAVE_ROUNDF 1 -%define HAVE_SINF 1 -%define HAVE_TRUNC 1 -%define HAVE_TRUNCF 1 -%define HAVE_ACCESS 1 -%define HAVE_ALIGNED_MALLOC 0 -%define HAVE_ARC4RANDOM 0 -%define HAVE_CLOCK_GETTIME 1 -%define HAVE_CLOSESOCKET 0 -%define HAVE_COMMANDLINETOARGVW 0 -%define HAVE_COTASKMEMFREE 0 -%define HAVE_CRYPTGENRANDOM 0 -%define HAVE_FCNTL 1 -%define HAVE_FLT_LIM 1 -%define HAVE_FORK 1 -%define HAVE_GETADDRINFO 1 -%define HAVE_GETHRTIME 0 -%define HAVE_GETOPT 1 -%define HAVE_GETPROCESSAFFINITYMASK 0 -%define HAVE_GETPROCESSMEMORYINFO 0 -%define HAVE_GETPROCESSTIMES 0 -%define HAVE_GETRUSAGE 1 -%define HAVE_GETSYSTEMTIMEASFILETIME 0 -%define HAVE_GETTIMEOFDAY 1 -%define HAVE_GLOB 1 -%define HAVE_GLXGETPROCADDRESS 0 -%define HAVE_GMTIME_R 1 -%define HAVE_INET_ATON 1 -%define HAVE_ISATTY 1 -%define HAVE_JACK_PORT_GET_LATENCY_RANGE 0 -%define HAVE_KBHIT 0 -%define HAVE_LOADLIBRARY 0 -%define HAVE_LOCALTIME_R 1 -%define HAVE_LSTAT 1 -%define HAVE_LZO1X_999_COMPRESS 0 -%define HAVE_MACH_ABSOLUTE_TIME 1 -%define HAVE_MAPVIEWOFFILE 0 -%define HAVE_MEMALIGN 0 -%define HAVE_MKSTEMP 1 -%define HAVE_MMAP 1 -%define HAVE_MPROTECT 1 -%define HAVE_NANOSLEEP 1 -%define HAVE_PEEKNAMEDPIPE 0 -%define HAVE_POSIX_MEMALIGN 1 -%define HAVE_PTHREAD_CANCEL 1 -%define HAVE_SCHED_GETAFFINITY 0 -%define HAVE_SETCONSOLETEXTATTRIBUTE 0 -%define HAVE_SETCONSOLECTRLHANDLER 0 -%define HAVE_SETMODE 0 -%define HAVE_SETRLIMIT 1 -%define HAVE_SLEEP 0 -%define HAVE_STRERROR_R 1 -%define HAVE_SYSCONF 1 -%define HAVE_SYSCTL 1 -%define HAVE_USLEEP 1 -%define HAVE_UTGETOSTYPEFROMSTRING 0 -%define HAVE_VIRTUALALLOC 0 -%define HAVE_WGLGETPROCADDRESS 0 -%define HAVE_PTHREADS 1 -%define HAVE_OS2THREADS 0 -%define HAVE_W32THREADS 0 -%define HAVE_AS_DN_DIRECTIVE 0 -%define HAVE_AS_FPU_DIRECTIVE 0 -%define HAVE_AS_FUNC 0 -%define HAVE_AS_OBJECT_ARCH 0 -%define HAVE_ASM_MOD_Q 0 -%define HAVE_ATTRIBUTE_MAY_ALIAS 1 -%define HAVE_ATTRIBUTE_PACKED 1 -%define HAVE_BLOCKS_EXTENSION 1 -%define HAVE_EBP_AVAILABLE 1 -%define HAVE_EBX_AVAILABLE 1 -%define HAVE_GNU_AS 0 -%define HAVE_GNU_WINDRES 0 -%define HAVE_IBM_ASM 0 -%define HAVE_INLINE_ASM_DIRECT_SYMBOL_REFS 1 -%define HAVE_INLINE_ASM_LABELS 1 -%define HAVE_INLINE_ASM_NONLOCAL_LABELS 1 -%define HAVE_PRAGMA_DEPRECATED 1 -%define HAVE_RSYNC_CONTIMEOUT 0 -%define HAVE_SYMVER_ASM_LABEL 1 -%define HAVE_SYMVER_GNU_ASM 0 -%define HAVE_VFP_ARGS 0 -%define HAVE_XFORM_ASM 0 -%define HAVE_XMM_CLOBBERS 1 -%define HAVE_CONDITION_VARIABLE_PTR 0 -%define HAVE_KCMVIDEOCODECTYPE_HEVC 0 -%define HAVE_SOCKLEN_T 1 -%define HAVE_STRUCT_ADDRINFO 1 -%define HAVE_STRUCT_GROUP_SOURCE_REQ 1 -%define HAVE_STRUCT_IP_MREQ_SOURCE 1 -%define HAVE_STRUCT_IPV6_MREQ 1 -%define HAVE_STRUCT_MSGHDR_MSG_FLAGS 1 -%define HAVE_STRUCT_POLLFD 1 -%define HAVE_STRUCT_RUSAGE_RU_MAXRSS 1 -%define HAVE_STRUCT_SCTP_EVENT_SUBSCRIBE 0 -%define HAVE_STRUCT_SOCKADDR_IN6 1 -%define HAVE_STRUCT_SOCKADDR_SA_LEN 1 -%define HAVE_STRUCT_SOCKADDR_STORAGE 1 -%define HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC 0 -%define HAVE_STRUCT_V4L2_FRMIVALENUM_DISCRETE 0 -%define HAVE_ATOMICS_NATIVE 1 -%define HAVE_DOS_PATHS 0 -%define HAVE_LIBC_MSVCRT 0 -%define HAVE_MAKEINFO 1 -%define HAVE_MAKEINFO_HTML 0 -%define HAVE_MMAL_PARAMETER_VIDEO_MAX_NUM_CALLBACKS 0 -%define HAVE_PERL 1 -%define HAVE_POD2MAN 1 -%define HAVE_SECTION_DATA_REL_RO 0 -%define HAVE_TEXI2HTML 0 -%define HAVE_THREADS 1 -%define HAVE_UWP 0 -%define HAVE_VAAPI_DRM 0 -%define HAVE_VAAPI_X11 0 -%define HAVE_VDPAU_X11 0 -%define HAVE_WINRT 0 -%define CONFIG_DOC 0 -%define CONFIG_HTMLPAGES 0 -%define CONFIG_MANPAGES 1 -%define CONFIG_PODPAGES 1 -%define CONFIG_TXTPAGES 1 -%define CONFIG_AVIO_DIR_CMD_EXAMPLE 1 -%define CONFIG_AVIO_READING_EXAMPLE 1 -%define CONFIG_DECODE_AUDIO_EXAMPLE 1 -%define CONFIG_DECODE_VIDEO_EXAMPLE 1 -%define CONFIG_DEMUXING_DECODING_EXAMPLE 0 -%define CONFIG_ENCODE_AUDIO_EXAMPLE 1 -%define CONFIG_ENCODE_VIDEO_EXAMPLE 1 -%define CONFIG_EXTRACT_MVS_EXAMPLE 0 -%define CONFIG_FILTER_AUDIO_EXAMPLE 0 -%define CONFIG_FILTERING_AUDIO_EXAMPLE 0 -%define CONFIG_FILTERING_VIDEO_EXAMPLE 0 -%define CONFIG_HTTP_MULTICLIENT_EXAMPLE 0 -%define CONFIG_HW_DECODE_EXAMPLE 0 -%define CONFIG_METADATA_EXAMPLE 0 -%define CONFIG_MUXING_EXAMPLE 0 -%define CONFIG_QSVDEC_EXAMPLE 0 -%define CONFIG_REMUXING_EXAMPLE 0 -%define CONFIG_RESAMPLING_AUDIO_EXAMPLE 0 -%define CONFIG_SCALING_VIDEO_EXAMPLE 0 -%define CONFIG_TRANSCODE_AAC_EXAMPLE 0 -%define CONFIG_TRANSCODING_EXAMPLE 0 -%define CONFIG_ALSA 0 -%define CONFIG_APPKIT 1 -%define CONFIG_AVFOUNDATION 1 -%define CONFIG_BZLIB 1 -%define CONFIG_COREIMAGE 1 -%define CONFIG_ICONV 0 -%define CONFIG_JACK 0 -%define CONFIG_LIBXCB 0 -%define CONFIG_LIBXCB_SHM 0 -%define CONFIG_LIBXCB_SHAPE 0 -%define CONFIG_LIBXCB_XFIXES 0 -%define CONFIG_LZMA 0 -%define CONFIG_SCHANNEL 0 -%define CONFIG_SDL2 0 -%define CONFIG_SECURETRANSPORT 0 -%define CONFIG_SNDIO 0 -%define CONFIG_XLIB 1 -%define CONFIG_ZLIB 1 -%define CONFIG_AVISYNTH 0 -%define CONFIG_FREI0R 0 -%define CONFIG_LIBCDIO 0 -%define CONFIG_LIBRUBBERBAND 0 -%define CONFIG_LIBVIDSTAB 0 -%define CONFIG_LIBX264 0 -%define CONFIG_LIBX265 0 -%define CONFIG_LIBXAVS 0 -%define CONFIG_LIBXVID 0 -%define CONFIG_DECKLINK 0 -%define CONFIG_LIBNDI_NEWTEK 0 -%define CONFIG_LIBFDK_AAC 0 -%define CONFIG_OPENSSL 0 -%define CONFIG_GMP 0 -%define CONFIG_LIBOPENCORE_AMRNB 0 -%define CONFIG_LIBOPENCORE_AMRWB 0 -%define CONFIG_LIBVO_AMRWBENC 0 -%define CONFIG_RKMPP 0 -%define CONFIG_LIBSMBCLIENT 0 -%define CONFIG_CHROMAPRINT 0 -%define CONFIG_GCRYPT 0 -%define CONFIG_GNUTLS 0 -%define CONFIG_JNI 0 -%define CONFIG_LADSPA 0 -%define CONFIG_LIBASS 0 -%define CONFIG_LIBBLURAY 0 -%define CONFIG_LIBBS2B 0 -%define CONFIG_LIBCACA 0 -%define CONFIG_LIBCELT 0 -%define CONFIG_LIBDC1394 0 -%define CONFIG_LIBDRM 0 -%define CONFIG_LIBFLITE 0 -%define CONFIG_LIBFONTCONFIG 0 -%define CONFIG_LIBFREETYPE 0 -%define CONFIG_LIBFRIBIDI 0 -%define CONFIG_LIBGME 0 -%define CONFIG_LIBGSM 0 -%define CONFIG_LIBIEC61883 0 -%define CONFIG_LIBILBC 0 -%define CONFIG_LIBKVAZAAR 0 -%define CONFIG_LIBMODPLUG 0 -%define CONFIG_LIBMP3LAME 0 -%define CONFIG_LIBMYSOFA 0 -%define CONFIG_LIBOPENCV 0 -%define CONFIG_LIBOPENH264 0 -%define CONFIG_LIBOPENJPEG 0 -%define CONFIG_LIBOPENMPT 0 -%define CONFIG_LIBOPUS 0 -%define CONFIG_LIBPULSE 0 -%define CONFIG_LIBRSVG 0 -%define CONFIG_LIBRTMP 0 -%define CONFIG_LIBSHINE 0 -%define CONFIG_LIBSMBCLIENT 0 -%define CONFIG_LIBSNAPPY 0 -%define CONFIG_LIBSOXR 0 -%define CONFIG_LIBSPEEX 0 -%define CONFIG_LIBSSH 0 -%define CONFIG_LIBTESSERACT 0 -%define CONFIG_LIBTHEORA 0 -%define CONFIG_LIBTWOLAME 0 -%define CONFIG_LIBV4L2 0 -%define CONFIG_LIBVMAF 0 -%define CONFIG_LIBVORBIS 0 -%define CONFIG_LIBVPX 0 -%define CONFIG_LIBWAVPACK 0 -%define CONFIG_LIBWEBP 0 -%define CONFIG_LIBXML2 0 -%define CONFIG_LIBZIMG 0 -%define CONFIG_LIBZMQ 0 -%define CONFIG_LIBZVBI 0 -%define CONFIG_MEDIACODEC 0 -%define CONFIG_OPENAL 0 -%define CONFIG_OPENCL 0 -%define CONFIG_OPENGL 0 -%define CONFIG_AUDIOTOOLBOX 1 -%define CONFIG_CRYSTALHD 0 -%define CONFIG_CUDA 0 -%define CONFIG_CUVID 0 -%define CONFIG_D3D11VA 0 -%define CONFIG_DXVA2 0 -%define CONFIG_NVENC 0 -%define CONFIG_VAAPI 0 -%define CONFIG_VDA 0 -%define CONFIG_VDPAU 0 -%define CONFIG_VIDEOTOOLBOX 0 -%define CONFIG_V4L2_M2M 0 -%define CONFIG_XVMC 0 -%define CONFIG_CUDA_SDK 0 -%define CONFIG_LIBNPP 0 -%define CONFIG_LIBMFX 0 -%define CONFIG_MMAL 0 -%define CONFIG_OMX 0 -%define CONFIG_FTRAPV 0 -%define CONFIG_GRAY 0 -%define CONFIG_HARDCODED_TABLES 0 -%define CONFIG_OMX_RPI 0 -%define CONFIG_RUNTIME_CPUDETECT 1 -%define CONFIG_SAFE_BITSTREAM_READER 1 -%define CONFIG_SHARED 1 -%define CONFIG_SMALL 0 -%define CONFIG_STATIC 0 -%define CONFIG_SWSCALE_ALPHA 1 -%define CONFIG_GPL 0 -%define CONFIG_NONFREE 0 -%define CONFIG_VERSION3 0 -%define CONFIG_AVCODEC 1 -%define CONFIG_AVDEVICE 0 -%define CONFIG_AVFILTER 0 -%define CONFIG_AVFORMAT 0 -%define CONFIG_AVRESAMPLE 0 -%define CONFIG_AVUTIL 1 -%define CONFIG_POSTPROC 0 -%define CONFIG_SWRESAMPLE 0 -%define CONFIG_SWSCALE 0 -%define CONFIG_FFPLAY 0 -%define CONFIG_FFPROBE 0 -%define CONFIG_FFSERVER 0 -%define CONFIG_FFMPEG 0 -%define CONFIG_DCT 1 -%define CONFIG_DWT 0 -%define CONFIG_ERROR_RESILIENCE 1 -%define CONFIG_FAAN 1 -%define CONFIG_FAST_UNALIGNED 1 -%define CONFIG_FFT 1 -%define CONFIG_LSP 0 -%define CONFIG_LZO 0 -%define CONFIG_MDCT 1 -%define CONFIG_PIXELUTILS 0 -%define CONFIG_NETWORK 0 -%define CONFIG_RDFT 1 -%define CONFIG_AUTODETECT 0 -%define CONFIG_FONTCONFIG 0 -%define CONFIG_LINUX_PERF 0 -%define CONFIG_MEMORY_POISONING 0 -%define CONFIG_NEON_CLOBBER_TEST 0 -%define CONFIG_OSSFUZZ 0 -%define CONFIG_PIC 1 -%define CONFIG_THUMB 0 -%define CONFIG_VALGRIND_BACKTRACE 0 -%define CONFIG_XMM_CLOBBER_TEST 0 -%define CONFIG_BSFS 1 -%define CONFIG_DECODERS 1 -%define CONFIG_ENCODERS 0 -%define CONFIG_HWACCELS 0 -%define CONFIG_PARSERS 1 -%define CONFIG_INDEVS 0 -%define CONFIG_OUTDEVS 0 -%define CONFIG_FILTERS 0 -%define CONFIG_DEMUXERS 0 -%define CONFIG_MUXERS 0 -%define CONFIG_PROTOCOLS 0 -%define CONFIG_AANDCTTABLES 0 -%define CONFIG_AC3DSP 0 -%define CONFIG_AUDIO_FRAME_QUEUE 0 -%define CONFIG_AUDIODSP 0 -%define CONFIG_BLOCKDSP 0 -%define CONFIG_BSWAPDSP 1 -%define CONFIG_CABAC 1 -%define CONFIG_DIRAC_PARSE 0 -%define CONFIG_DVPROFILE 0 -%define CONFIG_EXIF 0 -%define CONFIG_FAANDCT 1 -%define CONFIG_FAANIDCT 1 -%define CONFIG_FDCTDSP 1 -%define CONFIG_FLACDSP 1 -%define CONFIG_FMTCONVERT 0 -%define CONFIG_FRAME_THREAD_ENCODER 0 -%define CONFIG_G722DSP 0 -%define CONFIG_GOLOMB 1 -%define CONFIG_GPLV3 0 -%define CONFIG_H263DSP 0 -%define CONFIG_H264CHROMA 1 -%define CONFIG_H264DSP 1 -%define CONFIG_H264PARSE 1 -%define CONFIG_H264PRED 1 -%define CONFIG_H264QPEL 1 -%define CONFIG_HEVCPARSE 1 -%define CONFIG_HPELDSP 0 -%define CONFIG_HUFFMAN 0 -%define CONFIG_HUFFYUVDSP 0 -%define CONFIG_HUFFYUVENCDSP 0 -%define CONFIG_IDCTDSP 1 -%define CONFIG_IIRFILTER 0 -%define CONFIG_MDCT15 1 -%define CONFIG_INTRAX8 0 -%define CONFIG_ISO_MEDIA 0 -%define CONFIG_IVIDSP 0 -%define CONFIG_JPEGTABLES 0 -%define CONFIG_LGPLV3 0 -%define CONFIG_LIBX262 0 -%define CONFIG_LLAUDDSP 0 -%define CONFIG_LLVIDDSP 0 -%define CONFIG_LLVIDENCDSP 0 -%define CONFIG_LPC 0 -%define CONFIG_LZF 0 -%define CONFIG_ME_CMP 1 -%define CONFIG_MPEG_ER 0 -%define CONFIG_MPEGAUDIO 1 -%define CONFIG_MPEGAUDIODSP 1 -%define CONFIG_MPEGAUDIOHEADER 1 -%define CONFIG_MPEGVIDEO 0 -%define CONFIG_MPEGVIDEOENC 0 -%define CONFIG_MSS34DSP 0 -%define CONFIG_PIXBLOCKDSP 1 -%define CONFIG_QPELDSP 0 -%define CONFIG_QSV 0 -%define CONFIG_QSVDEC 0 -%define CONFIG_QSVENC 0 -%define CONFIG_RANGECODER 0 -%define CONFIG_RIFFDEC 0 -%define CONFIG_RIFFENC 0 -%define CONFIG_RTPDEC 0 -%define CONFIG_RTPENC_CHAIN 0 -%define CONFIG_RV34DSP 0 -%define CONFIG_SINEWIN 1 -%define CONFIG_SNAPPY 0 -%define CONFIG_SRTP 0 -%define CONFIG_STARTCODE 1 -%define CONFIG_TEXTUREDSP 0 -%define CONFIG_TEXTUREDSPENC 0 -%define CONFIG_TPELDSP 0 -%define CONFIG_VAAPI_1 0 -%define CONFIG_VAAPI_ENCODE 0 -%define CONFIG_VC1DSP 0 -%define CONFIG_VIDEODSP 1 -%define CONFIG_VP3DSP 0 -%define CONFIG_VP56DSP 0 -%define CONFIG_VP8DSP 1 -%define CONFIG_WMA_FREQS 0 -%define CONFIG_WMV2DSP 0 -%define CONFIG_AAC_ADTSTOASC_BSF 0 -%define CONFIG_CHOMP_BSF 0 -%define CONFIG_DUMP_EXTRADATA_BSF 0 -%define CONFIG_DCA_CORE_BSF 0 -%define CONFIG_EXTRACT_EXTRADATA_BSF 0 -%define CONFIG_H264_MP4TOANNEXB_BSF 0 -%define CONFIG_HEVC_MP4TOANNEXB_BSF 0 -%define CONFIG_IMX_DUMP_HEADER_BSF 0 -%define CONFIG_MJPEG2JPEG_BSF 0 -%define CONFIG_MJPEGA_DUMP_HEADER_BSF 0 -%define CONFIG_MP3_HEADER_DECOMPRESS_BSF 0 -%define CONFIG_MPEG4_UNPACK_BFRAMES_BSF 0 -%define CONFIG_MOV2TEXTSUB_BSF 0 -%define CONFIG_NOISE_BSF 0 -%define CONFIG_NULL_BSF 1 -%define CONFIG_REMOVE_EXTRADATA_BSF 0 -%define CONFIG_TEXT2MOVSUB_BSF 0 -%define CONFIG_VP9_RAW_REORDER_BSF 0 -%define CONFIG_VP9_SUPERFRAME_BSF 0 -%define CONFIG_VP9_SUPERFRAME_SPLIT_BSF 0 -%define CONFIG_AASC_DECODER 0 -%define CONFIG_AIC_DECODER 0 -%define CONFIG_ALIAS_PIX_DECODER 0 -%define CONFIG_AMV_DECODER 0 -%define CONFIG_ANM_DECODER 0 -%define CONFIG_ANSI_DECODER 0 -%define CONFIG_APNG_DECODER 0 -%define CONFIG_ASV1_DECODER 0 -%define CONFIG_ASV2_DECODER 0 -%define CONFIG_AURA_DECODER 0 -%define CONFIG_AURA2_DECODER 0 -%define CONFIG_AVRP_DECODER 0 -%define CONFIG_AVRN_DECODER 0 -%define CONFIG_AVS_DECODER 0 -%define CONFIG_AVUI_DECODER 0 -%define CONFIG_AYUV_DECODER 0 -%define CONFIG_BETHSOFTVID_DECODER 0 -%define CONFIG_BFI_DECODER 0 -%define CONFIG_BINK_DECODER 0 -%define CONFIG_BMP_DECODER 0 -%define CONFIG_BMV_VIDEO_DECODER 0 -%define CONFIG_BRENDER_PIX_DECODER 0 -%define CONFIG_C93_DECODER 0 -%define CONFIG_CAVS_DECODER 0 -%define CONFIG_CDGRAPHICS_DECODER 0 -%define CONFIG_CDXL_DECODER 0 -%define CONFIG_CFHD_DECODER 0 -%define CONFIG_CINEPAK_DECODER 0 -%define CONFIG_CLEARVIDEO_DECODER 0 -%define CONFIG_CLJR_DECODER 0 -%define CONFIG_CLLC_DECODER 0 -%define CONFIG_COMFORTNOISE_DECODER 0 -%define CONFIG_CPIA_DECODER 0 -%define CONFIG_CSCD_DECODER 0 -%define CONFIG_CYUV_DECODER 0 -%define CONFIG_DDS_DECODER 0 -%define CONFIG_DFA_DECODER 0 -%define CONFIG_DIRAC_DECODER 0 -%define CONFIG_DNXHD_DECODER 0 -%define CONFIG_DPX_DECODER 0 -%define CONFIG_DSICINVIDEO_DECODER 0 -%define CONFIG_DVAUDIO_DECODER 0 -%define CONFIG_DVVIDEO_DECODER 0 -%define CONFIG_DXA_DECODER 0 -%define CONFIG_DXTORY_DECODER 0 -%define CONFIG_DXV_DECODER 0 -%define CONFIG_EACMV_DECODER 0 -%define CONFIG_EAMAD_DECODER 0 -%define CONFIG_EATGQ_DECODER 0 -%define CONFIG_EATGV_DECODER 0 -%define CONFIG_EATQI_DECODER 0 -%define CONFIG_EIGHTBPS_DECODER 0 -%define CONFIG_EIGHTSVX_EXP_DECODER 0 -%define CONFIG_EIGHTSVX_FIB_DECODER 0 -%define CONFIG_ESCAPE124_DECODER 0 -%define CONFIG_ESCAPE130_DECODER 0 -%define CONFIG_EXR_DECODER 0 -%define CONFIG_FFV1_DECODER 0 -%define CONFIG_FFVHUFF_DECODER 0 -%define CONFIG_FIC_DECODER 0 -%define CONFIG_FITS_DECODER 0 -%define CONFIG_FLASHSV_DECODER 0 -%define CONFIG_FLASHSV2_DECODER 0 -%define CONFIG_FLIC_DECODER 0 -%define CONFIG_FLV_DECODER 0 -%define CONFIG_FMVC_DECODER 0 -%define CONFIG_FOURXM_DECODER 0 -%define CONFIG_FRAPS_DECODER 0 -%define CONFIG_FRWU_DECODER 0 -%define CONFIG_G2M_DECODER 0 -%define CONFIG_GDV_DECODER 0 -%define CONFIG_GIF_DECODER 0 -%define CONFIG_H261_DECODER 0 -%define CONFIG_H263_DECODER 0 -%define CONFIG_H263I_DECODER 0 -%define CONFIG_H263P_DECODER 0 -%define CONFIG_H263_V4L2M2M_DECODER 0 -%define CONFIG_H264_DECODER 1 -%define CONFIG_H264_CRYSTALHD_DECODER 0 -%define CONFIG_H264_V4L2M2M_DECODER 0 -%define CONFIG_H264_MEDIACODEC_DECODER 0 -%define CONFIG_H264_MMAL_DECODER 0 -%define CONFIG_H264_QSV_DECODER 0 -%define CONFIG_H264_RKMPP_DECODER 0 -%define CONFIG_H264_VDA_DECODER 0 -%define CONFIG_H264_VDPAU_DECODER 0 -%define CONFIG_HAP_DECODER 0 -%define CONFIG_HEVC_DECODER 1 -%define CONFIG_HEVC_QSV_DECODER 0 -%define CONFIG_HEVC_RKMPP_DECODER 0 -%define CONFIG_HEVC_V4L2M2M_DECODER 0 -%define CONFIG_HNM4_VIDEO_DECODER 0 -%define CONFIG_HQ_HQA_DECODER 0 -%define CONFIG_HQX_DECODER 0 -%define CONFIG_HUFFYUV_DECODER 0 -%define CONFIG_IDCIN_DECODER 0 -%define CONFIG_IFF_ILBM_DECODER 0 -%define CONFIG_INDEO2_DECODER 0 -%define CONFIG_INDEO3_DECODER 0 -%define CONFIG_INDEO4_DECODER 0 -%define CONFIG_INDEO5_DECODER 0 -%define CONFIG_INTERPLAY_VIDEO_DECODER 0 -%define CONFIG_JPEG2000_DECODER 0 -%define CONFIG_JPEGLS_DECODER 0 -%define CONFIG_JV_DECODER 0 -%define CONFIG_KGV1_DECODER 0 -%define CONFIG_KMVC_DECODER 0 -%define CONFIG_LAGARITH_DECODER 0 -%define CONFIG_LOCO_DECODER 0 -%define CONFIG_M101_DECODER 0 -%define CONFIG_MAGICYUV_DECODER 0 -%define CONFIG_MDEC_DECODER 0 -%define CONFIG_MIMIC_DECODER 0 -%define CONFIG_MJPEG_DECODER 0 -%define CONFIG_MJPEGB_DECODER 0 -%define CONFIG_MMVIDEO_DECODER 0 -%define CONFIG_MOTIONPIXELS_DECODER 0 -%define CONFIG_MPEG_XVMC_DECODER 0 -%define CONFIG_MPEG1VIDEO_DECODER 0 -%define CONFIG_MPEG2VIDEO_DECODER 0 -%define CONFIG_MPEG4_DECODER 0 -%define CONFIG_MPEG4_CRYSTALHD_DECODER 0 -%define CONFIG_MPEG4_V4L2M2M_DECODER 0 -%define CONFIG_MPEG4_MMAL_DECODER 0 -%define CONFIG_MPEG4_VDPAU_DECODER 0 -%define CONFIG_MPEGVIDEO_DECODER 0 -%define CONFIG_MPEG_VDPAU_DECODER 0 -%define CONFIG_MPEG1_VDPAU_DECODER 0 -%define CONFIG_MPEG1_V4L2M2M_DECODER 0 -%define CONFIG_MPEG2_MMAL_DECODER 0 -%define CONFIG_MPEG2_CRYSTALHD_DECODER 0 -%define CONFIG_MPEG2_V4L2M2M_DECODER 0 -%define CONFIG_MPEG2_QSV_DECODER 0 -%define CONFIG_MPEG2_MEDIACODEC_DECODER 0 -%define CONFIG_MSA1_DECODER 0 -%define CONFIG_MSCC_DECODER 0 -%define CONFIG_MSMPEG4V1_DECODER 0 -%define CONFIG_MSMPEG4V2_DECODER 0 -%define CONFIG_MSMPEG4V3_DECODER 0 -%define CONFIG_MSMPEG4_CRYSTALHD_DECODER 0 -%define CONFIG_MSRLE_DECODER 0 -%define CONFIG_MSS1_DECODER 0 -%define CONFIG_MSS2_DECODER 0 -%define CONFIG_MSVIDEO1_DECODER 0 -%define CONFIG_MSZH_DECODER 0 -%define CONFIG_MTS2_DECODER 0 -%define CONFIG_MVC1_DECODER 0 -%define CONFIG_MVC2_DECODER 0 -%define CONFIG_MXPEG_DECODER 0 -%define CONFIG_NUV_DECODER 0 -%define CONFIG_PAF_VIDEO_DECODER 0 -%define CONFIG_PAM_DECODER 0 -%define CONFIG_PBM_DECODER 0 -%define CONFIG_PCX_DECODER 0 -%define CONFIG_PGM_DECODER 0 -%define CONFIG_PGMYUV_DECODER 0 -%define CONFIG_PICTOR_DECODER 0 -%define CONFIG_PIXLET_DECODER 0 -%define CONFIG_PNG_DECODER 0 -%define CONFIG_PPM_DECODER 0 -%define CONFIG_PRORES_DECODER 0 -%define CONFIG_PRORES_LGPL_DECODER 0 -%define CONFIG_PSD_DECODER 0 -%define CONFIG_PTX_DECODER 0 -%define CONFIG_QDRAW_DECODER 0 -%define CONFIG_QPEG_DECODER 0 -%define CONFIG_QTRLE_DECODER 0 -%define CONFIG_R10K_DECODER 0 -%define CONFIG_R210_DECODER 0 -%define CONFIG_RAWVIDEO_DECODER 0 -%define CONFIG_RL2_DECODER 0 -%define CONFIG_ROQ_DECODER 0 -%define CONFIG_RPZA_DECODER 0 -%define CONFIG_RSCC_DECODER 0 -%define CONFIG_RV10_DECODER 0 -%define CONFIG_RV20_DECODER 0 -%define CONFIG_RV30_DECODER 0 -%define CONFIG_RV40_DECODER 0 -%define CONFIG_S302M_DECODER 0 -%define CONFIG_SANM_DECODER 0 -%define CONFIG_SCPR_DECODER 0 -%define CONFIG_SCREENPRESSO_DECODER 0 -%define CONFIG_SDX2_DPCM_DECODER 0 -%define CONFIG_SGI_DECODER 0 -%define CONFIG_SGIRLE_DECODER 0 -%define CONFIG_SHEERVIDEO_DECODER 0 -%define CONFIG_SMACKER_DECODER 0 -%define CONFIG_SMC_DECODER 0 -%define CONFIG_SMVJPEG_DECODER 0 -%define CONFIG_SNOW_DECODER 0 -%define CONFIG_SP5X_DECODER 0 -%define CONFIG_SPEEDHQ_DECODER 0 -%define CONFIG_SRGC_DECODER 0 -%define CONFIG_SUNRAST_DECODER 0 -%define CONFIG_SVQ1_DECODER 0 -%define CONFIG_SVQ3_DECODER 0 -%define CONFIG_TARGA_DECODER 0 -%define CONFIG_TARGA_Y216_DECODER 0 -%define CONFIG_TDSC_DECODER 0 -%define CONFIG_THEORA_DECODER 0 -%define CONFIG_THP_DECODER 0 -%define CONFIG_TIERTEXSEQVIDEO_DECODER 0 -%define CONFIG_TIFF_DECODER 0 -%define CONFIG_TMV_DECODER 0 -%define CONFIG_TRUEMOTION1_DECODER 0 -%define CONFIG_TRUEMOTION2_DECODER 0 -%define CONFIG_TRUEMOTION2RT_DECODER 0 -%define CONFIG_TSCC_DECODER 0 -%define CONFIG_TSCC2_DECODER 0 -%define CONFIG_TXD_DECODER 0 -%define CONFIG_ULTI_DECODER 0 -%define CONFIG_UTVIDEO_DECODER 0 -%define CONFIG_V210_DECODER 0 -%define CONFIG_V210X_DECODER 0 -%define CONFIG_V308_DECODER 0 -%define CONFIG_V408_DECODER 0 -%define CONFIG_V410_DECODER 0 -%define CONFIG_VB_DECODER 0 -%define CONFIG_VBLE_DECODER 0 -%define CONFIG_VC1_DECODER 0 -%define CONFIG_VC1_CRYSTALHD_DECODER 0 -%define CONFIG_VC1_VDPAU_DECODER 0 -%define CONFIG_VC1IMAGE_DECODER 0 -%define CONFIG_VC1_MMAL_DECODER 0 -%define CONFIG_VC1_QSV_DECODER 0 -%define CONFIG_VC1_V4L2M2M_DECODER 0 -%define CONFIG_VCR1_DECODER 0 -%define CONFIG_VMDVIDEO_DECODER 0 -%define CONFIG_VMNC_DECODER 0 -%define CONFIG_VP3_DECODER 0 -%define CONFIG_VP5_DECODER 0 -%define CONFIG_VP6_DECODER 0 -%define CONFIG_VP6A_DECODER 0 -%define CONFIG_VP6F_DECODER 0 -%define CONFIG_VP7_DECODER 0 -%define CONFIG_VP8_DECODER 1 -%define CONFIG_VP8_RKMPP_DECODER 0 -%define CONFIG_VP8_V4L2M2M_DECODER 0 -%define CONFIG_VP9_DECODER 1 -%define CONFIG_VP9_RKMPP_DECODER 0 -%define CONFIG_VP9_V4L2M2M_DECODER 0 -%define CONFIG_VQA_DECODER 0 -%define CONFIG_BITPACKED_DECODER 0 -%define CONFIG_WEBP_DECODER 0 -%define CONFIG_WRAPPED_AVFRAME_DECODER 0 -%define CONFIG_WMV1_DECODER 0 -%define CONFIG_WMV2_DECODER 0 -%define CONFIG_WMV3_DECODER 0 -%define CONFIG_WMV3_CRYSTALHD_DECODER 0 -%define CONFIG_WMV3_VDPAU_DECODER 0 -%define CONFIG_WMV3IMAGE_DECODER 0 -%define CONFIG_WNV1_DECODER 0 -%define CONFIG_XAN_WC3_DECODER 0 -%define CONFIG_XAN_WC4_DECODER 0 -%define CONFIG_XBM_DECODER 0 -%define CONFIG_XFACE_DECODER 0 -%define CONFIG_XL_DECODER 0 -%define CONFIG_XPM_DECODER 0 -%define CONFIG_XWD_DECODER 0 -%define CONFIG_Y41P_DECODER 0 -%define CONFIG_YLC_DECODER 0 -%define CONFIG_YOP_DECODER 0 -%define CONFIG_YUV4_DECODER 0 -%define CONFIG_ZERO12V_DECODER 0 -%define CONFIG_ZEROCODEC_DECODER 0 -%define CONFIG_ZLIB_DECODER 0 -%define CONFIG_ZMBV_DECODER 0 -%define CONFIG_AAC_DECODER 1 -%define CONFIG_AAC_FIXED_DECODER 0 -%define CONFIG_AAC_LATM_DECODER 1 -%define CONFIG_AC3_DECODER 0 -%define CONFIG_AC3_FIXED_DECODER 0 -%define CONFIG_ALAC_DECODER 0 -%define CONFIG_ALS_DECODER 0 -%define CONFIG_AMRNB_DECODER 0 -%define CONFIG_AMRWB_DECODER 0 -%define CONFIG_APE_DECODER 0 -%define CONFIG_ATRAC1_DECODER 0 -%define CONFIG_ATRAC3_DECODER 0 -%define CONFIG_ATRAC3AL_DECODER 0 -%define CONFIG_ATRAC3P_DECODER 0 -%define CONFIG_ATRAC3PAL_DECODER 0 -%define CONFIG_BINKAUDIO_DCT_DECODER 0 -%define CONFIG_BINKAUDIO_RDFT_DECODER 0 -%define CONFIG_BMV_AUDIO_DECODER 0 -%define CONFIG_COOK_DECODER 0 -%define CONFIG_DCA_DECODER 0 -%define CONFIG_DOLBY_E_DECODER 0 -%define CONFIG_DSD_LSBF_DECODER 0 -%define CONFIG_DSD_MSBF_DECODER 0 -%define CONFIG_DSD_LSBF_PLANAR_DECODER 0 -%define CONFIG_DSD_MSBF_PLANAR_DECODER 0 -%define CONFIG_DSICINAUDIO_DECODER 0 -%define CONFIG_DSS_SP_DECODER 0 -%define CONFIG_DST_DECODER 0 -%define CONFIG_EAC3_DECODER 0 -%define CONFIG_EVRC_DECODER 0 -%define CONFIG_FFWAVESYNTH_DECODER 0 -%define CONFIG_FLAC_DECODER 1 -%define CONFIG_G723_1_DECODER 0 -%define CONFIG_G729_DECODER 0 -%define CONFIG_GSM_DECODER 0 -%define CONFIG_GSM_MS_DECODER 0 -%define CONFIG_IAC_DECODER 0 -%define CONFIG_IMC_DECODER 0 -%define CONFIG_INTERPLAY_ACM_DECODER 0 -%define CONFIG_MACE3_DECODER 0 -%define CONFIG_MACE6_DECODER 0 -%define CONFIG_METASOUND_DECODER 0 -%define CONFIG_MLP_DECODER 0 -%define CONFIG_MP1_DECODER 0 -%define CONFIG_MP1FLOAT_DECODER 0 -%define CONFIG_MP2_DECODER 0 -%define CONFIG_MP2FLOAT_DECODER 0 -%define CONFIG_MP3_DECODER 1 -%define CONFIG_MP3FLOAT_DECODER 0 -%define CONFIG_MP3ADU_DECODER 0 -%define CONFIG_MP3ADUFLOAT_DECODER 0 -%define CONFIG_MP3ON4_DECODER 0 -%define CONFIG_MP3ON4FLOAT_DECODER 0 -%define CONFIG_MPC7_DECODER 0 -%define CONFIG_MPC8_DECODER 0 -%define CONFIG_NELLYMOSER_DECODER 0 -%define CONFIG_ON2AVC_DECODER 0 -%define CONFIG_OPUS_DECODER 0 -%define CONFIG_PAF_AUDIO_DECODER 0 -%define CONFIG_QCELP_DECODER 0 -%define CONFIG_QDM2_DECODER 0 -%define CONFIG_QDMC_DECODER 0 -%define CONFIG_RA_144_DECODER 0 -%define CONFIG_RA_288_DECODER 0 -%define CONFIG_RALF_DECODER 0 -%define CONFIG_SHORTEN_DECODER 0 -%define CONFIG_SIPR_DECODER 0 -%define CONFIG_SMACKAUD_DECODER 0 -%define CONFIG_SONIC_DECODER 0 -%define CONFIG_TAK_DECODER 0 -%define CONFIG_TRUEHD_DECODER 0 -%define CONFIG_TRUESPEECH_DECODER 0 -%define CONFIG_TTA_DECODER 0 -%define CONFIG_TWINVQ_DECODER 0 -%define CONFIG_VMDAUDIO_DECODER 0 -%define CONFIG_VORBIS_DECODER 0 -%define CONFIG_WAVPACK_DECODER 0 -%define CONFIG_WMALOSSLESS_DECODER 0 -%define CONFIG_WMAPRO_DECODER 0 -%define CONFIG_WMAV1_DECODER 0 -%define CONFIG_WMAV2_DECODER 0 -%define CONFIG_WMAVOICE_DECODER 0 -%define CONFIG_WS_SND1_DECODER 0 -%define CONFIG_XMA1_DECODER 0 -%define CONFIG_XMA2_DECODER 0 -%define CONFIG_PCM_ALAW_DECODER 0 -%define CONFIG_PCM_BLURAY_DECODER 0 -%define CONFIG_PCM_DVD_DECODER 0 -%define CONFIG_PCM_F16LE_DECODER 0 -%define CONFIG_PCM_F24LE_DECODER 0 -%define CONFIG_PCM_F32BE_DECODER 0 -%define CONFIG_PCM_F32LE_DECODER 0 -%define CONFIG_PCM_F64BE_DECODER 0 -%define CONFIG_PCM_F64LE_DECODER 0 -%define CONFIG_PCM_LXF_DECODER 0 -%define CONFIG_PCM_MULAW_DECODER 0 -%define CONFIG_PCM_S8_DECODER 0 -%define CONFIG_PCM_S8_PLANAR_DECODER 0 -%define CONFIG_PCM_S16BE_DECODER 0 -%define CONFIG_PCM_S16BE_PLANAR_DECODER 0 -%define CONFIG_PCM_S16LE_DECODER 0 -%define CONFIG_PCM_S16LE_PLANAR_DECODER 0 -%define CONFIG_PCM_S24BE_DECODER 0 -%define CONFIG_PCM_S24DAUD_DECODER 0 -%define CONFIG_PCM_S24LE_DECODER 0 -%define CONFIG_PCM_S24LE_PLANAR_DECODER 0 -%define CONFIG_PCM_S32BE_DECODER 0 -%define CONFIG_PCM_S32LE_DECODER 0 -%define CONFIG_PCM_S32LE_PLANAR_DECODER 0 -%define CONFIG_PCM_S64BE_DECODER 0 -%define CONFIG_PCM_S64LE_DECODER 0 -%define CONFIG_PCM_U8_DECODER 0 -%define CONFIG_PCM_U16BE_DECODER 0 -%define CONFIG_PCM_U16LE_DECODER 0 -%define CONFIG_PCM_U24BE_DECODER 0 -%define CONFIG_PCM_U24LE_DECODER 0 -%define CONFIG_PCM_U32BE_DECODER 0 -%define CONFIG_PCM_U32LE_DECODER 0 -%define CONFIG_PCM_ZORK_DECODER 0 -%define CONFIG_GREMLIN_DPCM_DECODER 0 -%define CONFIG_INTERPLAY_DPCM_DECODER 0 -%define CONFIG_ROQ_DPCM_DECODER 0 -%define CONFIG_SOL_DPCM_DECODER 0 -%define CONFIG_XAN_DPCM_DECODER 0 -%define CONFIG_ADPCM_4XM_DECODER 0 -%define CONFIG_ADPCM_ADX_DECODER 0 -%define CONFIG_ADPCM_AFC_DECODER 0 -%define CONFIG_ADPCM_AICA_DECODER 0 -%define CONFIG_ADPCM_CT_DECODER 0 -%define CONFIG_ADPCM_DTK_DECODER 0 -%define CONFIG_ADPCM_EA_DECODER 0 -%define CONFIG_ADPCM_EA_MAXIS_XA_DECODER 0 -%define CONFIG_ADPCM_EA_R1_DECODER 0 -%define CONFIG_ADPCM_EA_R2_DECODER 0 -%define CONFIG_ADPCM_EA_R3_DECODER 0 -%define CONFIG_ADPCM_EA_XAS_DECODER 0 -%define CONFIG_ADPCM_G722_DECODER 0 -%define CONFIG_ADPCM_G726_DECODER 0 -%define CONFIG_ADPCM_G726LE_DECODER 0 -%define CONFIG_ADPCM_IMA_AMV_DECODER 0 -%define CONFIG_ADPCM_IMA_APC_DECODER 0 -%define CONFIG_ADPCM_IMA_DAT4_DECODER 0 -%define CONFIG_ADPCM_IMA_DK3_DECODER 0 -%define CONFIG_ADPCM_IMA_DK4_DECODER 0 -%define CONFIG_ADPCM_IMA_EA_EACS_DECODER 0 -%define CONFIG_ADPCM_IMA_EA_SEAD_DECODER 0 -%define CONFIG_ADPCM_IMA_ISS_DECODER 0 -%define CONFIG_ADPCM_IMA_OKI_DECODER 0 -%define CONFIG_ADPCM_IMA_QT_DECODER 0 -%define CONFIG_ADPCM_IMA_RAD_DECODER 0 -%define CONFIG_ADPCM_IMA_SMJPEG_DECODER 0 -%define CONFIG_ADPCM_IMA_WAV_DECODER 0 -%define CONFIG_ADPCM_IMA_WS_DECODER 0 -%define CONFIG_ADPCM_MS_DECODER 0 -%define CONFIG_ADPCM_MTAF_DECODER 0 -%define CONFIG_ADPCM_PSX_DECODER 0 -%define CONFIG_ADPCM_SBPRO_2_DECODER 0 -%define CONFIG_ADPCM_SBPRO_3_DECODER 0 -%define CONFIG_ADPCM_SBPRO_4_DECODER 0 -%define CONFIG_ADPCM_SWF_DECODER 0 -%define CONFIG_ADPCM_THP_DECODER 0 -%define CONFIG_ADPCM_THP_LE_DECODER 0 -%define CONFIG_ADPCM_VIMA_DECODER 0 -%define CONFIG_ADPCM_XA_DECODER 0 -%define CONFIG_ADPCM_YAMAHA_DECODER 0 -%define CONFIG_SSA_DECODER 0 -%define CONFIG_ASS_DECODER 0 -%define CONFIG_CCAPTION_DECODER 0 -%define CONFIG_DVBSUB_DECODER 0 -%define CONFIG_DVDSUB_DECODER 0 -%define CONFIG_JACOSUB_DECODER 0 -%define CONFIG_MICRODVD_DECODER 0 -%define CONFIG_MOVTEXT_DECODER 0 -%define CONFIG_MPL2_DECODER 0 -%define CONFIG_PGSSUB_DECODER 0 -%define CONFIG_PJS_DECODER 0 -%define CONFIG_REALTEXT_DECODER 0 -%define CONFIG_SAMI_DECODER 0 -%define CONFIG_SRT_DECODER 0 -%define CONFIG_STL_DECODER 0 -%define CONFIG_SUBRIP_DECODER 0 -%define CONFIG_SUBVIEWER_DECODER 0 -%define CONFIG_SUBVIEWER1_DECODER 0 -%define CONFIG_TEXT_DECODER 0 -%define CONFIG_VPLAYER_DECODER 0 -%define CONFIG_WEBVTT_DECODER 0 -%define CONFIG_XSUB_DECODER 0 -%define CONFIG_AAC_AT_DECODER 0 -%define CONFIG_AC3_AT_DECODER 0 -%define CONFIG_ADPCM_IMA_QT_AT_DECODER 0 -%define CONFIG_ALAC_AT_DECODER 0 -%define CONFIG_AMR_NB_AT_DECODER 0 -%define CONFIG_EAC3_AT_DECODER 0 -%define CONFIG_GSM_MS_AT_DECODER 0 -%define CONFIG_ILBC_AT_DECODER 0 -%define CONFIG_MP1_AT_DECODER 0 -%define CONFIG_MP2_AT_DECODER 0 -%define CONFIG_MP3_AT_DECODER 0 -%define CONFIG_PCM_ALAW_AT_DECODER 0 -%define CONFIG_PCM_MULAW_AT_DECODER 0 -%define CONFIG_QDMC_AT_DECODER 0 -%define CONFIG_QDM2_AT_DECODER 0 -%define CONFIG_LIBCELT_DECODER 0 -%define CONFIG_LIBFDK_AAC_DECODER 0 -%define CONFIG_LIBGSM_DECODER 0 -%define CONFIG_LIBGSM_MS_DECODER 0 -%define CONFIG_LIBILBC_DECODER 0 -%define CONFIG_LIBOPENCORE_AMRNB_DECODER 0 -%define CONFIG_LIBOPENCORE_AMRWB_DECODER 0 -%define CONFIG_LIBOPENJPEG_DECODER 0 -%define CONFIG_LIBOPUS_DECODER 0 -%define CONFIG_LIBRSVG_DECODER 0 -%define CONFIG_LIBSPEEX_DECODER 0 -%define CONFIG_LIBVORBIS_DECODER 0 -%define CONFIG_LIBVPX_VP8_DECODER 0 -%define CONFIG_LIBVPX_VP9_DECODER 0 -%define CONFIG_LIBZVBI_TELETEXT_DECODER 0 -%define CONFIG_BINTEXT_DECODER 0 -%define CONFIG_XBIN_DECODER 0 -%define CONFIG_IDF_DECODER 0 -%define CONFIG_LIBOPENH264_DECODER 0 -%define CONFIG_H264_CUVID_DECODER 0 -%define CONFIG_HEVC_CUVID_DECODER 0 -%define CONFIG_HEVC_MEDIACODEC_DECODER 0 -%define CONFIG_MJPEG_CUVID_DECODER 0 -%define CONFIG_MPEG1_CUVID_DECODER 0 -%define CONFIG_MPEG2_CUVID_DECODER 0 -%define CONFIG_MPEG4_CUVID_DECODER 0 -%define CONFIG_MPEG4_MEDIACODEC_DECODER 0 -%define CONFIG_VC1_CUVID_DECODER 0 -%define CONFIG_VP8_CUVID_DECODER 0 -%define CONFIG_VP8_MEDIACODEC_DECODER 0 -%define CONFIG_VP8_QSV_DECODER 0 -%define CONFIG_VP9_CUVID_DECODER 0 -%define CONFIG_VP9_MEDIACODEC_DECODER 0 -%define CONFIG_AA_DEMUXER 0 -%define CONFIG_AAC_DEMUXER 0 -%define CONFIG_AC3_DEMUXER 0 -%define CONFIG_ACM_DEMUXER 0 -%define CONFIG_ACT_DEMUXER 0 -%define CONFIG_ADF_DEMUXER 0 -%define CONFIG_ADP_DEMUXER 0 -%define CONFIG_ADS_DEMUXER 0 -%define CONFIG_ADX_DEMUXER 0 -%define CONFIG_AEA_DEMUXER 0 -%define CONFIG_AFC_DEMUXER 0 -%define CONFIG_AIFF_DEMUXER 0 -%define CONFIG_AIX_DEMUXER 0 -%define CONFIG_AMR_DEMUXER 0 -%define CONFIG_ANM_DEMUXER 0 -%define CONFIG_APC_DEMUXER 0 -%define CONFIG_APE_DEMUXER 0 -%define CONFIG_APNG_DEMUXER 0 -%define CONFIG_AQTITLE_DEMUXER 0 -%define CONFIG_ASF_DEMUXER 0 -%define CONFIG_ASF_O_DEMUXER 0 -%define CONFIG_ASS_DEMUXER 0 -%define CONFIG_AST_DEMUXER 0 -%define CONFIG_AU_DEMUXER 0 -%define CONFIG_AVI_DEMUXER 0 -%define CONFIG_AVISYNTH_DEMUXER 0 -%define CONFIG_AVR_DEMUXER 0 -%define CONFIG_AVS_DEMUXER 0 -%define CONFIG_BETHSOFTVID_DEMUXER 0 -%define CONFIG_BFI_DEMUXER 0 -%define CONFIG_BINTEXT_DEMUXER 0 -%define CONFIG_BINK_DEMUXER 0 -%define CONFIG_BIT_DEMUXER 0 -%define CONFIG_BMV_DEMUXER 0 -%define CONFIG_BFSTM_DEMUXER 0 -%define CONFIG_BRSTM_DEMUXER 0 -%define CONFIG_BOA_DEMUXER 0 -%define CONFIG_C93_DEMUXER 0 -%define CONFIG_CAF_DEMUXER 0 -%define CONFIG_CAVSVIDEO_DEMUXER 0 -%define CONFIG_CDG_DEMUXER 0 -%define CONFIG_CDXL_DEMUXER 0 -%define CONFIG_CINE_DEMUXER 0 -%define CONFIG_CONCAT_DEMUXER 0 -%define CONFIG_DASH_DEMUXER 0 -%define CONFIG_DATA_DEMUXER 0 -%define CONFIG_DAUD_DEMUXER 0 -%define CONFIG_DCSTR_DEMUXER 0 -%define CONFIG_DFA_DEMUXER 0 -%define CONFIG_DIRAC_DEMUXER 0 -%define CONFIG_DNXHD_DEMUXER 0 -%define CONFIG_DSF_DEMUXER 0 -%define CONFIG_DSICIN_DEMUXER 0 -%define CONFIG_DSS_DEMUXER 0 -%define CONFIG_DTS_DEMUXER 0 -%define CONFIG_DTSHD_DEMUXER 0 -%define CONFIG_DV_DEMUXER 0 -%define CONFIG_DVBSUB_DEMUXER 0 -%define CONFIG_DVBTXT_DEMUXER 0 -%define CONFIG_DXA_DEMUXER 0 -%define CONFIG_EA_DEMUXER 0 -%define CONFIG_EA_CDATA_DEMUXER 0 -%define CONFIG_EAC3_DEMUXER 0 -%define CONFIG_EPAF_DEMUXER 0 -%define CONFIG_FFM_DEMUXER 0 -%define CONFIG_FFMETADATA_DEMUXER 0 -%define CONFIG_FILMSTRIP_DEMUXER 0 -%define CONFIG_FITS_DEMUXER 0 -%define CONFIG_FLAC_DEMUXER 0 -%define CONFIG_FLIC_DEMUXER 0 -%define CONFIG_FLV_DEMUXER 0 -%define CONFIG_LIVE_FLV_DEMUXER 0 -%define CONFIG_FOURXM_DEMUXER 0 -%define CONFIG_FRM_DEMUXER 0 -%define CONFIG_FSB_DEMUXER 0 -%define CONFIG_G722_DEMUXER 0 -%define CONFIG_G723_1_DEMUXER 0 -%define CONFIG_G726_DEMUXER 0 -%define CONFIG_G726LE_DEMUXER 0 -%define CONFIG_G729_DEMUXER 0 -%define CONFIG_GDV_DEMUXER 0 -%define CONFIG_GENH_DEMUXER 0 -%define CONFIG_GIF_DEMUXER 0 -%define CONFIG_GSM_DEMUXER 0 -%define CONFIG_GXF_DEMUXER 0 -%define CONFIG_H261_DEMUXER 0 -%define CONFIG_H263_DEMUXER 0 -%define CONFIG_H264_DEMUXER 0 -%define CONFIG_HEVC_DEMUXER 0 -%define CONFIG_HLS_DEMUXER 0 -%define CONFIG_HNM_DEMUXER 0 -%define CONFIG_ICO_DEMUXER 0 -%define CONFIG_IDCIN_DEMUXER 0 -%define CONFIG_IDF_DEMUXER 0 -%define CONFIG_IFF_DEMUXER 0 -%define CONFIG_ILBC_DEMUXER 0 -%define CONFIG_IMAGE2_DEMUXER 0 -%define CONFIG_IMAGE2PIPE_DEMUXER 0 -%define CONFIG_IMAGE2_ALIAS_PIX_DEMUXER 0 -%define CONFIG_IMAGE2_BRENDER_PIX_DEMUXER 0 -%define CONFIG_INGENIENT_DEMUXER 0 -%define CONFIG_IPMOVIE_DEMUXER 0 -%define CONFIG_IRCAM_DEMUXER 0 -%define CONFIG_ISS_DEMUXER 0 -%define CONFIG_IV8_DEMUXER 0 -%define CONFIG_IVF_DEMUXER 0 -%define CONFIG_IVR_DEMUXER 0 -%define CONFIG_JACOSUB_DEMUXER 0 -%define CONFIG_JV_DEMUXER 0 -%define CONFIG_LMLM4_DEMUXER 0 -%define CONFIG_LOAS_DEMUXER 0 -%define CONFIG_LRC_DEMUXER 0 -%define CONFIG_LVF_DEMUXER 0 -%define CONFIG_LXF_DEMUXER 0 -%define CONFIG_M4V_DEMUXER 0 -%define CONFIG_MATROSKA_DEMUXER 0 -%define CONFIG_MGSTS_DEMUXER 0 -%define CONFIG_MICRODVD_DEMUXER 0 -%define CONFIG_MJPEG_DEMUXER 0 -%define CONFIG_MJPEG_2000_DEMUXER 0 -%define CONFIG_MLP_DEMUXER 0 -%define CONFIG_MLV_DEMUXER 0 -%define CONFIG_MM_DEMUXER 0 -%define CONFIG_MMF_DEMUXER 0 -%define CONFIG_MOV_DEMUXER 0 -%define CONFIG_MP3_DEMUXER 0 -%define CONFIG_MPC_DEMUXER 0 -%define CONFIG_MPC8_DEMUXER 0 -%define CONFIG_MPEGPS_DEMUXER 0 -%define CONFIG_MPEGTS_DEMUXER 0 -%define CONFIG_MPEGTSRAW_DEMUXER 0 -%define CONFIG_MPEGVIDEO_DEMUXER 0 -%define CONFIG_MPJPEG_DEMUXER 0 -%define CONFIG_MPL2_DEMUXER 0 -%define CONFIG_MPSUB_DEMUXER 0 -%define CONFIG_MSF_DEMUXER 0 -%define CONFIG_MSNWC_TCP_DEMUXER 0 -%define CONFIG_MTAF_DEMUXER 0 -%define CONFIG_MTV_DEMUXER 0 -%define CONFIG_MUSX_DEMUXER 0 -%define CONFIG_MV_DEMUXER 0 -%define CONFIG_MVI_DEMUXER 0 -%define CONFIG_MXF_DEMUXER 0 -%define CONFIG_MXG_DEMUXER 0 -%define CONFIG_NC_DEMUXER 0 -%define CONFIG_NISTSPHERE_DEMUXER 0 -%define CONFIG_NSV_DEMUXER 0 -%define CONFIG_NUT_DEMUXER 0 -%define CONFIG_NUV_DEMUXER 0 -%define CONFIG_OGG_DEMUXER 0 -%define CONFIG_OMA_DEMUXER 0 -%define CONFIG_PAF_DEMUXER 0 -%define CONFIG_PCM_ALAW_DEMUXER 0 -%define CONFIG_PCM_MULAW_DEMUXER 0 -%define CONFIG_PCM_F64BE_DEMUXER 0 -%define CONFIG_PCM_F64LE_DEMUXER 0 -%define CONFIG_PCM_F32BE_DEMUXER 0 -%define CONFIG_PCM_F32LE_DEMUXER 0 -%define CONFIG_PCM_S32BE_DEMUXER 0 -%define CONFIG_PCM_S32LE_DEMUXER 0 -%define CONFIG_PCM_S24BE_DEMUXER 0 -%define CONFIG_PCM_S24LE_DEMUXER 0 -%define CONFIG_PCM_S16BE_DEMUXER 0 -%define CONFIG_PCM_S16LE_DEMUXER 0 -%define CONFIG_PCM_S8_DEMUXER 0 -%define CONFIG_PCM_U32BE_DEMUXER 0 -%define CONFIG_PCM_U32LE_DEMUXER 0 -%define CONFIG_PCM_U24BE_DEMUXER 0 -%define CONFIG_PCM_U24LE_DEMUXER 0 -%define CONFIG_PCM_U16BE_DEMUXER 0 -%define CONFIG_PCM_U16LE_DEMUXER 0 -%define CONFIG_PCM_U8_DEMUXER 0 -%define CONFIG_PJS_DEMUXER 0 -%define CONFIG_PMP_DEMUXER 0 -%define CONFIG_PVA_DEMUXER 0 -%define CONFIG_PVF_DEMUXER 0 -%define CONFIG_QCP_DEMUXER 0 -%define CONFIG_R3D_DEMUXER 0 -%define CONFIG_RAWVIDEO_DEMUXER 0 -%define CONFIG_REALTEXT_DEMUXER 0 -%define CONFIG_REDSPARK_DEMUXER 0 -%define CONFIG_RL2_DEMUXER 0 -%define CONFIG_RM_DEMUXER 0 -%define CONFIG_ROQ_DEMUXER 0 -%define CONFIG_RPL_DEMUXER 0 -%define CONFIG_RSD_DEMUXER 0 -%define CONFIG_RSO_DEMUXER 0 -%define CONFIG_RTP_DEMUXER 0 -%define CONFIG_RTSP_DEMUXER 0 -%define CONFIG_S337M_DEMUXER 0 -%define CONFIG_SAMI_DEMUXER 0 -%define CONFIG_SAP_DEMUXER 0 -%define CONFIG_SBG_DEMUXER 0 -%define CONFIG_SCC_DEMUXER 0 -%define CONFIG_SDP_DEMUXER 0 -%define CONFIG_SDR2_DEMUXER 0 -%define CONFIG_SDS_DEMUXER 0 -%define CONFIG_SDX_DEMUXER 0 -%define CONFIG_SEGAFILM_DEMUXER 0 -%define CONFIG_SHORTEN_DEMUXER 0 -%define CONFIG_SIFF_DEMUXER 0 -%define CONFIG_SLN_DEMUXER 0 -%define CONFIG_SMACKER_DEMUXER 0 -%define CONFIG_SMJPEG_DEMUXER 0 -%define CONFIG_SMUSH_DEMUXER 0 -%define CONFIG_SOL_DEMUXER 0 -%define CONFIG_SOX_DEMUXER 0 -%define CONFIG_SPDIF_DEMUXER 0 -%define CONFIG_SRT_DEMUXER 0 -%define CONFIG_STR_DEMUXER 0 -%define CONFIG_STL_DEMUXER 0 -%define CONFIG_SUBVIEWER1_DEMUXER 0 -%define CONFIG_SUBVIEWER_DEMUXER 0 -%define CONFIG_SUP_DEMUXER 0 -%define CONFIG_SVAG_DEMUXER 0 -%define CONFIG_SWF_DEMUXER 0 -%define CONFIG_TAK_DEMUXER 0 -%define CONFIG_TEDCAPTIONS_DEMUXER 0 -%define CONFIG_THP_DEMUXER 0 -%define CONFIG_THREEDOSTR_DEMUXER 0 -%define CONFIG_TIERTEXSEQ_DEMUXER 0 -%define CONFIG_TMV_DEMUXER 0 -%define CONFIG_TRUEHD_DEMUXER 0 -%define CONFIG_TTA_DEMUXER 0 -%define CONFIG_TXD_DEMUXER 0 -%define CONFIG_TTY_DEMUXER 0 -%define CONFIG_V210_DEMUXER 0 -%define CONFIG_V210X_DEMUXER 0 -%define CONFIG_VAG_DEMUXER 0 -%define CONFIG_VC1_DEMUXER 0 -%define CONFIG_VC1T_DEMUXER 0 -%define CONFIG_VIVO_DEMUXER 0 -%define CONFIG_VMD_DEMUXER 0 -%define CONFIG_VOBSUB_DEMUXER 0 -%define CONFIG_VOC_DEMUXER 0 -%define CONFIG_VPK_DEMUXER 0 -%define CONFIG_VPLAYER_DEMUXER 0 -%define CONFIG_VQF_DEMUXER 0 -%define CONFIG_W64_DEMUXER 0 -%define CONFIG_WAV_DEMUXER 0 -%define CONFIG_WC3_DEMUXER 0 -%define CONFIG_WEBM_DASH_MANIFEST_DEMUXER 0 -%define CONFIG_WEBVTT_DEMUXER 0 -%define CONFIG_WSAUD_DEMUXER 0 -%define CONFIG_WSD_DEMUXER 0 -%define CONFIG_WSVQA_DEMUXER 0 -%define CONFIG_WTV_DEMUXER 0 -%define CONFIG_WVE_DEMUXER 0 -%define CONFIG_WV_DEMUXER 0 -%define CONFIG_XA_DEMUXER 0 -%define CONFIG_XBIN_DEMUXER 0 -%define CONFIG_XMV_DEMUXER 0 -%define CONFIG_XVAG_DEMUXER 0 -%define CONFIG_XWMA_DEMUXER 0 -%define CONFIG_YOP_DEMUXER 0 -%define CONFIG_YUV4MPEGPIPE_DEMUXER 0 -%define CONFIG_IMAGE_BMP_PIPE_DEMUXER 0 -%define CONFIG_IMAGE_DDS_PIPE_DEMUXER 0 -%define CONFIG_IMAGE_DPX_PIPE_DEMUXER 0 -%define CONFIG_IMAGE_EXR_PIPE_DEMUXER 0 -%define CONFIG_IMAGE_J2K_PIPE_DEMUXER 0 -%define CONFIG_IMAGE_JPEG_PIPE_DEMUXER 0 -%define CONFIG_IMAGE_JPEGLS_PIPE_DEMUXER 0 -%define CONFIG_IMAGE_PAM_PIPE_DEMUXER 0 -%define CONFIG_IMAGE_PBM_PIPE_DEMUXER 0 -%define CONFIG_IMAGE_PCX_PIPE_DEMUXER 0 -%define CONFIG_IMAGE_PGMYUV_PIPE_DEMUXER 0 -%define CONFIG_IMAGE_PGM_PIPE_DEMUXER 0 -%define CONFIG_IMAGE_PICTOR_PIPE_DEMUXER 0 -%define CONFIG_IMAGE_PNG_PIPE_DEMUXER 0 -%define CONFIG_IMAGE_PPM_PIPE_DEMUXER 0 -%define CONFIG_IMAGE_PSD_PIPE_DEMUXER 0 -%define CONFIG_IMAGE_QDRAW_PIPE_DEMUXER 0 -%define CONFIG_IMAGE_SGI_PIPE_DEMUXER 0 -%define CONFIG_IMAGE_SVG_PIPE_DEMUXER 0 -%define CONFIG_IMAGE_SUNRAST_PIPE_DEMUXER 0 -%define CONFIG_IMAGE_TIFF_PIPE_DEMUXER 0 -%define CONFIG_IMAGE_WEBP_PIPE_DEMUXER 0 -%define CONFIG_IMAGE_XPM_PIPE_DEMUXER 0 -%define CONFIG_LIBGME_DEMUXER 0 -%define CONFIG_LIBMODPLUG_DEMUXER 0 -%define CONFIG_LIBOPENMPT_DEMUXER 0 -%define CONFIG_A64MULTI_ENCODER 0 -%define CONFIG_A64MULTI5_ENCODER 0 -%define CONFIG_ALIAS_PIX_ENCODER 0 -%define CONFIG_AMV_ENCODER 0 -%define CONFIG_APNG_ENCODER 0 -%define CONFIG_ASV1_ENCODER 0 -%define CONFIG_ASV2_ENCODER 0 -%define CONFIG_AVRP_ENCODER 0 -%define CONFIG_AVUI_ENCODER 0 -%define CONFIG_AYUV_ENCODER 0 -%define CONFIG_BMP_ENCODER 0 -%define CONFIG_CINEPAK_ENCODER 0 -%define CONFIG_CLJR_ENCODER 0 -%define CONFIG_COMFORTNOISE_ENCODER 0 -%define CONFIG_DNXHD_ENCODER 0 -%define CONFIG_DPX_ENCODER 0 -%define CONFIG_DVVIDEO_ENCODER 0 -%define CONFIG_FFV1_ENCODER 0 -%define CONFIG_FFVHUFF_ENCODER 0 -%define CONFIG_FITS_ENCODER 0 -%define CONFIG_FLASHSV_ENCODER 0 -%define CONFIG_FLASHSV2_ENCODER 0 -%define CONFIG_FLV_ENCODER 0 -%define CONFIG_GIF_ENCODER 0 -%define CONFIG_H261_ENCODER 0 -%define CONFIG_H263_ENCODER 0 -%define CONFIG_H263P_ENCODER 0 -%define CONFIG_HAP_ENCODER 0 -%define CONFIG_HUFFYUV_ENCODER 0 -%define CONFIG_JPEG2000_ENCODER 0 -%define CONFIG_JPEGLS_ENCODER 0 -%define CONFIG_LJPEG_ENCODER 0 -%define CONFIG_MJPEG_ENCODER 0 -%define CONFIG_MPEG1VIDEO_ENCODER 0 -%define CONFIG_MPEG2VIDEO_ENCODER 0 -%define CONFIG_MPEG4_ENCODER 0 -%define CONFIG_MSMPEG4V2_ENCODER 0 -%define CONFIG_MSMPEG4V3_ENCODER 0 -%define CONFIG_MSVIDEO1_ENCODER 0 -%define CONFIG_PAM_ENCODER 0 -%define CONFIG_PBM_ENCODER 0 -%define CONFIG_PCX_ENCODER 0 -%define CONFIG_PGM_ENCODER 0 -%define CONFIG_PGMYUV_ENCODER 0 -%define CONFIG_PNG_ENCODER 0 -%define CONFIG_PPM_ENCODER 0 -%define CONFIG_PRORES_ENCODER 0 -%define CONFIG_PRORES_AW_ENCODER 0 -%define CONFIG_PRORES_KS_ENCODER 0 -%define CONFIG_QTRLE_ENCODER 0 -%define CONFIG_R10K_ENCODER 0 -%define CONFIG_R210_ENCODER 0 -%define CONFIG_RAWVIDEO_ENCODER 0 -%define CONFIG_ROQ_ENCODER 0 -%define CONFIG_RV10_ENCODER 0 -%define CONFIG_RV20_ENCODER 0 -%define CONFIG_S302M_ENCODER 0 -%define CONFIG_SGI_ENCODER 0 -%define CONFIG_SNOW_ENCODER 0 -%define CONFIG_SUNRAST_ENCODER 0 -%define CONFIG_SVQ1_ENCODER 0 -%define CONFIG_TARGA_ENCODER 0 -%define CONFIG_TIFF_ENCODER 0 -%define CONFIG_UTVIDEO_ENCODER 0 -%define CONFIG_V210_ENCODER 0 -%define CONFIG_V308_ENCODER 0 -%define CONFIG_V408_ENCODER 0 -%define CONFIG_V410_ENCODER 0 -%define CONFIG_VC2_ENCODER 0 -%define CONFIG_WRAPPED_AVFRAME_ENCODER 0 -%define CONFIG_WMV1_ENCODER 0 -%define CONFIG_WMV2_ENCODER 0 -%define CONFIG_XBM_ENCODER 0 -%define CONFIG_XFACE_ENCODER 0 -%define CONFIG_XWD_ENCODER 0 -%define CONFIG_Y41P_ENCODER 0 -%define CONFIG_YUV4_ENCODER 0 -%define CONFIG_ZLIB_ENCODER 0 -%define CONFIG_ZMBV_ENCODER 0 -%define CONFIG_AAC_ENCODER 0 -%define CONFIG_AC3_ENCODER 0 -%define CONFIG_AC3_FIXED_ENCODER 0 -%define CONFIG_ALAC_ENCODER 0 -%define CONFIG_DCA_ENCODER 0 -%define CONFIG_EAC3_ENCODER 0 -%define CONFIG_FLAC_ENCODER 0 -%define CONFIG_G723_1_ENCODER 0 -%define CONFIG_MLP_ENCODER 0 -%define CONFIG_MP2_ENCODER 0 -%define CONFIG_MP2FIXED_ENCODER 0 -%define CONFIG_NELLYMOSER_ENCODER 0 -%define CONFIG_OPUS_ENCODER 0 -%define CONFIG_RA_144_ENCODER 0 -%define CONFIG_SONIC_ENCODER 0 -%define CONFIG_SONIC_LS_ENCODER 0 -%define CONFIG_TRUEHD_ENCODER 0 -%define CONFIG_TTA_ENCODER 0 -%define CONFIG_VORBIS_ENCODER 0 -%define CONFIG_WAVPACK_ENCODER 0 -%define CONFIG_WMAV1_ENCODER 0 -%define CONFIG_WMAV2_ENCODER 0 -%define CONFIG_PCM_ALAW_ENCODER 0 -%define CONFIG_PCM_F32BE_ENCODER 0 -%define CONFIG_PCM_F32LE_ENCODER 0 -%define CONFIG_PCM_F64BE_ENCODER 0 -%define CONFIG_PCM_F64LE_ENCODER 0 -%define CONFIG_PCM_MULAW_ENCODER 0 -%define CONFIG_PCM_S8_ENCODER 0 -%define CONFIG_PCM_S8_PLANAR_ENCODER 0 -%define CONFIG_PCM_S16BE_ENCODER 0 -%define CONFIG_PCM_S16BE_PLANAR_ENCODER 0 -%define CONFIG_PCM_S16LE_ENCODER 0 -%define CONFIG_PCM_S16LE_PLANAR_ENCODER 0 -%define CONFIG_PCM_S24BE_ENCODER 0 -%define CONFIG_PCM_S24DAUD_ENCODER 0 -%define CONFIG_PCM_S24LE_ENCODER 0 -%define CONFIG_PCM_S24LE_PLANAR_ENCODER 0 -%define CONFIG_PCM_S32BE_ENCODER 0 -%define CONFIG_PCM_S32LE_ENCODER 0 -%define CONFIG_PCM_S32LE_PLANAR_ENCODER 0 -%define CONFIG_PCM_S64BE_ENCODER 0 -%define CONFIG_PCM_S64LE_ENCODER 0 -%define CONFIG_PCM_U8_ENCODER 0 -%define CONFIG_PCM_U16BE_ENCODER 0 -%define CONFIG_PCM_U16LE_ENCODER 0 -%define CONFIG_PCM_U24BE_ENCODER 0 -%define CONFIG_PCM_U24LE_ENCODER 0 -%define CONFIG_PCM_U32BE_ENCODER 0 -%define CONFIG_PCM_U32LE_ENCODER 0 -%define CONFIG_ROQ_DPCM_ENCODER 0 -%define CONFIG_ADPCM_ADX_ENCODER 0 -%define CONFIG_ADPCM_G722_ENCODER 0 -%define CONFIG_ADPCM_G726_ENCODER 0 -%define CONFIG_ADPCM_G726LE_ENCODER 0 -%define CONFIG_ADPCM_IMA_QT_ENCODER 0 -%define CONFIG_ADPCM_IMA_WAV_ENCODER 0 -%define CONFIG_ADPCM_MS_ENCODER 0 -%define CONFIG_ADPCM_SWF_ENCODER 0 -%define CONFIG_ADPCM_YAMAHA_ENCODER 0 -%define CONFIG_SSA_ENCODER 0 -%define CONFIG_ASS_ENCODER 0 -%define CONFIG_DVBSUB_ENCODER 0 -%define CONFIG_DVDSUB_ENCODER 0 -%define CONFIG_MOVTEXT_ENCODER 0 -%define CONFIG_SRT_ENCODER 0 -%define CONFIG_SUBRIP_ENCODER 0 -%define CONFIG_TEXT_ENCODER 0 -%define CONFIG_WEBVTT_ENCODER 0 -%define CONFIG_XSUB_ENCODER 0 -%define CONFIG_AAC_AT_ENCODER 0 -%define CONFIG_ALAC_AT_ENCODER 0 -%define CONFIG_ILBC_AT_ENCODER 0 -%define CONFIG_PCM_ALAW_AT_ENCODER 0 -%define CONFIG_PCM_MULAW_AT_ENCODER 0 -%define CONFIG_LIBFDK_AAC_ENCODER 0 -%define CONFIG_LIBGSM_ENCODER 0 -%define CONFIG_LIBGSM_MS_ENCODER 0 -%define CONFIG_LIBILBC_ENCODER 0 -%define CONFIG_LIBMP3LAME_ENCODER 0 -%define CONFIG_LIBOPENCORE_AMRNB_ENCODER 0 -%define CONFIG_LIBOPENJPEG_ENCODER 0 -%define CONFIG_LIBOPUS_ENCODER 0 -%define CONFIG_LIBSHINE_ENCODER 0 -%define CONFIG_LIBSPEEX_ENCODER 0 -%define CONFIG_LIBTHEORA_ENCODER 0 -%define CONFIG_LIBTWOLAME_ENCODER 0 -%define CONFIG_LIBVO_AMRWBENC_ENCODER 0 -%define CONFIG_LIBVORBIS_ENCODER 0 -%define CONFIG_LIBVPX_VP8_ENCODER 0 -%define CONFIG_LIBVPX_VP9_ENCODER 0 -%define CONFIG_LIBWAVPACK_ENCODER 0 -%define CONFIG_LIBWEBP_ANIM_ENCODER 0 -%define CONFIG_LIBWEBP_ENCODER 0 -%define CONFIG_LIBX262_ENCODER 0 -%define CONFIG_LIBX264_ENCODER 0 -%define CONFIG_LIBX264RGB_ENCODER 0 -%define CONFIG_LIBX265_ENCODER 0 -%define CONFIG_LIBXAVS_ENCODER 0 -%define CONFIG_LIBXVID_ENCODER 0 -%define CONFIG_H263_V4L2M2M_ENCODER 0 -%define CONFIG_LIBOPENH264_ENCODER 0 -%define CONFIG_H264_NVENC_ENCODER 0 -%define CONFIG_H264_OMX_ENCODER 0 -%define CONFIG_H264_QSV_ENCODER 0 -%define CONFIG_H264_V4L2M2M_ENCODER 0 -%define CONFIG_H264_VAAPI_ENCODER 0 -%define CONFIG_H264_VIDEOTOOLBOX_ENCODER 0 -%define CONFIG_NVENC_ENCODER 0 -%define CONFIG_NVENC_H264_ENCODER 0 -%define CONFIG_NVENC_HEVC_ENCODER 0 -%define CONFIG_HEVC_NVENC_ENCODER 0 -%define CONFIG_HEVC_QSV_ENCODER 0 -%define CONFIG_HEVC_V4L2M2M_ENCODER 0 -%define CONFIG_HEVC_VAAPI_ENCODER 0 -%define CONFIG_LIBKVAZAAR_ENCODER 0 -%define CONFIG_MJPEG_VAAPI_ENCODER 0 -%define CONFIG_MPEG2_QSV_ENCODER 0 -%define CONFIG_MPEG2_VAAPI_ENCODER 0 -%define CONFIG_MPEG4_V4L2M2M_ENCODER 0 -%define CONFIG_VP8_V4L2M2M_ENCODER 0 -%define CONFIG_VP8_VAAPI_ENCODER 0 -%define CONFIG_VP9_VAAPI_ENCODER 0 -%define CONFIG_ABENCH_FILTER 0 -%define CONFIG_ACOMPRESSOR_FILTER 0 -%define CONFIG_ACOPY_FILTER 0 -%define CONFIG_ACROSSFADE_FILTER 0 -%define CONFIG_ACRUSHER_FILTER 0 -%define CONFIG_ADELAY_FILTER 0 -%define CONFIG_AECHO_FILTER 0 -%define CONFIG_AEMPHASIS_FILTER 0 -%define CONFIG_AEVAL_FILTER 0 -%define CONFIG_AFADE_FILTER 0 -%define CONFIG_AFFTFILT_FILTER 0 -%define CONFIG_AFIR_FILTER 0 -%define CONFIG_AFORMAT_FILTER 0 -%define CONFIG_AGATE_FILTER 0 -%define CONFIG_AINTERLEAVE_FILTER 0 -%define CONFIG_ALIMITER_FILTER 0 -%define CONFIG_ALLPASS_FILTER 0 -%define CONFIG_ALOOP_FILTER 0 -%define CONFIG_AMERGE_FILTER 0 -%define CONFIG_AMETADATA_FILTER 0 -%define CONFIG_AMIX_FILTER 0 -%define CONFIG_ANEQUALIZER_FILTER 0 -%define CONFIG_ANULL_FILTER 0 -%define CONFIG_APAD_FILTER 0 -%define CONFIG_APERMS_FILTER 0 -%define CONFIG_APHASER_FILTER 0 -%define CONFIG_APULSATOR_FILTER 0 -%define CONFIG_AREALTIME_FILTER 0 -%define CONFIG_ARESAMPLE_FILTER 0 -%define CONFIG_AREVERSE_FILTER 0 -%define CONFIG_ASELECT_FILTER 0 -%define CONFIG_ASENDCMD_FILTER 0 -%define CONFIG_ASETNSAMPLES_FILTER 0 -%define CONFIG_ASETPTS_FILTER 0 -%define CONFIG_ASETRATE_FILTER 0 -%define CONFIG_ASETTB_FILTER 0 -%define CONFIG_ASHOWINFO_FILTER 0 -%define CONFIG_ASIDEDATA_FILTER 0 -%define CONFIG_ASPLIT_FILTER 0 -%define CONFIG_ASTATS_FILTER 0 -%define CONFIG_ASTREAMSELECT_FILTER 0 -%define CONFIG_ATEMPO_FILTER 0 -%define CONFIG_ATRIM_FILTER 0 -%define CONFIG_AZMQ_FILTER 0 -%define CONFIG_BANDPASS_FILTER 0 -%define CONFIG_BANDREJECT_FILTER 0 -%define CONFIG_BASS_FILTER 0 -%define CONFIG_BIQUAD_FILTER 0 -%define CONFIG_BS2B_FILTER 0 -%define CONFIG_CHANNELMAP_FILTER 0 -%define CONFIG_CHANNELSPLIT_FILTER 0 -%define CONFIG_CHORUS_FILTER 0 -%define CONFIG_COMPAND_FILTER 0 -%define CONFIG_COMPENSATIONDELAY_FILTER 0 -%define CONFIG_CROSSFEED_FILTER 0 -%define CONFIG_CRYSTALIZER_FILTER 0 -%define CONFIG_DCSHIFT_FILTER 0 -%define CONFIG_DYNAUDNORM_FILTER 0 -%define CONFIG_EARWAX_FILTER 0 -%define CONFIG_EBUR128_FILTER 0 -%define CONFIG_EQUALIZER_FILTER 0 -%define CONFIG_EXTRASTEREO_FILTER 0 -%define CONFIG_FIREQUALIZER_FILTER 0 -%define CONFIG_FLANGER_FILTER 0 -%define CONFIG_HAAS_FILTER 0 -%define CONFIG_HDCD_FILTER 0 -%define CONFIG_HEADPHONE_FILTER 0 -%define CONFIG_HIGHPASS_FILTER 0 -%define CONFIG_JOIN_FILTER 0 -%define CONFIG_LADSPA_FILTER 0 -%define CONFIG_LOUDNORM_FILTER 0 -%define CONFIG_LOWPASS_FILTER 0 -%define CONFIG_PAN_FILTER 0 -%define CONFIG_REPLAYGAIN_FILTER 0 -%define CONFIG_RESAMPLE_FILTER 0 -%define CONFIG_RUBBERBAND_FILTER 0 -%define CONFIG_SIDECHAINCOMPRESS_FILTER 0 -%define CONFIG_SIDECHAINGATE_FILTER 0 -%define CONFIG_SILENCEDETECT_FILTER 0 -%define CONFIG_SILENCEREMOVE_FILTER 0 -%define CONFIG_SOFALIZER_FILTER 0 -%define CONFIG_STEREOTOOLS_FILTER 0 -%define CONFIG_STEREOWIDEN_FILTER 0 -%define CONFIG_SUPEREQUALIZER_FILTER 0 -%define CONFIG_SURROUND_FILTER 0 -%define CONFIG_TREBLE_FILTER 0 -%define CONFIG_TREMOLO_FILTER 0 -%define CONFIG_VIBRATO_FILTER 0 -%define CONFIG_VOLUME_FILTER 0 -%define CONFIG_VOLUMEDETECT_FILTER 0 -%define CONFIG_AEVALSRC_FILTER 0 -%define CONFIG_ANOISESRC_FILTER 0 -%define CONFIG_ANULLSRC_FILTER 0 -%define CONFIG_FLITE_FILTER 0 -%define CONFIG_SINE_FILTER 0 -%define CONFIG_ANULLSINK_FILTER 0 -%define CONFIG_ALPHAEXTRACT_FILTER 0 -%define CONFIG_ALPHAMERGE_FILTER 0 -%define CONFIG_ASS_FILTER 0 -%define CONFIG_ATADENOISE_FILTER 0 -%define CONFIG_AVGBLUR_FILTER 0 -%define CONFIG_BBOX_FILTER 0 -%define CONFIG_BENCH_FILTER 0 -%define CONFIG_BITPLANENOISE_FILTER 0 -%define CONFIG_BLACKDETECT_FILTER 0 -%define CONFIG_BLACKFRAME_FILTER 0 -%define CONFIG_BLEND_FILTER 0 -%define CONFIG_BOXBLUR_FILTER 0 -%define CONFIG_BWDIF_FILTER 0 -%define CONFIG_CHROMAKEY_FILTER 0 -%define CONFIG_CIESCOPE_FILTER 0 -%define CONFIG_CODECVIEW_FILTER 0 -%define CONFIG_COLORBALANCE_FILTER 0 -%define CONFIG_COLORCHANNELMIXER_FILTER 0 -%define CONFIG_COLORKEY_FILTER 0 -%define CONFIG_COLORLEVELS_FILTER 0 -%define CONFIG_COLORMATRIX_FILTER 0 -%define CONFIG_COLORSPACE_FILTER 0 -%define CONFIG_CONVOLUTION_FILTER 0 -%define CONFIG_CONVOLVE_FILTER 0 -%define CONFIG_COPY_FILTER 0 -%define CONFIG_COREIMAGE_FILTER 0 -%define CONFIG_COVER_RECT_FILTER 0 -%define CONFIG_CROP_FILTER 0 -%define CONFIG_CROPDETECT_FILTER 0 -%define CONFIG_CURVES_FILTER 0 -%define CONFIG_DATASCOPE_FILTER 0 -%define CONFIG_DCTDNOIZ_FILTER 0 -%define CONFIG_DEBAND_FILTER 0 -%define CONFIG_DECIMATE_FILTER 0 -%define CONFIG_DEFLATE_FILTER 0 -%define CONFIG_DEFLICKER_FILTER 0 -%define CONFIG_DEINTERLACE_QSV_FILTER 0 -%define CONFIG_DEINTERLACE_VAAPI_FILTER 0 -%define CONFIG_DEJUDDER_FILTER 0 -%define CONFIG_DELOGO_FILTER 0 -%define CONFIG_DESHAKE_FILTER 0 -%define CONFIG_DESPILL_FILTER 0 -%define CONFIG_DETELECINE_FILTER 0 -%define CONFIG_DILATION_FILTER 0 -%define CONFIG_DISPLACE_FILTER 0 -%define CONFIG_DOUBLEWEAVE_FILTER 0 -%define CONFIG_DRAWBOX_FILTER 0 -%define CONFIG_DRAWGRAPH_FILTER 0 -%define CONFIG_DRAWGRID_FILTER 0 -%define CONFIG_DRAWTEXT_FILTER 0 -%define CONFIG_EDGEDETECT_FILTER 0 -%define CONFIG_ELBG_FILTER 0 -%define CONFIG_EQ_FILTER 0 -%define CONFIG_EROSION_FILTER 0 -%define CONFIG_EXTRACTPLANES_FILTER 0 -%define CONFIG_FADE_FILTER 0 -%define CONFIG_FFTFILT_FILTER 0 -%define CONFIG_FIELD_FILTER 0 -%define CONFIG_FIELDHINT_FILTER 0 -%define CONFIG_FIELDMATCH_FILTER 0 -%define CONFIG_FIELDORDER_FILTER 0 -%define CONFIG_FIND_RECT_FILTER 0 -%define CONFIG_FLOODFILL_FILTER 0 -%define CONFIG_FORMAT_FILTER 0 -%define CONFIG_FPS_FILTER 0 -%define CONFIG_FRAMEPACK_FILTER 0 -%define CONFIG_FRAMERATE_FILTER 0 -%define CONFIG_FRAMESTEP_FILTER 0 -%define CONFIG_FREI0R_FILTER 0 -%define CONFIG_FSPP_FILTER 0 -%define CONFIG_GBLUR_FILTER 0 -%define CONFIG_GEQ_FILTER 0 -%define CONFIG_GRADFUN_FILTER 0 -%define CONFIG_HALDCLUT_FILTER 0 -%define CONFIG_HFLIP_FILTER 0 -%define CONFIG_HISTEQ_FILTER 0 -%define CONFIG_HISTOGRAM_FILTER 0 -%define CONFIG_HQDN3D_FILTER 0 -%define CONFIG_HQX_FILTER 0 -%define CONFIG_HSTACK_FILTER 0 -%define CONFIG_HUE_FILTER 0 -%define CONFIG_HWDOWNLOAD_FILTER 0 -%define CONFIG_HWMAP_FILTER 0 -%define CONFIG_HWUPLOAD_FILTER 0 -%define CONFIG_HWUPLOAD_CUDA_FILTER 0 -%define CONFIG_HYSTERESIS_FILTER 0 -%define CONFIG_IDET_FILTER 0 -%define CONFIG_IL_FILTER 0 -%define CONFIG_INFLATE_FILTER 0 -%define CONFIG_INTERLACE_FILTER 0 -%define CONFIG_INTERLEAVE_FILTER 0 -%define CONFIG_KERNDEINT_FILTER 0 -%define CONFIG_LENSCORRECTION_FILTER 0 -%define CONFIG_LIBVMAF_FILTER 0 -%define CONFIG_LIMITER_FILTER 0 -%define CONFIG_LOOP_FILTER 0 -%define CONFIG_LUMAKEY_FILTER 0 -%define CONFIG_LUT_FILTER 0 -%define CONFIG_LUT2_FILTER 0 -%define CONFIG_LUT3D_FILTER 0 -%define CONFIG_LUTRGB_FILTER 0 -%define CONFIG_LUTYUV_FILTER 0 -%define CONFIG_MASKEDCLAMP_FILTER 0 -%define CONFIG_MASKEDMERGE_FILTER 0 -%define CONFIG_MCDEINT_FILTER 0 -%define CONFIG_MERGEPLANES_FILTER 0 -%define CONFIG_MESTIMATE_FILTER 0 -%define CONFIG_METADATA_FILTER 0 -%define CONFIG_MIDEQUALIZER_FILTER 0 -%define CONFIG_MINTERPOLATE_FILTER 0 -%define CONFIG_MPDECIMATE_FILTER 0 -%define CONFIG_NEGATE_FILTER 0 -%define CONFIG_NLMEANS_FILTER 0 -%define CONFIG_NNEDI_FILTER 0 -%define CONFIG_NOFORMAT_FILTER 0 -%define CONFIG_NOISE_FILTER 0 -%define CONFIG_NULL_FILTER 0 -%define CONFIG_OCR_FILTER 0 -%define CONFIG_OCV_FILTER 0 -%define CONFIG_OSCILLOSCOPE_FILTER 0 -%define CONFIG_OVERLAY_FILTER 0 -%define CONFIG_OWDENOISE_FILTER 0 -%define CONFIG_PAD_FILTER 0 -%define CONFIG_PALETTEGEN_FILTER 0 -%define CONFIG_PALETTEUSE_FILTER 0 -%define CONFIG_PERMS_FILTER 0 -%define CONFIG_PERSPECTIVE_FILTER 0 -%define CONFIG_PHASE_FILTER 0 -%define CONFIG_PIXDESCTEST_FILTER 0 -%define CONFIG_PIXSCOPE_FILTER 0 -%define CONFIG_PP_FILTER 0 -%define CONFIG_PP7_FILTER 0 -%define CONFIG_PREMULTIPLY_FILTER 0 -%define CONFIG_PREWITT_FILTER 0 -%define CONFIG_PSEUDOCOLOR_FILTER 0 -%define CONFIG_PSNR_FILTER 0 -%define CONFIG_PULLUP_FILTER 0 -%define CONFIG_QP_FILTER 0 -%define CONFIG_RANDOM_FILTER 0 -%define CONFIG_READEIA608_FILTER 0 -%define CONFIG_READVITC_FILTER 0 -%define CONFIG_REALTIME_FILTER 0 -%define CONFIG_REMAP_FILTER 0 -%define CONFIG_REMOVEGRAIN_FILTER 0 -%define CONFIG_REMOVELOGO_FILTER 0 -%define CONFIG_REPEATFIELDS_FILTER 0 -%define CONFIG_REVERSE_FILTER 0 -%define CONFIG_ROBERTS_FILTER 0 -%define CONFIG_ROTATE_FILTER 0 -%define CONFIG_SAB_FILTER 0 -%define CONFIG_SCALE_FILTER 0 -%define CONFIG_SCALE_CUDA_FILTER 0 -%define CONFIG_SCALE_NPP_FILTER 0 -%define CONFIG_SCALE_QSV_FILTER 0 -%define CONFIG_SCALE_VAAPI_FILTER 0 -%define CONFIG_SCALE2REF_FILTER 0 -%define CONFIG_SELECT_FILTER 0 -%define CONFIG_SELECTIVECOLOR_FILTER 0 -%define CONFIG_SENDCMD_FILTER 0 -%define CONFIG_SEPARATEFIELDS_FILTER 0 -%define CONFIG_SETDAR_FILTER 0 -%define CONFIG_SETFIELD_FILTER 0 -%define CONFIG_SETPTS_FILTER 0 -%define CONFIG_SETSAR_FILTER 0 -%define CONFIG_SETTB_FILTER 0 -%define CONFIG_SHOWINFO_FILTER 0 -%define CONFIG_SHOWPALETTE_FILTER 0 -%define CONFIG_SHUFFLEFRAMES_FILTER 0 -%define CONFIG_SHUFFLEPLANES_FILTER 0 -%define CONFIG_SIDEDATA_FILTER 0 -%define CONFIG_SIGNALSTATS_FILTER 0 -%define CONFIG_SIGNATURE_FILTER 0 -%define CONFIG_SMARTBLUR_FILTER 0 -%define CONFIG_SOBEL_FILTER 0 -%define CONFIG_SPLIT_FILTER 0 -%define CONFIG_SPP_FILTER 0 -%define CONFIG_SSIM_FILTER 0 -%define CONFIG_STEREO3D_FILTER 0 -%define CONFIG_STREAMSELECT_FILTER 0 -%define CONFIG_SUBTITLES_FILTER 0 -%define CONFIG_SUPER2XSAI_FILTER 0 -%define CONFIG_SWAPRECT_FILTER 0 -%define CONFIG_SWAPUV_FILTER 0 -%define CONFIG_TBLEND_FILTER 0 -%define CONFIG_TELECINE_FILTER 0 -%define CONFIG_THRESHOLD_FILTER 0 -%define CONFIG_THUMBNAIL_FILTER 0 -%define CONFIG_THUMBNAIL_CUDA_FILTER 0 -%define CONFIG_TILE_FILTER 0 -%define CONFIG_TINTERLACE_FILTER 0 -%define CONFIG_TLUT2_FILTER 0 -%define CONFIG_TONEMAP_FILTER 0 -%define CONFIG_TRANSPOSE_FILTER 0 -%define CONFIG_TRIM_FILTER 0 -%define CONFIG_UNPREMULTIPLY_FILTER 0 -%define CONFIG_UNSHARP_FILTER 0 -%define CONFIG_USPP_FILTER 0 -%define CONFIG_VAGUEDENOISER_FILTER 0 -%define CONFIG_VECTORSCOPE_FILTER 0 -%define CONFIG_VFLIP_FILTER 0 -%define CONFIG_VIDSTABDETECT_FILTER 0 -%define CONFIG_VIDSTABTRANSFORM_FILTER 0 -%define CONFIG_VIGNETTE_FILTER 0 -%define CONFIG_VMAFMOTION_FILTER 0 -%define CONFIG_VSTACK_FILTER 0 -%define CONFIG_W3FDIF_FILTER 0 -%define CONFIG_WAVEFORM_FILTER 0 -%define CONFIG_WEAVE_FILTER 0 -%define CONFIG_XBR_FILTER 0 -%define CONFIG_YADIF_FILTER 0 -%define CONFIG_ZMQ_FILTER 0 -%define CONFIG_ZOOMPAN_FILTER 0 -%define CONFIG_ZSCALE_FILTER 0 -%define CONFIG_ALLRGB_FILTER 0 -%define CONFIG_ALLYUV_FILTER 0 -%define CONFIG_CELLAUTO_FILTER 0 -%define CONFIG_COLOR_FILTER 0 -%define CONFIG_COREIMAGESRC_FILTER 0 -%define CONFIG_FREI0R_SRC_FILTER 0 -%define CONFIG_HALDCLUTSRC_FILTER 0 -%define CONFIG_LIFE_FILTER 0 -%define CONFIG_MANDELBROT_FILTER 0 -%define CONFIG_MPTESTSRC_FILTER 0 -%define CONFIG_NULLSRC_FILTER 0 -%define CONFIG_RGBTESTSRC_FILTER 0 -%define CONFIG_SMPTEBARS_FILTER 0 -%define CONFIG_SMPTEHDBARS_FILTER 0 -%define CONFIG_TESTSRC_FILTER 0 -%define CONFIG_TESTSRC2_FILTER 0 -%define CONFIG_YUVTESTSRC_FILTER 0 -%define CONFIG_NULLSINK_FILTER 0 -%define CONFIG_ABITSCOPE_FILTER 0 -%define CONFIG_ADRAWGRAPH_FILTER 0 -%define CONFIG_AHISTOGRAM_FILTER 0 -%define CONFIG_APHASEMETER_FILTER 0 -%define CONFIG_AVECTORSCOPE_FILTER 0 -%define CONFIG_CONCAT_FILTER 0 -%define CONFIG_SHOWCQT_FILTER 0 -%define CONFIG_SHOWFREQS_FILTER 0 -%define CONFIG_SHOWSPECTRUM_FILTER 0 -%define CONFIG_SHOWSPECTRUMPIC_FILTER 0 -%define CONFIG_SHOWVOLUME_FILTER 0 -%define CONFIG_SHOWWAVES_FILTER 0 -%define CONFIG_SHOWWAVESPIC_FILTER 0 -%define CONFIG_SPECTRUMSYNTH_FILTER 0 -%define CONFIG_AMOVIE_FILTER 0 -%define CONFIG_MOVIE_FILTER 0 -%define CONFIG_H263_VAAPI_HWACCEL 0 -%define CONFIG_H263_VIDEOTOOLBOX_HWACCEL 0 -%define CONFIG_H264_CUVID_HWACCEL 0 -%define CONFIG_H264_D3D11VA_HWACCEL 0 -%define CONFIG_H264_D3D11VA2_HWACCEL 0 -%define CONFIG_H264_DXVA2_HWACCEL 0 -%define CONFIG_H264_MEDIACODEC_HWACCEL 0 -%define CONFIG_H264_MMAL_HWACCEL 0 -%define CONFIG_H264_QSV_HWACCEL 0 -%define CONFIG_H264_VAAPI_HWACCEL 0 -%define CONFIG_H264_VDA_HWACCEL 0 -%define CONFIG_H264_VDA_OLD_HWACCEL 0 -%define CONFIG_H264_VDPAU_HWACCEL 0 -%define CONFIG_H264_VIDEOTOOLBOX_HWACCEL 0 -%define CONFIG_HEVC_CUVID_HWACCEL 0 -%define CONFIG_HEVC_D3D11VA_HWACCEL 0 -%define CONFIG_HEVC_D3D11VA2_HWACCEL 0 -%define CONFIG_HEVC_DXVA2_HWACCEL 0 -%define CONFIG_HEVC_MEDIACODEC_HWACCEL 0 -%define CONFIG_HEVC_QSV_HWACCEL 0 -%define CONFIG_HEVC_VAAPI_HWACCEL 0 -%define CONFIG_HEVC_VDPAU_HWACCEL 0 -%define CONFIG_HEVC_VIDEOTOOLBOX_HWACCEL 0 -%define CONFIG_MJPEG_CUVID_HWACCEL 0 -%define CONFIG_MPEG1_CUVID_HWACCEL 0 -%define CONFIG_MPEG1_XVMC_HWACCEL 0 -%define CONFIG_MPEG1_VDPAU_HWACCEL 0 -%define CONFIG_MPEG1_VIDEOTOOLBOX_HWACCEL 0 -%define CONFIG_MPEG2_CUVID_HWACCEL 0 -%define CONFIG_MPEG2_XVMC_HWACCEL 0 -%define CONFIG_MPEG2_D3D11VA_HWACCEL 0 -%define CONFIG_MPEG2_D3D11VA2_HWACCEL 0 -%define CONFIG_MPEG2_DXVA2_HWACCEL 0 -%define CONFIG_MPEG2_MMAL_HWACCEL 0 -%define CONFIG_MPEG2_QSV_HWACCEL 0 -%define CONFIG_MPEG2_VAAPI_HWACCEL 0 -%define CONFIG_MPEG2_VDPAU_HWACCEL 0 -%define CONFIG_MPEG2_VIDEOTOOLBOX_HWACCEL 0 -%define CONFIG_MPEG2_MEDIACODEC_HWACCEL 0 -%define CONFIG_MPEG4_CUVID_HWACCEL 0 -%define CONFIG_MPEG4_MEDIACODEC_HWACCEL 0 -%define CONFIG_MPEG4_MMAL_HWACCEL 0 -%define CONFIG_MPEG4_VAAPI_HWACCEL 0 -%define CONFIG_MPEG4_VDPAU_HWACCEL 0 -%define CONFIG_MPEG4_VIDEOTOOLBOX_HWACCEL 0 -%define CONFIG_VC1_CUVID_HWACCEL 0 -%define CONFIG_VC1_D3D11VA_HWACCEL 0 -%define CONFIG_VC1_D3D11VA2_HWACCEL 0 -%define CONFIG_VC1_DXVA2_HWACCEL 0 -%define CONFIG_VC1_VAAPI_HWACCEL 0 -%define CONFIG_VC1_VDPAU_HWACCEL 0 -%define CONFIG_VC1_MMAL_HWACCEL 0 -%define CONFIG_VC1_QSV_HWACCEL 0 -%define CONFIG_VP8_CUVID_HWACCEL 0 -%define CONFIG_VP8_MEDIACODEC_HWACCEL 0 -%define CONFIG_VP8_QSV_HWACCEL 0 -%define CONFIG_VP9_CUVID_HWACCEL 0 -%define CONFIG_VP9_D3D11VA_HWACCEL 0 -%define CONFIG_VP9_D3D11VA2_HWACCEL 0 -%define CONFIG_VP9_DXVA2_HWACCEL 0 -%define CONFIG_VP9_MEDIACODEC_HWACCEL 0 -%define CONFIG_VP9_VAAPI_HWACCEL 0 -%define CONFIG_WMV3_D3D11VA_HWACCEL 0 -%define CONFIG_WMV3_D3D11VA2_HWACCEL 0 -%define CONFIG_WMV3_DXVA2_HWACCEL 0 -%define CONFIG_WMV3_VAAPI_HWACCEL 0 -%define CONFIG_WMV3_VDPAU_HWACCEL 0 -%define CONFIG_ALSA_INDEV 0 -%define CONFIG_AVFOUNDATION_INDEV 0 -%define CONFIG_BKTR_INDEV 0 -%define CONFIG_DECKLINK_INDEV 0 -%define CONFIG_LIBNDI_NEWTEK_INDEV 0 -%define CONFIG_DSHOW_INDEV 0 -%define CONFIG_FBDEV_INDEV 0 -%define CONFIG_GDIGRAB_INDEV 0 -%define CONFIG_IEC61883_INDEV 0 -%define CONFIG_JACK_INDEV 0 -%define CONFIG_KMSGRAB_INDEV 0 -%define CONFIG_LAVFI_INDEV 0 -%define CONFIG_OPENAL_INDEV 0 -%define CONFIG_OSS_INDEV 0 -%define CONFIG_PULSE_INDEV 0 -%define CONFIG_SNDIO_INDEV 0 -%define CONFIG_V4L2_INDEV 0 -%define CONFIG_VFWCAP_INDEV 0 -%define CONFIG_XCBGRAB_INDEV 0 -%define CONFIG_LIBCDIO_INDEV 0 -%define CONFIG_LIBDC1394_INDEV 0 -%define CONFIG_A64_MUXER 0 -%define CONFIG_AC3_MUXER 0 -%define CONFIG_ADTS_MUXER 0 -%define CONFIG_ADX_MUXER 0 -%define CONFIG_AIFF_MUXER 0 -%define CONFIG_AMR_MUXER 0 -%define CONFIG_APNG_MUXER 0 -%define CONFIG_ASF_MUXER 0 -%define CONFIG_ASS_MUXER 0 -%define CONFIG_AST_MUXER 0 -%define CONFIG_ASF_STREAM_MUXER 0 -%define CONFIG_AU_MUXER 0 -%define CONFIG_AVI_MUXER 0 -%define CONFIG_AVM2_MUXER 0 -%define CONFIG_BIT_MUXER 0 -%define CONFIG_CAF_MUXER 0 -%define CONFIG_CAVSVIDEO_MUXER 0 -%define CONFIG_CRC_MUXER 0 -%define CONFIG_DASH_MUXER 0 -%define CONFIG_DATA_MUXER 0 -%define CONFIG_DAUD_MUXER 0 -%define CONFIG_DIRAC_MUXER 0 -%define CONFIG_DNXHD_MUXER 0 -%define CONFIG_DTS_MUXER 0 -%define CONFIG_DV_MUXER 0 -%define CONFIG_EAC3_MUXER 0 -%define CONFIG_F4V_MUXER 0 -%define CONFIG_FFM_MUXER 0 -%define CONFIG_FFMETADATA_MUXER 0 -%define CONFIG_FIFO_MUXER 0 -%define CONFIG_FILMSTRIP_MUXER 0 -%define CONFIG_FITS_MUXER 0 -%define CONFIG_FLAC_MUXER 0 -%define CONFIG_FLV_MUXER 0 -%define CONFIG_FRAMECRC_MUXER 0 -%define CONFIG_FRAMEHASH_MUXER 0 -%define CONFIG_FRAMEMD5_MUXER 0 -%define CONFIG_G722_MUXER 0 -%define CONFIG_G723_1_MUXER 0 -%define CONFIG_G726_MUXER 0 -%define CONFIG_G726LE_MUXER 0 -%define CONFIG_GIF_MUXER 0 -%define CONFIG_GSM_MUXER 0 -%define CONFIG_GXF_MUXER 0 -%define CONFIG_H261_MUXER 0 -%define CONFIG_H263_MUXER 0 -%define CONFIG_H264_MUXER 0 -%define CONFIG_HASH_MUXER 0 -%define CONFIG_HDS_MUXER 0 -%define CONFIG_HEVC_MUXER 0 -%define CONFIG_HLS_MUXER 0 -%define CONFIG_ICO_MUXER 0 -%define CONFIG_ILBC_MUXER 0 -%define CONFIG_IMAGE2_MUXER 0 -%define CONFIG_IMAGE2PIPE_MUXER 0 -%define CONFIG_IPOD_MUXER 0 -%define CONFIG_IRCAM_MUXER 0 -%define CONFIG_ISMV_MUXER 0 -%define CONFIG_IVF_MUXER 0 -%define CONFIG_JACOSUB_MUXER 0 -%define CONFIG_LATM_MUXER 0 -%define CONFIG_LRC_MUXER 0 -%define CONFIG_M4V_MUXER 0 -%define CONFIG_MD5_MUXER 0 -%define CONFIG_MATROSKA_MUXER 0 -%define CONFIG_MATROSKA_AUDIO_MUXER 0 -%define CONFIG_MICRODVD_MUXER 0 -%define CONFIG_MJPEG_MUXER 0 -%define CONFIG_MLP_MUXER 0 -%define CONFIG_MMF_MUXER 0 -%define CONFIG_MOV_MUXER 0 -%define CONFIG_MP2_MUXER 0 -%define CONFIG_MP3_MUXER 0 -%define CONFIG_MP4_MUXER 0 -%define CONFIG_MPEG1SYSTEM_MUXER 0 -%define CONFIG_MPEG1VCD_MUXER 0 -%define CONFIG_MPEG1VIDEO_MUXER 0 -%define CONFIG_MPEG2DVD_MUXER 0 -%define CONFIG_MPEG2SVCD_MUXER 0 -%define CONFIG_MPEG2VIDEO_MUXER 0 -%define CONFIG_MPEG2VOB_MUXER 0 -%define CONFIG_MPEGTS_MUXER 0 -%define CONFIG_MPJPEG_MUXER 0 -%define CONFIG_MXF_MUXER 0 -%define CONFIG_MXF_D10_MUXER 0 -%define CONFIG_MXF_OPATOM_MUXER 0 -%define CONFIG_NULL_MUXER 0 -%define CONFIG_NUT_MUXER 0 -%define CONFIG_OGA_MUXER 0 -%define CONFIG_OGG_MUXER 0 -%define CONFIG_OGV_MUXER 0 -%define CONFIG_OMA_MUXER 0 -%define CONFIG_OPUS_MUXER 0 -%define CONFIG_PCM_ALAW_MUXER 0 -%define CONFIG_PCM_MULAW_MUXER 0 -%define CONFIG_PCM_F64BE_MUXER 0 -%define CONFIG_PCM_F64LE_MUXER 0 -%define CONFIG_PCM_F32BE_MUXER 0 -%define CONFIG_PCM_F32LE_MUXER 0 -%define CONFIG_PCM_S32BE_MUXER 0 -%define CONFIG_PCM_S32LE_MUXER 0 -%define CONFIG_PCM_S24BE_MUXER 0 -%define CONFIG_PCM_S24LE_MUXER 0 -%define CONFIG_PCM_S16BE_MUXER 0 -%define CONFIG_PCM_S16LE_MUXER 0 -%define CONFIG_PCM_S8_MUXER 0 -%define CONFIG_PCM_U32BE_MUXER 0 -%define CONFIG_PCM_U32LE_MUXER 0 -%define CONFIG_PCM_U24BE_MUXER 0 -%define CONFIG_PCM_U24LE_MUXER 0 -%define CONFIG_PCM_U16BE_MUXER 0 -%define CONFIG_PCM_U16LE_MUXER 0 -%define CONFIG_PCM_U8_MUXER 0 -%define CONFIG_PSP_MUXER 0 -%define CONFIG_RAWVIDEO_MUXER 0 -%define CONFIG_RM_MUXER 0 -%define CONFIG_ROQ_MUXER 0 -%define CONFIG_RSO_MUXER 0 -%define CONFIG_RTP_MUXER 0 -%define CONFIG_RTP_MPEGTS_MUXER 0 -%define CONFIG_RTSP_MUXER 0 -%define CONFIG_SAP_MUXER 0 -%define CONFIG_SCC_MUXER 0 -%define CONFIG_SEGMENT_MUXER 0 -%define CONFIG_STREAM_SEGMENT_MUXER 0 -%define CONFIG_SINGLEJPEG_MUXER 0 -%define CONFIG_SMJPEG_MUXER 0 -%define CONFIG_SMOOTHSTREAMING_MUXER 0 -%define CONFIG_SOX_MUXER 0 -%define CONFIG_SPX_MUXER 0 -%define CONFIG_SPDIF_MUXER 0 -%define CONFIG_SRT_MUXER 0 -%define CONFIG_SUP_MUXER 0 -%define CONFIG_SWF_MUXER 0 -%define CONFIG_TEE_MUXER 0 -%define CONFIG_TG2_MUXER 0 -%define CONFIG_TGP_MUXER 0 -%define CONFIG_MKVTIMESTAMP_V2_MUXER 0 -%define CONFIG_TRUEHD_MUXER 0 -%define CONFIG_TTA_MUXER 0 -%define CONFIG_UNCODEDFRAMECRC_MUXER 0 -%define CONFIG_VC1_MUXER 0 -%define CONFIG_VC1T_MUXER 0 -%define CONFIG_VOC_MUXER 0 -%define CONFIG_W64_MUXER 0 -%define CONFIG_WAV_MUXER 0 -%define CONFIG_WEBM_MUXER 0 -%define CONFIG_WEBM_DASH_MANIFEST_MUXER 0 -%define CONFIG_WEBM_CHUNK_MUXER 0 -%define CONFIG_WEBP_MUXER 0 -%define CONFIG_WEBVTT_MUXER 0 -%define CONFIG_WTV_MUXER 0 -%define CONFIG_WV_MUXER 0 -%define CONFIG_YUV4MPEGPIPE_MUXER 0 -%define CONFIG_CHROMAPRINT_MUXER 0 -%define CONFIG_ALSA_OUTDEV 0 -%define CONFIG_CACA_OUTDEV 0 -%define CONFIG_DECKLINK_OUTDEV 0 -%define CONFIG_LIBNDI_NEWTEK_OUTDEV 0 -%define CONFIG_FBDEV_OUTDEV 0 -%define CONFIG_OPENGL_OUTDEV 0 -%define CONFIG_OSS_OUTDEV 0 -%define CONFIG_PULSE_OUTDEV 0 -%define CONFIG_SDL2_OUTDEV 0 -%define CONFIG_SNDIO_OUTDEV 0 -%define CONFIG_V4L2_OUTDEV 0 -%define CONFIG_XV_OUTDEV 0 -%define CONFIG_AAC_PARSER 1 -%define CONFIG_AAC_LATM_PARSER 1 -%define CONFIG_AC3_PARSER 0 -%define CONFIG_ADX_PARSER 0 -%define CONFIG_BMP_PARSER 0 -%define CONFIG_CAVSVIDEO_PARSER 0 -%define CONFIG_COOK_PARSER 0 -%define CONFIG_DCA_PARSER 0 -%define CONFIG_DIRAC_PARSER 0 -%define CONFIG_DNXHD_PARSER 0 -%define CONFIG_DPX_PARSER 0 -%define CONFIG_DVAUDIO_PARSER 0 -%define CONFIG_DVBSUB_PARSER 0 -%define CONFIG_DVDSUB_PARSER 0 -%define CONFIG_DVD_NAV_PARSER 0 -%define CONFIG_FLAC_PARSER 1 -%define CONFIG_G729_PARSER 0 -%define CONFIG_GSM_PARSER 0 -%define CONFIG_H261_PARSER 0 -%define CONFIG_H263_PARSER 0 -%define CONFIG_H264_PARSER 1 -%define CONFIG_HEVC_PARSER 1 -%define CONFIG_MJPEG_PARSER 0 -%define CONFIG_MLP_PARSER 0 -%define CONFIG_MPEG4VIDEO_PARSER 0 -%define CONFIG_MPEGAUDIO_PARSER 1 -%define CONFIG_MPEGVIDEO_PARSER 0 -%define CONFIG_OPUS_PARSER 0 -%define CONFIG_PNG_PARSER 0 -%define CONFIG_PNM_PARSER 0 -%define CONFIG_RV30_PARSER 0 -%define CONFIG_RV40_PARSER 0 -%define CONFIG_SIPR_PARSER 0 -%define CONFIG_TAK_PARSER 0 -%define CONFIG_VC1_PARSER 0 -%define CONFIG_VORBIS_PARSER 0 -%define CONFIG_VP3_PARSER 0 -%define CONFIG_VP8_PARSER 1 -%define CONFIG_VP9_PARSER 1 -%define CONFIG_XMA_PARSER 0 -%define CONFIG_ASYNC_PROTOCOL 0 -%define CONFIG_BLURAY_PROTOCOL 0 -%define CONFIG_CACHE_PROTOCOL 0 -%define CONFIG_CONCAT_PROTOCOL 0 -%define CONFIG_CRYPTO_PROTOCOL 0 -%define CONFIG_DATA_PROTOCOL 0 -%define CONFIG_FFRTMPCRYPT_PROTOCOL 0 -%define CONFIG_FFRTMPHTTP_PROTOCOL 0 -%define CONFIG_FILE_PROTOCOL 0 -%define CONFIG_FTP_PROTOCOL 0 -%define CONFIG_GOPHER_PROTOCOL 0 -%define CONFIG_HLS_PROTOCOL 0 -%define CONFIG_HTTP_PROTOCOL 0 -%define CONFIG_HTTPPROXY_PROTOCOL 0 -%define CONFIG_HTTPS_PROTOCOL 0 -%define CONFIG_ICECAST_PROTOCOL 0 -%define CONFIG_MMSH_PROTOCOL 0 -%define CONFIG_MMST_PROTOCOL 0 -%define CONFIG_MD5_PROTOCOL 0 -%define CONFIG_PIPE_PROTOCOL 0 -%define CONFIG_PROMPEG_PROTOCOL 0 -%define CONFIG_RTMP_PROTOCOL 0 -%define CONFIG_RTMPE_PROTOCOL 0 -%define CONFIG_RTMPS_PROTOCOL 0 -%define CONFIG_RTMPT_PROTOCOL 0 -%define CONFIG_RTMPTE_PROTOCOL 0 -%define CONFIG_RTMPTS_PROTOCOL 0 -%define CONFIG_RTP_PROTOCOL 0 -%define CONFIG_SCTP_PROTOCOL 0 -%define CONFIG_SRTP_PROTOCOL 0 -%define CONFIG_SUBFILE_PROTOCOL 0 -%define CONFIG_TEE_PROTOCOL 0 -%define CONFIG_TCP_PROTOCOL 0 -%define CONFIG_TLS_GNUTLS_PROTOCOL 0 -%define CONFIG_TLS_SCHANNEL_PROTOCOL 0 -%define CONFIG_TLS_SECURETRANSPORT_PROTOCOL 0 -%define CONFIG_TLS_OPENSSL_PROTOCOL 0 -%define CONFIG_UDP_PROTOCOL 0 -%define CONFIG_UDPLITE_PROTOCOL 0 -%define CONFIG_UNIX_PROTOCOL 0 -%define CONFIG_LIBRTMP_PROTOCOL 0 -%define CONFIG_LIBRTMPE_PROTOCOL 0 -%define CONFIG_LIBRTMPS_PROTOCOL 0 -%define CONFIG_LIBRTMPT_PROTOCOL 0 -%define CONFIG_LIBRTMPTE_PROTOCOL 0 -%define CONFIG_LIBSSH_PROTOCOL 0 -%define CONFIG_LIBSMBCLIENT_PROTOCOL 0 diff --git a/media/ffvpx/config_darwin64.h b/media/ffvpx/config_darwin64.h deleted file mode 100644 index 318188a709..0000000000 --- a/media/ffvpx/config_darwin64.h +++ /dev/null @@ -1,2356 +0,0 @@ -/* Automatically generated by configure - do not modify! */ -#ifndef FFMPEG_CONFIG_H -#define FFMPEG_CONFIG_H -#define FFMPEG_CONFIGURATION "--disable-everything --disable-protocols --disable-demuxers --disable-muxers --disable-filters --disable-programs --disable-doc --disable-parsers --enable-parser=vp8 --enable-parser=vp9 --enable-decoder=vp8 --enable-decoder=vp9 --disable-static --enable-shared --disable-debug --disable-sdl2 --disable-libxcb --disable-securetransport --disable-iconv --disable-swresample --disable-swscale --disable-avdevice --disable-avfilter --disable-avformat --disable-d3d11va --disable-dxva2 --disable-vaapi --disable-vdpau --disable-videotoolbox --enable-decoder=flac --enable-asm --enable-x86asm" -#define FFMPEG_LICENSE "LGPL version 2.1 or later" -#define CONFIG_THIS_YEAR 2018 -#define FFMPEG_DATADIR "/usr/local/share/ffmpeg" -#define AVCONV_DATADIR "/usr/local/share/ffmpeg" -#define CC_IDENT "Apple LLVM version 9.0.0 (clang-900.0.38)" -#define av_restrict restrict -#define EXTERN_PREFIX "_" -#define EXTERN_ASM _ -#define BUILDSUF "" -#define SLIBSUF ".dylib" -#define HAVE_MMX2 HAVE_MMXEXT -#define SWS_MAX_FILTER_SIZE 256 -#define ARCH_AARCH64 0 -#define ARCH_ALPHA 0 -#define ARCH_ARM 0 -#define ARCH_AVR32 0 -#define ARCH_AVR32_AP 0 -#define ARCH_AVR32_UC 0 -#define ARCH_BFIN 0 -#define ARCH_IA64 0 -#define ARCH_M68K 0 -#define ARCH_MIPS 0 -#define ARCH_MIPS64 0 -#define ARCH_PARISC 0 -#define ARCH_PPC 0 -#define ARCH_PPC64 0 -#define ARCH_S390 0 -#define ARCH_SH4 0 -#define ARCH_SPARC 0 -#define ARCH_SPARC64 0 -#define ARCH_TILEGX 0 -#define ARCH_TILEPRO 0 -#define ARCH_TOMI 0 -#define ARCH_X86 1 -#define ARCH_X86_32 0 -#define ARCH_X86_64 1 -#define HAVE_ARMV5TE 0 -#define HAVE_ARMV6 0 -#define HAVE_ARMV6T2 0 -#define HAVE_ARMV8 0 -#define HAVE_NEON 0 -#define HAVE_VFP 0 -#define HAVE_VFPV3 0 -#define HAVE_SETEND 0 -#define HAVE_ALTIVEC 0 -#define HAVE_DCBZL 0 -#define HAVE_LDBRX 0 -#define HAVE_POWER8 0 -#define HAVE_PPC4XX 0 -#define HAVE_VSX 0 -#define HAVE_AESNI 1 -#define HAVE_AMD3DNOW 1 -#define HAVE_AMD3DNOWEXT 1 -#define HAVE_AVX 1 -#define HAVE_AVX2 1 -#define HAVE_FMA3 1 -#define HAVE_FMA4 1 -#define HAVE_MMX 1 -#define HAVE_MMXEXT 1 -#define HAVE_SSE 1 -#define HAVE_SSE2 1 -#define HAVE_SSE3 1 -#define HAVE_SSE4 1 -#define HAVE_SSE42 1 -#define HAVE_SSSE3 1 -#define HAVE_XOP 1 -#define HAVE_CPUNOP 1 -#define HAVE_I686 1 -#define HAVE_MIPSFPU 0 -#define HAVE_MIPS32R2 0 -#define HAVE_MIPS32R5 0 -#define HAVE_MIPS64R2 0 -#define HAVE_MIPS32R6 0 -#define HAVE_MIPS64R6 0 -#define HAVE_MIPSDSP 0 -#define HAVE_MIPSDSPR2 0 -#define HAVE_MSA 0 -#define HAVE_LOONGSON2 0 -#define HAVE_LOONGSON3 0 -#define HAVE_MMI 0 -#define HAVE_ARMV5TE_EXTERNAL 0 -#define HAVE_ARMV6_EXTERNAL 0 -#define HAVE_ARMV6T2_EXTERNAL 0 -#define HAVE_ARMV8_EXTERNAL 0 -#define HAVE_NEON_EXTERNAL 0 -#define HAVE_VFP_EXTERNAL 0 -#define HAVE_VFPV3_EXTERNAL 0 -#define HAVE_SETEND_EXTERNAL 0 -#define HAVE_ALTIVEC_EXTERNAL 0 -#define HAVE_DCBZL_EXTERNAL 0 -#define HAVE_LDBRX_EXTERNAL 0 -#define HAVE_POWER8_EXTERNAL 0 -#define HAVE_PPC4XX_EXTERNAL 0 -#define HAVE_VSX_EXTERNAL 0 -#define HAVE_AESNI_EXTERNAL 1 -#define HAVE_AMD3DNOW_EXTERNAL 1 -#define HAVE_AMD3DNOWEXT_EXTERNAL 1 -#define HAVE_AVX_EXTERNAL 1 -#define HAVE_AVX2_EXTERNAL 1 -#define HAVE_FMA3_EXTERNAL 1 -#define HAVE_FMA4_EXTERNAL 1 -#define HAVE_MMX_EXTERNAL 1 -#define HAVE_MMXEXT_EXTERNAL 1 -#define HAVE_SSE_EXTERNAL 1 -#define HAVE_SSE2_EXTERNAL 1 -#define HAVE_SSE3_EXTERNAL 1 -#define HAVE_SSE4_EXTERNAL 1 -#define HAVE_SSE42_EXTERNAL 1 -#define HAVE_SSSE3_EXTERNAL 1 -#define HAVE_XOP_EXTERNAL 1 -#define HAVE_CPUNOP_EXTERNAL 0 -#define HAVE_I686_EXTERNAL 0 -#define HAVE_MIPSFPU_EXTERNAL 0 -#define HAVE_MIPS32R2_EXTERNAL 0 -#define HAVE_MIPS32R5_EXTERNAL 0 -#define HAVE_MIPS64R2_EXTERNAL 0 -#define HAVE_MIPS32R6_EXTERNAL 0 -#define HAVE_MIPS64R6_EXTERNAL 0 -#define HAVE_MIPSDSP_EXTERNAL 0 -#define HAVE_MIPSDSPR2_EXTERNAL 0 -#define HAVE_MSA_EXTERNAL 0 -#define HAVE_LOONGSON2_EXTERNAL 0 -#define HAVE_LOONGSON3_EXTERNAL 0 -#define HAVE_MMI_EXTERNAL 0 -#define HAVE_ARMV5TE_INLINE 0 -#define HAVE_ARMV6_INLINE 0 -#define HAVE_ARMV6T2_INLINE 0 -#define HAVE_ARMV8_INLINE 0 -#define HAVE_NEON_INLINE 0 -#define HAVE_VFP_INLINE 0 -#define HAVE_VFPV3_INLINE 0 -#define HAVE_SETEND_INLINE 0 -#define HAVE_ALTIVEC_INLINE 0 -#define HAVE_DCBZL_INLINE 0 -#define HAVE_LDBRX_INLINE 0 -#define HAVE_POWER8_INLINE 0 -#define HAVE_PPC4XX_INLINE 0 -#define HAVE_VSX_INLINE 0 -#define HAVE_AESNI_INLINE 1 -#define HAVE_AMD3DNOW_INLINE 1 -#define HAVE_AMD3DNOWEXT_INLINE 1 -#define HAVE_AVX_INLINE 1 -#define HAVE_AVX2_INLINE 1 -#define HAVE_FMA3_INLINE 1 -#define HAVE_FMA4_INLINE 1 -#define HAVE_MMX_INLINE 1 -#define HAVE_MMXEXT_INLINE 1 -#define HAVE_SSE_INLINE 1 -#define HAVE_SSE2_INLINE 1 -#define HAVE_SSE3_INLINE 1 -#define HAVE_SSE4_INLINE 1 -#define HAVE_SSE42_INLINE 1 -#define HAVE_SSSE3_INLINE 1 -#define HAVE_XOP_INLINE 1 -#define HAVE_CPUNOP_INLINE 0 -#define HAVE_I686_INLINE 0 -#define HAVE_MIPSFPU_INLINE 0 -#define HAVE_MIPS32R2_INLINE 0 -#define HAVE_MIPS32R5_INLINE 0 -#define HAVE_MIPS64R2_INLINE 0 -#define HAVE_MIPS32R6_INLINE 0 -#define HAVE_MIPS64R6_INLINE 0 -#define HAVE_MIPSDSP_INLINE 0 -#define HAVE_MIPSDSPR2_INLINE 0 -#define HAVE_MSA_INLINE 0 -#define HAVE_LOONGSON2_INLINE 0 -#define HAVE_LOONGSON3_INLINE 0 -#define HAVE_MMI_INLINE 0 -#define HAVE_ALIGNED_STACK 1 -#define HAVE_FAST_64BIT 1 -#define HAVE_FAST_CLZ 1 -#define HAVE_FAST_CMOV 1 -#define HAVE_LOCAL_ALIGNED_8 1 -#define HAVE_LOCAL_ALIGNED_16 1 -#define HAVE_LOCAL_ALIGNED_32 1 -#define HAVE_SIMD_ALIGN_16 1 -#define HAVE_SIMD_ALIGN_32 1 -#define HAVE_ATOMICS_GCC 1 -#define HAVE_ATOMICS_SUNCC 0 -#define HAVE_ATOMICS_WIN32 0 -#define HAVE_ATOMIC_CAS_PTR 0 -#define HAVE_MACHINE_RW_BARRIER 0 -#define HAVE_MEMORYBARRIER 0 -#define HAVE_MM_EMPTY 1 -#define HAVE_RDTSC 0 -#define HAVE_SARESTART 1 -#define HAVE_SEM_TIMEDWAIT 0 -#define HAVE_SYNC_VAL_COMPARE_AND_SWAP 1 -#define HAVE_CABS 1 -#define HAVE_CEXP 1 -#define HAVE_INLINE_ASM 1 -#define HAVE_SYMVER 1 -#define HAVE_X86ASM 1 -#define HAVE_BIGENDIAN 0 -#define HAVE_FAST_UNALIGNED 1 -#define HAVE_ALTIVEC_H 0 -#define HAVE_ARPA_INET_H 1 -#define HAVE_ASM_TYPES_H 0 -#define HAVE_CDIO_PARANOIA_H 0 -#define HAVE_CDIO_PARANOIA_PARANOIA_H 0 -#define HAVE_CUDA_H 0 -#define HAVE_D3D11_H 0 -#define HAVE_DISPATCH_DISPATCH_H 1 -#define HAVE_DEV_BKTR_IOCTL_BT848_H 0 -#define HAVE_DEV_BKTR_IOCTL_METEOR_H 0 -#define HAVE_DEV_IC_BT8XX_H 0 -#define HAVE_DEV_VIDEO_BKTR_IOCTL_BT848_H 0 -#define HAVE_DEV_VIDEO_METEOR_IOCTL_METEOR_H 0 -#define HAVE_DIRECT_H 0 -#define HAVE_DIRENT_H 1 -#define HAVE_DLFCN_H 1 -#define HAVE_DXGIDEBUG_H 0 -#define HAVE_DXVA_H 0 -#define HAVE_ES2_GL_H 0 -#define HAVE_GSM_H 0 -#define HAVE_IO_H 0 -#define HAVE_MACH_MACH_TIME_H 1 -#define HAVE_MACHINE_IOCTL_BT848_H 0 -#define HAVE_MACHINE_IOCTL_METEOR_H 0 -#define HAVE_MALLOC_H 1 -#define HAVE_OPENCV2_CORE_CORE_C_H 0 -#define HAVE_OPENJPEG_2_3_OPENJPEG_H 0 -#define HAVE_OPENJPEG_2_2_OPENJPEG_H 0 -#define HAVE_OPENJPEG_2_1_OPENJPEG_H 0 -#define HAVE_OPENJPEG_2_0_OPENJPEG_H 0 -#define HAVE_OPENJPEG_1_5_OPENJPEG_H 0 -#define HAVE_OPENGL_GL3_H 0 -#define HAVE_POLL_H 1 -#define HAVE_SOUNDCARD_H 0 -#define HAVE_STDATOMIC_H 1 -#define HAVE_SYS_MMAN_H 1 -#define HAVE_SYS_PARAM_H 1 -#define HAVE_SYS_RESOURCE_H 1 -#define HAVE_SYS_SELECT_H 1 -#define HAVE_SYS_SOUNDCARD_H 0 -#define HAVE_SYS_TIME_H 1 -#define HAVE_SYS_UN_H 1 -#define HAVE_SYS_VIDEOIO_H 0 -#define HAVE_TERMIOS_H 1 -#define HAVE_UDPLITE_H 0 -#define HAVE_UNISTD_H 1 -#define HAVE_VALGRIND_VALGRIND_H 0 -#define HAVE_WINDOWS_H 0 -#define HAVE_WINSOCK2_H 0 -#define HAVE_INTRINSICS_NEON 0 -#define HAVE_ATANF 1 -#define HAVE_ATAN2F 1 -#define HAVE_CBRT 1 -#define HAVE_CBRTF 1 -#define HAVE_COPYSIGN 1 -#define HAVE_COSF 1 -#define HAVE_ERF 1 -#define HAVE_EXP2 1 -#define HAVE_EXP2F 1 -#define HAVE_EXPF 1 -#define HAVE_HYPOT 1 -#define HAVE_ISFINITE 1 -#define HAVE_ISINF 1 -#define HAVE_ISNAN 1 -#define HAVE_LDEXPF 1 -#define HAVE_LLRINT 1 -#define HAVE_LLRINTF 1 -#define HAVE_LOG2 1 -#define HAVE_LOG2F 1 -#define HAVE_LOG10F 1 -#define HAVE_LRINT 1 -#define HAVE_LRINTF 1 -#define HAVE_POWF 1 -#define HAVE_RINT 1 -#define HAVE_ROUND 1 -#define HAVE_ROUNDF 1 -#define HAVE_SINF 1 -#define HAVE_TRUNC 1 -#define HAVE_TRUNCF 1 -#define HAVE_ACCESS 1 -#define HAVE_ALIGNED_MALLOC 0 -#define HAVE_ARC4RANDOM 0 -#define HAVE_CLOCK_GETTIME 1 -#define HAVE_CLOSESOCKET 0 -#define HAVE_COMMANDLINETOARGVW 0 -#define HAVE_COTASKMEMFREE 0 -#define HAVE_CRYPTGENRANDOM 0 -#define HAVE_FCNTL 1 -#define HAVE_FLT_LIM 1 -#define HAVE_FORK 1 -#define HAVE_GETADDRINFO 1 -#define HAVE_GETHRTIME 0 -#define HAVE_GETOPT 1 -#define HAVE_GETPROCESSAFFINITYMASK 0 -#define HAVE_GETPROCESSMEMORYINFO 0 -#define HAVE_GETPROCESSTIMES 0 -#define HAVE_GETRUSAGE 1 -#define HAVE_GETSYSTEMTIMEASFILETIME 0 -#define HAVE_GETTIMEOFDAY 1 -#define HAVE_GLOB 1 -#define HAVE_GLXGETPROCADDRESS 0 -#define HAVE_GMTIME_R 1 -#define HAVE_INET_ATON 1 -#define HAVE_ISATTY 1 -#define HAVE_JACK_PORT_GET_LATENCY_RANGE 0 -#define HAVE_KBHIT 0 -#define HAVE_LOADLIBRARY 0 -#define HAVE_LOCALTIME_R 1 -#define HAVE_LSTAT 1 -#define HAVE_LZO1X_999_COMPRESS 0 -#define HAVE_MACH_ABSOLUTE_TIME 1 -#define HAVE_MAPVIEWOFFILE 0 -#define HAVE_MEMALIGN 0 -#define HAVE_MKSTEMP 1 -#define HAVE_MMAP 1 -#define HAVE_MPROTECT 1 -#define HAVE_NANOSLEEP 1 -#define HAVE_PEEKNAMEDPIPE 0 -#define HAVE_POSIX_MEMALIGN 1 -#define HAVE_PTHREAD_CANCEL 1 -#define HAVE_SCHED_GETAFFINITY 0 -#define HAVE_SETCONSOLETEXTATTRIBUTE 0 -#define HAVE_SETCONSOLECTRLHANDLER 0 -#define HAVE_SETMODE 0 -#define HAVE_SETRLIMIT 1 -#define HAVE_SLEEP 0 -#define HAVE_STRERROR_R 1 -#define HAVE_SYSCONF 1 -#define HAVE_SYSCTL 1 -#define HAVE_USLEEP 1 -#define HAVE_UTGETOSTYPEFROMSTRING 0 -#define HAVE_VIRTUALALLOC 0 -#define HAVE_WGLGETPROCADDRESS 0 -#define HAVE_PTHREADS 1 -#define HAVE_OS2THREADS 0 -#define HAVE_W32THREADS 0 -#define HAVE_AS_DN_DIRECTIVE 0 -#define HAVE_AS_FPU_DIRECTIVE 0 -#define HAVE_AS_FUNC 0 -#define HAVE_AS_OBJECT_ARCH 0 -#define HAVE_ASM_MOD_Q 0 -#define HAVE_ATTRIBUTE_MAY_ALIAS 1 -#define HAVE_ATTRIBUTE_PACKED 1 -#define HAVE_BLOCKS_EXTENSION 1 -#define HAVE_EBP_AVAILABLE 1 -#define HAVE_EBX_AVAILABLE 1 -#define HAVE_GNU_AS 0 -#define HAVE_GNU_WINDRES 0 -#define HAVE_IBM_ASM 0 -#define HAVE_INLINE_ASM_DIRECT_SYMBOL_REFS 1 -#define HAVE_INLINE_ASM_LABELS 1 -#define HAVE_INLINE_ASM_NONLOCAL_LABELS 1 -#define HAVE_PRAGMA_DEPRECATED 1 -#define HAVE_RSYNC_CONTIMEOUT 0 -#define HAVE_SYMVER_ASM_LABEL 1 -#define HAVE_SYMVER_GNU_ASM 0 -#define HAVE_VFP_ARGS 0 -#define HAVE_XFORM_ASM 0 -#define HAVE_XMM_CLOBBERS 1 -#define HAVE_CONDITION_VARIABLE_PTR 0 -#define HAVE_KCMVIDEOCODECTYPE_HEVC 0 -#define HAVE_SOCKLEN_T 1 -#define HAVE_STRUCT_ADDRINFO 1 -#define HAVE_STRUCT_GROUP_SOURCE_REQ 1 -#define HAVE_STRUCT_IP_MREQ_SOURCE 1 -#define HAVE_STRUCT_IPV6_MREQ 1 -#define HAVE_STRUCT_MSGHDR_MSG_FLAGS 1 -#define HAVE_STRUCT_POLLFD 1 -#define HAVE_STRUCT_RUSAGE_RU_MAXRSS 1 -#define HAVE_STRUCT_SCTP_EVENT_SUBSCRIBE 0 -#define HAVE_STRUCT_SOCKADDR_IN6 1 -#define HAVE_STRUCT_SOCKADDR_SA_LEN 1 -#define HAVE_STRUCT_SOCKADDR_STORAGE 1 -#define HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC 0 -#define HAVE_STRUCT_V4L2_FRMIVALENUM_DISCRETE 0 -#define HAVE_ATOMICS_NATIVE 1 -#define HAVE_DOS_PATHS 0 -#define HAVE_LIBC_MSVCRT 0 -#define HAVE_MAKEINFO 1 -#define HAVE_MAKEINFO_HTML 0 -#define HAVE_MMAL_PARAMETER_VIDEO_MAX_NUM_CALLBACKS 0 -#define HAVE_PERL 1 -#define HAVE_POD2MAN 1 -#define HAVE_SECTION_DATA_REL_RO 0 -#define HAVE_TEXI2HTML 0 -#define HAVE_THREADS 1 -#define HAVE_UWP 0 -#define HAVE_VAAPI_DRM 0 -#define HAVE_VAAPI_X11 0 -#define HAVE_VDPAU_X11 0 -#define HAVE_WINRT 0 -#define CONFIG_DOC 0 -#define CONFIG_HTMLPAGES 0 -#define CONFIG_MANPAGES 1 -#define CONFIG_PODPAGES 1 -#define CONFIG_TXTPAGES 1 -#define CONFIG_AVIO_DIR_CMD_EXAMPLE 1 -#define CONFIG_AVIO_READING_EXAMPLE 1 -#define CONFIG_DECODE_AUDIO_EXAMPLE 1 -#define CONFIG_DECODE_VIDEO_EXAMPLE 1 -#define CONFIG_DEMUXING_DECODING_EXAMPLE 0 -#define CONFIG_ENCODE_AUDIO_EXAMPLE 1 -#define CONFIG_ENCODE_VIDEO_EXAMPLE 1 -#define CONFIG_EXTRACT_MVS_EXAMPLE 0 -#define CONFIG_FILTER_AUDIO_EXAMPLE 0 -#define CONFIG_FILTERING_AUDIO_EXAMPLE 0 -#define CONFIG_FILTERING_VIDEO_EXAMPLE 0 -#define CONFIG_HTTP_MULTICLIENT_EXAMPLE 0 -#define CONFIG_HW_DECODE_EXAMPLE 0 -#define CONFIG_METADATA_EXAMPLE 0 -#define CONFIG_MUXING_EXAMPLE 0 -#define CONFIG_QSVDEC_EXAMPLE 0 -#define CONFIG_REMUXING_EXAMPLE 0 -#define CONFIG_RESAMPLING_AUDIO_EXAMPLE 0 -#define CONFIG_SCALING_VIDEO_EXAMPLE 0 -#define CONFIG_TRANSCODE_AAC_EXAMPLE 0 -#define CONFIG_TRANSCODING_EXAMPLE 0 -#define CONFIG_ALSA 0 -#define CONFIG_APPKIT 1 -#define CONFIG_AVFOUNDATION 1 -#define CONFIG_BZLIB 1 -#define CONFIG_COREIMAGE 1 -#define CONFIG_ICONV 0 -#define CONFIG_JACK 0 -#define CONFIG_LIBXCB 0 -#define CONFIG_LIBXCB_SHM 0 -#define CONFIG_LIBXCB_SHAPE 0 -#define CONFIG_LIBXCB_XFIXES 0 -#define CONFIG_LZMA 0 -#define CONFIG_SCHANNEL 0 -#define CONFIG_SDL2 0 -#define CONFIG_SECURETRANSPORT 0 -#define CONFIG_SNDIO 0 -#define CONFIG_XLIB 1 -#define CONFIG_ZLIB 1 -#define CONFIG_AVISYNTH 0 -#define CONFIG_FREI0R 0 -#define CONFIG_LIBCDIO 0 -#define CONFIG_LIBRUBBERBAND 0 -#define CONFIG_LIBVIDSTAB 0 -#define CONFIG_LIBX264 0 -#define CONFIG_LIBX265 0 -#define CONFIG_LIBXAVS 0 -#define CONFIG_LIBXVID 0 -#define CONFIG_DECKLINK 0 -#define CONFIG_LIBNDI_NEWTEK 0 -#define CONFIG_LIBFDK_AAC 0 -#define CONFIG_OPENSSL 0 -#define CONFIG_GMP 0 -#define CONFIG_LIBOPENCORE_AMRNB 0 -#define CONFIG_LIBOPENCORE_AMRWB 0 -#define CONFIG_LIBVO_AMRWBENC 0 -#define CONFIG_RKMPP 0 -#define CONFIG_LIBSMBCLIENT 0 -#define CONFIG_CHROMAPRINT 0 -#define CONFIG_GCRYPT 0 -#define CONFIG_GNUTLS 0 -#define CONFIG_JNI 0 -#define CONFIG_LADSPA 0 -#define CONFIG_LIBASS 0 -#define CONFIG_LIBBLURAY 0 -#define CONFIG_LIBBS2B 0 -#define CONFIG_LIBCACA 0 -#define CONFIG_LIBCELT 0 -#define CONFIG_LIBDC1394 0 -#define CONFIG_LIBDRM 0 -#define CONFIG_LIBFLITE 0 -#define CONFIG_LIBFONTCONFIG 0 -#define CONFIG_LIBFREETYPE 0 -#define CONFIG_LIBFRIBIDI 0 -#define CONFIG_LIBGME 0 -#define CONFIG_LIBGSM 0 -#define CONFIG_LIBIEC61883 0 -#define CONFIG_LIBILBC 0 -#define CONFIG_LIBKVAZAAR 0 -#define CONFIG_LIBMODPLUG 0 -#define CONFIG_LIBMP3LAME 0 -#define CONFIG_LIBMYSOFA 0 -#define CONFIG_LIBOPENCV 0 -#define CONFIG_LIBOPENH264 0 -#define CONFIG_LIBOPENJPEG 0 -#define CONFIG_LIBOPENMPT 0 -#define CONFIG_LIBOPUS 0 -#define CONFIG_LIBPULSE 0 -#define CONFIG_LIBRSVG 0 -#define CONFIG_LIBRTMP 0 -#define CONFIG_LIBSHINE 0 -#define CONFIG_LIBSMBCLIENT 0 -#define CONFIG_LIBSNAPPY 0 -#define CONFIG_LIBSOXR 0 -#define CONFIG_LIBSPEEX 0 -#define CONFIG_LIBSSH 0 -#define CONFIG_LIBTESSERACT 0 -#define CONFIG_LIBTHEORA 0 -#define CONFIG_LIBTWOLAME 0 -#define CONFIG_LIBV4L2 0 -#define CONFIG_LIBVMAF 0 -#define CONFIG_LIBVORBIS 0 -#define CONFIG_LIBVPX 0 -#define CONFIG_LIBWAVPACK 0 -#define CONFIG_LIBWEBP 0 -#define CONFIG_LIBXML2 0 -#define CONFIG_LIBZIMG 0 -#define CONFIG_LIBZMQ 0 -#define CONFIG_LIBZVBI 0 -#define CONFIG_MEDIACODEC 0 -#define CONFIG_OPENAL 0 -#define CONFIG_OPENCL 0 -#define CONFIG_OPENGL 0 -#define CONFIG_AUDIOTOOLBOX 1 -#define CONFIG_CRYSTALHD 0 -#define CONFIG_CUDA 0 -#define CONFIG_CUVID 0 -#define CONFIG_D3D11VA 0 -#define CONFIG_DXVA2 0 -#define CONFIG_NVENC 0 -#define CONFIG_VAAPI 0 -#define CONFIG_VDA 0 -#define CONFIG_VDPAU 0 -#define CONFIG_VIDEOTOOLBOX 0 -#define CONFIG_V4L2_M2M 0 -#define CONFIG_XVMC 0 -#define CONFIG_CUDA_SDK 0 -#define CONFIG_LIBNPP 0 -#define CONFIG_LIBMFX 0 -#define CONFIG_MMAL 0 -#define CONFIG_OMX 0 -#define CONFIG_FTRAPV 0 -#define CONFIG_GRAY 0 -#define CONFIG_HARDCODED_TABLES 0 -#define CONFIG_OMX_RPI 0 -#define CONFIG_RUNTIME_CPUDETECT 1 -#define CONFIG_SAFE_BITSTREAM_READER 1 -#define CONFIG_SHARED 1 -#define CONFIG_SMALL 0 -#define CONFIG_STATIC 0 -#define CONFIG_SWSCALE_ALPHA 1 -#define CONFIG_GPL 0 -#define CONFIG_NONFREE 0 -#define CONFIG_VERSION3 0 -#define CONFIG_AVCODEC 1 -#define CONFIG_AVDEVICE 0 -#define CONFIG_AVFILTER 0 -#define CONFIG_AVFORMAT 0 -#define CONFIG_AVRESAMPLE 0 -#define CONFIG_AVUTIL 1 -#define CONFIG_POSTPROC 0 -#define CONFIG_SWRESAMPLE 0 -#define CONFIG_SWSCALE 0 -#define CONFIG_FFPLAY 0 -#define CONFIG_FFPROBE 0 -#define CONFIG_FFSERVER 0 -#define CONFIG_FFMPEG 0 -#define CONFIG_DCT 1 -#define CONFIG_DWT 0 -#define CONFIG_ERROR_RESILIENCE 1 -#define CONFIG_FAAN 1 -#define CONFIG_FAST_UNALIGNED 1 -#define CONFIG_FFT 1 -#define CONFIG_LSP 0 -#define CONFIG_LZO 0 -#define CONFIG_MDCT 1 -#define CONFIG_PIXELUTILS 0 -#define CONFIG_NETWORK 0 -#define CONFIG_RDFT 1 -#define CONFIG_AUTODETECT 0 -#define CONFIG_FONTCONFIG 0 -#define CONFIG_LINUX_PERF 0 -#define CONFIG_MEMORY_POISONING 0 -#define CONFIG_NEON_CLOBBER_TEST 0 -#define CONFIG_OSSFUZZ 0 -#define CONFIG_PIC 1 -#define CONFIG_THUMB 0 -#define CONFIG_VALGRIND_BACKTRACE 0 -#define CONFIG_XMM_CLOBBER_TEST 0 -#define CONFIG_BSFS 1 -#define CONFIG_DECODERS 1 -#define CONFIG_ENCODERS 0 -#define CONFIG_HWACCELS 0 -#define CONFIG_PARSERS 1 -#define CONFIG_INDEVS 0 -#define CONFIG_OUTDEVS 0 -#define CONFIG_FILTERS 0 -#define CONFIG_DEMUXERS 0 -#define CONFIG_MUXERS 0 -#define CONFIG_PROTOCOLS 0 -#define CONFIG_AANDCTTABLES 0 -#define CONFIG_AC3DSP 0 -#define CONFIG_AUDIO_FRAME_QUEUE 0 -#define CONFIG_AUDIODSP 0 -#define CONFIG_BLOCKDSP 0 -#define CONFIG_BSWAPDSP 1 -#define CONFIG_CABAC 1 -#define CONFIG_DIRAC_PARSE 0 -#define CONFIG_DVPROFILE 0 -#define CONFIG_EXIF 0 -#define CONFIG_FAANDCT 1 -#define CONFIG_FAANIDCT 1 -#define CONFIG_FDCTDSP 1 -#define CONFIG_FLACDSP 1 -#define CONFIG_FMTCONVERT 0 -#define CONFIG_FRAME_THREAD_ENCODER 0 -#define CONFIG_G722DSP 0 -#define CONFIG_GOLOMB 1 -#define CONFIG_GPLV3 0 -#define CONFIG_H263DSP 0 -#define CONFIG_H264CHROMA 1 -#define CONFIG_H264DSP 1 -#define CONFIG_H264PARSE 1 -#define CONFIG_H264PRED 1 -#define CONFIG_H264QPEL 1 -#define CONFIG_HEVCPARSE 1 -#define CONFIG_HPELDSP 0 -#define CONFIG_HUFFMAN 0 -#define CONFIG_HUFFYUVDSP 0 -#define CONFIG_HUFFYUVENCDSP 0 -#define CONFIG_IDCTDSP 1 -#define CONFIG_IIRFILTER 0 -#define CONFIG_MDCT15 1 -#define CONFIG_INTRAX8 0 -#define CONFIG_ISO_MEDIA 0 -#define CONFIG_IVIDSP 0 -#define CONFIG_JPEGTABLES 0 -#define CONFIG_LGPLV3 0 -#define CONFIG_LIBX262 0 -#define CONFIG_LLAUDDSP 0 -#define CONFIG_LLVIDDSP 0 -#define CONFIG_LLVIDENCDSP 0 -#define CONFIG_LPC 0 -#define CONFIG_LZF 0 -#define CONFIG_ME_CMP 1 -#define CONFIG_MPEG_ER 0 -#define CONFIG_MPEGAUDIO 1 -#define CONFIG_MPEGAUDIODSP 1 -#define CONFIG_MPEGAUDIOHEADER 1 -#define CONFIG_MPEGVIDEO 0 -#define CONFIG_MPEGVIDEOENC 0 -#define CONFIG_MSS34DSP 0 -#define CONFIG_PIXBLOCKDSP 1 -#define CONFIG_QPELDSP 0 -#define CONFIG_QSV 0 -#define CONFIG_QSVDEC 0 -#define CONFIG_QSVENC 0 -#define CONFIG_RANGECODER 0 -#define CONFIG_RIFFDEC 0 -#define CONFIG_RIFFENC 0 -#define CONFIG_RTPDEC 0 -#define CONFIG_RTPENC_CHAIN 0 -#define CONFIG_RV34DSP 0 -#define CONFIG_SINEWIN 1 -#define CONFIG_SNAPPY 0 -#define CONFIG_SRTP 0 -#define CONFIG_STARTCODE 1 -#define CONFIG_TEXTUREDSP 0 -#define CONFIG_TEXTUREDSPENC 0 -#define CONFIG_TPELDSP 0 -#define CONFIG_VAAPI_1 0 -#define CONFIG_VAAPI_ENCODE 0 -#define CONFIG_VC1DSP 0 -#define CONFIG_VIDEODSP 1 -#define CONFIG_VP3DSP 0 -#define CONFIG_VP56DSP 0 -#define CONFIG_VP8DSP 1 -#define CONFIG_WMA_FREQS 0 -#define CONFIG_WMV2DSP 0 -#define CONFIG_AAC_ADTSTOASC_BSF 0 -#define CONFIG_CHOMP_BSF 0 -#define CONFIG_DUMP_EXTRADATA_BSF 0 -#define CONFIG_DCA_CORE_BSF 0 -#define CONFIG_EXTRACT_EXTRADATA_BSF 0 -#define CONFIG_H264_MP4TOANNEXB_BSF 0 -#define CONFIG_HEVC_MP4TOANNEXB_BSF 0 -#define CONFIG_IMX_DUMP_HEADER_BSF 0 -#define CONFIG_MJPEG2JPEG_BSF 0 -#define CONFIG_MJPEGA_DUMP_HEADER_BSF 0 -#define CONFIG_MP3_HEADER_DECOMPRESS_BSF 0 -#define CONFIG_MPEG4_UNPACK_BFRAMES_BSF 0 -#define CONFIG_MOV2TEXTSUB_BSF 0 -#define CONFIG_NOISE_BSF 0 -#define CONFIG_NULL_BSF 1 -#define CONFIG_REMOVE_EXTRADATA_BSF 0 -#define CONFIG_TEXT2MOVSUB_BSF 0 -#define CONFIG_VP9_RAW_REORDER_BSF 0 -#define CONFIG_VP9_SUPERFRAME_BSF 0 -#define CONFIG_VP9_SUPERFRAME_SPLIT_BSF 0 -#define CONFIG_AASC_DECODER 0 -#define CONFIG_AIC_DECODER 0 -#define CONFIG_ALIAS_PIX_DECODER 0 -#define CONFIG_AMV_DECODER 0 -#define CONFIG_ANM_DECODER 0 -#define CONFIG_ANSI_DECODER 0 -#define CONFIG_APNG_DECODER 0 -#define CONFIG_ASV1_DECODER 0 -#define CONFIG_ASV2_DECODER 0 -#define CONFIG_AURA_DECODER 0 -#define CONFIG_AURA2_DECODER 0 -#define CONFIG_AVRP_DECODER 0 -#define CONFIG_AVRN_DECODER 0 -#define CONFIG_AVS_DECODER 0 -#define CONFIG_AVUI_DECODER 0 -#define CONFIG_AYUV_DECODER 0 -#define CONFIG_BETHSOFTVID_DECODER 0 -#define CONFIG_BFI_DECODER 0 -#define CONFIG_BINK_DECODER 0 -#define CONFIG_BMP_DECODER 0 -#define CONFIG_BMV_VIDEO_DECODER 0 -#define CONFIG_BRENDER_PIX_DECODER 0 -#define CONFIG_C93_DECODER 0 -#define CONFIG_CAVS_DECODER 0 -#define CONFIG_CDGRAPHICS_DECODER 0 -#define CONFIG_CDXL_DECODER 0 -#define CONFIG_CFHD_DECODER 0 -#define CONFIG_CINEPAK_DECODER 0 -#define CONFIG_CLEARVIDEO_DECODER 0 -#define CONFIG_CLJR_DECODER 0 -#define CONFIG_CLLC_DECODER 0 -#define CONFIG_COMFORTNOISE_DECODER 0 -#define CONFIG_CPIA_DECODER 0 -#define CONFIG_CSCD_DECODER 0 -#define CONFIG_CYUV_DECODER 0 -#define CONFIG_DDS_DECODER 0 -#define CONFIG_DFA_DECODER 0 -#define CONFIG_DIRAC_DECODER 0 -#define CONFIG_DNXHD_DECODER 0 -#define CONFIG_DPX_DECODER 0 -#define CONFIG_DSICINVIDEO_DECODER 0 -#define CONFIG_DVAUDIO_DECODER 0 -#define CONFIG_DVVIDEO_DECODER 0 -#define CONFIG_DXA_DECODER 0 -#define CONFIG_DXTORY_DECODER 0 -#define CONFIG_DXV_DECODER 0 -#define CONFIG_EACMV_DECODER 0 -#define CONFIG_EAMAD_DECODER 0 -#define CONFIG_EATGQ_DECODER 0 -#define CONFIG_EATGV_DECODER 0 -#define CONFIG_EATQI_DECODER 0 -#define CONFIG_EIGHTBPS_DECODER 0 -#define CONFIG_EIGHTSVX_EXP_DECODER 0 -#define CONFIG_EIGHTSVX_FIB_DECODER 0 -#define CONFIG_ESCAPE124_DECODER 0 -#define CONFIG_ESCAPE130_DECODER 0 -#define CONFIG_EXR_DECODER 0 -#define CONFIG_FFV1_DECODER 0 -#define CONFIG_FFVHUFF_DECODER 0 -#define CONFIG_FIC_DECODER 0 -#define CONFIG_FITS_DECODER 0 -#define CONFIG_FLASHSV_DECODER 0 -#define CONFIG_FLASHSV2_DECODER 0 -#define CONFIG_FLIC_DECODER 0 -#define CONFIG_FLV_DECODER 0 -#define CONFIG_FMVC_DECODER 0 -#define CONFIG_FOURXM_DECODER 0 -#define CONFIG_FRAPS_DECODER 0 -#define CONFIG_FRWU_DECODER 0 -#define CONFIG_G2M_DECODER 0 -#define CONFIG_GDV_DECODER 0 -#define CONFIG_GIF_DECODER 0 -#define CONFIG_H261_DECODER 0 -#define CONFIG_H263_DECODER 0 -#define CONFIG_H263I_DECODER 0 -#define CONFIG_H263P_DECODER 0 -#define CONFIG_H263_V4L2M2M_DECODER 0 -#define CONFIG_H264_DECODER 1 -#define CONFIG_H264_CRYSTALHD_DECODER 0 -#define CONFIG_H264_V4L2M2M_DECODER 0 -#define CONFIG_H264_MEDIACODEC_DECODER 0 -#define CONFIG_H264_MMAL_DECODER 0 -#define CONFIG_H264_QSV_DECODER 0 -#define CONFIG_H264_RKMPP_DECODER 0 -#define CONFIG_H264_VDA_DECODER 0 -#define CONFIG_H264_VDPAU_DECODER 0 -#define CONFIG_HAP_DECODER 0 -#define CONFIG_HEVC_DECODER 1 -#define CONFIG_HEVC_QSV_DECODER 0 -#define CONFIG_HEVC_RKMPP_DECODER 0 -#define CONFIG_HEVC_V4L2M2M_DECODER 0 -#define CONFIG_HNM4_VIDEO_DECODER 0 -#define CONFIG_HQ_HQA_DECODER 0 -#define CONFIG_HQX_DECODER 0 -#define CONFIG_HUFFYUV_DECODER 0 -#define CONFIG_IDCIN_DECODER 0 -#define CONFIG_IFF_ILBM_DECODER 0 -#define CONFIG_INDEO2_DECODER 0 -#define CONFIG_INDEO3_DECODER 0 -#define CONFIG_INDEO4_DECODER 0 -#define CONFIG_INDEO5_DECODER 0 -#define CONFIG_INTERPLAY_VIDEO_DECODER 0 -#define CONFIG_JPEG2000_DECODER 0 -#define CONFIG_JPEGLS_DECODER 0 -#define CONFIG_JV_DECODER 0 -#define CONFIG_KGV1_DECODER 0 -#define CONFIG_KMVC_DECODER 0 -#define CONFIG_LAGARITH_DECODER 0 -#define CONFIG_LOCO_DECODER 0 -#define CONFIG_M101_DECODER 0 -#define CONFIG_MAGICYUV_DECODER 0 -#define CONFIG_MDEC_DECODER 0 -#define CONFIG_MIMIC_DECODER 0 -#define CONFIG_MJPEG_DECODER 0 -#define CONFIG_MJPEGB_DECODER 0 -#define CONFIG_MMVIDEO_DECODER 0 -#define CONFIG_MOTIONPIXELS_DECODER 0 -#define CONFIG_MPEG_XVMC_DECODER 0 -#define CONFIG_MPEG1VIDEO_DECODER 0 -#define CONFIG_MPEG2VIDEO_DECODER 0 -#define CONFIG_MPEG4_DECODER 0 -#define CONFIG_MPEG4_CRYSTALHD_DECODER 0 -#define CONFIG_MPEG4_V4L2M2M_DECODER 0 -#define CONFIG_MPEG4_MMAL_DECODER 0 -#define CONFIG_MPEG4_VDPAU_DECODER 0 -#define CONFIG_MPEGVIDEO_DECODER 0 -#define CONFIG_MPEG_VDPAU_DECODER 0 -#define CONFIG_MPEG1_VDPAU_DECODER 0 -#define CONFIG_MPEG1_V4L2M2M_DECODER 0 -#define CONFIG_MPEG2_MMAL_DECODER 0 -#define CONFIG_MPEG2_CRYSTALHD_DECODER 0 -#define CONFIG_MPEG2_V4L2M2M_DECODER 0 -#define CONFIG_MPEG2_QSV_DECODER 0 -#define CONFIG_MPEG2_MEDIACODEC_DECODER 0 -#define CONFIG_MSA1_DECODER 0 -#define CONFIG_MSCC_DECODER 0 -#define CONFIG_MSMPEG4V1_DECODER 0 -#define CONFIG_MSMPEG4V2_DECODER 0 -#define CONFIG_MSMPEG4V3_DECODER 0 -#define CONFIG_MSMPEG4_CRYSTALHD_DECODER 0 -#define CONFIG_MSRLE_DECODER 0 -#define CONFIG_MSS1_DECODER 0 -#define CONFIG_MSS2_DECODER 0 -#define CONFIG_MSVIDEO1_DECODER 0 -#define CONFIG_MSZH_DECODER 0 -#define CONFIG_MTS2_DECODER 0 -#define CONFIG_MVC1_DECODER 0 -#define CONFIG_MVC2_DECODER 0 -#define CONFIG_MXPEG_DECODER 0 -#define CONFIG_NUV_DECODER 0 -#define CONFIG_PAF_VIDEO_DECODER 0 -#define CONFIG_PAM_DECODER 0 -#define CONFIG_PBM_DECODER 0 -#define CONFIG_PCX_DECODER 0 -#define CONFIG_PGM_DECODER 0 -#define CONFIG_PGMYUV_DECODER 0 -#define CONFIG_PICTOR_DECODER 0 -#define CONFIG_PIXLET_DECODER 0 -#define CONFIG_PNG_DECODER 0 -#define CONFIG_PPM_DECODER 0 -#define CONFIG_PRORES_DECODER 0 -#define CONFIG_PRORES_LGPL_DECODER 0 -#define CONFIG_PSD_DECODER 0 -#define CONFIG_PTX_DECODER 0 -#define CONFIG_QDRAW_DECODER 0 -#define CONFIG_QPEG_DECODER 0 -#define CONFIG_QTRLE_DECODER 0 -#define CONFIG_R10K_DECODER 0 -#define CONFIG_R210_DECODER 0 -#define CONFIG_RAWVIDEO_DECODER 0 -#define CONFIG_RL2_DECODER 0 -#define CONFIG_ROQ_DECODER 0 -#define CONFIG_RPZA_DECODER 0 -#define CONFIG_RSCC_DECODER 0 -#define CONFIG_RV10_DECODER 0 -#define CONFIG_RV20_DECODER 0 -#define CONFIG_RV30_DECODER 0 -#define CONFIG_RV40_DECODER 0 -#define CONFIG_S302M_DECODER 0 -#define CONFIG_SANM_DECODER 0 -#define CONFIG_SCPR_DECODER 0 -#define CONFIG_SCREENPRESSO_DECODER 0 -#define CONFIG_SDX2_DPCM_DECODER 0 -#define CONFIG_SGI_DECODER 0 -#define CONFIG_SGIRLE_DECODER 0 -#define CONFIG_SHEERVIDEO_DECODER 0 -#define CONFIG_SMACKER_DECODER 0 -#define CONFIG_SMC_DECODER 0 -#define CONFIG_SMVJPEG_DECODER 0 -#define CONFIG_SNOW_DECODER 0 -#define CONFIG_SP5X_DECODER 0 -#define CONFIG_SPEEDHQ_DECODER 0 -#define CONFIG_SRGC_DECODER 0 -#define CONFIG_SUNRAST_DECODER 0 -#define CONFIG_SVQ1_DECODER 0 -#define CONFIG_SVQ3_DECODER 0 -#define CONFIG_TARGA_DECODER 0 -#define CONFIG_TARGA_Y216_DECODER 0 -#define CONFIG_TDSC_DECODER 0 -#define CONFIG_THEORA_DECODER 0 -#define CONFIG_THP_DECODER 0 -#define CONFIG_TIERTEXSEQVIDEO_DECODER 0 -#define CONFIG_TIFF_DECODER 0 -#define CONFIG_TMV_DECODER 0 -#define CONFIG_TRUEMOTION1_DECODER 0 -#define CONFIG_TRUEMOTION2_DECODER 0 -#define CONFIG_TRUEMOTION2RT_DECODER 0 -#define CONFIG_TSCC_DECODER 0 -#define CONFIG_TSCC2_DECODER 0 -#define CONFIG_TXD_DECODER 0 -#define CONFIG_ULTI_DECODER 0 -#define CONFIG_UTVIDEO_DECODER 0 -#define CONFIG_V210_DECODER 0 -#define CONFIG_V210X_DECODER 0 -#define CONFIG_V308_DECODER 0 -#define CONFIG_V408_DECODER 0 -#define CONFIG_V410_DECODER 0 -#define CONFIG_VB_DECODER 0 -#define CONFIG_VBLE_DECODER 0 -#define CONFIG_VC1_DECODER 0 -#define CONFIG_VC1_CRYSTALHD_DECODER 0 -#define CONFIG_VC1_VDPAU_DECODER 0 -#define CONFIG_VC1IMAGE_DECODER 0 -#define CONFIG_VC1_MMAL_DECODER 0 -#define CONFIG_VC1_QSV_DECODER 0 -#define CONFIG_VC1_V4L2M2M_DECODER 0 -#define CONFIG_VCR1_DECODER 0 -#define CONFIG_VMDVIDEO_DECODER 0 -#define CONFIG_VMNC_DECODER 0 -#define CONFIG_VP3_DECODER 0 -#define CONFIG_VP5_DECODER 0 -#define CONFIG_VP6_DECODER 0 -#define CONFIG_VP6A_DECODER 0 -#define CONFIG_VP6F_DECODER 0 -#define CONFIG_VP7_DECODER 0 -#define CONFIG_VP8_DECODER 1 -#define CONFIG_VP8_RKMPP_DECODER 0 -#define CONFIG_VP8_V4L2M2M_DECODER 0 -#define CONFIG_VP9_DECODER 1 -#define CONFIG_VP9_RKMPP_DECODER 0 -#define CONFIG_VP9_V4L2M2M_DECODER 0 -#define CONFIG_VQA_DECODER 0 -#define CONFIG_BITPACKED_DECODER 0 -#define CONFIG_WEBP_DECODER 0 -#define CONFIG_WRAPPED_AVFRAME_DECODER 0 -#define CONFIG_WMV1_DECODER 0 -#define CONFIG_WMV2_DECODER 0 -#define CONFIG_WMV3_DECODER 0 -#define CONFIG_WMV3_CRYSTALHD_DECODER 0 -#define CONFIG_WMV3_VDPAU_DECODER 0 -#define CONFIG_WMV3IMAGE_DECODER 0 -#define CONFIG_WNV1_DECODER 0 -#define CONFIG_XAN_WC3_DECODER 0 -#define CONFIG_XAN_WC4_DECODER 0 -#define CONFIG_XBM_DECODER 0 -#define CONFIG_XFACE_DECODER 0 -#define CONFIG_XL_DECODER 0 -#define CONFIG_XPM_DECODER 0 -#define CONFIG_XWD_DECODER 0 -#define CONFIG_Y41P_DECODER 0 -#define CONFIG_YLC_DECODER 0 -#define CONFIG_YOP_DECODER 0 -#define CONFIG_YUV4_DECODER 0 -#define CONFIG_ZERO12V_DECODER 0 -#define CONFIG_ZEROCODEC_DECODER 0 -#define CONFIG_ZLIB_DECODER 0 -#define CONFIG_ZMBV_DECODER 0 -#define CONFIG_AAC_DECODER 1 -#define CONFIG_AAC_FIXED_DECODER 0 -#define CONFIG_AAC_LATM_DECODER 1 -#define CONFIG_AC3_DECODER 0 -#define CONFIG_AC3_FIXED_DECODER 0 -#define CONFIG_ALAC_DECODER 0 -#define CONFIG_ALS_DECODER 0 -#define CONFIG_AMRNB_DECODER 0 -#define CONFIG_AMRWB_DECODER 0 -#define CONFIG_APE_DECODER 0 -#define CONFIG_ATRAC1_DECODER 0 -#define CONFIG_ATRAC3_DECODER 0 -#define CONFIG_ATRAC3AL_DECODER 0 -#define CONFIG_ATRAC3P_DECODER 0 -#define CONFIG_ATRAC3PAL_DECODER 0 -#define CONFIG_BINKAUDIO_DCT_DECODER 0 -#define CONFIG_BINKAUDIO_RDFT_DECODER 0 -#define CONFIG_BMV_AUDIO_DECODER 0 -#define CONFIG_COOK_DECODER 0 -#define CONFIG_DCA_DECODER 0 -#define CONFIG_DOLBY_E_DECODER 0 -#define CONFIG_DSD_LSBF_DECODER 0 -#define CONFIG_DSD_MSBF_DECODER 0 -#define CONFIG_DSD_LSBF_PLANAR_DECODER 0 -#define CONFIG_DSD_MSBF_PLANAR_DECODER 0 -#define CONFIG_DSICINAUDIO_DECODER 0 -#define CONFIG_DSS_SP_DECODER 0 -#define CONFIG_DST_DECODER 0 -#define CONFIG_EAC3_DECODER 0 -#define CONFIG_EVRC_DECODER 0 -#define CONFIG_FFWAVESYNTH_DECODER 0 -#define CONFIG_FLAC_DECODER 1 -#define CONFIG_G723_1_DECODER 0 -#define CONFIG_G729_DECODER 0 -#define CONFIG_GSM_DECODER 0 -#define CONFIG_GSM_MS_DECODER 0 -#define CONFIG_IAC_DECODER 0 -#define CONFIG_IMC_DECODER 0 -#define CONFIG_INTERPLAY_ACM_DECODER 0 -#define CONFIG_MACE3_DECODER 0 -#define CONFIG_MACE6_DECODER 0 -#define CONFIG_METASOUND_DECODER 0 -#define CONFIG_MLP_DECODER 0 -#define CONFIG_MP1_DECODER 0 -#define CONFIG_MP1FLOAT_DECODER 0 -#define CONFIG_MP2_DECODER 0 -#define CONFIG_MP2FLOAT_DECODER 0 -#define CONFIG_MP3_DECODER 1 -#define CONFIG_MP3FLOAT_DECODER 0 -#define CONFIG_MP3ADU_DECODER 0 -#define CONFIG_MP3ADUFLOAT_DECODER 0 -#define CONFIG_MP3ON4_DECODER 0 -#define CONFIG_MP3ON4FLOAT_DECODER 0 -#define CONFIG_MPC7_DECODER 0 -#define CONFIG_MPC8_DECODER 0 -#define CONFIG_NELLYMOSER_DECODER 0 -#define CONFIG_ON2AVC_DECODER 0 -#define CONFIG_OPUS_DECODER 0 -#define CONFIG_PAF_AUDIO_DECODER 0 -#define CONFIG_QCELP_DECODER 0 -#define CONFIG_QDM2_DECODER 0 -#define CONFIG_QDMC_DECODER 0 -#define CONFIG_RA_144_DECODER 0 -#define CONFIG_RA_288_DECODER 0 -#define CONFIG_RALF_DECODER 0 -#define CONFIG_SHORTEN_DECODER 0 -#define CONFIG_SIPR_DECODER 0 -#define CONFIG_SMACKAUD_DECODER 0 -#define CONFIG_SONIC_DECODER 0 -#define CONFIG_TAK_DECODER 0 -#define CONFIG_TRUEHD_DECODER 0 -#define CONFIG_TRUESPEECH_DECODER 0 -#define CONFIG_TTA_DECODER 0 -#define CONFIG_TWINVQ_DECODER 0 -#define CONFIG_VMDAUDIO_DECODER 0 -#define CONFIG_VORBIS_DECODER 0 -#define CONFIG_WAVPACK_DECODER 0 -#define CONFIG_WMALOSSLESS_DECODER 0 -#define CONFIG_WMAPRO_DECODER 0 -#define CONFIG_WMAV1_DECODER 0 -#define CONFIG_WMAV2_DECODER 0 -#define CONFIG_WMAVOICE_DECODER 0 -#define CONFIG_WS_SND1_DECODER 0 -#define CONFIG_XMA1_DECODER 0 -#define CONFIG_XMA2_DECODER 0 -#define CONFIG_PCM_ALAW_DECODER 0 -#define CONFIG_PCM_BLURAY_DECODER 0 -#define CONFIG_PCM_DVD_DECODER 0 -#define CONFIG_PCM_F16LE_DECODER 0 -#define CONFIG_PCM_F24LE_DECODER 0 -#define CONFIG_PCM_F32BE_DECODER 0 -#define CONFIG_PCM_F32LE_DECODER 0 -#define CONFIG_PCM_F64BE_DECODER 0 -#define CONFIG_PCM_F64LE_DECODER 0 -#define CONFIG_PCM_LXF_DECODER 0 -#define CONFIG_PCM_MULAW_DECODER 0 -#define CONFIG_PCM_S8_DECODER 0 -#define CONFIG_PCM_S8_PLANAR_DECODER 0 -#define CONFIG_PCM_S16BE_DECODER 0 -#define CONFIG_PCM_S16BE_PLANAR_DECODER 0 -#define CONFIG_PCM_S16LE_DECODER 0 -#define CONFIG_PCM_S16LE_PLANAR_DECODER 0 -#define CONFIG_PCM_S24BE_DECODER 0 -#define CONFIG_PCM_S24DAUD_DECODER 0 -#define CONFIG_PCM_S24LE_DECODER 0 -#define CONFIG_PCM_S24LE_PLANAR_DECODER 0 -#define CONFIG_PCM_S32BE_DECODER 0 -#define CONFIG_PCM_S32LE_DECODER 0 -#define CONFIG_PCM_S32LE_PLANAR_DECODER 0 -#define CONFIG_PCM_S64BE_DECODER 0 -#define CONFIG_PCM_S64LE_DECODER 0 -#define CONFIG_PCM_U8_DECODER 0 -#define CONFIG_PCM_U16BE_DECODER 0 -#define CONFIG_PCM_U16LE_DECODER 0 -#define CONFIG_PCM_U24BE_DECODER 0 -#define CONFIG_PCM_U24LE_DECODER 0 -#define CONFIG_PCM_U32BE_DECODER 0 -#define CONFIG_PCM_U32LE_DECODER 0 -#define CONFIG_PCM_ZORK_DECODER 0 -#define CONFIG_GREMLIN_DPCM_DECODER 0 -#define CONFIG_INTERPLAY_DPCM_DECODER 0 -#define CONFIG_ROQ_DPCM_DECODER 0 -#define CONFIG_SOL_DPCM_DECODER 0 -#define CONFIG_XAN_DPCM_DECODER 0 -#define CONFIG_ADPCM_4XM_DECODER 0 -#define CONFIG_ADPCM_ADX_DECODER 0 -#define CONFIG_ADPCM_AFC_DECODER 0 -#define CONFIG_ADPCM_AICA_DECODER 0 -#define CONFIG_ADPCM_CT_DECODER 0 -#define CONFIG_ADPCM_DTK_DECODER 0 -#define CONFIG_ADPCM_EA_DECODER 0 -#define CONFIG_ADPCM_EA_MAXIS_XA_DECODER 0 -#define CONFIG_ADPCM_EA_R1_DECODER 0 -#define CONFIG_ADPCM_EA_R2_DECODER 0 -#define CONFIG_ADPCM_EA_R3_DECODER 0 -#define CONFIG_ADPCM_EA_XAS_DECODER 0 -#define CONFIG_ADPCM_G722_DECODER 0 -#define CONFIG_ADPCM_G726_DECODER 0 -#define CONFIG_ADPCM_G726LE_DECODER 0 -#define CONFIG_ADPCM_IMA_AMV_DECODER 0 -#define CONFIG_ADPCM_IMA_APC_DECODER 0 -#define CONFIG_ADPCM_IMA_DAT4_DECODER 0 -#define CONFIG_ADPCM_IMA_DK3_DECODER 0 -#define CONFIG_ADPCM_IMA_DK4_DECODER 0 -#define CONFIG_ADPCM_IMA_EA_EACS_DECODER 0 -#define CONFIG_ADPCM_IMA_EA_SEAD_DECODER 0 -#define CONFIG_ADPCM_IMA_ISS_DECODER 0 -#define CONFIG_ADPCM_IMA_OKI_DECODER 0 -#define CONFIG_ADPCM_IMA_QT_DECODER 0 -#define CONFIG_ADPCM_IMA_RAD_DECODER 0 -#define CONFIG_ADPCM_IMA_SMJPEG_DECODER 0 -#define CONFIG_ADPCM_IMA_WAV_DECODER 0 -#define CONFIG_ADPCM_IMA_WS_DECODER 0 -#define CONFIG_ADPCM_MS_DECODER 0 -#define CONFIG_ADPCM_MTAF_DECODER 0 -#define CONFIG_ADPCM_PSX_DECODER 0 -#define CONFIG_ADPCM_SBPRO_2_DECODER 0 -#define CONFIG_ADPCM_SBPRO_3_DECODER 0 -#define CONFIG_ADPCM_SBPRO_4_DECODER 0 -#define CONFIG_ADPCM_SWF_DECODER 0 -#define CONFIG_ADPCM_THP_DECODER 0 -#define CONFIG_ADPCM_THP_LE_DECODER 0 -#define CONFIG_ADPCM_VIMA_DECODER 0 -#define CONFIG_ADPCM_XA_DECODER 0 -#define CONFIG_ADPCM_YAMAHA_DECODER 0 -#define CONFIG_SSA_DECODER 0 -#define CONFIG_ASS_DECODER 0 -#define CONFIG_CCAPTION_DECODER 0 -#define CONFIG_DVBSUB_DECODER 0 -#define CONFIG_DVDSUB_DECODER 0 -#define CONFIG_JACOSUB_DECODER 0 -#define CONFIG_MICRODVD_DECODER 0 -#define CONFIG_MOVTEXT_DECODER 0 -#define CONFIG_MPL2_DECODER 0 -#define CONFIG_PGSSUB_DECODER 0 -#define CONFIG_PJS_DECODER 0 -#define CONFIG_REALTEXT_DECODER 0 -#define CONFIG_SAMI_DECODER 0 -#define CONFIG_SRT_DECODER 0 -#define CONFIG_STL_DECODER 0 -#define CONFIG_SUBRIP_DECODER 0 -#define CONFIG_SUBVIEWER_DECODER 0 -#define CONFIG_SUBVIEWER1_DECODER 0 -#define CONFIG_TEXT_DECODER 0 -#define CONFIG_VPLAYER_DECODER 0 -#define CONFIG_WEBVTT_DECODER 0 -#define CONFIG_XSUB_DECODER 0 -#define CONFIG_AAC_AT_DECODER 0 -#define CONFIG_AC3_AT_DECODER 0 -#define CONFIG_ADPCM_IMA_QT_AT_DECODER 0 -#define CONFIG_ALAC_AT_DECODER 0 -#define CONFIG_AMR_NB_AT_DECODER 0 -#define CONFIG_EAC3_AT_DECODER 0 -#define CONFIG_GSM_MS_AT_DECODER 0 -#define CONFIG_ILBC_AT_DECODER 0 -#define CONFIG_MP1_AT_DECODER 0 -#define CONFIG_MP2_AT_DECODER 0 -#define CONFIG_MP3_AT_DECODER 0 -#define CONFIG_PCM_ALAW_AT_DECODER 0 -#define CONFIG_PCM_MULAW_AT_DECODER 0 -#define CONFIG_QDMC_AT_DECODER 0 -#define CONFIG_QDM2_AT_DECODER 0 -#define CONFIG_LIBCELT_DECODER 0 -#define CONFIG_LIBFDK_AAC_DECODER 0 -#define CONFIG_LIBGSM_DECODER 0 -#define CONFIG_LIBGSM_MS_DECODER 0 -#define CONFIG_LIBILBC_DECODER 0 -#define CONFIG_LIBOPENCORE_AMRNB_DECODER 0 -#define CONFIG_LIBOPENCORE_AMRWB_DECODER 0 -#define CONFIG_LIBOPENJPEG_DECODER 0 -#define CONFIG_LIBOPUS_DECODER 0 -#define CONFIG_LIBRSVG_DECODER 0 -#define CONFIG_LIBSPEEX_DECODER 0 -#define CONFIG_LIBVORBIS_DECODER 0 -#define CONFIG_LIBVPX_VP8_DECODER 0 -#define CONFIG_LIBVPX_VP9_DECODER 0 -#define CONFIG_LIBZVBI_TELETEXT_DECODER 0 -#define CONFIG_BINTEXT_DECODER 0 -#define CONFIG_XBIN_DECODER 0 -#define CONFIG_IDF_DECODER 0 -#define CONFIG_LIBOPENH264_DECODER 0 -#define CONFIG_H264_CUVID_DECODER 0 -#define CONFIG_HEVC_CUVID_DECODER 0 -#define CONFIG_HEVC_MEDIACODEC_DECODER 0 -#define CONFIG_MJPEG_CUVID_DECODER 0 -#define CONFIG_MPEG1_CUVID_DECODER 0 -#define CONFIG_MPEG2_CUVID_DECODER 0 -#define CONFIG_MPEG4_CUVID_DECODER 0 -#define CONFIG_MPEG4_MEDIACODEC_DECODER 0 -#define CONFIG_VC1_CUVID_DECODER 0 -#define CONFIG_VP8_CUVID_DECODER 0 -#define CONFIG_VP8_MEDIACODEC_DECODER 0 -#define CONFIG_VP8_QSV_DECODER 0 -#define CONFIG_VP9_CUVID_DECODER 0 -#define CONFIG_VP9_MEDIACODEC_DECODER 0 -#define CONFIG_AA_DEMUXER 0 -#define CONFIG_AAC_DEMUXER 0 -#define CONFIG_AC3_DEMUXER 0 -#define CONFIG_ACM_DEMUXER 0 -#define CONFIG_ACT_DEMUXER 0 -#define CONFIG_ADF_DEMUXER 0 -#define CONFIG_ADP_DEMUXER 0 -#define CONFIG_ADS_DEMUXER 0 -#define CONFIG_ADX_DEMUXER 0 -#define CONFIG_AEA_DEMUXER 0 -#define CONFIG_AFC_DEMUXER 0 -#define CONFIG_AIFF_DEMUXER 0 -#define CONFIG_AIX_DEMUXER 0 -#define CONFIG_AMR_DEMUXER 0 -#define CONFIG_ANM_DEMUXER 0 -#define CONFIG_APC_DEMUXER 0 -#define CONFIG_APE_DEMUXER 0 -#define CONFIG_APNG_DEMUXER 0 -#define CONFIG_AQTITLE_DEMUXER 0 -#define CONFIG_ASF_DEMUXER 0 -#define CONFIG_ASF_O_DEMUXER 0 -#define CONFIG_ASS_DEMUXER 0 -#define CONFIG_AST_DEMUXER 0 -#define CONFIG_AU_DEMUXER 0 -#define CONFIG_AVI_DEMUXER 0 -#define CONFIG_AVISYNTH_DEMUXER 0 -#define CONFIG_AVR_DEMUXER 0 -#define CONFIG_AVS_DEMUXER 0 -#define CONFIG_BETHSOFTVID_DEMUXER 0 -#define CONFIG_BFI_DEMUXER 0 -#define CONFIG_BINTEXT_DEMUXER 0 -#define CONFIG_BINK_DEMUXER 0 -#define CONFIG_BIT_DEMUXER 0 -#define CONFIG_BMV_DEMUXER 0 -#define CONFIG_BFSTM_DEMUXER 0 -#define CONFIG_BRSTM_DEMUXER 0 -#define CONFIG_BOA_DEMUXER 0 -#define CONFIG_C93_DEMUXER 0 -#define CONFIG_CAF_DEMUXER 0 -#define CONFIG_CAVSVIDEO_DEMUXER 0 -#define CONFIG_CDG_DEMUXER 0 -#define CONFIG_CDXL_DEMUXER 0 -#define CONFIG_CINE_DEMUXER 0 -#define CONFIG_CONCAT_DEMUXER 0 -#define CONFIG_DASH_DEMUXER 0 -#define CONFIG_DATA_DEMUXER 0 -#define CONFIG_DAUD_DEMUXER 0 -#define CONFIG_DCSTR_DEMUXER 0 -#define CONFIG_DFA_DEMUXER 0 -#define CONFIG_DIRAC_DEMUXER 0 -#define CONFIG_DNXHD_DEMUXER 0 -#define CONFIG_DSF_DEMUXER 0 -#define CONFIG_DSICIN_DEMUXER 0 -#define CONFIG_DSS_DEMUXER 0 -#define CONFIG_DTS_DEMUXER 0 -#define CONFIG_DTSHD_DEMUXER 0 -#define CONFIG_DV_DEMUXER 0 -#define CONFIG_DVBSUB_DEMUXER 0 -#define CONFIG_DVBTXT_DEMUXER 0 -#define CONFIG_DXA_DEMUXER 0 -#define CONFIG_EA_DEMUXER 0 -#define CONFIG_EA_CDATA_DEMUXER 0 -#define CONFIG_EAC3_DEMUXER 0 -#define CONFIG_EPAF_DEMUXER 0 -#define CONFIG_FFM_DEMUXER 0 -#define CONFIG_FFMETADATA_DEMUXER 0 -#define CONFIG_FILMSTRIP_DEMUXER 0 -#define CONFIG_FITS_DEMUXER 0 -#define CONFIG_FLAC_DEMUXER 0 -#define CONFIG_FLIC_DEMUXER 0 -#define CONFIG_FLV_DEMUXER 0 -#define CONFIG_LIVE_FLV_DEMUXER 0 -#define CONFIG_FOURXM_DEMUXER 0 -#define CONFIG_FRM_DEMUXER 0 -#define CONFIG_FSB_DEMUXER 0 -#define CONFIG_G722_DEMUXER 0 -#define CONFIG_G723_1_DEMUXER 0 -#define CONFIG_G726_DEMUXER 0 -#define CONFIG_G726LE_DEMUXER 0 -#define CONFIG_G729_DEMUXER 0 -#define CONFIG_GDV_DEMUXER 0 -#define CONFIG_GENH_DEMUXER 0 -#define CONFIG_GIF_DEMUXER 0 -#define CONFIG_GSM_DEMUXER 0 -#define CONFIG_GXF_DEMUXER 0 -#define CONFIG_H261_DEMUXER 0 -#define CONFIG_H263_DEMUXER 0 -#define CONFIG_H264_DEMUXER 0 -#define CONFIG_HEVC_DEMUXER 0 -#define CONFIG_HLS_DEMUXER 0 -#define CONFIG_HNM_DEMUXER 0 -#define CONFIG_ICO_DEMUXER 0 -#define CONFIG_IDCIN_DEMUXER 0 -#define CONFIG_IDF_DEMUXER 0 -#define CONFIG_IFF_DEMUXER 0 -#define CONFIG_ILBC_DEMUXER 0 -#define CONFIG_IMAGE2_DEMUXER 0 -#define CONFIG_IMAGE2PIPE_DEMUXER 0 -#define CONFIG_IMAGE2_ALIAS_PIX_DEMUXER 0 -#define CONFIG_IMAGE2_BRENDER_PIX_DEMUXER 0 -#define CONFIG_INGENIENT_DEMUXER 0 -#define CONFIG_IPMOVIE_DEMUXER 0 -#define CONFIG_IRCAM_DEMUXER 0 -#define CONFIG_ISS_DEMUXER 0 -#define CONFIG_IV8_DEMUXER 0 -#define CONFIG_IVF_DEMUXER 0 -#define CONFIG_IVR_DEMUXER 0 -#define CONFIG_JACOSUB_DEMUXER 0 -#define CONFIG_JV_DEMUXER 0 -#define CONFIG_LMLM4_DEMUXER 0 -#define CONFIG_LOAS_DEMUXER 0 -#define CONFIG_LRC_DEMUXER 0 -#define CONFIG_LVF_DEMUXER 0 -#define CONFIG_LXF_DEMUXER 0 -#define CONFIG_M4V_DEMUXER 0 -#define CONFIG_MATROSKA_DEMUXER 0 -#define CONFIG_MGSTS_DEMUXER 0 -#define CONFIG_MICRODVD_DEMUXER 0 -#define CONFIG_MJPEG_DEMUXER 0 -#define CONFIG_MJPEG_2000_DEMUXER 0 -#define CONFIG_MLP_DEMUXER 0 -#define CONFIG_MLV_DEMUXER 0 -#define CONFIG_MM_DEMUXER 0 -#define CONFIG_MMF_DEMUXER 0 -#define CONFIG_MOV_DEMUXER 0 -#define CONFIG_MP3_DEMUXER 0 -#define CONFIG_MPC_DEMUXER 0 -#define CONFIG_MPC8_DEMUXER 0 -#define CONFIG_MPEGPS_DEMUXER 0 -#define CONFIG_MPEGTS_DEMUXER 0 -#define CONFIG_MPEGTSRAW_DEMUXER 0 -#define CONFIG_MPEGVIDEO_DEMUXER 0 -#define CONFIG_MPJPEG_DEMUXER 0 -#define CONFIG_MPL2_DEMUXER 0 -#define CONFIG_MPSUB_DEMUXER 0 -#define CONFIG_MSF_DEMUXER 0 -#define CONFIG_MSNWC_TCP_DEMUXER 0 -#define CONFIG_MTAF_DEMUXER 0 -#define CONFIG_MTV_DEMUXER 0 -#define CONFIG_MUSX_DEMUXER 0 -#define CONFIG_MV_DEMUXER 0 -#define CONFIG_MVI_DEMUXER 0 -#define CONFIG_MXF_DEMUXER 0 -#define CONFIG_MXG_DEMUXER 0 -#define CONFIG_NC_DEMUXER 0 -#define CONFIG_NISTSPHERE_DEMUXER 0 -#define CONFIG_NSV_DEMUXER 0 -#define CONFIG_NUT_DEMUXER 0 -#define CONFIG_NUV_DEMUXER 0 -#define CONFIG_OGG_DEMUXER 0 -#define CONFIG_OMA_DEMUXER 0 -#define CONFIG_PAF_DEMUXER 0 -#define CONFIG_PCM_ALAW_DEMUXER 0 -#define CONFIG_PCM_MULAW_DEMUXER 0 -#define CONFIG_PCM_F64BE_DEMUXER 0 -#define CONFIG_PCM_F64LE_DEMUXER 0 -#define CONFIG_PCM_F32BE_DEMUXER 0 -#define CONFIG_PCM_F32LE_DEMUXER 0 -#define CONFIG_PCM_S32BE_DEMUXER 0 -#define CONFIG_PCM_S32LE_DEMUXER 0 -#define CONFIG_PCM_S24BE_DEMUXER 0 -#define CONFIG_PCM_S24LE_DEMUXER 0 -#define CONFIG_PCM_S16BE_DEMUXER 0 -#define CONFIG_PCM_S16LE_DEMUXER 0 -#define CONFIG_PCM_S8_DEMUXER 0 -#define CONFIG_PCM_U32BE_DEMUXER 0 -#define CONFIG_PCM_U32LE_DEMUXER 0 -#define CONFIG_PCM_U24BE_DEMUXER 0 -#define CONFIG_PCM_U24LE_DEMUXER 0 -#define CONFIG_PCM_U16BE_DEMUXER 0 -#define CONFIG_PCM_U16LE_DEMUXER 0 -#define CONFIG_PCM_U8_DEMUXER 0 -#define CONFIG_PJS_DEMUXER 0 -#define CONFIG_PMP_DEMUXER 0 -#define CONFIG_PVA_DEMUXER 0 -#define CONFIG_PVF_DEMUXER 0 -#define CONFIG_QCP_DEMUXER 0 -#define CONFIG_R3D_DEMUXER 0 -#define CONFIG_RAWVIDEO_DEMUXER 0 -#define CONFIG_REALTEXT_DEMUXER 0 -#define CONFIG_REDSPARK_DEMUXER 0 -#define CONFIG_RL2_DEMUXER 0 -#define CONFIG_RM_DEMUXER 0 -#define CONFIG_ROQ_DEMUXER 0 -#define CONFIG_RPL_DEMUXER 0 -#define CONFIG_RSD_DEMUXER 0 -#define CONFIG_RSO_DEMUXER 0 -#define CONFIG_RTP_DEMUXER 0 -#define CONFIG_RTSP_DEMUXER 0 -#define CONFIG_S337M_DEMUXER 0 -#define CONFIG_SAMI_DEMUXER 0 -#define CONFIG_SAP_DEMUXER 0 -#define CONFIG_SBG_DEMUXER 0 -#define CONFIG_SCC_DEMUXER 0 -#define CONFIG_SDP_DEMUXER 0 -#define CONFIG_SDR2_DEMUXER 0 -#define CONFIG_SDS_DEMUXER 0 -#define CONFIG_SDX_DEMUXER 0 -#define CONFIG_SEGAFILM_DEMUXER 0 -#define CONFIG_SHORTEN_DEMUXER 0 -#define CONFIG_SIFF_DEMUXER 0 -#define CONFIG_SLN_DEMUXER 0 -#define CONFIG_SMACKER_DEMUXER 0 -#define CONFIG_SMJPEG_DEMUXER 0 -#define CONFIG_SMUSH_DEMUXER 0 -#define CONFIG_SOL_DEMUXER 0 -#define CONFIG_SOX_DEMUXER 0 -#define CONFIG_SPDIF_DEMUXER 0 -#define CONFIG_SRT_DEMUXER 0 -#define CONFIG_STR_DEMUXER 0 -#define CONFIG_STL_DEMUXER 0 -#define CONFIG_SUBVIEWER1_DEMUXER 0 -#define CONFIG_SUBVIEWER_DEMUXER 0 -#define CONFIG_SUP_DEMUXER 0 -#define CONFIG_SVAG_DEMUXER 0 -#define CONFIG_SWF_DEMUXER 0 -#define CONFIG_TAK_DEMUXER 0 -#define CONFIG_TEDCAPTIONS_DEMUXER 0 -#define CONFIG_THP_DEMUXER 0 -#define CONFIG_THREEDOSTR_DEMUXER 0 -#define CONFIG_TIERTEXSEQ_DEMUXER 0 -#define CONFIG_TMV_DEMUXER 0 -#define CONFIG_TRUEHD_DEMUXER 0 -#define CONFIG_TTA_DEMUXER 0 -#define CONFIG_TXD_DEMUXER 0 -#define CONFIG_TTY_DEMUXER 0 -#define CONFIG_V210_DEMUXER 0 -#define CONFIG_V210X_DEMUXER 0 -#define CONFIG_VAG_DEMUXER 0 -#define CONFIG_VC1_DEMUXER 0 -#define CONFIG_VC1T_DEMUXER 0 -#define CONFIG_VIVO_DEMUXER 0 -#define CONFIG_VMD_DEMUXER 0 -#define CONFIG_VOBSUB_DEMUXER 0 -#define CONFIG_VOC_DEMUXER 0 -#define CONFIG_VPK_DEMUXER 0 -#define CONFIG_VPLAYER_DEMUXER 0 -#define CONFIG_VQF_DEMUXER 0 -#define CONFIG_W64_DEMUXER 0 -#define CONFIG_WAV_DEMUXER 0 -#define CONFIG_WC3_DEMUXER 0 -#define CONFIG_WEBM_DASH_MANIFEST_DEMUXER 0 -#define CONFIG_WEBVTT_DEMUXER 0 -#define CONFIG_WSAUD_DEMUXER 0 -#define CONFIG_WSD_DEMUXER 0 -#define CONFIG_WSVQA_DEMUXER 0 -#define CONFIG_WTV_DEMUXER 0 -#define CONFIG_WVE_DEMUXER 0 -#define CONFIG_WV_DEMUXER 0 -#define CONFIG_XA_DEMUXER 0 -#define CONFIG_XBIN_DEMUXER 0 -#define CONFIG_XMV_DEMUXER 0 -#define CONFIG_XVAG_DEMUXER 0 -#define CONFIG_XWMA_DEMUXER 0 -#define CONFIG_YOP_DEMUXER 0 -#define CONFIG_YUV4MPEGPIPE_DEMUXER 0 -#define CONFIG_IMAGE_BMP_PIPE_DEMUXER 0 -#define CONFIG_IMAGE_DDS_PIPE_DEMUXER 0 -#define CONFIG_IMAGE_DPX_PIPE_DEMUXER 0 -#define CONFIG_IMAGE_EXR_PIPE_DEMUXER 0 -#define CONFIG_IMAGE_J2K_PIPE_DEMUXER 0 -#define CONFIG_IMAGE_JPEG_PIPE_DEMUXER 0 -#define CONFIG_IMAGE_JPEGLS_PIPE_DEMUXER 0 -#define CONFIG_IMAGE_PAM_PIPE_DEMUXER 0 -#define CONFIG_IMAGE_PBM_PIPE_DEMUXER 0 -#define CONFIG_IMAGE_PCX_PIPE_DEMUXER 0 -#define CONFIG_IMAGE_PGMYUV_PIPE_DEMUXER 0 -#define CONFIG_IMAGE_PGM_PIPE_DEMUXER 0 -#define CONFIG_IMAGE_PICTOR_PIPE_DEMUXER 0 -#define CONFIG_IMAGE_PNG_PIPE_DEMUXER 0 -#define CONFIG_IMAGE_PPM_PIPE_DEMUXER 0 -#define CONFIG_IMAGE_PSD_PIPE_DEMUXER 0 -#define CONFIG_IMAGE_QDRAW_PIPE_DEMUXER 0 -#define CONFIG_IMAGE_SGI_PIPE_DEMUXER 0 -#define CONFIG_IMAGE_SVG_PIPE_DEMUXER 0 -#define CONFIG_IMAGE_SUNRAST_PIPE_DEMUXER 0 -#define CONFIG_IMAGE_TIFF_PIPE_DEMUXER 0 -#define CONFIG_IMAGE_WEBP_PIPE_DEMUXER 0 -#define CONFIG_IMAGE_XPM_PIPE_DEMUXER 0 -#define CONFIG_LIBGME_DEMUXER 0 -#define CONFIG_LIBMODPLUG_DEMUXER 0 -#define CONFIG_LIBOPENMPT_DEMUXER 0 -#define CONFIG_A64MULTI_ENCODER 0 -#define CONFIG_A64MULTI5_ENCODER 0 -#define CONFIG_ALIAS_PIX_ENCODER 0 -#define CONFIG_AMV_ENCODER 0 -#define CONFIG_APNG_ENCODER 0 -#define CONFIG_ASV1_ENCODER 0 -#define CONFIG_ASV2_ENCODER 0 -#define CONFIG_AVRP_ENCODER 0 -#define CONFIG_AVUI_ENCODER 0 -#define CONFIG_AYUV_ENCODER 0 -#define CONFIG_BMP_ENCODER 0 -#define CONFIG_CINEPAK_ENCODER 0 -#define CONFIG_CLJR_ENCODER 0 -#define CONFIG_COMFORTNOISE_ENCODER 0 -#define CONFIG_DNXHD_ENCODER 0 -#define CONFIG_DPX_ENCODER 0 -#define CONFIG_DVVIDEO_ENCODER 0 -#define CONFIG_FFV1_ENCODER 0 -#define CONFIG_FFVHUFF_ENCODER 0 -#define CONFIG_FITS_ENCODER 0 -#define CONFIG_FLASHSV_ENCODER 0 -#define CONFIG_FLASHSV2_ENCODER 0 -#define CONFIG_FLV_ENCODER 0 -#define CONFIG_GIF_ENCODER 0 -#define CONFIG_H261_ENCODER 0 -#define CONFIG_H263_ENCODER 0 -#define CONFIG_H263P_ENCODER 0 -#define CONFIG_HAP_ENCODER 0 -#define CONFIG_HUFFYUV_ENCODER 0 -#define CONFIG_JPEG2000_ENCODER 0 -#define CONFIG_JPEGLS_ENCODER 0 -#define CONFIG_LJPEG_ENCODER 0 -#define CONFIG_MJPEG_ENCODER 0 -#define CONFIG_MPEG1VIDEO_ENCODER 0 -#define CONFIG_MPEG2VIDEO_ENCODER 0 -#define CONFIG_MPEG4_ENCODER 0 -#define CONFIG_MSMPEG4V2_ENCODER 0 -#define CONFIG_MSMPEG4V3_ENCODER 0 -#define CONFIG_MSVIDEO1_ENCODER 0 -#define CONFIG_PAM_ENCODER 0 -#define CONFIG_PBM_ENCODER 0 -#define CONFIG_PCX_ENCODER 0 -#define CONFIG_PGM_ENCODER 0 -#define CONFIG_PGMYUV_ENCODER 0 -#define CONFIG_PNG_ENCODER 0 -#define CONFIG_PPM_ENCODER 0 -#define CONFIG_PRORES_ENCODER 0 -#define CONFIG_PRORES_AW_ENCODER 0 -#define CONFIG_PRORES_KS_ENCODER 0 -#define CONFIG_QTRLE_ENCODER 0 -#define CONFIG_R10K_ENCODER 0 -#define CONFIG_R210_ENCODER 0 -#define CONFIG_RAWVIDEO_ENCODER 0 -#define CONFIG_ROQ_ENCODER 0 -#define CONFIG_RV10_ENCODER 0 -#define CONFIG_RV20_ENCODER 0 -#define CONFIG_S302M_ENCODER 0 -#define CONFIG_SGI_ENCODER 0 -#define CONFIG_SNOW_ENCODER 0 -#define CONFIG_SUNRAST_ENCODER 0 -#define CONFIG_SVQ1_ENCODER 0 -#define CONFIG_TARGA_ENCODER 0 -#define CONFIG_TIFF_ENCODER 0 -#define CONFIG_UTVIDEO_ENCODER 0 -#define CONFIG_V210_ENCODER 0 -#define CONFIG_V308_ENCODER 0 -#define CONFIG_V408_ENCODER 0 -#define CONFIG_V410_ENCODER 0 -#define CONFIG_VC2_ENCODER 0 -#define CONFIG_WRAPPED_AVFRAME_ENCODER 0 -#define CONFIG_WMV1_ENCODER 0 -#define CONFIG_WMV2_ENCODER 0 -#define CONFIG_XBM_ENCODER 0 -#define CONFIG_XFACE_ENCODER 0 -#define CONFIG_XWD_ENCODER 0 -#define CONFIG_Y41P_ENCODER 0 -#define CONFIG_YUV4_ENCODER 0 -#define CONFIG_ZLIB_ENCODER 0 -#define CONFIG_ZMBV_ENCODER 0 -#define CONFIG_AAC_ENCODER 0 -#define CONFIG_AC3_ENCODER 0 -#define CONFIG_AC3_FIXED_ENCODER 0 -#define CONFIG_ALAC_ENCODER 0 -#define CONFIG_DCA_ENCODER 0 -#define CONFIG_EAC3_ENCODER 0 -#define CONFIG_FLAC_ENCODER 0 -#define CONFIG_G723_1_ENCODER 0 -#define CONFIG_MLP_ENCODER 0 -#define CONFIG_MP2_ENCODER 0 -#define CONFIG_MP2FIXED_ENCODER 0 -#define CONFIG_NELLYMOSER_ENCODER 0 -#define CONFIG_OPUS_ENCODER 0 -#define CONFIG_RA_144_ENCODER 0 -#define CONFIG_SONIC_ENCODER 0 -#define CONFIG_SONIC_LS_ENCODER 0 -#define CONFIG_TRUEHD_ENCODER 0 -#define CONFIG_TTA_ENCODER 0 -#define CONFIG_VORBIS_ENCODER 0 -#define CONFIG_WAVPACK_ENCODER 0 -#define CONFIG_WMAV1_ENCODER 0 -#define CONFIG_WMAV2_ENCODER 0 -#define CONFIG_PCM_ALAW_ENCODER 0 -#define CONFIG_PCM_F32BE_ENCODER 0 -#define CONFIG_PCM_F32LE_ENCODER 0 -#define CONFIG_PCM_F64BE_ENCODER 0 -#define CONFIG_PCM_F64LE_ENCODER 0 -#define CONFIG_PCM_MULAW_ENCODER 0 -#define CONFIG_PCM_S8_ENCODER 0 -#define CONFIG_PCM_S8_PLANAR_ENCODER 0 -#define CONFIG_PCM_S16BE_ENCODER 0 -#define CONFIG_PCM_S16BE_PLANAR_ENCODER 0 -#define CONFIG_PCM_S16LE_ENCODER 0 -#define CONFIG_PCM_S16LE_PLANAR_ENCODER 0 -#define CONFIG_PCM_S24BE_ENCODER 0 -#define CONFIG_PCM_S24DAUD_ENCODER 0 -#define CONFIG_PCM_S24LE_ENCODER 0 -#define CONFIG_PCM_S24LE_PLANAR_ENCODER 0 -#define CONFIG_PCM_S32BE_ENCODER 0 -#define CONFIG_PCM_S32LE_ENCODER 0 -#define CONFIG_PCM_S32LE_PLANAR_ENCODER 0 -#define CONFIG_PCM_S64BE_ENCODER 0 -#define CONFIG_PCM_S64LE_ENCODER 0 -#define CONFIG_PCM_U8_ENCODER 0 -#define CONFIG_PCM_U16BE_ENCODER 0 -#define CONFIG_PCM_U16LE_ENCODER 0 -#define CONFIG_PCM_U24BE_ENCODER 0 -#define CONFIG_PCM_U24LE_ENCODER 0 -#define CONFIG_PCM_U32BE_ENCODER 0 -#define CONFIG_PCM_U32LE_ENCODER 0 -#define CONFIG_ROQ_DPCM_ENCODER 0 -#define CONFIG_ADPCM_ADX_ENCODER 0 -#define CONFIG_ADPCM_G722_ENCODER 0 -#define CONFIG_ADPCM_G726_ENCODER 0 -#define CONFIG_ADPCM_G726LE_ENCODER 0 -#define CONFIG_ADPCM_IMA_QT_ENCODER 0 -#define CONFIG_ADPCM_IMA_WAV_ENCODER 0 -#define CONFIG_ADPCM_MS_ENCODER 0 -#define CONFIG_ADPCM_SWF_ENCODER 0 -#define CONFIG_ADPCM_YAMAHA_ENCODER 0 -#define CONFIG_SSA_ENCODER 0 -#define CONFIG_ASS_ENCODER 0 -#define CONFIG_DVBSUB_ENCODER 0 -#define CONFIG_DVDSUB_ENCODER 0 -#define CONFIG_MOVTEXT_ENCODER 0 -#define CONFIG_SRT_ENCODER 0 -#define CONFIG_SUBRIP_ENCODER 0 -#define CONFIG_TEXT_ENCODER 0 -#define CONFIG_WEBVTT_ENCODER 0 -#define CONFIG_XSUB_ENCODER 0 -#define CONFIG_AAC_AT_ENCODER 0 -#define CONFIG_ALAC_AT_ENCODER 0 -#define CONFIG_ILBC_AT_ENCODER 0 -#define CONFIG_PCM_ALAW_AT_ENCODER 0 -#define CONFIG_PCM_MULAW_AT_ENCODER 0 -#define CONFIG_LIBFDK_AAC_ENCODER 0 -#define CONFIG_LIBGSM_ENCODER 0 -#define CONFIG_LIBGSM_MS_ENCODER 0 -#define CONFIG_LIBILBC_ENCODER 0 -#define CONFIG_LIBMP3LAME_ENCODER 0 -#define CONFIG_LIBOPENCORE_AMRNB_ENCODER 0 -#define CONFIG_LIBOPENJPEG_ENCODER 0 -#define CONFIG_LIBOPUS_ENCODER 0 -#define CONFIG_LIBSHINE_ENCODER 0 -#define CONFIG_LIBSPEEX_ENCODER 0 -#define CONFIG_LIBTHEORA_ENCODER 0 -#define CONFIG_LIBTWOLAME_ENCODER 0 -#define CONFIG_LIBVO_AMRWBENC_ENCODER 0 -#define CONFIG_LIBVORBIS_ENCODER 0 -#define CONFIG_LIBVPX_VP8_ENCODER 0 -#define CONFIG_LIBVPX_VP9_ENCODER 0 -#define CONFIG_LIBWAVPACK_ENCODER 0 -#define CONFIG_LIBWEBP_ANIM_ENCODER 0 -#define CONFIG_LIBWEBP_ENCODER 0 -#define CONFIG_LIBX262_ENCODER 0 -#define CONFIG_LIBX264_ENCODER 0 -#define CONFIG_LIBX264RGB_ENCODER 0 -#define CONFIG_LIBX265_ENCODER 0 -#define CONFIG_LIBXAVS_ENCODER 0 -#define CONFIG_LIBXVID_ENCODER 0 -#define CONFIG_H263_V4L2M2M_ENCODER 0 -#define CONFIG_LIBOPENH264_ENCODER 0 -#define CONFIG_H264_NVENC_ENCODER 0 -#define CONFIG_H264_OMX_ENCODER 0 -#define CONFIG_H264_QSV_ENCODER 0 -#define CONFIG_H264_V4L2M2M_ENCODER 0 -#define CONFIG_H264_VAAPI_ENCODER 0 -#define CONFIG_H264_VIDEOTOOLBOX_ENCODER 0 -#define CONFIG_NVENC_ENCODER 0 -#define CONFIG_NVENC_H264_ENCODER 0 -#define CONFIG_NVENC_HEVC_ENCODER 0 -#define CONFIG_HEVC_NVENC_ENCODER 0 -#define CONFIG_HEVC_QSV_ENCODER 0 -#define CONFIG_HEVC_V4L2M2M_ENCODER 0 -#define CONFIG_HEVC_VAAPI_ENCODER 0 -#define CONFIG_LIBKVAZAAR_ENCODER 0 -#define CONFIG_MJPEG_VAAPI_ENCODER 0 -#define CONFIG_MPEG2_QSV_ENCODER 0 -#define CONFIG_MPEG2_VAAPI_ENCODER 0 -#define CONFIG_MPEG4_V4L2M2M_ENCODER 0 -#define CONFIG_VP8_V4L2M2M_ENCODER 0 -#define CONFIG_VP8_VAAPI_ENCODER 0 -#define CONFIG_VP9_VAAPI_ENCODER 0 -#define CONFIG_ABENCH_FILTER 0 -#define CONFIG_ACOMPRESSOR_FILTER 0 -#define CONFIG_ACOPY_FILTER 0 -#define CONFIG_ACROSSFADE_FILTER 0 -#define CONFIG_ACRUSHER_FILTER 0 -#define CONFIG_ADELAY_FILTER 0 -#define CONFIG_AECHO_FILTER 0 -#define CONFIG_AEMPHASIS_FILTER 0 -#define CONFIG_AEVAL_FILTER 0 -#define CONFIG_AFADE_FILTER 0 -#define CONFIG_AFFTFILT_FILTER 0 -#define CONFIG_AFIR_FILTER 0 -#define CONFIG_AFORMAT_FILTER 0 -#define CONFIG_AGATE_FILTER 0 -#define CONFIG_AINTERLEAVE_FILTER 0 -#define CONFIG_ALIMITER_FILTER 0 -#define CONFIG_ALLPASS_FILTER 0 -#define CONFIG_ALOOP_FILTER 0 -#define CONFIG_AMERGE_FILTER 0 -#define CONFIG_AMETADATA_FILTER 0 -#define CONFIG_AMIX_FILTER 0 -#define CONFIG_ANEQUALIZER_FILTER 0 -#define CONFIG_ANULL_FILTER 0 -#define CONFIG_APAD_FILTER 0 -#define CONFIG_APERMS_FILTER 0 -#define CONFIG_APHASER_FILTER 0 -#define CONFIG_APULSATOR_FILTER 0 -#define CONFIG_AREALTIME_FILTER 0 -#define CONFIG_ARESAMPLE_FILTER 0 -#define CONFIG_AREVERSE_FILTER 0 -#define CONFIG_ASELECT_FILTER 0 -#define CONFIG_ASENDCMD_FILTER 0 -#define CONFIG_ASETNSAMPLES_FILTER 0 -#define CONFIG_ASETPTS_FILTER 0 -#define CONFIG_ASETRATE_FILTER 0 -#define CONFIG_ASETTB_FILTER 0 -#define CONFIG_ASHOWINFO_FILTER 0 -#define CONFIG_ASIDEDATA_FILTER 0 -#define CONFIG_ASPLIT_FILTER 0 -#define CONFIG_ASTATS_FILTER 0 -#define CONFIG_ASTREAMSELECT_FILTER 0 -#define CONFIG_ATEMPO_FILTER 0 -#define CONFIG_ATRIM_FILTER 0 -#define CONFIG_AZMQ_FILTER 0 -#define CONFIG_BANDPASS_FILTER 0 -#define CONFIG_BANDREJECT_FILTER 0 -#define CONFIG_BASS_FILTER 0 -#define CONFIG_BIQUAD_FILTER 0 -#define CONFIG_BS2B_FILTER 0 -#define CONFIG_CHANNELMAP_FILTER 0 -#define CONFIG_CHANNELSPLIT_FILTER 0 -#define CONFIG_CHORUS_FILTER 0 -#define CONFIG_COMPAND_FILTER 0 -#define CONFIG_COMPENSATIONDELAY_FILTER 0 -#define CONFIG_CROSSFEED_FILTER 0 -#define CONFIG_CRYSTALIZER_FILTER 0 -#define CONFIG_DCSHIFT_FILTER 0 -#define CONFIG_DYNAUDNORM_FILTER 0 -#define CONFIG_EARWAX_FILTER 0 -#define CONFIG_EBUR128_FILTER 0 -#define CONFIG_EQUALIZER_FILTER 0 -#define CONFIG_EXTRASTEREO_FILTER 0 -#define CONFIG_FIREQUALIZER_FILTER 0 -#define CONFIG_FLANGER_FILTER 0 -#define CONFIG_HAAS_FILTER 0 -#define CONFIG_HDCD_FILTER 0 -#define CONFIG_HEADPHONE_FILTER 0 -#define CONFIG_HIGHPASS_FILTER 0 -#define CONFIG_JOIN_FILTER 0 -#define CONFIG_LADSPA_FILTER 0 -#define CONFIG_LOUDNORM_FILTER 0 -#define CONFIG_LOWPASS_FILTER 0 -#define CONFIG_PAN_FILTER 0 -#define CONFIG_REPLAYGAIN_FILTER 0 -#define CONFIG_RESAMPLE_FILTER 0 -#define CONFIG_RUBBERBAND_FILTER 0 -#define CONFIG_SIDECHAINCOMPRESS_FILTER 0 -#define CONFIG_SIDECHAINGATE_FILTER 0 -#define CONFIG_SILENCEDETECT_FILTER 0 -#define CONFIG_SILENCEREMOVE_FILTER 0 -#define CONFIG_SOFALIZER_FILTER 0 -#define CONFIG_STEREOTOOLS_FILTER 0 -#define CONFIG_STEREOWIDEN_FILTER 0 -#define CONFIG_SUPEREQUALIZER_FILTER 0 -#define CONFIG_SURROUND_FILTER 0 -#define CONFIG_TREBLE_FILTER 0 -#define CONFIG_TREMOLO_FILTER 0 -#define CONFIG_VIBRATO_FILTER 0 -#define CONFIG_VOLUME_FILTER 0 -#define CONFIG_VOLUMEDETECT_FILTER 0 -#define CONFIG_AEVALSRC_FILTER 0 -#define CONFIG_ANOISESRC_FILTER 0 -#define CONFIG_ANULLSRC_FILTER 0 -#define CONFIG_FLITE_FILTER 0 -#define CONFIG_SINE_FILTER 0 -#define CONFIG_ANULLSINK_FILTER 0 -#define CONFIG_ALPHAEXTRACT_FILTER 0 -#define CONFIG_ALPHAMERGE_FILTER 0 -#define CONFIG_ASS_FILTER 0 -#define CONFIG_ATADENOISE_FILTER 0 -#define CONFIG_AVGBLUR_FILTER 0 -#define CONFIG_BBOX_FILTER 0 -#define CONFIG_BENCH_FILTER 0 -#define CONFIG_BITPLANENOISE_FILTER 0 -#define CONFIG_BLACKDETECT_FILTER 0 -#define CONFIG_BLACKFRAME_FILTER 0 -#define CONFIG_BLEND_FILTER 0 -#define CONFIG_BOXBLUR_FILTER 0 -#define CONFIG_BWDIF_FILTER 0 -#define CONFIG_CHROMAKEY_FILTER 0 -#define CONFIG_CIESCOPE_FILTER 0 -#define CONFIG_CODECVIEW_FILTER 0 -#define CONFIG_COLORBALANCE_FILTER 0 -#define CONFIG_COLORCHANNELMIXER_FILTER 0 -#define CONFIG_COLORKEY_FILTER 0 -#define CONFIG_COLORLEVELS_FILTER 0 -#define CONFIG_COLORMATRIX_FILTER 0 -#define CONFIG_COLORSPACE_FILTER 0 -#define CONFIG_CONVOLUTION_FILTER 0 -#define CONFIG_CONVOLVE_FILTER 0 -#define CONFIG_COPY_FILTER 0 -#define CONFIG_COREIMAGE_FILTER 0 -#define CONFIG_COVER_RECT_FILTER 0 -#define CONFIG_CROP_FILTER 0 -#define CONFIG_CROPDETECT_FILTER 0 -#define CONFIG_CURVES_FILTER 0 -#define CONFIG_DATASCOPE_FILTER 0 -#define CONFIG_DCTDNOIZ_FILTER 0 -#define CONFIG_DEBAND_FILTER 0 -#define CONFIG_DECIMATE_FILTER 0 -#define CONFIG_DEFLATE_FILTER 0 -#define CONFIG_DEFLICKER_FILTER 0 -#define CONFIG_DEINTERLACE_QSV_FILTER 0 -#define CONFIG_DEINTERLACE_VAAPI_FILTER 0 -#define CONFIG_DEJUDDER_FILTER 0 -#define CONFIG_DELOGO_FILTER 0 -#define CONFIG_DESHAKE_FILTER 0 -#define CONFIG_DESPILL_FILTER 0 -#define CONFIG_DETELECINE_FILTER 0 -#define CONFIG_DILATION_FILTER 0 -#define CONFIG_DISPLACE_FILTER 0 -#define CONFIG_DOUBLEWEAVE_FILTER 0 -#define CONFIG_DRAWBOX_FILTER 0 -#define CONFIG_DRAWGRAPH_FILTER 0 -#define CONFIG_DRAWGRID_FILTER 0 -#define CONFIG_DRAWTEXT_FILTER 0 -#define CONFIG_EDGEDETECT_FILTER 0 -#define CONFIG_ELBG_FILTER 0 -#define CONFIG_EQ_FILTER 0 -#define CONFIG_EROSION_FILTER 0 -#define CONFIG_EXTRACTPLANES_FILTER 0 -#define CONFIG_FADE_FILTER 0 -#define CONFIG_FFTFILT_FILTER 0 -#define CONFIG_FIELD_FILTER 0 -#define CONFIG_FIELDHINT_FILTER 0 -#define CONFIG_FIELDMATCH_FILTER 0 -#define CONFIG_FIELDORDER_FILTER 0 -#define CONFIG_FIND_RECT_FILTER 0 -#define CONFIG_FLOODFILL_FILTER 0 -#define CONFIG_FORMAT_FILTER 0 -#define CONFIG_FPS_FILTER 0 -#define CONFIG_FRAMEPACK_FILTER 0 -#define CONFIG_FRAMERATE_FILTER 0 -#define CONFIG_FRAMESTEP_FILTER 0 -#define CONFIG_FREI0R_FILTER 0 -#define CONFIG_FSPP_FILTER 0 -#define CONFIG_GBLUR_FILTER 0 -#define CONFIG_GEQ_FILTER 0 -#define CONFIG_GRADFUN_FILTER 0 -#define CONFIG_HALDCLUT_FILTER 0 -#define CONFIG_HFLIP_FILTER 0 -#define CONFIG_HISTEQ_FILTER 0 -#define CONFIG_HISTOGRAM_FILTER 0 -#define CONFIG_HQDN3D_FILTER 0 -#define CONFIG_HQX_FILTER 0 -#define CONFIG_HSTACK_FILTER 0 -#define CONFIG_HUE_FILTER 0 -#define CONFIG_HWDOWNLOAD_FILTER 0 -#define CONFIG_HWMAP_FILTER 0 -#define CONFIG_HWUPLOAD_FILTER 0 -#define CONFIG_HWUPLOAD_CUDA_FILTER 0 -#define CONFIG_HYSTERESIS_FILTER 0 -#define CONFIG_IDET_FILTER 0 -#define CONFIG_IL_FILTER 0 -#define CONFIG_INFLATE_FILTER 0 -#define CONFIG_INTERLACE_FILTER 0 -#define CONFIG_INTERLEAVE_FILTER 0 -#define CONFIG_KERNDEINT_FILTER 0 -#define CONFIG_LENSCORRECTION_FILTER 0 -#define CONFIG_LIBVMAF_FILTER 0 -#define CONFIG_LIMITER_FILTER 0 -#define CONFIG_LOOP_FILTER 0 -#define CONFIG_LUMAKEY_FILTER 0 -#define CONFIG_LUT_FILTER 0 -#define CONFIG_LUT2_FILTER 0 -#define CONFIG_LUT3D_FILTER 0 -#define CONFIG_LUTRGB_FILTER 0 -#define CONFIG_LUTYUV_FILTER 0 -#define CONFIG_MASKEDCLAMP_FILTER 0 -#define CONFIG_MASKEDMERGE_FILTER 0 -#define CONFIG_MCDEINT_FILTER 0 -#define CONFIG_MERGEPLANES_FILTER 0 -#define CONFIG_MESTIMATE_FILTER 0 -#define CONFIG_METADATA_FILTER 0 -#define CONFIG_MIDEQUALIZER_FILTER 0 -#define CONFIG_MINTERPOLATE_FILTER 0 -#define CONFIG_MPDECIMATE_FILTER 0 -#define CONFIG_NEGATE_FILTER 0 -#define CONFIG_NLMEANS_FILTER 0 -#define CONFIG_NNEDI_FILTER 0 -#define CONFIG_NOFORMAT_FILTER 0 -#define CONFIG_NOISE_FILTER 0 -#define CONFIG_NULL_FILTER 0 -#define CONFIG_OCR_FILTER 0 -#define CONFIG_OCV_FILTER 0 -#define CONFIG_OSCILLOSCOPE_FILTER 0 -#define CONFIG_OVERLAY_FILTER 0 -#define CONFIG_OWDENOISE_FILTER 0 -#define CONFIG_PAD_FILTER 0 -#define CONFIG_PALETTEGEN_FILTER 0 -#define CONFIG_PALETTEUSE_FILTER 0 -#define CONFIG_PERMS_FILTER 0 -#define CONFIG_PERSPECTIVE_FILTER 0 -#define CONFIG_PHASE_FILTER 0 -#define CONFIG_PIXDESCTEST_FILTER 0 -#define CONFIG_PIXSCOPE_FILTER 0 -#define CONFIG_PP_FILTER 0 -#define CONFIG_PP7_FILTER 0 -#define CONFIG_PREMULTIPLY_FILTER 0 -#define CONFIG_PREWITT_FILTER 0 -#define CONFIG_PSEUDOCOLOR_FILTER 0 -#define CONFIG_PSNR_FILTER 0 -#define CONFIG_PULLUP_FILTER 0 -#define CONFIG_QP_FILTER 0 -#define CONFIG_RANDOM_FILTER 0 -#define CONFIG_READEIA608_FILTER 0 -#define CONFIG_READVITC_FILTER 0 -#define CONFIG_REALTIME_FILTER 0 -#define CONFIG_REMAP_FILTER 0 -#define CONFIG_REMOVEGRAIN_FILTER 0 -#define CONFIG_REMOVELOGO_FILTER 0 -#define CONFIG_REPEATFIELDS_FILTER 0 -#define CONFIG_REVERSE_FILTER 0 -#define CONFIG_ROBERTS_FILTER 0 -#define CONFIG_ROTATE_FILTER 0 -#define CONFIG_SAB_FILTER 0 -#define CONFIG_SCALE_FILTER 0 -#define CONFIG_SCALE_CUDA_FILTER 0 -#define CONFIG_SCALE_NPP_FILTER 0 -#define CONFIG_SCALE_QSV_FILTER 0 -#define CONFIG_SCALE_VAAPI_FILTER 0 -#define CONFIG_SCALE2REF_FILTER 0 -#define CONFIG_SELECT_FILTER 0 -#define CONFIG_SELECTIVECOLOR_FILTER 0 -#define CONFIG_SENDCMD_FILTER 0 -#define CONFIG_SEPARATEFIELDS_FILTER 0 -#define CONFIG_SETDAR_FILTER 0 -#define CONFIG_SETFIELD_FILTER 0 -#define CONFIG_SETPTS_FILTER 0 -#define CONFIG_SETSAR_FILTER 0 -#define CONFIG_SETTB_FILTER 0 -#define CONFIG_SHOWINFO_FILTER 0 -#define CONFIG_SHOWPALETTE_FILTER 0 -#define CONFIG_SHUFFLEFRAMES_FILTER 0 -#define CONFIG_SHUFFLEPLANES_FILTER 0 -#define CONFIG_SIDEDATA_FILTER 0 -#define CONFIG_SIGNALSTATS_FILTER 0 -#define CONFIG_SIGNATURE_FILTER 0 -#define CONFIG_SMARTBLUR_FILTER 0 -#define CONFIG_SOBEL_FILTER 0 -#define CONFIG_SPLIT_FILTER 0 -#define CONFIG_SPP_FILTER 0 -#define CONFIG_SSIM_FILTER 0 -#define CONFIG_STEREO3D_FILTER 0 -#define CONFIG_STREAMSELECT_FILTER 0 -#define CONFIG_SUBTITLES_FILTER 0 -#define CONFIG_SUPER2XSAI_FILTER 0 -#define CONFIG_SWAPRECT_FILTER 0 -#define CONFIG_SWAPUV_FILTER 0 -#define CONFIG_TBLEND_FILTER 0 -#define CONFIG_TELECINE_FILTER 0 -#define CONFIG_THRESHOLD_FILTER 0 -#define CONFIG_THUMBNAIL_FILTER 0 -#define CONFIG_THUMBNAIL_CUDA_FILTER 0 -#define CONFIG_TILE_FILTER 0 -#define CONFIG_TINTERLACE_FILTER 0 -#define CONFIG_TLUT2_FILTER 0 -#define CONFIG_TONEMAP_FILTER 0 -#define CONFIG_TRANSPOSE_FILTER 0 -#define CONFIG_TRIM_FILTER 0 -#define CONFIG_UNPREMULTIPLY_FILTER 0 -#define CONFIG_UNSHARP_FILTER 0 -#define CONFIG_USPP_FILTER 0 -#define CONFIG_VAGUEDENOISER_FILTER 0 -#define CONFIG_VECTORSCOPE_FILTER 0 -#define CONFIG_VFLIP_FILTER 0 -#define CONFIG_VIDSTABDETECT_FILTER 0 -#define CONFIG_VIDSTABTRANSFORM_FILTER 0 -#define CONFIG_VIGNETTE_FILTER 0 -#define CONFIG_VMAFMOTION_FILTER 0 -#define CONFIG_VSTACK_FILTER 0 -#define CONFIG_W3FDIF_FILTER 0 -#define CONFIG_WAVEFORM_FILTER 0 -#define CONFIG_WEAVE_FILTER 0 -#define CONFIG_XBR_FILTER 0 -#define CONFIG_YADIF_FILTER 0 -#define CONFIG_ZMQ_FILTER 0 -#define CONFIG_ZOOMPAN_FILTER 0 -#define CONFIG_ZSCALE_FILTER 0 -#define CONFIG_ALLRGB_FILTER 0 -#define CONFIG_ALLYUV_FILTER 0 -#define CONFIG_CELLAUTO_FILTER 0 -#define CONFIG_COLOR_FILTER 0 -#define CONFIG_COREIMAGESRC_FILTER 0 -#define CONFIG_FREI0R_SRC_FILTER 0 -#define CONFIG_HALDCLUTSRC_FILTER 0 -#define CONFIG_LIFE_FILTER 0 -#define CONFIG_MANDELBROT_FILTER 0 -#define CONFIG_MPTESTSRC_FILTER 0 -#define CONFIG_NULLSRC_FILTER 0 -#define CONFIG_RGBTESTSRC_FILTER 0 -#define CONFIG_SMPTEBARS_FILTER 0 -#define CONFIG_SMPTEHDBARS_FILTER 0 -#define CONFIG_TESTSRC_FILTER 0 -#define CONFIG_TESTSRC2_FILTER 0 -#define CONFIG_YUVTESTSRC_FILTER 0 -#define CONFIG_NULLSINK_FILTER 0 -#define CONFIG_ABITSCOPE_FILTER 0 -#define CONFIG_ADRAWGRAPH_FILTER 0 -#define CONFIG_AHISTOGRAM_FILTER 0 -#define CONFIG_APHASEMETER_FILTER 0 -#define CONFIG_AVECTORSCOPE_FILTER 0 -#define CONFIG_CONCAT_FILTER 0 -#define CONFIG_SHOWCQT_FILTER 0 -#define CONFIG_SHOWFREQS_FILTER 0 -#define CONFIG_SHOWSPECTRUM_FILTER 0 -#define CONFIG_SHOWSPECTRUMPIC_FILTER 0 -#define CONFIG_SHOWVOLUME_FILTER 0 -#define CONFIG_SHOWWAVES_FILTER 0 -#define CONFIG_SHOWWAVESPIC_FILTER 0 -#define CONFIG_SPECTRUMSYNTH_FILTER 0 -#define CONFIG_AMOVIE_FILTER 0 -#define CONFIG_MOVIE_FILTER 0 -#define CONFIG_H263_VAAPI_HWACCEL 0 -#define CONFIG_H263_VIDEOTOOLBOX_HWACCEL 0 -#define CONFIG_H264_CUVID_HWACCEL 0 -#define CONFIG_H264_D3D11VA_HWACCEL 0 -#define CONFIG_H264_D3D11VA2_HWACCEL 0 -#define CONFIG_H264_DXVA2_HWACCEL 0 -#define CONFIG_H264_MEDIACODEC_HWACCEL 0 -#define CONFIG_H264_MMAL_HWACCEL 0 -#define CONFIG_H264_QSV_HWACCEL 0 -#define CONFIG_H264_VAAPI_HWACCEL 0 -#define CONFIG_H264_VDA_HWACCEL 0 -#define CONFIG_H264_VDA_OLD_HWACCEL 0 -#define CONFIG_H264_VDPAU_HWACCEL 0 -#define CONFIG_H264_VIDEOTOOLBOX_HWACCEL 0 -#define CONFIG_HEVC_CUVID_HWACCEL 0 -#define CONFIG_HEVC_D3D11VA_HWACCEL 0 -#define CONFIG_HEVC_D3D11VA2_HWACCEL 0 -#define CONFIG_HEVC_DXVA2_HWACCEL 0 -#define CONFIG_HEVC_MEDIACODEC_HWACCEL 0 -#define CONFIG_HEVC_QSV_HWACCEL 0 -#define CONFIG_HEVC_VAAPI_HWACCEL 0 -#define CONFIG_HEVC_VDPAU_HWACCEL 0 -#define CONFIG_HEVC_VIDEOTOOLBOX_HWACCEL 0 -#define CONFIG_MJPEG_CUVID_HWACCEL 0 -#define CONFIG_MPEG1_CUVID_HWACCEL 0 -#define CONFIG_MPEG1_XVMC_HWACCEL 0 -#define CONFIG_MPEG1_VDPAU_HWACCEL 0 -#define CONFIG_MPEG1_VIDEOTOOLBOX_HWACCEL 0 -#define CONFIG_MPEG2_CUVID_HWACCEL 0 -#define CONFIG_MPEG2_XVMC_HWACCEL 0 -#define CONFIG_MPEG2_D3D11VA_HWACCEL 0 -#define CONFIG_MPEG2_D3D11VA2_HWACCEL 0 -#define CONFIG_MPEG2_DXVA2_HWACCEL 0 -#define CONFIG_MPEG2_MMAL_HWACCEL 0 -#define CONFIG_MPEG2_QSV_HWACCEL 0 -#define CONFIG_MPEG2_VAAPI_HWACCEL 0 -#define CONFIG_MPEG2_VDPAU_HWACCEL 0 -#define CONFIG_MPEG2_VIDEOTOOLBOX_HWACCEL 0 -#define CONFIG_MPEG2_MEDIACODEC_HWACCEL 0 -#define CONFIG_MPEG4_CUVID_HWACCEL 0 -#define CONFIG_MPEG4_MEDIACODEC_HWACCEL 0 -#define CONFIG_MPEG4_MMAL_HWACCEL 0 -#define CONFIG_MPEG4_VAAPI_HWACCEL 0 -#define CONFIG_MPEG4_VDPAU_HWACCEL 0 -#define CONFIG_MPEG4_VIDEOTOOLBOX_HWACCEL 0 -#define CONFIG_VC1_CUVID_HWACCEL 0 -#define CONFIG_VC1_D3D11VA_HWACCEL 0 -#define CONFIG_VC1_D3D11VA2_HWACCEL 0 -#define CONFIG_VC1_DXVA2_HWACCEL 0 -#define CONFIG_VC1_VAAPI_HWACCEL 0 -#define CONFIG_VC1_VDPAU_HWACCEL 0 -#define CONFIG_VC1_MMAL_HWACCEL 0 -#define CONFIG_VC1_QSV_HWACCEL 0 -#define CONFIG_VP8_CUVID_HWACCEL 0 -#define CONFIG_VP8_MEDIACODEC_HWACCEL 0 -#define CONFIG_VP8_QSV_HWACCEL 0 -#define CONFIG_VP9_CUVID_HWACCEL 0 -#define CONFIG_VP9_D3D11VA_HWACCEL 0 -#define CONFIG_VP9_D3D11VA2_HWACCEL 0 -#define CONFIG_VP9_DXVA2_HWACCEL 0 -#define CONFIG_VP9_MEDIACODEC_HWACCEL 0 -#define CONFIG_VP9_VAAPI_HWACCEL 0 -#define CONFIG_WMV3_D3D11VA_HWACCEL 0 -#define CONFIG_WMV3_D3D11VA2_HWACCEL 0 -#define CONFIG_WMV3_DXVA2_HWACCEL 0 -#define CONFIG_WMV3_VAAPI_HWACCEL 0 -#define CONFIG_WMV3_VDPAU_HWACCEL 0 -#define CONFIG_ALSA_INDEV 0 -#define CONFIG_AVFOUNDATION_INDEV 0 -#define CONFIG_BKTR_INDEV 0 -#define CONFIG_DECKLINK_INDEV 0 -#define CONFIG_LIBNDI_NEWTEK_INDEV 0 -#define CONFIG_DSHOW_INDEV 0 -#define CONFIG_FBDEV_INDEV 0 -#define CONFIG_GDIGRAB_INDEV 0 -#define CONFIG_IEC61883_INDEV 0 -#define CONFIG_JACK_INDEV 0 -#define CONFIG_KMSGRAB_INDEV 0 -#define CONFIG_LAVFI_INDEV 0 -#define CONFIG_OPENAL_INDEV 0 -#define CONFIG_OSS_INDEV 0 -#define CONFIG_PULSE_INDEV 0 -#define CONFIG_SNDIO_INDEV 0 -#define CONFIG_V4L2_INDEV 0 -#define CONFIG_VFWCAP_INDEV 0 -#define CONFIG_XCBGRAB_INDEV 0 -#define CONFIG_LIBCDIO_INDEV 0 -#define CONFIG_LIBDC1394_INDEV 0 -#define CONFIG_A64_MUXER 0 -#define CONFIG_AC3_MUXER 0 -#define CONFIG_ADTS_MUXER 0 -#define CONFIG_ADX_MUXER 0 -#define CONFIG_AIFF_MUXER 0 -#define CONFIG_AMR_MUXER 0 -#define CONFIG_APNG_MUXER 0 -#define CONFIG_ASF_MUXER 0 -#define CONFIG_ASS_MUXER 0 -#define CONFIG_AST_MUXER 0 -#define CONFIG_ASF_STREAM_MUXER 0 -#define CONFIG_AU_MUXER 0 -#define CONFIG_AVI_MUXER 0 -#define CONFIG_AVM2_MUXER 0 -#define CONFIG_BIT_MUXER 0 -#define CONFIG_CAF_MUXER 0 -#define CONFIG_CAVSVIDEO_MUXER 0 -#define CONFIG_CRC_MUXER 0 -#define CONFIG_DASH_MUXER 0 -#define CONFIG_DATA_MUXER 0 -#define CONFIG_DAUD_MUXER 0 -#define CONFIG_DIRAC_MUXER 0 -#define CONFIG_DNXHD_MUXER 0 -#define CONFIG_DTS_MUXER 0 -#define CONFIG_DV_MUXER 0 -#define CONFIG_EAC3_MUXER 0 -#define CONFIG_F4V_MUXER 0 -#define CONFIG_FFM_MUXER 0 -#define CONFIG_FFMETADATA_MUXER 0 -#define CONFIG_FIFO_MUXER 0 -#define CONFIG_FILMSTRIP_MUXER 0 -#define CONFIG_FITS_MUXER 0 -#define CONFIG_FLAC_MUXER 0 -#define CONFIG_FLV_MUXER 0 -#define CONFIG_FRAMECRC_MUXER 0 -#define CONFIG_FRAMEHASH_MUXER 0 -#define CONFIG_FRAMEMD5_MUXER 0 -#define CONFIG_G722_MUXER 0 -#define CONFIG_G723_1_MUXER 0 -#define CONFIG_G726_MUXER 0 -#define CONFIG_G726LE_MUXER 0 -#define CONFIG_GIF_MUXER 0 -#define CONFIG_GSM_MUXER 0 -#define CONFIG_GXF_MUXER 0 -#define CONFIG_H261_MUXER 0 -#define CONFIG_H263_MUXER 0 -#define CONFIG_H264_MUXER 0 -#define CONFIG_HASH_MUXER 0 -#define CONFIG_HDS_MUXER 0 -#define CONFIG_HEVC_MUXER 0 -#define CONFIG_HLS_MUXER 0 -#define CONFIG_ICO_MUXER 0 -#define CONFIG_ILBC_MUXER 0 -#define CONFIG_IMAGE2_MUXER 0 -#define CONFIG_IMAGE2PIPE_MUXER 0 -#define CONFIG_IPOD_MUXER 0 -#define CONFIG_IRCAM_MUXER 0 -#define CONFIG_ISMV_MUXER 0 -#define CONFIG_IVF_MUXER 0 -#define CONFIG_JACOSUB_MUXER 0 -#define CONFIG_LATM_MUXER 0 -#define CONFIG_LRC_MUXER 0 -#define CONFIG_M4V_MUXER 0 -#define CONFIG_MD5_MUXER 0 -#define CONFIG_MATROSKA_MUXER 0 -#define CONFIG_MATROSKA_AUDIO_MUXER 0 -#define CONFIG_MICRODVD_MUXER 0 -#define CONFIG_MJPEG_MUXER 0 -#define CONFIG_MLP_MUXER 0 -#define CONFIG_MMF_MUXER 0 -#define CONFIG_MOV_MUXER 0 -#define CONFIG_MP2_MUXER 0 -#define CONFIG_MP3_MUXER 0 -#define CONFIG_MP4_MUXER 0 -#define CONFIG_MPEG1SYSTEM_MUXER 0 -#define CONFIG_MPEG1VCD_MUXER 0 -#define CONFIG_MPEG1VIDEO_MUXER 0 -#define CONFIG_MPEG2DVD_MUXER 0 -#define CONFIG_MPEG2SVCD_MUXER 0 -#define CONFIG_MPEG2VIDEO_MUXER 0 -#define CONFIG_MPEG2VOB_MUXER 0 -#define CONFIG_MPEGTS_MUXER 0 -#define CONFIG_MPJPEG_MUXER 0 -#define CONFIG_MXF_MUXER 0 -#define CONFIG_MXF_D10_MUXER 0 -#define CONFIG_MXF_OPATOM_MUXER 0 -#define CONFIG_NULL_MUXER 0 -#define CONFIG_NUT_MUXER 0 -#define CONFIG_OGA_MUXER 0 -#define CONFIG_OGG_MUXER 0 -#define CONFIG_OGV_MUXER 0 -#define CONFIG_OMA_MUXER 0 -#define CONFIG_OPUS_MUXER 0 -#define CONFIG_PCM_ALAW_MUXER 0 -#define CONFIG_PCM_MULAW_MUXER 0 -#define CONFIG_PCM_F64BE_MUXER 0 -#define CONFIG_PCM_F64LE_MUXER 0 -#define CONFIG_PCM_F32BE_MUXER 0 -#define CONFIG_PCM_F32LE_MUXER 0 -#define CONFIG_PCM_S32BE_MUXER 0 -#define CONFIG_PCM_S32LE_MUXER 0 -#define CONFIG_PCM_S24BE_MUXER 0 -#define CONFIG_PCM_S24LE_MUXER 0 -#define CONFIG_PCM_S16BE_MUXER 0 -#define CONFIG_PCM_S16LE_MUXER 0 -#define CONFIG_PCM_S8_MUXER 0 -#define CONFIG_PCM_U32BE_MUXER 0 -#define CONFIG_PCM_U32LE_MUXER 0 -#define CONFIG_PCM_U24BE_MUXER 0 -#define CONFIG_PCM_U24LE_MUXER 0 -#define CONFIG_PCM_U16BE_MUXER 0 -#define CONFIG_PCM_U16LE_MUXER 0 -#define CONFIG_PCM_U8_MUXER 0 -#define CONFIG_PSP_MUXER 0 -#define CONFIG_RAWVIDEO_MUXER 0 -#define CONFIG_RM_MUXER 0 -#define CONFIG_ROQ_MUXER 0 -#define CONFIG_RSO_MUXER 0 -#define CONFIG_RTP_MUXER 0 -#define CONFIG_RTP_MPEGTS_MUXER 0 -#define CONFIG_RTSP_MUXER 0 -#define CONFIG_SAP_MUXER 0 -#define CONFIG_SCC_MUXER 0 -#define CONFIG_SEGMENT_MUXER 0 -#define CONFIG_STREAM_SEGMENT_MUXER 0 -#define CONFIG_SINGLEJPEG_MUXER 0 -#define CONFIG_SMJPEG_MUXER 0 -#define CONFIG_SMOOTHSTREAMING_MUXER 0 -#define CONFIG_SOX_MUXER 0 -#define CONFIG_SPX_MUXER 0 -#define CONFIG_SPDIF_MUXER 0 -#define CONFIG_SRT_MUXER 0 -#define CONFIG_SUP_MUXER 0 -#define CONFIG_SWF_MUXER 0 -#define CONFIG_TEE_MUXER 0 -#define CONFIG_TG2_MUXER 0 -#define CONFIG_TGP_MUXER 0 -#define CONFIG_MKVTIMESTAMP_V2_MUXER 0 -#define CONFIG_TRUEHD_MUXER 0 -#define CONFIG_TTA_MUXER 0 -#define CONFIG_UNCODEDFRAMECRC_MUXER 0 -#define CONFIG_VC1_MUXER 0 -#define CONFIG_VC1T_MUXER 0 -#define CONFIG_VOC_MUXER 0 -#define CONFIG_W64_MUXER 0 -#define CONFIG_WAV_MUXER 0 -#define CONFIG_WEBM_MUXER 0 -#define CONFIG_WEBM_DASH_MANIFEST_MUXER 0 -#define CONFIG_WEBM_CHUNK_MUXER 0 -#define CONFIG_WEBP_MUXER 0 -#define CONFIG_WEBVTT_MUXER 0 -#define CONFIG_WTV_MUXER 0 -#define CONFIG_WV_MUXER 0 -#define CONFIG_YUV4MPEGPIPE_MUXER 0 -#define CONFIG_CHROMAPRINT_MUXER 0 -#define CONFIG_ALSA_OUTDEV 0 -#define CONFIG_CACA_OUTDEV 0 -#define CONFIG_DECKLINK_OUTDEV 0 -#define CONFIG_LIBNDI_NEWTEK_OUTDEV 0 -#define CONFIG_FBDEV_OUTDEV 0 -#define CONFIG_OPENGL_OUTDEV 0 -#define CONFIG_OSS_OUTDEV 0 -#define CONFIG_PULSE_OUTDEV 0 -#define CONFIG_SDL2_OUTDEV 0 -#define CONFIG_SNDIO_OUTDEV 0 -#define CONFIG_V4L2_OUTDEV 0 -#define CONFIG_XV_OUTDEV 0 -#define CONFIG_AAC_PARSER 1 -#define CONFIG_AAC_LATM_PARSER 1 -#define CONFIG_AC3_PARSER 0 -#define CONFIG_ADX_PARSER 0 -#define CONFIG_BMP_PARSER 0 -#define CONFIG_CAVSVIDEO_PARSER 0 -#define CONFIG_COOK_PARSER 0 -#define CONFIG_DCA_PARSER 0 -#define CONFIG_DIRAC_PARSER 0 -#define CONFIG_DNXHD_PARSER 0 -#define CONFIG_DPX_PARSER 0 -#define CONFIG_DVAUDIO_PARSER 0 -#define CONFIG_DVBSUB_PARSER 0 -#define CONFIG_DVDSUB_PARSER 0 -#define CONFIG_DVD_NAV_PARSER 0 -#define CONFIG_FLAC_PARSER 1 -#define CONFIG_G729_PARSER 0 -#define CONFIG_GSM_PARSER 0 -#define CONFIG_H261_PARSER 0 -#define CONFIG_H263_PARSER 0 -#define CONFIG_H264_PARSER 1 -#define CONFIG_HEVC_PARSER 1 -#define CONFIG_MJPEG_PARSER 0 -#define CONFIG_MLP_PARSER 0 -#define CONFIG_MPEG4VIDEO_PARSER 0 -#define CONFIG_MPEGAUDIO_PARSER 1 -#define CONFIG_MPEGVIDEO_PARSER 0 -#define CONFIG_OPUS_PARSER 0 -#define CONFIG_PNG_PARSER 0 -#define CONFIG_PNM_PARSER 0 -#define CONFIG_RV30_PARSER 0 -#define CONFIG_RV40_PARSER 0 -#define CONFIG_SIPR_PARSER 0 -#define CONFIG_TAK_PARSER 0 -#define CONFIG_VC1_PARSER 0 -#define CONFIG_VORBIS_PARSER 0 -#define CONFIG_VP3_PARSER 0 -#define CONFIG_VP8_PARSER 1 -#define CONFIG_VP9_PARSER 1 -#define CONFIG_XMA_PARSER 0 -#define CONFIG_ASYNC_PROTOCOL 0 -#define CONFIG_BLURAY_PROTOCOL 0 -#define CONFIG_CACHE_PROTOCOL 0 -#define CONFIG_CONCAT_PROTOCOL 0 -#define CONFIG_CRYPTO_PROTOCOL 0 -#define CONFIG_DATA_PROTOCOL 0 -#define CONFIG_FFRTMPCRYPT_PROTOCOL 0 -#define CONFIG_FFRTMPHTTP_PROTOCOL 0 -#define CONFIG_FILE_PROTOCOL 0 -#define CONFIG_FTP_PROTOCOL 0 -#define CONFIG_GOPHER_PROTOCOL 0 -#define CONFIG_HLS_PROTOCOL 0 -#define CONFIG_HTTP_PROTOCOL 0 -#define CONFIG_HTTPPROXY_PROTOCOL 0 -#define CONFIG_HTTPS_PROTOCOL 0 -#define CONFIG_ICECAST_PROTOCOL 0 -#define CONFIG_MMSH_PROTOCOL 0 -#define CONFIG_MMST_PROTOCOL 0 -#define CONFIG_MD5_PROTOCOL 0 -#define CONFIG_PIPE_PROTOCOL 0 -#define CONFIG_PROMPEG_PROTOCOL 0 -#define CONFIG_RTMP_PROTOCOL 0 -#define CONFIG_RTMPE_PROTOCOL 0 -#define CONFIG_RTMPS_PROTOCOL 0 -#define CONFIG_RTMPT_PROTOCOL 0 -#define CONFIG_RTMPTE_PROTOCOL 0 -#define CONFIG_RTMPTS_PROTOCOL 0 -#define CONFIG_RTP_PROTOCOL 0 -#define CONFIG_SCTP_PROTOCOL 0 -#define CONFIG_SRTP_PROTOCOL 0 -#define CONFIG_SUBFILE_PROTOCOL 0 -#define CONFIG_TEE_PROTOCOL 0 -#define CONFIG_TCP_PROTOCOL 0 -#define CONFIG_TLS_GNUTLS_PROTOCOL 0 -#define CONFIG_TLS_SCHANNEL_PROTOCOL 0 -#define CONFIG_TLS_SECURETRANSPORT_PROTOCOL 0 -#define CONFIG_TLS_OPENSSL_PROTOCOL 0 -#define CONFIG_UDP_PROTOCOL 0 -#define CONFIG_UDPLITE_PROTOCOL 0 -#define CONFIG_UNIX_PROTOCOL 0 -#define CONFIG_LIBRTMP_PROTOCOL 0 -#define CONFIG_LIBRTMPE_PROTOCOL 0 -#define CONFIG_LIBRTMPS_PROTOCOL 0 -#define CONFIG_LIBRTMPT_PROTOCOL 0 -#define CONFIG_LIBRTMPTE_PROTOCOL 0 -#define CONFIG_LIBSSH_PROTOCOL 0 -#define CONFIG_LIBSMBCLIENT_PROTOCOL 0 -#endif /* FFMPEG_CONFIG_H */ diff --git a/media/libav/config.h b/media/libav/config.h index 96c5ea9506..4abd411041 100644 --- a/media/libav/config.h +++ b/media/libav/config.h @@ -17,8 +17,6 @@ #define MOZ_LIBAV_CONFIG_H #if defined(XP_WIN) #include "config_win.h" -#elif defined(XP_DARWIN) -#include "config_darwin.h" #elif defined(XP_UNIX) #include "config_unix.h" #endif diff --git a/media/libav/config_darwin.asm b/media/libav/config_darwin.asm deleted file mode 100644 index 89413c594e..0000000000 --- a/media/libav/config_darwin.asm +++ /dev/null @@ -1,249 +0,0 @@ -%include "config_common.asm" -%define HAVE_ARMV5TE 0 -%define HAVE_ARMV6 0 -%define HAVE_ARMV6T2 0 -%define HAVE_ARMV8 0 -%define HAVE_NEON 0 -%define HAVE_VFP 0 -%define HAVE_VFPV3 0 -%define HAVE_ALTIVEC 0 -%define HAVE_DCBZL 1 -%define HAVE_LDBRX 1 -%define HAVE_PPC4XX 0 -%define HAVE_AMD3DNOW 1 -%define HAVE_AMD3DNOWEXT 1 -%define HAVE_AVX 1 -%define HAVE_AVX2 1 -%define HAVE_FMA3 1 -%define HAVE_FMA4 1 -%define HAVE_MMX 1 -%define HAVE_MMXEXT 1 -%define HAVE_SSE 1 -%define HAVE_SSE2 1 -%define HAVE_SSE3 1 -%define HAVE_SSE4 1 -%define HAVE_SSE42 1 -%define HAVE_SSSE3 1 -%define HAVE_XOP 1 -%define HAVE_CPUNOP 1 -%define HAVE_I686 1 -%define HAVE_LOONGSON 1 -%define HAVE_VIS 1 -%define HAVE_ARMV5TE_EXTERNAL 0 -%define HAVE_ARMV6_EXTERNAL 0 -%define HAVE_ARMV6T2_EXTERNAL 0 -%define HAVE_ARMV8_EXTERNAL 0 -%define HAVE_NEON_EXTERNAL 0 -%define HAVE_VFP_EXTERNAL 0 -%define HAVE_VFPV3_EXTERNAL 0 -%define HAVE_ALTIVEC_EXTERNAL 0 -%define HAVE_DCBZL_EXTERNAL 0 -%define HAVE_LDBRX_EXTERNAL 0 -%define HAVE_PPC4XX_EXTERNAL 0 -%define HAVE_AMD3DNOW_EXTERNAL 1 -%define HAVE_AMD3DNOWEXT_EXTERNAL 1 -%define HAVE_AVX_EXTERNAL 1 -%define HAVE_AVX2_EXTERNAL 1 -%define HAVE_FMA3_EXTERNAL 1 -%define HAVE_FMA4_EXTERNAL 1 -%define HAVE_MMX_EXTERNAL 1 -%define HAVE_MMXEXT_EXTERNAL 1 -%define HAVE_SSE_EXTERNAL 1 -%define HAVE_SSE2_EXTERNAL 1 -%define HAVE_SSE3_EXTERNAL 1 -%define HAVE_SSE4_EXTERNAL 1 -%define HAVE_SSE42_EXTERNAL 1 -%define HAVE_SSSE3_EXTERNAL 1 -%define HAVE_XOP_EXTERNAL 1 -%define HAVE_CPUNOP_EXTERNAL 0 -%define HAVE_I686_EXTERNAL 0 -%define HAVE_LOONGSON_EXTERNAL 0 -%define HAVE_VIS_EXTERNAL 0 -%define HAVE_ARMV5TE_INLINE 0 -%define HAVE_ARMV6_INLINE 0 -%define HAVE_ARMV6T2_INLINE 0 -%define HAVE_ARMV8_INLINE 0 -%define HAVE_NEON_INLINE 0 -%define HAVE_VFP_INLINE 0 -%define HAVE_VFPV3_INLINE 0 -%define HAVE_ALTIVEC_INLINE 0 -%define HAVE_DCBZL_INLINE 0 -%define HAVE_LDBRX_INLINE 0 -%define HAVE_PPC4XX_INLINE 0 -%define HAVE_AMD3DNOW_INLINE 1 -%define HAVE_AMD3DNOWEXT_INLINE 1 -%define HAVE_AVX_INLINE 1 -%define HAVE_AVX2_INLINE 1 -%define HAVE_FMA3_INLINE 1 -%define HAVE_FMA4_INLINE 1 -%define HAVE_MMX_INLINE 1 -%define HAVE_MMXEXT_INLINE 1 -%define HAVE_SSE_INLINE 1 -%define HAVE_SSE2_INLINE 1 -%define HAVE_SSE3_INLINE 1 -%define HAVE_SSE4_INLINE 1 -%define HAVE_SSE42_INLINE 1 -%define HAVE_SSSE3_INLINE 1 -%define HAVE_XOP_INLINE 1 -%define HAVE_CPUNOP_INLINE 0 -%define HAVE_I686_INLINE 0 -%define HAVE_LOONGSON_INLINE 0 -%define HAVE_VIS_INLINE 0 -%define HAVE_ALIGNED_STACK 1 -%define HAVE_FAST_64BIT 0 -%define HAVE_FAST_CLZ 0 -%define HAVE_FAST_CMOV 0 -%define HAVE_LOCAL_ALIGNED_8 1 -%define HAVE_LOCAL_ALIGNED_16 1 -%define HAVE_SIMD_ALIGN_16 1 -%define HAVE_ATOMICS_GCC 1 -%define HAVE_ATOMICS_SUNCC 0 -%define HAVE_ATOMICS_WIN32 0 -%define HAVE_ATOMIC_CAS_PTR 0 -%define HAVE_MACHINE_RW_BARRIER 0 -%define HAVE_MEMORYBARRIER 0 -%define HAVE_MM_EMPTY 1 -%define HAVE_RDTSC 0 -%define HAVE_SYNC_VAL_COMPARE_AND_SWAP 1 -%define HAVE_INLINE_ASM 1 -%define HAVE_SYMVER 0 -%define HAVE_YASM 1 -%define HAVE_BIGENDIAN 0 -%define HAVE_FAST_UNALIGNED 1 -%define HAVE_ALSA_ASOUNDLIB_H 0 -%define HAVE_ALTIVEC_H 0 -%define HAVE_ARPA_INET_H 0 -%define HAVE_CDIO_PARANOIA_H 0 -%define HAVE_CDIO_PARANOIA_PARANOIA_H 0 -%define HAVE_DEV_BKTR_IOCTL_BT848_H 0 -%define HAVE_DEV_BKTR_IOCTL_METEOR_H 0 -%define HAVE_DEV_IC_BT8XX_H 0 -%define HAVE_DEV_VIDEO_BKTR_IOCTL_BT848_H 0 -%define HAVE_DEV_VIDEO_METEOR_IOCTL_METEOR_H 0 -%define HAVE_DIRECT_H 0 -%define HAVE_DLFCN_H 1 -%define HAVE_DXVA_H 0 -%define HAVE_GSM_H 0 -%define HAVE_IO_H 0 -%define HAVE_MACH_MACH_TIME_H 1 -%define HAVE_MACHINE_IOCTL_BT848_H 0 -%define HAVE_MACHINE_IOCTL_METEOR_H 0 -%define HAVE_POLL_H 1 -%define HAVE_SNDIO_H 0 -%define HAVE_SOUNDCARD_H 0 -%define HAVE_SYS_MMAN_H 1 -%define HAVE_SYS_PARAM_H 1 -%define HAVE_SYS_RESOURCE_H 1 -%define HAVE_SYS_SELECT_H 1 -%define HAVE_SYS_SOUNDCARD_H 0 -%define HAVE_SYS_TIME_H 1 -%define HAVE_SYS_UN_H 1 -%define HAVE_SYS_VIDEOIO_H 0 -%define HAVE_UNISTD_H 1 -%define HAVE_WINDOWS_H 0 -%define HAVE_WINSOCK2_H 0 -%define HAVE_INTRINSICS_NEON 0 -%define HAVE_ATANF 1 -%define HAVE_ATAN2F 1 -%define HAVE_CBRTF 1 -%define HAVE_COSF 1 -%define HAVE_EXP2 1 -%define HAVE_EXP2F 1 -%define HAVE_EXPF 1 -%define HAVE_ISINF 1 -%define HAVE_ISNAN 1 -%define HAVE_LDEXPF 1 -%define HAVE_LLRINT 1 -%define HAVE_LLRINTF 1 -%define HAVE_LOG2 1 -%define HAVE_LOG2F 1 -%define HAVE_LOG10F 1 -%define HAVE_LRINT 1 -%define HAVE_LRINTF 1 -%define HAVE_POWF 1 -%define HAVE_RINT 1 -%define HAVE_ROUND 1 -%define HAVE_ROUNDF 1 -%define HAVE_SINF 1 -%define HAVE_TRUNC 1 -%define HAVE_TRUNCF 1 -%define HAVE_ALIGNED_MALLOC 0 -%define HAVE_CLOSESOCKET 0 -%define HAVE_COMMANDLINETOARGVW 0 -%define HAVE_COTASKMEMFREE 0 -%define HAVE_CRYPTGENRANDOM 0 -%define HAVE_DLOPEN 1 -%define HAVE_FCNTL 1 -%define HAVE_FLT_LIM 1 -%define HAVE_FORK 1 -%define HAVE_GETADDRINFO 0 -%define HAVE_GETHRTIME 0 -%define HAVE_GETOPT 1 -%define HAVE_GETPROCESSAFFINITYMASK 0 -%define HAVE_GETPROCESSMEMORYINFO 0 -%define HAVE_GETPROCESSTIMES 0 -%define HAVE_GETRUSAGE 1 -%define HAVE_GETSERVBYPORT 0 -%define HAVE_GETSYSTEMTIMEASFILETIME 0 -%define HAVE_GETTIMEOFDAY 1 -%define HAVE_INET_ATON 0 -%define HAVE_ISATTY 1 -%define HAVE_JACK_PORT_GET_LATENCY_RANGE 0 -%define HAVE_MACH_ABSOLUTE_TIME 1 -%define HAVE_MAPVIEWOFFILE 0 -%define HAVE_MKSTEMP 1 -%define HAVE_MMAP 1 -%define HAVE_MPROTECT 1 -%define HAVE_NANOSLEEP 1 -%define HAVE_SCHED_GETAFFINITY 0 -%define HAVE_SETCONSOLETEXTATTRIBUTE 0 -%define HAVE_SETMODE 0 -%define HAVE_SETRLIMIT 1 -%define HAVE_SLEEP 0 -%define HAVE_STRERROR_R 1 -%define HAVE_STRPTIME 1 -%define HAVE_SYSCONF 1 -%define HAVE_SYSCTL 1 -%define HAVE_USLEEP 1 -%define HAVE_VIRTUALALLOC 0 -%define HAVE_PTHREADS 0 -%define HAVE_W32THREADS 0 -%define HAVE_AS_DN_DIRECTIVE 0 -%define HAVE_AS_FUNC 0 -%define HAVE_AS_OBJECT_ARCH 0 -%define HAVE_ASM_MOD_Q 0 -%define HAVE_ATTRIBUTE_MAY_ALIAS 1 -%define HAVE_ATTRIBUTE_PACKED 1 -%define HAVE_EBP_AVAILABLE 1 -%define HAVE_EBX_AVAILABLE 1 -%define HAVE_GNU_AS 0 -%define HAVE_IBM_ASM 0 -%define HAVE_INLINE_ASM_LABELS 1 -%define HAVE_PRAGMA_DEPRECATED 1 -%define HAVE_SYMVER_ASM_LABEL 0 -%define HAVE_SYMVER_GNU_ASM 0 -%define HAVE_VFP_ARGS 0 -%define HAVE_XFORM_ASM 0 -%define HAVE_XMM_CLOBBERS 1 -%define HAVE_SOCKLEN_T 0 -%define HAVE_STRUCT_ADDRINFO 0 -%define HAVE_STRUCT_GROUP_SOURCE_REQ 0 -%define HAVE_STRUCT_IP_MREQ_SOURCE 0 -%define HAVE_STRUCT_IPV6_MREQ 0 -%define HAVE_STRUCT_POLLFD 0 -%define HAVE_STRUCT_RUSAGE_RU_MAXRSS 1 -%define HAVE_STRUCT_SOCKADDR_IN6 0 -%define HAVE_STRUCT_SOCKADDR_SA_LEN 0 -%define HAVE_STRUCT_SOCKADDR_STORAGE 0 -%define HAVE_STRUCT_V4L2_FRMIVALENUM_DISCRETE 0 -%define HAVE_ATOMICS_NATIVE 1 -%define HAVE_DOS_PATHS 0 -%define HAVE_DXVA2_LIB 0 -%define HAVE_LIBC_MSVCRT 0 -%define HAVE_LIBDC1394_1 0 -%define HAVE_LIBDC1394_2 0 -%define HAVE_SDL 0 -%define HAVE_THREADS 0 -%define HAVE_VDPAU_X11 0 -%define HAVE_XLIB 0 - diff --git a/media/libav/config_darwin.h b/media/libav/config_darwin.h deleted file mode 100644 index ae7844f3aa..0000000000 --- a/media/libav/config_darwin.h +++ /dev/null @@ -1,259 +0,0 @@ -/* Automatically generated by configure - do not modify! */ -#ifndef LIBAV_CONFIG_H -#define LIBAV_CONFIG_H -#define LIBAV_CONFIGURATION "--disable-programs --disable-everything" -#define LIBAV_LICENSE "LGPL version 2.1 or later" -#define AVCONV_DATADIR "/usr/local/share/avconv" -#define CC_IDENT "Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)" -#define restrict restrict -#define EXTERN_PREFIX "" -#define EXTERN_ASM -#define SLIBSUF ".dylib" -#define HAVE_ARMV5TE 0 -#define HAVE_ARMV6 0 -#define HAVE_ARMV6T2 0 -#define HAVE_ARMV8 0 -#define HAVE_NEON 0 -#define HAVE_VFP 0 -#define HAVE_VFPV3 0 -#define HAVE_ALTIVEC 0 -#define HAVE_DCBZL 1 -#define HAVE_LDBRX 1 -#define HAVE_PPC4XX 0 -#define HAVE_AMD3DNOW 1 -#define HAVE_AMD3DNOWEXT 1 -#define HAVE_AVX 1 -#define HAVE_AVX2 1 -#define HAVE_FMA3 1 -#define HAVE_FMA4 1 -#define HAVE_MMX 1 -#define HAVE_MMXEXT 1 -#define HAVE_SSE 1 -#define HAVE_SSE2 1 -#define HAVE_SSE3 1 -#define HAVE_SSE4 1 -#define HAVE_SSE42 1 -#define HAVE_SSSE3 1 -#define HAVE_XOP 1 -#define HAVE_CPUNOP 1 -#define HAVE_I686 1 -#define HAVE_LOONGSON 1 -#define HAVE_VIS 1 -#define HAVE_ARMV5TE_EXTERNAL 0 -#define HAVE_ARMV6_EXTERNAL 0 -#define HAVE_ARMV6T2_EXTERNAL 0 -#define HAVE_ARMV8_EXTERNAL 0 -#define HAVE_NEON_EXTERNAL 0 -#define HAVE_VFP_EXTERNAL 0 -#define HAVE_VFPV3_EXTERNAL 0 -#define HAVE_ALTIVEC_EXTERNAL 0 -#define HAVE_DCBZL_EXTERNAL 0 -#define HAVE_LDBRX_EXTERNAL 0 -#define HAVE_PPC4XX_EXTERNAL 0 -#define HAVE_AMD3DNOW_EXTERNAL 1 -#define HAVE_AMD3DNOWEXT_EXTERNAL 1 -#define HAVE_AVX_EXTERNAL 1 -#define HAVE_AVX2_EXTERNAL 1 -#define HAVE_FMA3_EXTERNAL 1 -#define HAVE_FMA4_EXTERNAL 1 -#define HAVE_MMX_EXTERNAL 1 -#define HAVE_MMXEXT_EXTERNAL 1 -#define HAVE_SSE_EXTERNAL 1 -#define HAVE_SSE2_EXTERNAL 1 -#define HAVE_SSE3_EXTERNAL 1 -#define HAVE_SSE4_EXTERNAL 1 -#define HAVE_SSE42_EXTERNAL 1 -#define HAVE_SSSE3_EXTERNAL 1 -#define HAVE_XOP_EXTERNAL 1 -#define HAVE_CPUNOP_EXTERNAL 0 -#define HAVE_I686_EXTERNAL 0 -#define HAVE_LOONGSON_EXTERNAL 0 -#define HAVE_VIS_EXTERNAL 0 -#define HAVE_ARMV5TE_INLINE 0 -#define HAVE_ARMV6_INLINE 0 -#define HAVE_ARMV6T2_INLINE 0 -#define HAVE_ARMV8_INLINE 0 -#define HAVE_NEON_INLINE 0 -#define HAVE_VFP_INLINE 0 -#define HAVE_VFPV3_INLINE 0 -#define HAVE_ALTIVEC_INLINE 0 -#define HAVE_DCBZL_INLINE 0 -#define HAVE_LDBRX_INLINE 0 -#define HAVE_PPC4XX_INLINE 0 -#define HAVE_AMD3DNOW_INLINE 1 -#define HAVE_AMD3DNOWEXT_INLINE 1 -#define HAVE_AVX_INLINE 1 -#define HAVE_AVX2_INLINE 1 -#define HAVE_FMA3_INLINE 1 -#define HAVE_FMA4_INLINE 1 -#define HAVE_MMX_INLINE 1 -#define HAVE_MMXEXT_INLINE 1 -#define HAVE_SSE_INLINE 1 -#define HAVE_SSE2_INLINE 1 -#define HAVE_SSE3_INLINE 1 -#define HAVE_SSE4_INLINE 1 -#define HAVE_SSE42_INLINE 1 -#define HAVE_SSSE3_INLINE 1 -#define HAVE_XOP_INLINE 1 -#define HAVE_CPUNOP_INLINE 0 -#define HAVE_I686_INLINE 0 -#define HAVE_LOONGSON_INLINE 0 -#define HAVE_VIS_INLINE 0 -#define HAVE_ALIGNED_STACK 1 -#define HAVE_FAST_64BIT 0 -#define HAVE_FAST_CLZ 0 -#define HAVE_FAST_CMOV 0 -#define HAVE_LOCAL_ALIGNED_8 1 -#define HAVE_LOCAL_ALIGNED_16 1 -#define HAVE_SIMD_ALIGN_16 1 -#define HAVE_ATOMICS_GCC 1 -#define HAVE_ATOMICS_SUNCC 0 -#define HAVE_ATOMICS_WIN32 0 -#define HAVE_ATOMIC_CAS_PTR 0 -#define HAVE_MACHINE_RW_BARRIER 0 -#define HAVE_MEMORYBARRIER 0 -#define HAVE_MM_EMPTY 1 -#define HAVE_RDTSC 0 -#define HAVE_SYNC_VAL_COMPARE_AND_SWAP 1 -#define HAVE_INLINE_ASM 1 -#define HAVE_SYMVER 0 -#define HAVE_YASM 1 -#define HAVE_BIGENDIAN 0 -#define HAVE_FAST_UNALIGNED 1 -#define HAVE_ALSA_ASOUNDLIB_H 0 -#define HAVE_ALTIVEC_H 0 -#define HAVE_ARPA_INET_H 0 -#define HAVE_CDIO_PARANOIA_H 0 -#define HAVE_CDIO_PARANOIA_PARANOIA_H 0 -#define HAVE_DEV_BKTR_IOCTL_BT848_H 0 -#define HAVE_DEV_BKTR_IOCTL_METEOR_H 0 -#define HAVE_DEV_IC_BT8XX_H 0 -#define HAVE_DEV_VIDEO_BKTR_IOCTL_BT848_H 0 -#define HAVE_DEV_VIDEO_METEOR_IOCTL_METEOR_H 0 -#define HAVE_DIRECT_H 0 -#define HAVE_DLFCN_H 1 -#define HAVE_DXVA_H 0 -#define HAVE_GSM_H 0 -#define HAVE_IO_H 0 -#define HAVE_MACH_MACH_TIME_H 1 -#define HAVE_MACHINE_IOCTL_BT848_H 0 -#define HAVE_MACHINE_IOCTL_METEOR_H 0 -#define HAVE_POLL_H 1 -#define HAVE_SNDIO_H 0 -#define HAVE_SOUNDCARD_H 0 -#define HAVE_SYS_MMAN_H 1 -#define HAVE_SYS_PARAM_H 1 -#define HAVE_SYS_RESOURCE_H 1 -#define HAVE_SYS_SELECT_H 1 -#define HAVE_SYS_SOUNDCARD_H 0 -#define HAVE_SYS_TIME_H 1 -#define HAVE_SYS_UN_H 1 -#define HAVE_SYS_VIDEOIO_H 0 -#define HAVE_UNISTD_H 1 -#define HAVE_WINDOWS_H 0 -#define HAVE_WINSOCK2_H 0 -#define HAVE_INTRINSICS_NEON 0 -#define HAVE_ATANF 1 -#define HAVE_ATAN2F 1 -#define HAVE_CBRTF 1 -#define HAVE_COSF 1 -#define HAVE_EXP2 1 -#define HAVE_EXP2F 1 -#define HAVE_EXPF 1 -#define HAVE_ISINF 1 -#define HAVE_ISNAN 1 -#define HAVE_LDEXPF 1 -#define HAVE_LLRINT 1 -#define HAVE_LLRINTF 1 -#define HAVE_LOG2 1 -#define HAVE_LOG2F 1 -#define HAVE_LOG10F 1 -#define HAVE_LRINT 1 -#define HAVE_LRINTF 1 -#define HAVE_POWF 1 -#define HAVE_RINT 1 -#define HAVE_ROUND 1 -#define HAVE_ROUNDF 1 -#define HAVE_SINF 1 -#define HAVE_TRUNC 1 -#define HAVE_TRUNCF 1 -#define HAVE_ALIGNED_MALLOC 0 -#define HAVE_CLOSESOCKET 0 -#define HAVE_COMMANDLINETOARGVW 0 -#define HAVE_COTASKMEMFREE 0 -#define HAVE_CRYPTGENRANDOM 0 -#define HAVE_DLOPEN 1 -#define HAVE_FCNTL 1 -#define HAVE_FLT_LIM 1 -#define HAVE_FORK 1 -#define HAVE_GETADDRINFO 0 -#define HAVE_GETHRTIME 0 -#define HAVE_GETOPT 1 -#define HAVE_GETPROCESSAFFINITYMASK 0 -#define HAVE_GETPROCESSMEMORYINFO 0 -#define HAVE_GETPROCESSTIMES 0 -#define HAVE_GETRUSAGE 1 -#define HAVE_GETSERVBYPORT 0 -#define HAVE_GETSYSTEMTIMEASFILETIME 0 -#define HAVE_GETTIMEOFDAY 1 -#define HAVE_INET_ATON 0 -#define HAVE_ISATTY 1 -#define HAVE_JACK_PORT_GET_LATENCY_RANGE 0 -#define HAVE_MACH_ABSOLUTE_TIME 1 -#define HAVE_MAPVIEWOFFILE 0 -#define HAVE_MKSTEMP 1 -#define HAVE_MMAP 1 -#define HAVE_MPROTECT 1 -#define HAVE_NANOSLEEP 1 -#define HAVE_SCHED_GETAFFINITY 0 -#define HAVE_SETCONSOLETEXTATTRIBUTE 0 -#define HAVE_SETMODE 0 -#define HAVE_SETRLIMIT 1 -#define HAVE_SLEEP 0 -#define HAVE_STRERROR_R 1 -#define HAVE_STRPTIME 1 -#define HAVE_SYSCONF 1 -#define HAVE_SYSCTL 1 -#define HAVE_USLEEP 1 -#define HAVE_VIRTUALALLOC 0 -#define HAVE_PTHREADS 0 -#define HAVE_W32THREADS 0 -#define HAVE_AS_DN_DIRECTIVE 0 -#define HAVE_AS_FUNC 0 -#define HAVE_AS_OBJECT_ARCH 0 -#define HAVE_ASM_MOD_Q 0 -#define HAVE_ATTRIBUTE_MAY_ALIAS 1 -#define HAVE_ATTRIBUTE_PACKED 1 -#define HAVE_EBP_AVAILABLE 1 -#define HAVE_EBX_AVAILABLE 1 -#define HAVE_GNU_AS 0 -#define HAVE_IBM_ASM 0 -#define HAVE_INLINE_ASM_LABELS 1 -#define HAVE_PRAGMA_DEPRECATED 1 -#define HAVE_SYMVER_ASM_LABEL 0 -#define HAVE_SYMVER_GNU_ASM 0 -#define HAVE_VFP_ARGS 0 -#define HAVE_XFORM_ASM 0 -#define HAVE_XMM_CLOBBERS 1 -#define HAVE_SOCKLEN_T 0 -#define HAVE_STRUCT_ADDRINFO 0 -#define HAVE_STRUCT_GROUP_SOURCE_REQ 0 -#define HAVE_STRUCT_IP_MREQ_SOURCE 0 -#define HAVE_STRUCT_IPV6_MREQ 0 -#define HAVE_STRUCT_POLLFD 0 -#define HAVE_STRUCT_RUSAGE_RU_MAXRSS 1 -#define HAVE_STRUCT_SOCKADDR_IN6 0 -#define HAVE_STRUCT_SOCKADDR_SA_LEN 0 -#define HAVE_STRUCT_SOCKADDR_STORAGE 0 -#define HAVE_STRUCT_V4L2_FRMIVALENUM_DISCRETE 0 -#define HAVE_ATOMICS_NATIVE 1 -#define HAVE_DOS_PATHS 0 -#define HAVE_DXVA2_LIB 0 -#define HAVE_LIBC_MSVCRT 0 -#define HAVE_LIBDC1394_1 0 -#define HAVE_LIBDC1394_2 0 -#define HAVE_SDL 0 -#define HAVE_THREADS 0 -#define HAVE_VDPAU_X11 0 -#define HAVE_XLIB 0 -#endif /* LIBAV_CONFIG_H */ diff --git a/memory/build/mozmemory.h b/memory/build/mozmemory.h index 84007fffb2..2ed63b9e1f 100644 --- a/memory/build/mozmemory.h +++ b/memory/build/mozmemory.h @@ -25,13 +25,6 @@ MOZ_BEGIN_EXTERN_C -/* - * On OSX, malloc/malloc.h contains the declaration for malloc_good_size, - * which will call back in jemalloc, through the zone allocator so just use it. - */ -#ifdef XP_DARWIN -# include -#else MOZ_MEMORY_API size_t malloc_good_size_impl(size_t size); /* Note: the MOZ_GLUE_IN_PROGRAM ifdef below is there to avoid -Werror turning @@ -39,15 +32,15 @@ MOZ_MEMORY_API size_t malloc_good_size_impl(size_t size); * to use weak imports. */ static inline size_t _malloc_good_size(size_t size) { -# if defined(MOZ_GLUE_IN_PROGRAM) && !defined(IMPL_MFBT) +#if defined(MOZ_GLUE_IN_PROGRAM) && !defined(IMPL_MFBT) if (!malloc_good_size) return size; -# endif +#endif return malloc_good_size_impl(size); } -# define malloc_good_size _malloc_good_size -#endif +#define malloc_good_size _malloc_good_size + MOZ_JEMALLOC_API void jemalloc_stats(jemalloc_stats_t *stats); diff --git a/memory/build/mozmemory_wrap.c b/memory/build/mozmemory_wrap.c index fdb8447d33..409b39da23 100644 --- a/memory/build/mozmemory_wrap.c +++ b/memory/build/mozmemory_wrap.c @@ -68,7 +68,6 @@ mozmem_malloc_impl(_ZdaPvRKSt9nothrow_t)(void *ptr) #undef strndup #undef strdup -#ifndef XP_DARWIN MOZ_MEMORY_API char * strndup_impl(const char *src, size_t len) { @@ -86,7 +85,6 @@ strdup_impl(const char *src) size_t len = strlen(src); return strndup_impl(src, len); } -#endif /* XP_DARWIN */ #ifdef XP_WIN /* diff --git a/memory/build/mozmemory_wrap.h b/memory/build/mozmemory_wrap.h index da4fd27bb1..aa305588d4 100644 --- a/memory/build/mozmemory_wrap.h +++ b/memory/build/mozmemory_wrap.h @@ -112,7 +112,7 @@ # define mozmem_jemalloc_impl(a) je_ ## a # else # define MOZ_JEMALLOC_API MFBT_API -# if (defined(XP_WIN) || defined(XP_DARWIN)) +# if defined(XP_WIN) # if defined(MOZ_REPLACE_MALLOC) # define mozmem_malloc_impl(a) a ## _impl # else diff --git a/memory/build/replace_malloc.c b/memory/build/replace_malloc.c index 91f86497c5..135b566630 100644 --- a/memory/build/replace_malloc.c +++ b/memory/build/replace_malloc.c @@ -26,9 +26,7 @@ * function resolved with GetProcAddress() instead of weak definitions * of functions. */ -#ifdef XP_DARWIN -# define MOZ_REPLACE_WEAK __attribute__((weak_import)) -#elif defined(XP_WIN) +#if defined(XP_WIN) # define MOZ_NO_REPLACE_FUNC_DECL #elif defined(__GNUC__) # define MOZ_REPLACE_WEAK __attribute__((weak)) @@ -284,111 +282,6 @@ MOZ_MEMORY_API __memalign_hook_type __memalign_hook = memalign_impl; * owned by the allocator. */ -#ifdef XP_DARWIN -#include -#include -#include "mozilla/Assertions.h" - -static size_t -zone_size(malloc_zone_t *zone, void *ptr) -{ - return malloc_usable_size_impl(ptr); -} - -static void * -zone_malloc(malloc_zone_t *zone, size_t size) -{ - return malloc_impl(size); -} - -static void * -zone_calloc(malloc_zone_t *zone, size_t num, size_t size) -{ - return calloc_impl(num, size); -} - -static void * -zone_realloc(malloc_zone_t *zone, void *ptr, size_t size) -{ - if (malloc_usable_size_impl(ptr)) - return realloc_impl(ptr, size); - return realloc(ptr, size); -} - -static void -zone_free(malloc_zone_t *zone, void *ptr) -{ - if (malloc_usable_size_impl(ptr)) { - free_impl(ptr); - return; - } - free(ptr); -} - -static void -zone_free_definite_size(malloc_zone_t *zone, void *ptr, size_t size) -{ - size_t current_size = malloc_usable_size_impl(ptr); - if (current_size) { - MOZ_ASSERT(current_size == size); - free_impl(ptr); - return; - } - free(ptr); -} - -static void * -zone_memalign(malloc_zone_t *zone, size_t alignment, size_t size) -{ - void *ptr; - if (posix_memalign_impl(&ptr, alignment, size) == 0) - return ptr; - return NULL; -} - -static void * -zone_valloc(malloc_zone_t *zone, size_t size) -{ - return valloc_impl(size); -} - -static void * -zone_destroy(malloc_zone_t *zone) -{ - /* This function should never be called. */ - MOZ_CRASH(); -} - -static size_t -zone_good_size(malloc_zone_t *zone, size_t size) -{ - return malloc_good_size_impl(size); -} - -#ifdef MOZ_JEMALLOC - -#include "jemalloc/internal/jemalloc_internal.h" - -static void -zone_force_lock(malloc_zone_t *zone) -{ - /* /!\ This calls into jemalloc. It works because we're linked in the - * same library. Stolen from jemalloc's zone.c. */ - if (isthreaded) - jemalloc_prefork(); -} - -static void -zone_force_unlock(malloc_zone_t *zone) -{ - /* /!\ This calls into jemalloc. It works because we're linked in the - * same library. Stolen from jemalloc's zone.c. */ - if (isthreaded) - jemalloc_postfork_parent(); -} - -#else - #define JEMALLOC_ZONE_VERSION 6 /* Empty implementations are needed, because fork() calls zone->force_(un)lock @@ -403,7 +296,7 @@ zone_force_unlock(malloc_zone_t *zone) { } -#endif +/* --- */ static malloc_zone_t zone; static struct malloc_introspection_t zone_introspect; diff --git a/memory/mozalloc/mozalloc.cpp b/memory/mozalloc/mozalloc.cpp index 55d36d80be..1ae071ea04 100644 --- a/memory/mozalloc/mozalloc.cpp +++ b/memory/mozalloc/mozalloc.cpp @@ -19,10 +19,6 @@ #define MOZ_MEMORY_IMPL #include "mozmemory_wrap.h" -#if defined(XP_DARWIN) -#include // for malloc_size -#endif - // See mozmemory_wrap.h for more details. This file is part of libmozglue, so // it needs to use _impl suffixes. However, with libmozglue growing, this is // becoming cumbersome, so we will likely use a malloc.h wrapper of some sort @@ -153,17 +149,6 @@ moz_posix_memalign(void **ptr, size_t alignment, size_t size) if (code) return code; -#if defined(XP_DARWIN) - // Workaround faulty OSX posix_memalign, which provides memory with the - // incorrect alignment sometimes, but returns 0 as if nothing was wrong. - size_t mask = alignment - 1; - if (((size_t)(*ptr) & mask) != 0) { - void* old = *ptr; - code = moz_posix_memalign(ptr, alignment, size); - free(old); - } -#endif - return code; } @@ -203,9 +188,7 @@ moz_malloc_usable_size(void *ptr) if (!ptr) return 0; -#if defined(XP_DARWIN) - return malloc_size(ptr); -#elif defined(HAVE_MALLOC_USABLE_SIZE) || defined(MOZ_MEMORY) +#if defined(HAVE_MALLOC_USABLE_SIZE) || defined(MOZ_MEMORY) return malloc_usable_size_impl(ptr); #elif defined(XP_WIN) return _msize(ptr); diff --git a/memory/volatile/VolatileBuffer.h b/memory/volatile/VolatileBuffer.h index b6bcdfcb74..19aeb9df2b 100644 --- a/memory/volatile/VolatileBuffer.h +++ b/memory/volatile/VolatileBuffer.h @@ -76,9 +76,7 @@ private: void* mBuf; size_t mSize; int mLockCount; -#ifdef XP_DARWIN - bool mHeap; -#elif defined(XP_WIN) +#if defined(XP_WIN) bool mHeap; bool mFirstLock; #endif diff --git a/mozglue/misc/StackWalk.cpp b/mozglue/misc/StackWalk.cpp index 141e2eb41b..f943827964 100644 --- a/mozglue/misc/StackWalk.cpp +++ b/mozglue/misc/StackWalk.cpp @@ -29,17 +29,10 @@ static CriticalAddress gCriticalAddress; #define _GNU_SOURCE #endif -#if defined(HAVE_DLOPEN) || defined(XP_DARWIN) +#if defined(HAVE_DLOPEN) #include #endif -#if (defined(XP_DARWIN) && \ - (defined(__i386) || defined(__ppc__) || defined(HAVE__UNWIND_BACKTRACE))) -#define MOZ_STACKWALK_SUPPORTS_MACOSX 1 -#else -#define MOZ_STACKWALK_SUPPORTS_MACOSX 0 -#endif - #if (defined(linux) && \ ((defined(__GNUC__) && (defined(__i386) || defined(PPC))) || \ defined(HAVE__UNWIND_BACKTRACE))) @@ -58,121 +51,18 @@ static CriticalAddress gCriticalAddress; extern MOZ_EXPORT void* __libc_stack_end; // from ld-linux.so #endif -#if MOZ_STACKWALK_SUPPORTS_MACOSX -#include -#include -#ifdef MOZ_WIDGET_COCOA -#include -#endif - -typedef void -malloc_logger_t(uint32_t aType, - uintptr_t aArg1, uintptr_t aArg2, uintptr_t aArg3, - uintptr_t aResult, uint32_t aNumHotFramesToSkip); -extern malloc_logger_t* malloc_logger; - -static void -stack_callback(uint32_t aFrameNumber, void* aPc, void* aSp, void* aClosure) -{ - const char* name = static_cast(aClosure); - Dl_info info; - - // On Leopard dladdr returns the wrong value for "new_sem_from_pool". The - // stack shows up as having two pthread_cond_wait$UNIX2003 frames. The - // correct one is the first that we find on our way up, so the - // following check for gCriticalAddress.mAddr is critical. - if (gCriticalAddress.mAddr || dladdr(aPc, &info) == 0 || - !info.dli_sname || strcmp(info.dli_sname, name) != 0) { - return; - } - gCriticalAddress.mAddr = aPc; -} - -static void -my_malloc_logger(uint32_t aType, - uintptr_t aArg1, uintptr_t aArg2, uintptr_t aArg3, - uintptr_t aResult, uint32_t aNumHotFramesToSkip) -{ - static bool once = false; - if (once) { - return; - } - once = true; - - // On Leopard dladdr returns the wrong value for "new_sem_from_pool". The - // stack shows up as having two pthread_cond_wait$UNIX2003 frames. - const char* name = "new_sem_from_pool"; - MozStackWalk(stack_callback, /* skipFrames */ 0, /* maxFrames */ 0, - const_cast(name), 0, nullptr); -} - -// This is called from NS_LogInit() and from the stack walking functions, but -// only the first call has any effect. We need to call this function from both -// places because it must run before any mutexes are created, and also before -// any objects whose refcounts we're logging are created. Running this -// function during NS_LogInit() ensures that we meet the first criterion, and -// running this function during the stack walking functions ensures we meet the -// second criterion. -MFBT_API void -StackWalkInitCriticalAddress() -{ - if (gCriticalAddress.mInit) { - return; - } - gCriticalAddress.mInit = true; - // We must not do work when 'new_sem_from_pool' calls realloc, since - // it holds a non-reentrant spin-lock and we will quickly deadlock. - // new_sem_from_pool is not directly accessible using dlsym, so - // we force a situation where new_sem_from_pool is on the stack and - // use dladdr to check the addresses. - - // malloc_logger can be set by external tools like 'Instruments' or 'leaks' - malloc_logger_t* old_malloc_logger = malloc_logger; - malloc_logger = my_malloc_logger; - - pthread_cond_t cond; - int r = pthread_cond_init(&cond, 0); - MOZ_ASSERT(r == 0); - pthread_mutex_t mutex; - r = pthread_mutex_init(&mutex, 0); - MOZ_ASSERT(r == 0); - r = pthread_mutex_lock(&mutex); - MOZ_ASSERT(r == 0); - struct timespec abstime = { 0, 1 }; - r = pthread_cond_timedwait_relative_np(&cond, &mutex, &abstime); - - // restore the previous malloc logger - malloc_logger = old_malloc_logger; - - MOZ_ASSERT(r == ETIMEDOUT); - r = pthread_mutex_unlock(&mutex); - MOZ_ASSERT(r == 0); - r = pthread_mutex_destroy(&mutex); - MOZ_ASSERT(r == 0); - r = pthread_cond_destroy(&cond); - MOZ_ASSERT(r == 0); -} - -static bool -IsCriticalAddress(void* aPC) -{ - return gCriticalAddress.mAddr == aPC; -} -#else static bool IsCriticalAddress(void* aPC) { return false; } // We still initialize gCriticalAddress.mInit so that this code behaves -// the same on all platforms. Otherwise a failure to init would be visible -// only on OS X. +// the same on all platforms. MFBT_API void StackWalkInitCriticalAddress() { gCriticalAddress.mInit = true; } -#endif #if defined(_WIN32) && (defined(_M_IX86) || defined(_M_AMD64) || defined(_M_IA64)) // WIN32 x86 stack walking code @@ -922,8 +812,6 @@ MozStackWalk(MozWalkStackCallback aCallback, uint32_t aSkipFrames, void* stackEnd; #if HAVE___LIBC_STACK_END stackEnd = __libc_stack_end; -#elif defined(XP_DARWIN) - stackEnd = pthread_get_stackaddr_np(pthread_self()); #else # error Unsupported configuration #endif diff --git a/mozglue/misc/TimeStamp.h b/mozglue/misc/TimeStamp.h index 019393b284..20e70cbdc1 100644 --- a/mozglue/misc/TimeStamp.h +++ b/mozglue/misc/TimeStamp.h @@ -399,18 +399,9 @@ public: * retrieved by mozilla::TimeStamp. Since we need this for * vsync timestamps, we enable the creation of mozilla::TimeStamps * on platforms that support vsync aligned refresh drivers / compositors - * Verified true as of Jan 31, 2015: OS X * False on Windows 7 * UNTESTED ON OTHER PLATFORMS */ -#if defined(XP_DARWIN) - static TimeStamp FromSystemTime(int64_t aSystemTime) - { - static_assert(sizeof(aSystemTime) == sizeof(TimeStampValue), - "System timestamp should be same units as TimeStampValue"); - return TimeStamp(aSystemTime); - } -#endif /** * Return true if this is the "null" moment diff --git a/netwerk/base/nsSocketTransport2.cpp b/netwerk/base/nsSocketTransport2.cpp index 27bb0de54a..1d3d58866b 100644 --- a/netwerk/base/nsSocketTransport2.cpp +++ b/netwerk/base/nsSocketTransport2.cpp @@ -3051,17 +3051,6 @@ nsSocketTransport::PRFileDescAutoLock::SetKeepaliveVals(bool aEnabled, } return NS_OK; -#elif defined(XP_DARWIN) - // Darwin uses sec; only supports idle time being set. - int err = setsockopt(sock, IPPROTO_TCP, TCP_KEEPALIVE, - &aIdleTime, sizeof(aIdleTime)); - if (NS_WARN_IF(err)) { - LogOSError("nsSocketTransport Failed setting TCP_KEEPALIVE", - mSocketTransport); - return NS_ERROR_UNEXPECTED; - } - return NS_OK; - #elif defined(XP_UNIX) // Not all *nix OSes support the following setsockopt() options // build errors will tell us if they are not. diff --git a/netwerk/protocol/websocket/WebSocketChannel.cpp b/netwerk/protocol/websocket/WebSocketChannel.cpp index 76be1c9dd0..952c0d5ee5 100644 --- a/netwerk/protocol/websocket/WebSocketChannel.cpp +++ b/netwerk/protocol/websocket/WebSocketChannel.cpp @@ -1247,10 +1247,10 @@ WebSocketChannel::Observe(nsISupports *subject, // Next we check mDataStarted, which we need to do on mTargetThread. if (!IsOnTargetThread()) { mTargetThread->Dispatch( - NewRunnableMethod(this, &WebSocketChannel::OnNetworkChanged), + NewRunnableMethod(this, &WebSocketChannel::OnNetworkChangedTargetThread), NS_DISPATCH_NORMAL); } else { - OnNetworkChanged(); + OnNetworkChangedTargetThread(); } } } @@ -1260,21 +1260,23 @@ WebSocketChannel::Observe(nsISupports *subject, } nsresult -WebSocketChannel::OnNetworkChanged() +WebSocketChannel::OnNetworkChangedTargetThread() { - if (IsOnTargetThread()) { - LOG(("WebSocketChannel::OnNetworkChanged() - on target thread %p", this)); + LOG(("WebSocketChannel::OnNetworkChangedTargetThread() - on target thread %p", this)); - if (!mDataStarted) { - LOG(("WebSocket: data not started yet, no ping needed")); - return NS_OK; - } - - return mSocketThread->Dispatch( - NewRunnableMethod(this, &WebSocketChannel::OnNetworkChanged), - NS_DISPATCH_NORMAL); + if (!mDataStarted) { + LOG(("WebSocket: data not started yet, no ping needed")); + return NS_OK; } + return mSocketThread->Dispatch( + NewRunnableMethod(this, &WebSocketChannel::OnNetworkChanged), + NS_DISPATCH_NORMAL); +} + +nsresult +WebSocketChannel::OnNetworkChanged() +{ MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread, "not socket thread"); LOG(("WebSocketChannel::OnNetworkChanged() - on socket thread %p", this)); diff --git a/netwerk/protocol/websocket/WebSocketChannel.h b/netwerk/protocol/websocket/WebSocketChannel.h index 631edebfaf..f60bc4fbbe 100644 --- a/netwerk/protocol/websocket/WebSocketChannel.h +++ b/netwerk/protocol/websocket/WebSocketChannel.h @@ -146,6 +146,7 @@ private: void GeneratePong(uint8_t *payload, uint32_t len); void GeneratePing(); + nsresult OnNetworkChangedTargetThread(); nsresult OnNetworkChanged(); nsresult StartPinging(); diff --git a/toolkit/components/telemetry/Histograms.json b/toolkit/components/telemetry/Histograms.json index 2d90166a6a..a1e01f048a 100644 --- a/toolkit/components/telemetry/Histograms.json +++ b/toolkit/components/telemetry/Histograms.json @@ -1231,14 +1231,6 @@ "description": "gfxGDIFontList::InitFontList Total (ms)", "cpp_guard": "XP_WIN" }, - "MAC_INITFONTLIST_TOTAL": { - "expires_in_version": "never", - "kind": "exponential", - "high": 30000, - "n_buckets": 10, - "description": "gfxMacPlatformFontList::InitFontList Total (ms)", - "cpp_guard": "XP_DARWIN" - }, "SYSTEM_FONT_FALLBACK": { "expires_in_version": "never", "kind": "exponential", diff --git a/toolkit/components/telemetry/histogram-whitelists.json b/toolkit/components/telemetry/histogram-whitelists.json index 5cd7c31452..c81cc7e5df 100644 --- a/toolkit/components/telemetry/histogram-whitelists.json +++ b/toolkit/components/telemetry/histogram-whitelists.json @@ -387,7 +387,6 @@ "LOCALDOMSTORAGE_SHUTDOWN_DATABASE_MS", "LOCALDOMSTORAGE_UNLOAD_BLOCKING_MS", "LONG_REFLOW_INTERRUPTIBLE", - "MAC_INITFONTLIST_TOTAL", "MASTER_PASSWORD_ENABLED", "MEDIA_WMF_DECODE_ERROR", "MIXED_CONTENT_PAGE_LOAD", @@ -1178,7 +1177,6 @@ "LOW_MEMORY_EVENTS_COMMIT_SPACE", "LOW_MEMORY_EVENTS_PHYSICAL", "LOW_MEMORY_EVENTS_VIRTUAL", - "MAC_INITFONTLIST_TOTAL", "MASTER_PASSWORD_ENABLED", "MEDIA_CODEC_USED", "MEDIA_WMF_DECODE_ERROR", diff --git a/toolkit/xre/nsXREDirProvider.cpp b/toolkit/xre/nsXREDirProvider.cpp index cfe9947cce..8db967af65 100644 --- a/toolkit/xre/nsXREDirProvider.cpp +++ b/toolkit/xre/nsXREDirProvider.cpp @@ -59,9 +59,6 @@ #ifdef XP_UNIX #include #endif -#ifdef XP_IOS -#include "UIKitDirProvider.h" -#endif #if defined(XP_MACOSX) #define APP_REGISTRY_NAME "Application Registry" @@ -1311,14 +1308,6 @@ nsXREDirProvider::GetUserDataDirectoryHome(nsIFile** aFile, bool aLocal) NS_ENSURE_SUCCESS(rv, rv); localDir = do_QueryInterface(dirFileMac, &rv); -#elif defined(XP_IOS) - nsAutoCString userDir; - if (GetUIKitDirectory(aLocal, userDir)) { - rv = NS_NewNativeLocalFile(userDir, true, getter_AddRefs(localDir)); - } else { - rv = NS_ERROR_FAILURE; - } - NS_ENSURE_SUCCESS(rv, rv); #elif defined(XP_WIN) nsString path; if (aLocal) { diff --git a/xpcom/base/MacHelpers.h b/xpcom/base/MacHelpers.h deleted file mode 100644 index 2bff0367ef..0000000000 --- a/xpcom/base/MacHelpers.h +++ /dev/null @@ -1,17 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* 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_MacHelpers_h -#define mozilla_MacHelpers_h - -#include "nsString.h" - -namespace mozilla { - -nsresult GetSelectedCityInfo(nsAString& aCountryCode); - -} // namespace mozilla - -#endif diff --git a/xpcom/base/MacHelpers.mm b/xpcom/base/MacHelpers.mm deleted file mode 100644 index e0b5e6c35b..0000000000 --- a/xpcom/base/MacHelpers.mm +++ /dev/null @@ -1,40 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* 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/. */ - -#include "nsString.h" -#include "MacHelpers.h" -#include "nsObjCExceptions.h" - -#import - -namespace mozilla { - -nsresult -GetSelectedCityInfo(nsAString& aCountryCode) -{ - NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT; - - // Can be replaced with [[NSLocale currentLocale] countryCode] once we build - // with the 10.12 SDK. - id countryCode = [[NSLocale currentLocale] objectForKey:NSLocaleCountryCode]; - - if (![countryCode isKindOfClass:[NSString class]]) { - return NS_ERROR_FAILURE; - } - - const char* countryCodeUTF8 = [(NSString*)countryCode UTF8String]; - - if (!countryCodeUTF8) { - return NS_ERROR_FAILURE; - } - - AppendUTF8toUTF16(countryCodeUTF8, aCountryCode); - return NS_OK; - - NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT; -} - -} // namespace Mozilla - diff --git a/xpcom/base/moz.build b/xpcom/base/moz.build index a59528c576..03a0fa43a7 100644 --- a/xpcom/base/moz.build +++ b/xpcom/base/moz.build @@ -28,17 +28,6 @@ XPIDL_SOURCES += [ 'nsrootidl.idl', ] -if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': - XPIDL_SOURCES += [ - 'nsIMacUtils.idl', - ] - EXPORTS.mozilla += [ - 'MacHelpers.h', - ] - UNIFIED_SOURCES += [ - 'MacHelpers.mm', - ] - XPIDL_MODULE = 'xpcom_base' EXPORTS += [ @@ -136,11 +125,7 @@ if CONFIG['OS_ARCH'] == 'Linux': 'SystemMemoryReporter.cpp', ] -if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': - SOURCES += [ - 'nsMacUtilsImpl.cpp', - ] -elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows': +if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows': SOURCES += [ 'nsCrashOnException.cpp', ] diff --git a/xpcom/base/nsDebugImpl.cpp b/xpcom/base/nsDebugImpl.cpp index c4d4437a9b..fb4831eeda 100644 --- a/xpcom/base/nsDebugImpl.cpp +++ b/xpcom/base/nsDebugImpl.cpp @@ -34,7 +34,7 @@ #include "nsString.h" #endif -#if defined(XP_MACOSX) || defined(__DragonFly__) || defined(__FreeBSD__) \ +#if defined(__DragonFly__) || defined(__FreeBSD__) \ || defined(__NetBSD__) || defined(__OpenBSD__) #include #include @@ -58,9 +58,7 @@ #define KINFO_PROC struct kinfo_proc #endif -#if defined(XP_MACOSX) -#define KP_FLAGS kp_proc.p_flag -#elif defined(__DragonFly__) +#if defined(__DragonFly__) #define KP_FLAGS kp_flags #elif defined(__FreeBSD__) #define KP_FLAGS ki_flag @@ -164,7 +162,7 @@ nsDebugImpl::GetIsDebuggerAttached(bool* aResult) #if defined(XP_WIN) *aResult = ::IsDebuggerPresent(); -#elif defined(XP_MACOSX) || defined(__DragonFly__) || defined(__FreeBSD__) \ +#elif defined(__DragonFly__) || defined(__FreeBSD__) \ || defined(__NetBSD__) || defined(__OpenBSD__) // Specify the info we're looking for int mib[] = { @@ -426,8 +424,6 @@ RealBreak() { #if defined(_WIN32) ::DebugBreak(); -#elif defined(XP_MACOSX) - raise(SIGTRAP); #elif defined(__GNUC__) && (defined(__i386__) || defined(__i386) || defined(__x86_64__)) asm("int $3"); #elif defined(__arm__) @@ -511,12 +507,6 @@ Break(const char* aMsg) } RealBreak(); -#elif defined(XP_MACOSX) - /* Note that we put this Mac OS X test above the GNUC/x86 test because the - * GNUC/x86 test is also true on Intel Mac OS X and we want the PPC/x86 - * impls to be the same. - */ - RealBreak(); #elif defined(__GNUC__) && (defined(__i386__) || defined(__i386) || defined(__x86_64__)) RealBreak(); #elif defined(__arm__) diff --git a/xpcom/base/nsIMacUtils.idl b/xpcom/base/nsIMacUtils.idl deleted file mode 100644 index 9a60df47cd..0000000000 --- a/xpcom/base/nsIMacUtils.idl +++ /dev/null @@ -1,32 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* 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/. */ - -#include "nsISupports.idl" - -/** - * nsIMacUtils: Generic globally-available Mac-specific utilities. - */ - -[scriptable, uuid(5E9072D7-FF95-455E-9466-8AF9841A72EC)] -interface nsIMacUtils : nsISupports -{ - /** - * True when the main executable is a fat file supporting at least - * ppc and x86 (universal binary). - */ - readonly attribute boolean isUniversalBinary; - - /** - * Returns a string containing a list of architectures delimited - * by "-". Architecture sets are always in the same order: - * ppc > i386 > ppc64 > x86_64 > (future additions) - */ - readonly attribute AString architecturesInBinary; - - /** - * True when running under binary translation (Rosetta). - */ - readonly attribute boolean isTranslated; -}; diff --git a/xpcom/base/nsMacUtilsImpl.cpp b/xpcom/base/nsMacUtilsImpl.cpp deleted file mode 100644 index eb93cc555e..0000000000 --- a/xpcom/base/nsMacUtilsImpl.cpp +++ /dev/null @@ -1,146 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* 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/. */ - -#include "nsMacUtilsImpl.h" - -#include - -NS_IMPL_ISUPPORTS(nsMacUtilsImpl, nsIMacUtils) - -nsresult -nsMacUtilsImpl::GetArchString(nsAString& aArchString) -{ - if (!mBinaryArchs.IsEmpty()) { - aArchString.Assign(mBinaryArchs); - return NS_OK; - } - - aArchString.Truncate(); - - bool foundPPC = false, - foundX86 = false, - foundPPC64 = false, - foundX86_64 = false; - - CFBundleRef mainBundle = ::CFBundleGetMainBundle(); - if (!mainBundle) { - return NS_ERROR_FAILURE; - } - - CFArrayRef archList = ::CFBundleCopyExecutableArchitectures(mainBundle); - if (!archList) { - return NS_ERROR_FAILURE; - } - - CFIndex archCount = ::CFArrayGetCount(archList); - for (CFIndex i = 0; i < archCount; i++) { - CFNumberRef arch = - static_cast(::CFArrayGetValueAtIndex(archList, i)); - - int archInt = 0; - if (!::CFNumberGetValue(arch, kCFNumberIntType, &archInt)) { - ::CFRelease(archList); - return NS_ERROR_FAILURE; - } - - if (archInt == kCFBundleExecutableArchitecturePPC) { - foundPPC = true; - } else if (archInt == kCFBundleExecutableArchitectureI386) { - foundX86 = true; - } else if (archInt == kCFBundleExecutableArchitecturePPC64) { - foundPPC64 = true; - } else if (archInt == kCFBundleExecutableArchitectureX86_64) { - foundX86_64 = true; - } - } - - ::CFRelease(archList); - - // The order in the string must always be the same so - // don't do this in the loop. - if (foundPPC) { - mBinaryArchs.AppendLiteral("ppc"); - } - - if (foundX86) { - if (!mBinaryArchs.IsEmpty()) { - mBinaryArchs.Append('-'); - } - mBinaryArchs.AppendLiteral("i386"); - } - - if (foundPPC64) { - if (!mBinaryArchs.IsEmpty()) { - mBinaryArchs.Append('-'); - } - mBinaryArchs.AppendLiteral("ppc64"); - } - - if (foundX86_64) { - if (!mBinaryArchs.IsEmpty()) { - mBinaryArchs.Append('-'); - } - mBinaryArchs.AppendLiteral("x86_64"); - } - - aArchString.Assign(mBinaryArchs); - - return (aArchString.IsEmpty() ? NS_ERROR_FAILURE : NS_OK); -} - -NS_IMETHODIMP -nsMacUtilsImpl::GetIsUniversalBinary(bool* aIsUniversalBinary) -{ - if (NS_WARN_IF(!aIsUniversalBinary)) { - return NS_ERROR_INVALID_ARG; - } - *aIsUniversalBinary = false; - - nsAutoString archString; - nsresult rv = GetArchString(archString); - if (NS_FAILED(rv)) { - return rv; - } - - // The delimiter char in the arch string is '-', so if that character - // is in the string we know we have multiple architectures. - *aIsUniversalBinary = (archString.Find("-") > -1); - - return NS_OK; -} - -NS_IMETHODIMP -nsMacUtilsImpl::GetArchitecturesInBinary(nsAString& aArchString) -{ - return GetArchString(aArchString); -} - -// True when running under binary translation (Rosetta). -NS_IMETHODIMP -nsMacUtilsImpl::GetIsTranslated(bool* aIsTranslated) -{ -#ifdef __ppc__ - static bool sInitialized = false; - - // Initialize sIsNative to 1. If the sysctl fails because it doesn't - // exist, then translation is not possible, so the process must not be - // running translated. - static int32_t sIsNative = 1; - - if (!sInitialized) { - size_t sz = sizeof(sIsNative); - sysctlbyname("sysctl.proc_native", &sIsNative, &sz, nullptr, 0); - sInitialized = true; - } - - *aIsTranslated = !sIsNative; -#else - // Translation only exists for ppc code. Other architectures aren't - // translated. - *aIsTranslated = false; -#endif - - return NS_OK; -} diff --git a/xpcom/base/nsMacUtilsImpl.h b/xpcom/base/nsMacUtilsImpl.h deleted file mode 100644 index 12a1add41a..0000000000 --- a/xpcom/base/nsMacUtilsImpl.h +++ /dev/null @@ -1,41 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* 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 nsMacUtilsImpl_h___ -#define nsMacUtilsImpl_h___ - -#include "nsIMacUtils.h" -#include "nsString.h" -#include "mozilla/Attributes.h" - -class nsMacUtilsImpl final : public nsIMacUtils -{ -public: - NS_DECL_ISUPPORTS - NS_DECL_NSIMACUTILS - - nsMacUtilsImpl() - { - } - -private: - ~nsMacUtilsImpl() - { - } - - nsresult GetArchString(nsAString& aArchString); - - // A string containing a "-" delimited list of architectures - // in our binary. - nsString mBinaryArchs; -}; - -// Global singleton service -// 697BD3FD-43E5-41CE-AD5E-C339175C0818 -#define NS_MACUTILSIMPL_CID \ - {0x697BD3FD, 0x43E5, 0x41CE, {0xAD, 0x5E, 0xC3, 0x39, 0x17, 0x5C, 0x08, 0x18}} -#define NS_MACUTILSIMPL_CONTRACTID "@mozilla.org/xpcom/mac-utils;1" - -#endif /* nsMacUtilsImpl_h___ */ diff --git a/xpcom/base/nsMemoryReporterManager.cpp b/xpcom/base/nsMemoryReporterManager.cpp index b17dee4e57..810254bcc6 100644 --- a/xpcom/base/nsMemoryReporterManager.cpp +++ b/xpcom/base/nsMemoryReporterManager.cpp @@ -395,168 +395,6 @@ ResidentFastDistinguishedAmount(int64_t* aN) return ResidentDistinguishedAmount(aN); } -#elif defined(XP_MACOSX) - -#include -#include -#include -#include -#include - -static MOZ_MUST_USE bool -GetTaskBasicInfo(struct task_basic_info* aTi) -{ - mach_msg_type_number_t count = TASK_BASIC_INFO_COUNT; - kern_return_t kr = task_info(mach_task_self(), TASK_BASIC_INFO, - (task_info_t)aTi, &count); - return kr == KERN_SUCCESS; -} - -// The VSIZE figure on Mac includes huge amounts of shared memory and is always -// absurdly high, eg. 2GB+ even at start-up. But both 'top' and 'ps' report -// it, so we might as well too. -#define HAVE_VSIZE_AND_RESIDENT_REPORTERS 1 -static MOZ_MUST_USE nsresult -VsizeDistinguishedAmount(int64_t* aN) -{ - task_basic_info ti; - if (!GetTaskBasicInfo(&ti)) { - return NS_ERROR_FAILURE; - } - *aN = ti.virtual_size; - return NS_OK; -} - -// If we're using jemalloc on Mac, we need to instruct jemalloc to purge the -// pages it has madvise(MADV_FREE)'d before we read our RSS in order to get -// an accurate result. The OS will take away MADV_FREE'd pages when there's -// memory pressure, so ideally, they shouldn't count against our RSS. -// -// Purging these pages can take a long time for some users (see bug 789975), -// so we provide the option to get the RSS without purging first. -static MOZ_MUST_USE nsresult -ResidentDistinguishedAmountHelper(int64_t* aN, bool aDoPurge) -{ -#ifdef HAVE_JEMALLOC_STATS - if (aDoPurge) { - jemalloc_purge_freed_pages(); - } -#endif - - task_basic_info ti; - if (!GetTaskBasicInfo(&ti)) { - return NS_ERROR_FAILURE; - } - *aN = ti.resident_size; - return NS_OK; -} - -static MOZ_MUST_USE nsresult -ResidentFastDistinguishedAmount(int64_t* aN) -{ - return ResidentDistinguishedAmountHelper(aN, /* doPurge = */ false); -} - -static MOZ_MUST_USE nsresult -ResidentDistinguishedAmount(int64_t* aN) -{ - return ResidentDistinguishedAmountHelper(aN, /* doPurge = */ true); -} - -#define HAVE_RESIDENT_UNIQUE_REPORTER 1 - -static bool -InSharedRegion(mach_vm_address_t aAddr, cpu_type_t aType) -{ - mach_vm_address_t base; - mach_vm_address_t size; - - switch (aType) { - case CPU_TYPE_ARM: - base = SHARED_REGION_BASE_ARM; - size = SHARED_REGION_SIZE_ARM; - break; - case CPU_TYPE_I386: - base = SHARED_REGION_BASE_I386; - size = SHARED_REGION_SIZE_I386; - break; - case CPU_TYPE_X86_64: - base = SHARED_REGION_BASE_X86_64; - size = SHARED_REGION_SIZE_X86_64; - break; - default: - return false; - } - - return base <= aAddr && aAddr < (base + size); -} - -static MOZ_MUST_USE nsresult -ResidentUniqueDistinguishedAmount(int64_t* aN) -{ - if (!aN) { - return NS_ERROR_FAILURE; - } - - cpu_type_t cpu_type; - size_t len = sizeof(cpu_type); - if (sysctlbyname("sysctl.proc_cputype", &cpu_type, &len, NULL, 0) != 0) { - return NS_ERROR_FAILURE; - } - - // Roughly based on libtop_update_vm_regions in - // http://www.opensource.apple.com/source/top/top-100.1.2/libtop.c - size_t privatePages = 0; - mach_vm_size_t size = 0; - for (mach_vm_address_t addr = MACH_VM_MIN_ADDRESS; ; addr += size) { - vm_region_top_info_data_t info; - mach_msg_type_number_t infoCount = VM_REGION_TOP_INFO_COUNT; - mach_port_t objectName; - - kern_return_t kr = - mach_vm_region(mach_task_self(), &addr, &size, VM_REGION_TOP_INFO, - reinterpret_cast(&info), - &infoCount, &objectName); - if (kr == KERN_INVALID_ADDRESS) { - // Done iterating VM regions. - break; - } else if (kr != KERN_SUCCESS) { - return NS_ERROR_FAILURE; - } - - if (InSharedRegion(addr, cpu_type) && info.share_mode != SM_PRIVATE) { - continue; - } - - switch (info.share_mode) { - case SM_LARGE_PAGE: - // NB: Large pages are not shareable and always resident. - case SM_PRIVATE: - privatePages += info.private_pages_resident; - privatePages += info.shared_pages_resident; - break; - case SM_COW: - privatePages += info.private_pages_resident; - if (info.ref_count == 1) { - // Treat copy-on-write pages as private if they only have one reference. - privatePages += info.shared_pages_resident; - } - break; - case SM_SHARED: - default: - break; - } - } - - vm_size_t pageSize; - if (host_page_size(mach_host_self(), &pageSize) != KERN_SUCCESS) { - pageSize = PAGE_SIZE; - } - - *aN = privatePages * pageSize; - return NS_OK; -} - #elif defined(XP_WIN) #include @@ -1147,9 +985,7 @@ ResidentPeakDistinguishedAmount(int64_t* aN) // - Solaris: pages? But some sources it actually always returns 0, so // check for that // - Linux, {Net/Open/Free}BSD, DragonFly: KiB -#ifdef XP_MACOSX - *aN = usage.ru_maxrss; -#elif defined(XP_SOLARIS) +#if defined(XP_SOLARIS) *aN = usage.ru_maxrss * getpagesize(); #else *aN = usage.ru_maxrss * 1024; diff --git a/xpcom/base/nsSystemInfo.cpp b/xpcom/base/nsSystemInfo.cpp index 4cfc11e9bf..027d36f10d 100644 --- a/xpcom/base/nsSystemInfo.cpp +++ b/xpcom/base/nsSystemInfo.cpp @@ -25,10 +25,6 @@ #include "nsWindowsHelpers.h" #endif -#ifdef XP_MACOSX -#include "MacHelpers.h" -#endif - #ifdef MOZ_WIDGET_GTK #include #include @@ -44,10 +40,6 @@ #include #endif -#ifdef XP_MACOSX -#include -#endif - // Slot for NS_InitXPCOM2 to pass information to nsSystemInfo::Init. // Only set to nonzero (potentially) if XP_UNIX. On such systems, the // system call to discover the appropriate value is not thread-safe, @@ -418,67 +410,6 @@ nsSystemInfo::Init() cpuFamily = si.wProcessorLevel; cpuModel = si.wProcessorRevision >> 8; cpuStepping = si.wProcessorRevision & 0xFF; -#elif defined (XP_MACOSX) - // CPU speed - uint64_t sysctlValue64 = 0; - uint32_t sysctlValue32 = 0; - size_t len = 0; - len = sizeof(sysctlValue64); - if (!sysctlbyname("hw.cpufrequency_max", &sysctlValue64, &len, NULL, 0)) { - cpuSpeed = static_cast(sysctlValue64/1000000); - } - MOZ_ASSERT(sizeof(sysctlValue64) == len); - - len = sizeof(sysctlValue32); - if (!sysctlbyname("hw.physicalcpu_max", &sysctlValue32, &len, NULL, 0)) { - physicalCPUs = static_cast(sysctlValue32); - } - MOZ_ASSERT(sizeof(sysctlValue32) == len); - - len = sizeof(sysctlValue32); - if (!sysctlbyname("hw.logicalcpu_max", &sysctlValue32, &len, NULL, 0)) { - logicalCPUs = static_cast(sysctlValue32); - } - MOZ_ASSERT(sizeof(sysctlValue32) == len); - - len = sizeof(sysctlValue64); - if (!sysctlbyname("hw.l2cachesize", &sysctlValue64, &len, NULL, 0)) { - cacheSizeL2 = static_cast(sysctlValue64/1024); - } - MOZ_ASSERT(sizeof(sysctlValue64) == len); - - len = sizeof(sysctlValue64); - if (!sysctlbyname("hw.l3cachesize", &sysctlValue64, &len, NULL, 0)) { - cacheSizeL3 = static_cast(sysctlValue64/1024); - } - MOZ_ASSERT(sizeof(sysctlValue64) == len); - - if (!sysctlbyname("machdep.cpu.vendor", NULL, &len, NULL, 0)) { - char* cpuVendorStr = new char[len]; - if (!sysctlbyname("machdep.cpu.vendor", cpuVendorStr, &len, NULL, 0)) { - cpuVendor = cpuVendorStr; - } - delete [] cpuVendorStr; - } - - len = sizeof(sysctlValue32); - if (!sysctlbyname("machdep.cpu.family", &sysctlValue32, &len, NULL, 0)) { - cpuFamily = static_cast(sysctlValue32); - } - MOZ_ASSERT(sizeof(sysctlValue32) == len); - - len = sizeof(sysctlValue32); - if (!sysctlbyname("machdep.cpu.model", &sysctlValue32, &len, NULL, 0)) { - cpuModel = static_cast(sysctlValue32); - } - MOZ_ASSERT(sizeof(sysctlValue32) == len); - - len = sizeof(sysctlValue32); - if (!sysctlbyname("machdep.cpu.stepping", &sysctlValue32, &len, NULL, 0)) { - cpuStepping = static_cast(sysctlValue32); - } - MOZ_ASSERT(sizeof(sysctlValue32) == len); - #elif defined(XP_LINUX) // Get vendor, family, model, stepping, physical cores, L3 cache size // from /proc/cpuinfo file @@ -655,14 +586,6 @@ nsSystemInfo::Init() } #endif -#if defined(XP_MACOSX) - nsAutoString countryCode; - if (NS_SUCCEEDED(GetSelectedCityInfo(countryCode))) { - rv = SetPropertyAsAString(NS_LITERAL_STRING("countryCode"), countryCode); - NS_ENSURE_SUCCESS(rv, rv); - } -#endif - #if defined(MOZ_WIDGET_GTK) // This must be done here because NSPR can only separate OS's when compiled, not libraries. // 64 bytes is going to be well enough for "GTK " followed by 3 integers diff --git a/xpcom/base/nsUUIDGenerator.cpp b/xpcom/base/nsUUIDGenerator.cpp index 645b34b87e..e3974b5fca 100644 --- a/xpcom/base/nsUUIDGenerator.cpp +++ b/xpcom/base/nsUUIDGenerator.cpp @@ -6,8 +6,6 @@ #if defined(XP_WIN) #include #include -#elif defined(XP_MACOSX) -#include #else #include #include "prrng.h" @@ -34,7 +32,7 @@ nsUUIDGenerator::Init() // We're a service, so we're guaranteed that Init() is not going // to be reentered while we're inside Init(). -#if !defined(XP_WIN) && !defined(XP_MACOSX) && !defined(HAVE_ARC4RANDOM) +#if !defined(XP_WIN) && !defined(HAVE_ARC4RANDOM) /* initialize random number generator using NSPR random noise */ unsigned int seed; @@ -71,7 +69,7 @@ nsUUIDGenerator::Init() } #endif -#endif /* non XP_WIN and non XP_MACOSX and non ARC4RANDOM */ +#endif /* non XP_WIN and non ARC4RANDOM */ return NS_OK; } @@ -106,17 +104,7 @@ nsUUIDGenerator::GenerateUUIDInPlace(nsID* aId) if (FAILED(hr)) { return NS_ERROR_FAILURE; } -#elif defined(XP_MACOSX) - CFUUIDRef uuid = CFUUIDCreate(kCFAllocatorDefault); - if (!uuid) { - return NS_ERROR_FAILURE; - } - - CFUUIDBytes bytes = CFUUIDGetUUIDBytes(uuid); - memcpy(aId, &bytes, sizeof(nsID)); - - CFRelease(uuid); -#else /* not windows or OS X; generate randomness using random(). */ +#else /* not windows; generate randomness using random(). */ /* XXX we should be saving the return of setstate here and switching * back to it; instead, we use the value returned when we called * initstate, since older glibc's have broken setstate() return values diff --git a/xpcom/base/nsUUIDGenerator.h b/xpcom/base/nsUUIDGenerator.h index bfd2805eaf..1eadd14eea 100644 --- a/xpcom/base/nsUUIDGenerator.h +++ b/xpcom/base/nsUUIDGenerator.h @@ -28,7 +28,7 @@ private: protected: mozilla::Mutex mLock; -#if !defined(XP_WIN) && !defined(XP_MACOSX) && !defined(HAVE_ARC4RANDOM) +#if !defined(XP_WIN) && !defined(HAVE_ARC4RANDOM) char mState[128]; char* mSavedState; uint8_t mRBytes; diff --git a/xpcom/build/BinaryPath.h b/xpcom/build/BinaryPath.h index 6c2622a557..8ad7e8aac2 100644 --- a/xpcom/build/BinaryPath.h +++ b/xpcom/build/BinaryPath.h @@ -9,8 +9,6 @@ #include "nsXPCOMPrivate.h" // for MAXPATHLEN #ifdef XP_WIN #include -#elif defined(XP_MACOSX) -#include #elif defined(XP_UNIX) #include #include @@ -43,46 +41,6 @@ private: return NS_ERROR_FAILURE; } -#elif defined(XP_MACOSX) - static nsresult Get(const char* argv0, char aResult[MAXPATHLEN]) - { - // Works even if we're not bundled. - CFBundleRef appBundle = CFBundleGetMainBundle(); - if (!appBundle) { - return NS_ERROR_FAILURE; - } - - CFURLRef executableURL = CFBundleCopyExecutableURL(appBundle); - if (!executableURL) { - return NS_ERROR_FAILURE; - } - - nsresult rv; - if (CFURLGetFileSystemRepresentation(executableURL, false, (UInt8*)aResult, - MAXPATHLEN)) { - // Sanitize path in case the app was launched from Terminal via - // './firefox' for example. - size_t readPos = 0; - size_t writePos = 0; - while (aResult[readPos] != '\0') { - if (aResult[readPos] == '.' && aResult[readPos + 1] == '/') { - readPos += 2; - } else { - aResult[writePos] = aResult[readPos]; - readPos++; - writePos++; - } - } - aResult[writePos] = '\0'; - rv = NS_OK; - } else { - rv = NS_ERROR_FAILURE; - } - - CFRelease(executableURL); - return rv; - } - #elif defined(XP_UNIX) static nsresult Get(const char* aArgv0, char aResult[MAXPATHLEN]) { diff --git a/xpcom/build/PoisonIOInterposer.h b/xpcom/build/PoisonIOInterposer.h index 20edbd5aa8..6a34e39a0c 100644 --- a/xpcom/build/PoisonIOInterposer.h +++ b/xpcom/build/PoisonIOInterposer.h @@ -35,7 +35,7 @@ void MozillaUnRegisterDebugFILE(FILE* aFile); MOZ_END_EXTERN_C -#if defined(XP_WIN) || defined(XP_MACOSX) +#if defined(XP_WIN) #ifdef __cplusplus namespace mozilla { @@ -53,16 +53,6 @@ bool IsDebugFile(intptr_t aFileID); */ void InitPoisonIOInterposer(); -#ifdef XP_MACOSX -/** - * Check that writes are dirty before reporting I/O (Mac OS X only) - * This is necessary for late-write checks on Mac OS X, but reading the buffer - * from file to see if we're writing dirty bits is expensive, so we don't want - * to do this for everything else that uses - */ -void OnlyReportDirtyWrites(); -#endif /* XP_MACOSX */ - /** * Clear IO poisoning, this is only safe to do on the main-thread when no other * threads are running. @@ -72,19 +62,16 @@ void ClearPoisonIOInterposer(); } // namespace mozilla #endif /* __cplusplus */ -#else /* XP_WIN || XP_MACOSX */ +#else /* XP_WIN */ #ifdef __cplusplus namespace mozilla { inline bool IsDebugFile(intptr_t aFileID) { return true; } inline void InitPoisonIOInterposer() {} inline void ClearPoisonIOInterposer() {} -#ifdef XP_MACOSX -inline void OnlyReportDirtyWrites() {} -#endif /* XP_MACOSX */ } // namespace mozilla #endif /* __cplusplus */ -#endif /* XP_WIN || XP_MACOSX */ +#endif /* XP_WIN */ #endif // mozilla_PoisonIOInterposer_h diff --git a/xpcom/build/PoisonIOInterposerMac.cpp b/xpcom/build/PoisonIOInterposerMac.cpp deleted file mode 100644 index dca9ba0297..0000000000 --- a/xpcom/build/PoisonIOInterposerMac.cpp +++ /dev/null @@ -1,385 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* 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/. */ - -#include "PoisonIOInterposer.h" -#include "mach_override.h" - -#include "mozilla/ArrayUtils.h" -#include "mozilla/Assertions.h" -#include "mozilla/DebugOnly.h" -#include "mozilla/IOInterposer.h" -#include "mozilla/Mutex.h" -#include "mozilla/ProcessedStack.h" -#include "mozilla/Telemetry.h" -#include "mozilla/UniquePtrExtensions.h" -#include "nsPrintfCString.h" -#include "mozilla/StackWalk.h" -#include "nsTraceRefcnt.h" -#include "plstr.h" -#include "prio.h" - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef MOZ_REPLACE_MALLOC -#include "replace_malloc_bridge.h" -#endif - -namespace { - -using namespace mozilla; - -// Bit tracking if poisoned writes are enabled -static bool sIsEnabled = false; - -// Check if writes are dirty before reporting IO -static bool sOnlyReportDirtyWrites = false; - -// Routines for write validation -bool IsValidWrite(int aFd, const void* aWbuf, size_t aCount); -bool IsIPCWrite(int aFd, const struct stat& aBuf); - -/******************************** IO AutoTimer ********************************/ - -/** - * RAII class for timing the duration of an I/O call and reporting the result - * to the IOInterposeObserver API. - */ -class MacIOAutoObservation : public IOInterposeObserver::Observation -{ -public: - MacIOAutoObservation(IOInterposeObserver::Operation aOp, int aFd) - : IOInterposeObserver::Observation(aOp, sReference, sIsEnabled && - !IsDebugFile(aFd)) - , mFd(aFd) - , mHasQueriedFilename(false) - , mFilename(nullptr) - { - } - - MacIOAutoObservation(IOInterposeObserver::Operation aOp, int aFd, - const void* aBuf, size_t aCount) - : IOInterposeObserver::Observation(aOp, sReference, sIsEnabled && - !IsDebugFile(aFd) && - IsValidWrite(aFd, aBuf, aCount)) - , mFd(aFd) - , mHasQueriedFilename(false) - , mFilename(nullptr) - { - } - - // Custom implementation of IOInterposeObserver::Observation::Filename - const char16_t* Filename() override; - - ~MacIOAutoObservation() - { - Report(); - if (mFilename) { - free(mFilename); - mFilename = nullptr; - } - } - -private: - int mFd; - bool mHasQueriedFilename; - char16_t* mFilename; - static const char* sReference; -}; - -const char* MacIOAutoObservation::sReference = "PoisonIOInterposer"; - -// Get filename for this observation -const char16_t* -MacIOAutoObservation::Filename() -{ - // If mHasQueriedFilename is true, then we already have it - if (mHasQueriedFilename) { - return mFilename; - } - char filename[MAXPATHLEN]; - if (fcntl(mFd, F_GETPATH, filename) != -1) { - mFilename = UTF8ToNewUnicode(nsDependentCString(filename)); - } else { - mFilename = nullptr; - } - mHasQueriedFilename = true; - - // Return filename - return mFilename; -} - -/****************************** Write Validation ******************************/ - -// We want to detect "actual" writes, not IPC. Some IPC mechanisms are -// implemented with file descriptors, so filter them out. -bool -IsIPCWrite(int aFd, const struct stat& aBuf) -{ - if ((aBuf.st_mode & S_IFMT) == S_IFIFO) { - return true; - } - - if ((aBuf.st_mode & S_IFMT) != S_IFSOCK) { - return false; - } - - sockaddr_storage address; - socklen_t len = sizeof(address); - if (getsockname(aFd, (sockaddr*)&address, &len) != 0) { - return true; // Ignore the aFd if we can't find what it is. - } - - return address.ss_family == AF_UNIX; -} - -// We want to report actual disk IO not things that don't move bits on the disk -bool -IsValidWrite(int aFd, const void* aWbuf, size_t aCount) -{ - // Ignore writes of zero bytes, Firefox does some during shutdown. - if (aCount == 0) { - return false; - } - - { - struct stat buf; - int rv = fstat(aFd, &buf); - if (rv != 0) { - return true; - } - - if (IsIPCWrite(aFd, buf)) { - return false; - } - } - - // For writev we pass a nullptr aWbuf. We should only get here from - // dbm, and it uses write, so assert that we have aWbuf. - if (!aWbuf) { - return true; - } - - // Break, here if we're allowed to report non-dirty writes - if (!sOnlyReportDirtyWrites) { - return true; - } - - // As a really bad hack, accept writes that don't change the on disk - // content. This is needed because dbm doesn't keep track of dirty bits - // and can end up writing the same data to disk twice. Once when the - // user (nss) asks it to sync and once when closing the database. - auto wbuf2 = MakeUniqueFallible(aCount); - if (!wbuf2) { - return true; - } - off_t pos = lseek(aFd, 0, SEEK_CUR); - if (pos == -1) { - return true; - } - ssize_t r = read(aFd, wbuf2.get(), aCount); - if (r < 0 || (size_t)r != aCount) { - return true; - } - int cmp = memcmp(aWbuf, wbuf2.get(), aCount); - if (cmp != 0) { - return true; - } - off_t pos2 = lseek(aFd, pos, SEEK_SET); - if (pos2 != pos) { - return true; - } - - // Otherwise this is not a valid write - return false; -} - -/*************************** Function Interception ***************************/ - -/** Structure for declaration of function override */ -struct FuncData -{ - const char* Name; // Name of the function for the ones we use dlsym - const void* Wrapper; // The function that we will replace 'Function' with - void* Function; // The function that will be replaced with 'Wrapper' - void* Buffer; // Will point to the jump buffer that lets us call - // 'Function' after it has been replaced. -}; - -// Wrap aio_write. We have not seen it before, so just assert/report it. -typedef ssize_t (*aio_write_t)(struct aiocb* aAioCbp); -ssize_t wrap_aio_write(struct aiocb* aAioCbp); -FuncData aio_write_data = { 0, (void*)wrap_aio_write, (void*)aio_write }; -ssize_t -wrap_aio_write(struct aiocb* aAioCbp) -{ - MacIOAutoObservation timer(IOInterposeObserver::OpWrite, - aAioCbp->aio_fildes); - - aio_write_t old_write = (aio_write_t)aio_write_data.Buffer; - return old_write(aAioCbp); -} - -// Wrap pwrite-like functions. -// We have not seen them before, so just assert/report it. -typedef ssize_t (*pwrite_t)(int aFd, const void* buf, size_t aNumBytes, - off_t aOffset); -template -ssize_t -wrap_pwrite_temp(int aFd, const void* aBuf, size_t aNumBytes, off_t aOffset) -{ - MacIOAutoObservation timer(IOInterposeObserver::OpWrite, aFd); - pwrite_t old_write = (pwrite_t)foo.Buffer; - return old_write(aFd, aBuf, aNumBytes, aOffset); -} - -// Define a FuncData for a pwrite-like functions. -#define DEFINE_PWRITE_DATA(X, NAME) \ -FuncData X ## _data = { NAME, (void*) wrap_pwrite_temp }; \ - -// This exists everywhere. -DEFINE_PWRITE_DATA(pwrite, "pwrite") -// These exist on 32 bit OS X -DEFINE_PWRITE_DATA(pwrite_NOCANCEL_UNIX2003, "pwrite$NOCANCEL$UNIX2003"); -DEFINE_PWRITE_DATA(pwrite_UNIX2003, "pwrite$UNIX2003"); -// This exists on 64 bit OS X -DEFINE_PWRITE_DATA(pwrite_NOCANCEL, "pwrite$NOCANCEL"); - - -typedef ssize_t (*writev_t)(int aFd, const struct iovec* aIov, int aIovCount); -template -ssize_t -wrap_writev_temp(int aFd, const struct iovec* aIov, int aIovCount) -{ - MacIOAutoObservation timer(IOInterposeObserver::OpWrite, aFd, nullptr, - aIovCount); - writev_t old_write = (writev_t)foo.Buffer; - return old_write(aFd, aIov, aIovCount); -} - -// Define a FuncData for a writev-like functions. -#define DEFINE_WRITEV_DATA(X, NAME) \ -FuncData X ## _data = { NAME, (void*) wrap_writev_temp }; \ - -// This exists everywhere. -DEFINE_WRITEV_DATA(writev, "writev"); -// These exist on 32 bit OS X -DEFINE_WRITEV_DATA(writev_NOCANCEL_UNIX2003, "writev$NOCANCEL$UNIX2003"); -DEFINE_WRITEV_DATA(writev_UNIX2003, "writev$UNIX2003"); -// This exists on 64 bit OS X -DEFINE_WRITEV_DATA(writev_NOCANCEL, "writev$NOCANCEL"); - -typedef ssize_t (*write_t)(int aFd, const void* aBuf, size_t aCount); -template -ssize_t -wrap_write_temp(int aFd, const void* aBuf, size_t aCount) -{ - MacIOAutoObservation timer(IOInterposeObserver::OpWrite, aFd, aBuf, aCount); - write_t old_write = (write_t)foo.Buffer; - return old_write(aFd, aBuf, aCount); -} - -// Define a FuncData for a write-like functions. -#define DEFINE_WRITE_DATA(X, NAME) \ -FuncData X ## _data = { NAME, (void*) wrap_write_temp }; \ - -// This exists everywhere. -DEFINE_WRITE_DATA(write, "write"); -// These exist on 32 bit OS X -DEFINE_WRITE_DATA(write_NOCANCEL_UNIX2003, "write$NOCANCEL$UNIX2003"); -DEFINE_WRITE_DATA(write_UNIX2003, "write$UNIX2003"); -// This exists on 64 bit OS X -DEFINE_WRITE_DATA(write_NOCANCEL, "write$NOCANCEL"); - -FuncData* Functions[] = { - &aio_write_data, - - &pwrite_data, - &pwrite_NOCANCEL_UNIX2003_data, - &pwrite_UNIX2003_data, - &pwrite_NOCANCEL_data, - - &write_data, - &write_NOCANCEL_UNIX2003_data, - &write_UNIX2003_data, - &write_NOCANCEL_data, - - &writev_data, - &writev_NOCANCEL_UNIX2003_data, - &writev_UNIX2003_data, - &writev_NOCANCEL_data -}; - -const int NumFunctions = ArrayLength(Functions); - -} // namespace - -/******************************** IO Poisoning ********************************/ - -namespace mozilla { - -void -InitPoisonIOInterposer() -{ - // Enable reporting from poisoned write methods - sIsEnabled = true; - - // Make sure we only poison writes once! - static bool WritesArePoisoned = false; - if (WritesArePoisoned) { - return; - } - WritesArePoisoned = true; - - // stdout and stderr are OK. - MozillaRegisterDebugFD(1); - MozillaRegisterDebugFD(2); - -#ifdef MOZ_REPLACE_MALLOC - // The contract with InitDebugFd is that the given registry can be used - // at any moment, so the instance needs to persist longer than the scope - // of this functions. - static DebugFdRegistry registry; - ReplaceMalloc::InitDebugFd(registry); -#endif - - for (int i = 0; i < NumFunctions; ++i) { - FuncData* d = Functions[i]; - if (!d->Function) { - d->Function = dlsym(RTLD_DEFAULT, d->Name); - } - if (!d->Function) { - continue; - } - DebugOnly t = mach_override_ptr(d->Function, d->Wrapper, - &d->Buffer); - MOZ_ASSERT(t == err_none); - } -} - -void -OnlyReportDirtyWrites() -{ - sOnlyReportDirtyWrites = true; -} - -void -ClearPoisonIOInterposer() -{ - // Not sure how or if we can unpoison the functions. Would be nice, but no - // worries we won't need to do this anyway. - sIsEnabled = false; -} - -} // namespace mozilla diff --git a/xpcom/build/XPCOMInit.cpp b/xpcom/build/XPCOMInit.cpp index dbea590d7b..3e2007c1f7 100644 --- a/xpcom/build/XPCOMInit.cpp +++ b/xpcom/build/XPCOMInit.cpp @@ -1018,9 +1018,6 @@ ShutdownXPCOM(nsIServiceManager* aServMgr) PROFILER_MARKER("Shutdown xpcom"); // If we are doing any shutdown checks, poison writes. if (gShutdownChecks != SCM_NOTHING) { -#ifdef XP_MACOSX - mozilla::OnlyReportDirtyWrites(); -#endif /* XP_MACOSX */ mozilla::BeginLateWriteChecks(); } diff --git a/xpcom/build/mach_override.c b/xpcom/build/mach_override.c deleted file mode 100644 index 9e4940d298..0000000000 --- a/xpcom/build/mach_override.c +++ /dev/null @@ -1,789 +0,0 @@ -// Copied from upstream at revision 195c13743fe0ebc658714e2a9567d86529f20443. -// mach_override.c semver:1.2.0 -// Copyright (c) 2003-2012 Jonathan 'Wolf' Rentzsch: http://rentzsch.com -// Some rights reserved: http://opensource.org/licenses/mit -// https://github.com/rentzsch/mach_override - -#include "mach_override.h" - -#include -#include -#include -#include -#include - -#include - -/************************** -* -* Constants -* -**************************/ -#pragma mark - -#pragma mark (Constants) - -#define kPageSize 4096 -#if defined(__ppc__) || defined(__POWERPC__) - -long kIslandTemplate[] = { - 0x9001FFFC, // stw r0,-4(SP) - 0x3C00DEAD, // lis r0,0xDEAD - 0x6000BEEF, // ori r0,r0,0xBEEF - 0x7C0903A6, // mtctr r0 - 0x8001FFFC, // lwz r0,-4(SP) - 0x60000000, // nop ; optionally replaced - 0x4E800420 // bctr -}; - -#define kAddressHi 3 -#define kAddressLo 5 -#define kInstructionHi 10 -#define kInstructionLo 11 - -#elif defined(__i386__) - -#define kOriginalInstructionsSize 16 -// On X86 we migh need to instert an add with a 32 bit immediate after the -// original instructions. -#define kMaxFixupSizeIncrease 5 - -unsigned char kIslandTemplate[] = { - // kOriginalInstructionsSize nop instructions so that we - // should have enough space to host original instructions - 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, - 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, - // Now the real jump instruction - 0xE9, 0xEF, 0xBE, 0xAD, 0xDE -}; - -#define kInstructions 0 -#define kJumpAddress kInstructions + kOriginalInstructionsSize + 1 -#elif defined(__x86_64__) - -#define kOriginalInstructionsSize 32 -// On X86-64 we never need to instert a new instruction. -#define kMaxFixupSizeIncrease 0 - -#define kJumpAddress kOriginalInstructionsSize + 6 - -unsigned char kIslandTemplate[] = { - // kOriginalInstructionsSize nop instructions so that we - // should have enough space to host original instructions - 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, - 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, - 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, - 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, - // Now the real jump instruction - 0xFF, 0x25, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00 -}; - -#endif - -/************************** -* -* Data Types -* -**************************/ -#pragma mark - -#pragma mark (Data Types) - -typedef struct { - char instructions[sizeof(kIslandTemplate)]; -} BranchIsland; - -/************************** -* -* Funky Protos -* -**************************/ -#pragma mark - -#pragma mark (Funky Protos) - -static mach_error_t -allocateBranchIsland( - BranchIsland **island, - void *originalFunctionAddress); - - mach_error_t -freeBranchIsland( - BranchIsland *island ); - -#if defined(__ppc__) || defined(__POWERPC__) - mach_error_t -setBranchIslandTarget( - BranchIsland *island, - const void *branchTo, - long instruction ); -#endif - -#if defined(__i386__) || defined(__x86_64__) -mach_error_t -setBranchIslandTarget_i386( - BranchIsland *island, - const void *branchTo, - char* instructions ); -void -atomic_mov64( - uint64_t *targetAddress, - uint64_t value ); - - static Boolean -eatKnownInstructions( - unsigned char *code, - uint64_t *newInstruction, - int *howManyEaten, - char *originalInstructions, - int *originalInstructionCount, - uint8_t *originalInstructionSizes ); - - static void -fixupInstructions( - uint32_t offset, - void *instructionsToFix, - int instructionCount, - uint8_t *instructionSizes ); -#endif - -/******************************************************************************* -* -* Interface -* -*******************************************************************************/ -#pragma mark - -#pragma mark (Interface) - -#if defined(__i386__) || defined(__x86_64__) -mach_error_t makeIslandExecutable(void *address) { - mach_error_t err = err_none; - uintptr_t page = (uintptr_t)address & ~(uintptr_t)(kPageSize-1); - int e = err_none; - e |= mprotect((void *)page, kPageSize, PROT_EXEC | PROT_READ | PROT_WRITE); - e |= msync((void *)page, kPageSize, MS_INVALIDATE ); - if (e) { - err = err_cannot_override; - } - return err; -} -#endif - - mach_error_t -mach_override_ptr( - void *originalFunctionAddress, - const void *overrideFunctionAddress, - void **originalFunctionReentryIsland ) -{ - assert( originalFunctionAddress ); - assert( overrideFunctionAddress ); - - // this addresses overriding such functions as AudioOutputUnitStart() - // test with modified DefaultOutputUnit project -#if defined(__x86_64__) - for(;;){ - if(*(uint16_t*)originalFunctionAddress==0x25FF) // jmp qword near [rip+0x????????] - originalFunctionAddress=*(void**)((char*)originalFunctionAddress+6+*(int32_t *)((uint16_t*)originalFunctionAddress+1)); - else break; - } -#elif defined(__i386__) - for(;;){ - if(*(uint16_t*)originalFunctionAddress==0x25FF) // jmp *0x???????? - originalFunctionAddress=**(void***)((uint16_t*)originalFunctionAddress+1); - else break; - } -#endif - - long *originalFunctionPtr = (long*) originalFunctionAddress; - mach_error_t err = err_none; - -#if defined(__ppc__) || defined(__POWERPC__) - // Ensure first instruction isn't 'mfctr'. - #define kMFCTRMask 0xfc1fffff - #define kMFCTRInstruction 0x7c0903a6 - - long originalInstruction = *originalFunctionPtr; - if( !err && ((originalInstruction & kMFCTRMask) == kMFCTRInstruction) ) - err = err_cannot_override; -#elif defined(__i386__) || defined(__x86_64__) - int eatenCount = 0; - int originalInstructionCount = 0; - char originalInstructions[kOriginalInstructionsSize]; - uint8_t originalInstructionSizes[kOriginalInstructionsSize]; - uint64_t jumpRelativeInstruction = 0; // JMP - - Boolean overridePossible = eatKnownInstructions ((unsigned char *)originalFunctionPtr, - &jumpRelativeInstruction, &eatenCount, - originalInstructions, &originalInstructionCount, - originalInstructionSizes ); - if (eatenCount + kMaxFixupSizeIncrease > kOriginalInstructionsSize) { - //printf ("Too many instructions eaten\n"); - overridePossible = false; - } - if (!overridePossible) err = err_cannot_override; - if (err) fprintf(stderr, "err = %x %s:%d\n", err, __FILE__, __LINE__); -#endif - - // Make the original function implementation writable. - if( !err ) { - err = vm_protect( mach_task_self(), - (vm_address_t) originalFunctionPtr, 8, false, - (VM_PROT_ALL | VM_PROT_COPY) ); - if( err ) - err = vm_protect( mach_task_self(), - (vm_address_t) originalFunctionPtr, 8, false, - (VM_PROT_DEFAULT | VM_PROT_COPY) ); - } - if (err) fprintf(stderr, "err = %x %s:%d\n", err, __FILE__, __LINE__); - - // Allocate and target the escape island to the overriding function. - BranchIsland *escapeIsland = NULL; - if( !err ) - err = allocateBranchIsland( &escapeIsland, originalFunctionAddress ); - if (err) fprintf(stderr, "err = %x %s:%d\n", err, __FILE__, __LINE__); - - -#if defined(__ppc__) || defined(__POWERPC__) - if( !err ) - err = setBranchIslandTarget( escapeIsland, overrideFunctionAddress, 0 ); - - // Build the branch absolute instruction to the escape island. - long branchAbsoluteInstruction = 0; // Set to 0 just to silence warning. - if( !err ) { - long escapeIslandAddress = ((long) escapeIsland) & 0x3FFFFFF; - branchAbsoluteInstruction = 0x48000002 | escapeIslandAddress; - } -#elif defined(__i386__) || defined(__x86_64__) - if (err) fprintf(stderr, "err = %x %s:%d\n", err, __FILE__, __LINE__); - - if( !err ) - err = setBranchIslandTarget_i386( escapeIsland, overrideFunctionAddress, 0 ); - - if (err) fprintf(stderr, "err = %x %s:%d\n", err, __FILE__, __LINE__); - // Build the jump relative instruction to the escape island -#endif - - -#if defined(__i386__) || defined(__x86_64__) - if (!err) { - uint32_t addressOffset = ((char*)escapeIsland - (char*)originalFunctionPtr - 5); - addressOffset = OSSwapInt32(addressOffset); - - jumpRelativeInstruction |= 0xE900000000000000LL; - jumpRelativeInstruction |= ((uint64_t)addressOffset & 0xffffffff) << 24; - jumpRelativeInstruction = OSSwapInt64(jumpRelativeInstruction); - } -#endif - - // Optionally allocate & return the reentry island. This may contain relocated - // jmp instructions and so has all the same addressing reachability requirements - // the escape island has to the original function, except the escape island is - // technically our original function. - BranchIsland *reentryIsland = NULL; - if( !err && originalFunctionReentryIsland ) { - err = allocateBranchIsland( &reentryIsland, escapeIsland); - if( !err ) - *originalFunctionReentryIsland = reentryIsland; - } - -#if defined(__ppc__) || defined(__POWERPC__) - // Atomically: - // o If the reentry island was allocated: - // o Insert the original instruction into the reentry island. - // o Target the reentry island at the 2nd instruction of the - // original function. - // o Replace the original instruction with the branch absolute. - if( !err ) { - int escapeIslandEngaged = false; - do { - if( reentryIsland ) - err = setBranchIslandTarget( reentryIsland, - (void*) (originalFunctionPtr+1), originalInstruction ); - if( !err ) { - escapeIslandEngaged = CompareAndSwap( originalInstruction, - branchAbsoluteInstruction, - (UInt32*)originalFunctionPtr ); - if( !escapeIslandEngaged ) { - // Someone replaced the instruction out from under us, - // re-read the instruction, make sure it's still not - // 'mfctr' and try again. - originalInstruction = *originalFunctionPtr; - if( (originalInstruction & kMFCTRMask) == kMFCTRInstruction) - err = err_cannot_override; - } - } - } while( !err && !escapeIslandEngaged ); - } -#elif defined(__i386__) || defined(__x86_64__) - // Atomically: - // o If the reentry island was allocated: - // o Insert the original instructions into the reentry island. - // o Target the reentry island at the first non-replaced - // instruction of the original function. - // o Replace the original first instructions with the jump relative. - // - // Note that on i386, we do not support someone else changing the code under our feet - if ( !err ) { - uint32_t offset = (uintptr_t)originalFunctionPtr - (uintptr_t)reentryIsland; - fixupInstructions(offset, originalInstructions, - originalInstructionCount, originalInstructionSizes ); - - if( reentryIsland ) - err = setBranchIslandTarget_i386( reentryIsland, - (void*) ((char *)originalFunctionPtr+eatenCount), originalInstructions ); - // try making islands executable before planting the jmp -#if defined(__x86_64__) || defined(__i386__) - if( !err ) - err = makeIslandExecutable(escapeIsland); - if( !err && reentryIsland ) - err = makeIslandExecutable(reentryIsland); -#endif - if ( !err ) - atomic_mov64((uint64_t *)originalFunctionPtr, jumpRelativeInstruction); - } -#endif - - // Clean up on error. - if( err ) { - if( reentryIsland ) - freeBranchIsland( reentryIsland ); - if( escapeIsland ) - freeBranchIsland( escapeIsland ); - } - - return err; -} - -/******************************************************************************* -* -* Implementation -* -*******************************************************************************/ -#pragma mark - -#pragma mark (Implementation) - -static bool jump_in_range(intptr_t from, intptr_t to) { - intptr_t field_value = to - from - 5; - int32_t field_value_32 = field_value; - return field_value == field_value_32; -} - -/******************************************************************************* - Implementation: Allocates memory for a branch island. - - @param island <- The allocated island. - @result <- mach_error_t - - ***************************************************************************/ - -static mach_error_t -allocateBranchIslandAux( - BranchIsland **island, - void *originalFunctionAddress, - bool forward) -{ - assert( island ); - assert( sizeof( BranchIsland ) <= kPageSize ); - - vm_map_t task_self = mach_task_self(); - vm_address_t original_address = (vm_address_t) originalFunctionAddress; - vm_address_t address = original_address; - - for (;;) { - vm_size_t vmsize = 0; - memory_object_name_t object = 0; - kern_return_t kr = 0; - vm_region_flavor_t flavor = VM_REGION_BASIC_INFO; - // Find the region the address is in. -#if __WORDSIZE == 32 - vm_region_basic_info_data_t info; - mach_msg_type_number_t info_count = VM_REGION_BASIC_INFO_COUNT; - kr = vm_region(task_self, &address, &vmsize, flavor, - (vm_region_info_t)&info, &info_count, &object); -#else - vm_region_basic_info_data_64_t info; - mach_msg_type_number_t info_count = VM_REGION_BASIC_INFO_COUNT_64; - kr = vm_region_64(task_self, &address, &vmsize, flavor, - (vm_region_info_t)&info, &info_count, &object); -#endif - if (kr != KERN_SUCCESS) - return kr; - assert((address & (kPageSize - 1)) == 0); - - // Go to the first page before or after this region - vm_address_t new_address = forward ? address + vmsize : address - kPageSize; -#if __WORDSIZE == 64 - if(!jump_in_range(original_address, new_address)) - break; -#endif - address = new_address; - - // Try to allocate this page. - kr = vm_allocate(task_self, &address, kPageSize, 0); - if (kr == KERN_SUCCESS) { - *island = (BranchIsland*) address; - return err_none; - } - if (kr != KERN_NO_SPACE) - return kr; - } - - return KERN_NO_SPACE; -} - -static mach_error_t -allocateBranchIsland( - BranchIsland **island, - void *originalFunctionAddress) -{ - mach_error_t err = - allocateBranchIslandAux(island, originalFunctionAddress, true); - if (!err) - return err; - return allocateBranchIslandAux(island, originalFunctionAddress, false); -} - - -/******************************************************************************* - Implementation: Deallocates memory for a branch island. - - @param island -> The island to deallocate. - @result <- mach_error_t - - ***************************************************************************/ - - mach_error_t -freeBranchIsland( - BranchIsland *island ) -{ - assert( island ); - assert( (*(long*)&island->instructions[0]) == kIslandTemplate[0] ); - assert( sizeof( BranchIsland ) <= kPageSize ); - return vm_deallocate( mach_task_self(), (vm_address_t) island, - kPageSize ); -} - -/******************************************************************************* - Implementation: Sets the branch island's target, with an optional - instruction. - - @param island -> The branch island to insert target into. - @param branchTo -> The address of the target. - @param instruction -> Optional instruction to execute prior to branch. Set - to zero for nop. - @result <- mach_error_t - - ***************************************************************************/ -#if defined(__ppc__) || defined(__POWERPC__) - mach_error_t -setBranchIslandTarget( - BranchIsland *island, - const void *branchTo, - long instruction ) -{ - // Copy over the template code. - bcopy( kIslandTemplate, island->instructions, sizeof( kIslandTemplate ) ); - - // Fill in the address. - ((short*)island->instructions)[kAddressLo] = ((long) branchTo) & 0x0000FFFF; - ((short*)island->instructions)[kAddressHi] - = (((long) branchTo) >> 16) & 0x0000FFFF; - - // Fill in the (optional) instuction. - if( instruction != 0 ) { - ((short*)island->instructions)[kInstructionLo] - = instruction & 0x0000FFFF; - ((short*)island->instructions)[kInstructionHi] - = (instruction >> 16) & 0x0000FFFF; - } - - //MakeDataExecutable( island->instructions, sizeof( kIslandTemplate ) ); - msync( island->instructions, sizeof( kIslandTemplate ), MS_INVALIDATE ); - - return err_none; -} -#endif - -#if defined(__i386__) - mach_error_t -setBranchIslandTarget_i386( - BranchIsland *island, - const void *branchTo, - char* instructions ) -{ - - // Copy over the template code. - bcopy( kIslandTemplate, island->instructions, sizeof( kIslandTemplate ) ); - - // copy original instructions - if (instructions) { - bcopy (instructions, island->instructions + kInstructions, kOriginalInstructionsSize); - } - - // Fill in the address. - int32_t addressOffset = (char *)branchTo - (island->instructions + kJumpAddress + 4); - *((int32_t *)(island->instructions + kJumpAddress)) = addressOffset; - - msync( island->instructions, sizeof( kIslandTemplate ), MS_INVALIDATE ); - return err_none; -} - -#elif defined(__x86_64__) -mach_error_t -setBranchIslandTarget_i386( - BranchIsland *island, - const void *branchTo, - char* instructions ) -{ - // Copy over the template code. - bcopy( kIslandTemplate, island->instructions, sizeof( kIslandTemplate ) ); - - // Copy original instructions. - if (instructions) { - bcopy (instructions, island->instructions, kOriginalInstructionsSize); - } - - // Fill in the address. - *((uint64_t *)(island->instructions + kJumpAddress)) = (uint64_t)branchTo; - msync( island->instructions, sizeof( kIslandTemplate ), MS_INVALIDATE ); - - return err_none; -} -#endif - - -#if defined(__i386__) || defined(__x86_64__) -// simplistic instruction matching -typedef struct { - unsigned int length; // max 15 - unsigned char mask[15]; // sequence of bytes in memory order - unsigned char constraint[15]; // sequence of bytes in memory order -} AsmInstructionMatch; - -#if defined(__i386__) -static AsmInstructionMatch possibleInstructions[] = { - { 0x5, {0xFF, 0x00, 0x00, 0x00, 0x00}, {0xE9, 0x00, 0x00, 0x00, 0x00} }, // jmp 0x???????? - { 0x5, {0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, {0x55, 0x89, 0xe5, 0xc9, 0xc3} }, // push %ebp; mov %esp,%ebp; leave; ret - { 0x1, {0xFF}, {0x90} }, // nop - { 0x1, {0xFF}, {0x55} }, // push %esp - { 0x2, {0xFF, 0xFF}, {0x89, 0xE5} }, // mov %esp,%ebp - { 0x1, {0xFF}, {0x53} }, // push %ebx - { 0x3, {0xFF, 0xFF, 0x00}, {0x83, 0xEC, 0x00} }, // sub 0x??, %esp - { 0x6, {0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00}, {0x81, 0xEC, 0x00, 0x00, 0x00, 0x00} }, // sub 0x??, %esp with 32bit immediate - { 0x1, {0xFF}, {0x57} }, // push %edi - { 0x1, {0xFF}, {0x56} }, // push %esi - { 0x2, {0xFF, 0xFF}, {0x31, 0xC0} }, // xor %eax, %eax - { 0x3, {0xFF, 0x4F, 0x00}, {0x8B, 0x45, 0x00} }, // mov $imm(%ebp), %reg - { 0x3, {0xFF, 0x4C, 0x00}, {0x8B, 0x40, 0x00} }, // mov $imm(%eax-%edx), %reg - { 0x4, {0xFF, 0xFF, 0xFF, 0x00}, {0x8B, 0x4C, 0x24, 0x00} }, // mov $imm(%esp), %ecx - { 0x5, {0xFF, 0x00, 0x00, 0x00, 0x00}, {0xB8, 0x00, 0x00, 0x00, 0x00} }, // mov $imm, %eax - { 0x6, {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, {0xE8, 0x00, 0x00, 0x00, 0x00, 0x58} }, // call $imm; pop %eax - { 0x0 } -}; -#elif defined(__x86_64__) -static AsmInstructionMatch possibleInstructions[] = { - { 0x5, {0xFF, 0x00, 0x00, 0x00, 0x00}, {0xE9, 0x00, 0x00, 0x00, 0x00} }, // jmp 0x???????? - { 0x1, {0xFF}, {0x90} }, // nop - { 0x1, {0xF8}, {0x50} }, // push %rX - { 0x3, {0xFF, 0xFF, 0xFF}, {0x48, 0x89, 0xE5} }, // mov %rsp,%rbp - { 0x4, {0xFF, 0xFF, 0xFF, 0x00}, {0x48, 0x83, 0xEC, 0x00} }, // sub 0x??, %rsp - { 0x4, {0xFB, 0xFF, 0x00, 0x00}, {0x48, 0x89, 0x00, 0x00} }, // move onto rbp - { 0x4, {0xFF, 0xFF, 0xFF, 0xFF}, {0x40, 0x0f, 0xbe, 0xce} }, // movsbl %sil, %ecx - { 0x2, {0xFF, 0x00}, {0x41, 0x00} }, // push %rXX - { 0x2, {0xFF, 0x00}, {0x85, 0x00} }, // test %rX,%rX - { 0x5, {0xF8, 0x00, 0x00, 0x00, 0x00}, {0xB8, 0x00, 0x00, 0x00, 0x00} }, // mov $imm, %reg - { 0x3, {0xFF, 0xFF, 0x00}, {0xFF, 0x77, 0x00} }, // pushq $imm(%rdi) - { 0x2, {0xFF, 0xFF}, {0x31, 0xC0} }, // xor %eax, %eax - { 0x2, {0xFF, 0xFF}, {0x89, 0xF8} }, // mov %edi, %eax - - //leaq offset(%rip),%rax - { 0x7, {0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00}, {0x48, 0x8d, 0x05, 0x00, 0x00, 0x00, 0x00} }, - - { 0x0 } -}; -#endif - -static Boolean codeMatchesInstruction(unsigned char *code, AsmInstructionMatch* instruction) -{ - Boolean match = true; - - size_t i; - for (i=0; ilength; i++) { - unsigned char mask = instruction->mask[i]; - unsigned char constraint = instruction->constraint[i]; - unsigned char codeValue = code[i]; - - match = ((codeValue & mask) == constraint); - if (!match) break; - } - - return match; -} - -#if defined(__i386__) || defined(__x86_64__) - static Boolean -eatKnownInstructions( - unsigned char *code, - uint64_t *newInstruction, - int *howManyEaten, - char *originalInstructions, - int *originalInstructionCount, - uint8_t *originalInstructionSizes ) -{ - Boolean allInstructionsKnown = true; - int totalEaten = 0; - unsigned char* ptr = code; - int remainsToEat = 5; // a JMP instruction takes 5 bytes - int instructionIndex = 0; - - if (howManyEaten) *howManyEaten = 0; - if (originalInstructionCount) *originalInstructionCount = 0; - while (remainsToEat > 0) { - Boolean curInstructionKnown = false; - - // See if instruction matches one we know - AsmInstructionMatch* curInstr = possibleInstructions; - do { - if ((curInstructionKnown = codeMatchesInstruction(ptr, curInstr))) break; - curInstr++; - } while (curInstr->length > 0); - - // if all instruction matches failed, we don't know current instruction then, stop here - if (!curInstructionKnown) { - allInstructionsKnown = false; - fprintf(stderr, "mach_override: some instructions unknown! Need to update mach_override.c\n"); - break; - } - - // At this point, we've matched curInstr - int eaten = curInstr->length; - ptr += eaten; - remainsToEat -= eaten; - totalEaten += eaten; - - if (originalInstructionSizes) originalInstructionSizes[instructionIndex] = eaten; - instructionIndex += 1; - if (originalInstructionCount) *originalInstructionCount = instructionIndex; - } - - - if (howManyEaten) *howManyEaten = totalEaten; - - if (originalInstructions) { - Boolean enoughSpaceForOriginalInstructions = (totalEaten < kOriginalInstructionsSize); - - if (enoughSpaceForOriginalInstructions) { - memset(originalInstructions, 0x90 /* NOP */, kOriginalInstructionsSize); // fill instructions with NOP - bcopy(code, originalInstructions, totalEaten); - } else { - // printf ("Not enough space in island to store original instructions. Adapt the island definition and kOriginalInstructionsSize\n"); - return false; - } - } - - if (allInstructionsKnown) { - // save last 3 bytes of first 64bits of codre we'll replace - uint64_t currentFirst64BitsOfCode = *((uint64_t *)code); - currentFirst64BitsOfCode = OSSwapInt64(currentFirst64BitsOfCode); // back to memory representation - currentFirst64BitsOfCode &= 0x0000000000FFFFFFLL; - - // keep only last 3 instructions bytes, first 5 will be replaced by JMP instr - *newInstruction &= 0xFFFFFFFFFF000000LL; // clear last 3 bytes - *newInstruction |= (currentFirst64BitsOfCode & 0x0000000000FFFFFFLL); // set last 3 bytes - } - - return allInstructionsKnown; -} - - static void -fixupInstructions( - uint32_t offset, - void *instructionsToFix, - int instructionCount, - uint8_t *instructionSizes ) -{ - // The start of "leaq offset(%rip),%rax" - static const uint8_t LeaqHeader[] = {0x48, 0x8d, 0x05}; - - int index; - for (index = 0;index < instructionCount;index += 1) - { - if (*(uint8_t*)instructionsToFix == 0xE9) // 32-bit jump relative - { - uint32_t *jumpOffsetPtr = (uint32_t*)((uintptr_t)instructionsToFix + 1); - *jumpOffsetPtr += offset; - } - - // leaq offset(%rip),%rax - if (memcmp(instructionsToFix, LeaqHeader, 3) == 0) { - uint32_t *LeaqOffsetPtr = (uint32_t*)((uintptr_t)instructionsToFix + 3); - *LeaqOffsetPtr += offset; - } - - // 32-bit call relative to the next addr; pop %eax - if (*(uint8_t*)instructionsToFix == 0xE8) - { - // Just this call is larger than the jump we use, so we - // know this is the last instruction. - assert(index == (instructionCount - 1)); - assert(instructionSizes[index] == 6); - - // Insert "addl $offset, %eax" in the end so that when - // we jump to the rest of the function %eax has the - // value it would have if eip had been pushed by the - // call in its original position. - uint8_t *op = instructionsToFix; - op += 6; - *op = 0x05; // addl - uint32_t *addImmPtr = (uint32_t*)(op + 1); - *addImmPtr = offset; - } - - instructionsToFix = (void*)((uintptr_t)instructionsToFix + instructionSizes[index]); - } -} -#endif - -#if defined(__i386__) -__asm( - ".text;" - ".align 2, 0x90;" - "_atomic_mov64:;" - " pushl %ebp;" - " movl %esp, %ebp;" - " pushl %esi;" - " pushl %ebx;" - " pushl %ecx;" - " pushl %eax;" - " pushl %edx;" - - // atomic push of value to an address - // we use cmpxchg8b, which compares content of an address with - // edx:eax. If they are equal, it atomically puts 64bit value - // ecx:ebx in address. - // We thus put contents of address in edx:eax to force ecx:ebx - // in address - " mov 8(%ebp), %esi;" // esi contains target address - " mov 12(%ebp), %ebx;" - " mov 16(%ebp), %ecx;" // ecx:ebx now contains value to put in target address - " mov (%esi), %eax;" - " mov 4(%esi), %edx;" // edx:eax now contains value currently contained in target address - " lock; cmpxchg8b (%esi);" // atomic move. - - // restore registers - " popl %edx;" - " popl %eax;" - " popl %ecx;" - " popl %ebx;" - " popl %esi;" - " popl %ebp;" - " ret" -); -#elif defined(__x86_64__) -void atomic_mov64( - uint64_t *targetAddress, - uint64_t value ) -{ - *targetAddress = value; -} -#endif -#endif diff --git a/xpcom/build/mach_override.h b/xpcom/build/mach_override.h deleted file mode 100644 index d9be988a34..0000000000 --- a/xpcom/build/mach_override.h +++ /dev/null @@ -1,121 +0,0 @@ -/******************************************************************************* - mach_override.h - Copyright (c) 2003-2009 Jonathan 'Wolf' Rentzsch: - Some rights reserved: - - ***************************************************************************/ - -/***************************************************************************//** - @mainpage mach_override - @author Jonathan 'Wolf' Rentzsch: - - This package, coded in C to the Mach API, allows you to override ("patch") - program- and system-supplied functions at runtime. You can fully replace - functions with your implementations, or merely head- or tail-patch the - original implementations. - - Use it by #include'ing mach_override.h from your .c, .m or .mm file(s). - - @todo Discontinue use of Carbon's MakeDataExecutable() and - CompareAndSwap() calls and start using the Mach equivalents, if they - exist. If they don't, write them and roll them in. That way, this - code will be pure Mach, which will make it easier to use everywhere. - Update: MakeDataExecutable() has been replaced by - msync(MS_INVALIDATE). There is an OSCompareAndSwap in libkern, but - I'm currently unsure if I can link against it. May have to roll in - my own version... - @todo Stop using an entire 4K high-allocated VM page per 28-byte escape - branch island. Done right, this will dramatically speed up escape - island allocations when they number over 250. Then again, if you're - overriding more than 250 functions, maybe speed isn't your main - concern... - @todo Add detection of: b, bl, bla, bc, bcl, bcla, bcctrl, bclrl - first-instructions. Initially, we should refuse to override - functions beginning with these instructions. Eventually, we should - dynamically rewrite them to make them position-independent. - @todo Write mach_unoverride(), which would remove an override placed on a - function. Must be multiple-override aware, which means an almost - complete rewrite under the covers, because the target address can't - be spread across two load instructions like it is now since it will - need to be atomically updatable. - @todo Add non-rentry variants of overrides to test_mach_override. - - ***************************************************************************/ - -#ifndef _mach_override_ -#define _mach_override_ - -#include -#include - -#ifdef __cplusplus - extern "C" { -#endif - -/** - Returned if the function to be overrided begins with a 'mfctr' instruction. -*/ -#define err_cannot_override (err_local|1) - -/************************************************************************************//** - Dynamically overrides the function implementation referenced by - originalFunctionAddress with the implentation pointed to by overrideFunctionAddress. - Optionally returns a pointer to a "reentry island" which, if jumped to, will resume - the original implementation. - - @param originalFunctionAddress -> Required address of the function to - override (with overrideFunctionAddress). - @param overrideFunctionAddress -> Required address to the overriding - function. - @param originalFunctionReentryIsland <- Optional pointer to pointer to the - reentry island. Can be nullptr. - @result <- err_cannot_override if the original - function's implementation begins with - the 'mfctr' instruction. - - ************************************************************************************/ - - mach_error_t -mach_override_ptr( - void *originalFunctionAddress, - const void *overrideFunctionAddress, - void **originalFunctionReentryIsland ); - -/************************************************************************************//** - - - ************************************************************************************/ - -#ifdef __cplusplus - -#define MACH_OVERRIDE( ORIGINAL_FUNCTION_RETURN_TYPE, ORIGINAL_FUNCTION_NAME, ORIGINAL_FUNCTION_ARGS, ERR ) \ - { \ - static ORIGINAL_FUNCTION_RETURN_TYPE (*ORIGINAL_FUNCTION_NAME##_reenter)ORIGINAL_FUNCTION_ARGS; \ - static bool ORIGINAL_FUNCTION_NAME##_overriden = false; \ - class mach_override_class__##ORIGINAL_FUNCTION_NAME { \ - public: \ - static kern_return_t override(void *originalFunctionPtr) { \ - kern_return_t result = err_none; \ - if (!ORIGINAL_FUNCTION_NAME##_overriden) { \ - ORIGINAL_FUNCTION_NAME##_overriden = true; \ - result = mach_override_ptr( (void*)originalFunctionPtr, \ - (void*)mach_override_class__##ORIGINAL_FUNCTION_NAME::replacement, \ - (void**)&ORIGINAL_FUNCTION_NAME##_reenter ); \ - } \ - return result; \ - } \ - static ORIGINAL_FUNCTION_RETURN_TYPE replacement ORIGINAL_FUNCTION_ARGS { - -#define END_MACH_OVERRIDE( ORIGINAL_FUNCTION_NAME ) \ - } \ - }; \ - \ - err = mach_override_class__##ORIGINAL_FUNCTION_NAME::override((void*)ORIGINAL_FUNCTION_NAME); \ - } - -#endif - -#ifdef __cplusplus - } -#endif -#endif // _mach_override_ diff --git a/xpcom/build/moz.build b/xpcom/build/moz.build index c58b4db3f5..bc20b8aedd 100644 --- a/xpcom/build/moz.build +++ b/xpcom/build/moz.build @@ -32,13 +32,6 @@ if CONFIG['OS_ARCH'] == 'WINNT': 'PoisonIOInterposerBase.cpp', 'PoisonIOInterposerWin.cpp', ] -elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': - UNIFIED_SOURCES += [ - 'PoisonIOInterposerBase.cpp', - 'PoisonIOInterposerMac.cpp', - ] - SOURCES += ['mach_override.c'] - SOURCES['mach_override.c'].flags += ['-Wno-unused-function'] else: SOURCES += ['PoisonIOInterposerStub.cpp'] diff --git a/xpcom/build/nsXPCOMPrivate.h b/xpcom/build/nsXPCOMPrivate.h index c5f6553c03..6c3a2bc0ab 100644 --- a/xpcom/build/nsXPCOMPrivate.h +++ b/xpcom/build/nsXPCOMPrivate.h @@ -254,15 +254,8 @@ void LogTerm(); #define XPCOM_DLL XUL_DLL -// you have to love apple.. -#ifdef XP_MACOSX -#define XPCOM_SEARCH_KEY "DYLD_LIBRARY_PATH" -#define GRE_FRAMEWORK_NAME "XUL.framework" -#define XUL_DLL "XUL" -#else #define XPCOM_SEARCH_KEY "LD_LIBRARY_PATH" #define XUL_DLL "libxul" MOZ_DLL_SUFFIX -#endif #define GRE_CONF_NAME ".gre.config" #define GRE_CONF_PATH "/etc/gre.conf" diff --git a/xpcom/build/nsXULAppAPI.h b/xpcom/build/nsXULAppAPI.h index ffb50565a0..78760f0431 100644 --- a/xpcom/build/nsXULAppAPI.h +++ b/xpcom/build/nsXULAppAPI.h @@ -106,7 +106,7 @@ */ #define XRE_SYS_SHARE_EXTENSION_PARENT_DIR "XRESysSExtPD" -#if defined(XP_UNIX) || defined(XP_MACOSX) +#if defined(XP_UNIX) /** * Directory service keys for the system-wide and user-specific * directories where host manifests used by the WebExtensions diff --git a/xpcom/components/nsNativeModuleLoader.cpp b/xpcom/components/nsNativeModuleLoader.cpp index bec3a11757..95b8349f19 100644 --- a/xpcom/components/nsNativeModuleLoader.cpp +++ b/xpcom/components/nsNativeModuleLoader.cpp @@ -33,10 +33,6 @@ #include #endif -#ifdef XP_MACOSX -#include -#endif - #ifdef DEBUG #define IMPLEMENT_BREAK_AFTER_LOAD #endif diff --git a/xpcom/ds/nsMathUtils.h b/xpcom/ds/nsMathUtils.h index a3058faaaf..57228d6634 100644 --- a/xpcom/ds/nsMathUtils.h +++ b/xpcom/ds/nsMathUtils.h @@ -103,10 +103,6 @@ NS_finite(double aNum) #ifdef WIN32 // NOTE: '!!' casts an int to bool without spamming MSVC warning C4800. return !!_finite(aNum); -#elif defined(XP_DARWIN) - // Darwin has deprecated |finite| and recommends |isfinite|. The former is - // not present in the iOS SDK. - return std::isfinite(aNum); #else return finite(aNum); #endif diff --git a/xpcom/glue/FileUtils.cpp b/xpcom/glue/FileUtils.cpp index 8057cf8cb1..04bba85cb4 100644 --- a/xpcom/glue/FileUtils.cpp +++ b/xpcom/glue/FileUtils.cpp @@ -12,16 +12,7 @@ #include "mozilla/Assertions.h" #include "mozilla/FileUtils.h" -#if defined(XP_MACOSX) -#include -#include -#include -#include -#include -#include -#include -#include -#elif defined(XP_UNIX) +#if defined(XP_UNIX) #include #include #if defined(LINUX) @@ -56,20 +47,6 @@ mozilla::fallocate(PRFileDesc* aFD, int64_t aLength) PR_Seek64(aFD, oldpos, PR_SEEK_SET); return retval; -#elif defined(XP_MACOSX) - int fd = PR_FileDesc2NativeHandle(aFD); - fstore_t store = {F_ALLOCATECONTIG, F_PEOFPOSMODE, 0, aLength}; - // Try to get a continous chunk of disk space - int ret = fcntl(fd, F_PREALLOCATE, &store); - if (ret == -1) { - // OK, perhaps we are too fragmented, allocate non-continuous - store.fst_flags = F_ALLOCATEALL; - ret = fcntl(fd, F_PREALLOCATE, &store); - if (ret == -1) { - return false; - } - } - return ftruncate(fd, aLength) == 0; #elif defined(XP_UNIX) // The following is copied from fcntlSizeHint in sqlite /* If the OS does not have posix_fallocate(), fake it. First use @@ -225,7 +202,7 @@ mozilla::ReadAheadLib(nsIFile* aFile) return; } ReadAheadLib(path.get()); -#elif defined(LINUX) || defined(XP_MACOSX) +#elif defined(LINUX) nsAutoCString nativePath; if (!aFile || NS_FAILED(aFile->GetNativePath(nativePath))) { return; @@ -244,7 +221,7 @@ mozilla::ReadAheadFile(nsIFile* aFile, const size_t aOffset, return; } ReadAheadFile(path.get(), aOffset, aCount, aOutFd); -#elif defined(LINUX) || defined(XP_MACOSX) +#elif defined(LINUX) nsAutoCString nativePath; if (!aFile || NS_FAILED(aFile->GetNativePath(nativePath))) { return; @@ -271,64 +248,6 @@ static const unsigned char ELFCLASS = ELFCLASS32; typedef Elf32_Off Elf_Off; #endif -#elif defined(XP_MACOSX) - -#if defined(__i386__) -static const uint32_t CPU_TYPE = CPU_TYPE_X86; -#elif defined(__x86_64__) -static const uint32_t CPU_TYPE = CPU_TYPE_X86_64; -#elif defined(__ppc__) -static const uint32_t CPU_TYPE = CPU_TYPE_POWERPC; -#elif defined(__ppc64__) -static const uint32_t CPU_TYPE = CPU_TYPE_POWERPC64; -#else -#error Unsupported CPU type -#endif - -#ifdef __LP64__ -#undef LC_SEGMENT -#define LC_SEGMENT LC_SEGMENT_64 -#undef MH_MAGIC -#define MH_MAGIC MH_MAGIC_64 -#define cpu_mach_header mach_header_64 -#define segment_command segment_command_64 -#else -#define cpu_mach_header mach_header -#endif - -class ScopedMMap -{ -public: - explicit ScopedMMap(const char* aFilePath) - : buf(nullptr) - { - fd = open(aFilePath, O_RDONLY); - if (fd < 0) { - return; - } - struct stat st; - if (fstat(fd, &st) < 0) { - return; - } - size = st.st_size; - buf = (char*)mmap(nullptr, size, PROT_READ, MAP_PRIVATE, fd, 0); - } - ~ScopedMMap() - { - if (buf) { - munmap(buf, size); - } - if (fd >= 0) { - close(fd); - } - } - operator char*() { return buf; } - int getFd() { return fd; } -private: - int fd; - char* buf; - size_t size; -}; #endif void @@ -385,14 +304,6 @@ mozilla::ReadAhead(mozilla::filedesc_t aFd, const size_t aOffset, readahead(aFd, aOffset, aCount); -#elif defined(XP_MACOSX) - - struct radvisory ra; - ra.ra_offset = aOffset; - ra.ra_count = aCount; - // The F_RDADVISE fcntl is equivalent to Linux' readahead() system call. - fcntl(aFd, F_RDADVISE, &ra); - #endif } @@ -449,62 +360,6 @@ mozilla::ReadAheadLib(mozilla::pathstr_t aFilePath) ReadAhead(fd, 0, end); } close(fd); -#elif defined(XP_MACOSX) - ScopedMMap buf(aFilePath); - char* base = buf; - if (!base) { - return; - } - - // An OSX binary might either be a fat (universal) binary or a - // Mach-O binary. A fat binary actually embeds several Mach-O - // binaries. If we have a fat binary, find the offset where the - // Mach-O binary for our CPU type can be found. - struct fat_header* fh = (struct fat_header*)base; - - if (OSSwapBigToHostInt32(fh->magic) == FAT_MAGIC) { - uint32_t nfat_arch = OSSwapBigToHostInt32(fh->nfat_arch); - struct fat_arch* arch = (struct fat_arch*)&buf[sizeof(struct fat_header)]; - for (; nfat_arch; arch++, nfat_arch--) { - if (OSSwapBigToHostInt32(arch->cputype) == CPU_TYPE) { - base += OSSwapBigToHostInt32(arch->offset); - break; - } - } - if (base == buf) { - return; - } - } - - // Check Mach-O magic in the Mach header - struct cpu_mach_header* mh = (struct cpu_mach_header*)base; - if (mh->magic != MH_MAGIC) { - return; - } - - // The Mach header is followed by a sequence of load commands. - // Each command has a header containing the command type and the - // command size. LD_SEGMENT commands describes how the dynamic - // loader is going to map the file in memory. We use that - // information to find the biggest offset from the library that - // will be mapped in memory. - char* cmd = &base[sizeof(struct cpu_mach_header)]; - uint32_t end = 0; - for (uint32_t ncmds = mh->ncmds; ncmds; ncmds--) { - struct segment_command* sh = (struct segment_command*)cmd; - if (sh->cmd != LC_SEGMENT) { - continue; - } - if (end < sh->fileoff + sh->filesize) { - end = sh->fileoff + sh->filesize; - } - cmd += sh->cmdsize; - } - // Let the kernel read ahead what the dynamic loader is going to - // map in memory soon after. - if (end > 0) { - ReadAhead(buf.getFd(), base - buf, end); - } #endif } @@ -531,7 +386,7 @@ mozilla::ReadAheadFile(mozilla::pathstr_t aFilePath, const size_t aOffset, if (!aOutFd) { CloseHandle(fd); } -#elif defined(LINUX) || defined(XP_MACOSX) || defined(XP_SOLARIS) +#elif defined(LINUX) || defined(XP_SOLARIS) if (!aFilePath) { if (aOutFd) { *aOutFd = -1; diff --git a/xpcom/glue/nsCRTGlue.h b/xpcom/glue/nsCRTGlue.h index d3c666d05c..6eda4bf8df 100644 --- a/xpcom/glue/nsCRTGlue.h +++ b/xpcom/glue/nsCRTGlue.h @@ -124,9 +124,7 @@ void NS_MakeRandomString(char* aBuf, int32_t aBufLen); // identify or replace all known path separators. #define KNOWN_PATH_SEPARATORS "\\/" -#if defined(XP_MACOSX) - #define FILE_PATH_SEPARATOR "/" -#elif defined(XP_WIN) +#if defined(XP_WIN) #define FILE_PATH_SEPARATOR "\\" #elif defined(XP_UNIX) #define FILE_PATH_SEPARATOR "/" diff --git a/xpcom/glue/nsThreadUtils.cpp b/xpcom/glue/nsThreadUtils.cpp index 9128509152..41e319ea5f 100644 --- a/xpcom/glue/nsThreadUtils.cpp +++ b/xpcom/glue/nsThreadUtils.cpp @@ -21,8 +21,6 @@ #include #include "mozilla/WindowsVersion.h" using mozilla::IsVistaOrLater; -#elif defined(XP_MACOSX) -#include #endif #include @@ -445,12 +443,6 @@ nsAutoLowPriorityIO::nsAutoLowPriorityIO() lowIOPrioritySet = IsVistaOrLater() && SetThreadPriority(GetCurrentThread(), THREAD_MODE_BACKGROUND_BEGIN); -#elif defined(XP_MACOSX) - oldPriority = getiopolicy_np(IOPOL_TYPE_DISK, IOPOL_SCOPE_THREAD); - lowIOPrioritySet = oldPriority != -1 && - setiopolicy_np(IOPOL_TYPE_DISK, - IOPOL_SCOPE_THREAD, - IOPOL_THROTTLE) != -1; #else lowIOPrioritySet = false; #endif @@ -463,9 +455,5 @@ nsAutoLowPriorityIO::~nsAutoLowPriorityIO() // On Windows the old thread priority is automatically restored SetThreadPriority(GetCurrentThread(), THREAD_MODE_BACKGROUND_END); } -#elif defined(XP_MACOSX) - if (MOZ_LIKELY(lowIOPrioritySet)) { - setiopolicy_np(IOPOL_TYPE_DISK, IOPOL_SCOPE_THREAD, oldPriority); - } #endif } diff --git a/xpcom/glue/nsThreadUtils.h b/xpcom/glue/nsThreadUtils.h index 01270c1e94..9942a1060a 100644 --- a/xpcom/glue/nsThreadUtils.h +++ b/xpcom/glue/nsThreadUtils.h @@ -1037,9 +1037,6 @@ public: private: bool lowIOPrioritySet; -#if defined(XP_MACOSX) - int oldPriority; -#endif }; void diff --git a/xpcom/glue/standalone/nsXPCOMGlue.cpp b/xpcom/glue/standalone/nsXPCOMGlue.cpp index 68dd58d1ed..e4a5d8bd44 100644 --- a/xpcom/glue/standalone/nsXPCOMGlue.cpp +++ b/xpcom/glue/standalone/nsXPCOMGlue.cpp @@ -97,11 +97,7 @@ static LibHandleType GetLibHandle(pathstr_t aDependentLib) { LibHandleType libHandle = dlopen(aDependentLib, - RTLD_GLOBAL | RTLD_LAZY -#ifdef XP_MACOSX - | RTLD_FIRST -#endif - ); + RTLD_GLOBAL | RTLD_LAZY); if (!libHandle) { fprintf(stderr, "XPCOMGlueLoad error for file %s:\n%s\n", aDependentLib, dlerror()); @@ -235,22 +231,6 @@ XPCOMGlueLoad(const char* aXPCOMFile) char xpcomDir[MAXPATHLEN]; #ifdef XP_WIN const char* lastSlash = ns_strrpbrk(aXPCOMFile, "/\\"); -#elif XP_MACOSX - // On OSX, the dependentlibs.list file lives under Contents/Resources. - // However, the actual libraries listed in dependentlibs.list live under - // Contents/MacOS. We want to read the list from Contents/Resources, then - // load the libraries from Contents/MacOS. - const char *tempSlash = strrchr(aXPCOMFile, '/'); - size_t tempLen = size_t(tempSlash - aXPCOMFile); - if (tempLen > MAXPATHLEN) { - return nullptr; - } - char tempBuffer[MAXPATHLEN]; - memcpy(tempBuffer, aXPCOMFile, tempLen); - tempBuffer[tempLen] = '\0'; - const char *slash = strrchr(tempBuffer, '/'); - tempLen = size_t(slash - tempBuffer); - const char *lastSlash = aXPCOMFile + tempLen; #else const char* lastSlash = strrchr(aXPCOMFile, '/'); #endif @@ -259,19 +239,11 @@ XPCOMGlueLoad(const char* aXPCOMFile) size_t len = size_t(lastSlash - aXPCOMFile); if (len > MAXPATHLEN - sizeof(XPCOM_FILE_PATH_SEPARATOR -#ifdef XP_MACOSX - "Resources" - XPCOM_FILE_PATH_SEPARATOR -#endif XPCOM_DEPENDENT_LIBS_LIST)) { return nullptr; } memcpy(xpcomDir, aXPCOMFile, len); strcpy(xpcomDir + len, XPCOM_FILE_PATH_SEPARATOR -#ifdef XP_MACOSX - "Resources" - XPCOM_FILE_PATH_SEPARATOR -#endif XPCOM_DEPENDENT_LIBS_LIST); cursor = xpcomDir + len + 1; } else { @@ -289,14 +261,6 @@ XPCOMGlueLoad(const char* aXPCOMFile) return nullptr; } -#ifdef XP_MACOSX - tempLen = size_t(cursor - xpcomDir); - if (tempLen > MAXPATHLEN - sizeof("MacOS" XPCOM_FILE_PATH_SEPARATOR) - 1) { - return nullptr; - } - strcpy(cursor, "MacOS" XPCOM_FILE_PATH_SEPARATOR); - cursor += strlen(cursor); -#endif *cursor = '\0'; char buffer[MAXPATHLEN]; diff --git a/xpcom/io/CocoaFileUtils.h b/xpcom/io/CocoaFileUtils.h deleted file mode 100644 index 919c127162..0000000000 --- a/xpcom/io/CocoaFileUtils.h +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* 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/. */ - -// This namespace contains methods with Obj-C/Cocoa implementations. The header -// is C/C++ for inclusion in C/C++-only files. - -#ifndef CocoaFileUtils_h_ -#define CocoaFileUtils_h_ - -#include "nscore.h" -#include - -namespace CocoaFileUtils { - -nsresult RevealFileInFinder(CFURLRef aUrl); -nsresult OpenURL(CFURLRef aUrl); -nsresult GetFileCreatorCode(CFURLRef aUrl, OSType* aCreatorCode); -nsresult SetFileCreatorCode(CFURLRef aUrl, OSType aCreatorCode); -nsresult GetFileTypeCode(CFURLRef aUrl, OSType* aTypeCode); -nsresult SetFileTypeCode(CFURLRef aUrl, OSType aTypeCode); -void AddOriginMetadataToFile(const CFStringRef filePath, - const CFURLRef sourceURL, - const CFURLRef referrerURL); -void AddQuarantineMetadataToFile(const CFStringRef filePath, - const CFURLRef sourceURL, - const CFURLRef referrerURL, - const bool isFromWeb); -CFURLRef GetTemporaryFolderCFURLRef(); - -} // namespace CocoaFileUtils - -#endif diff --git a/xpcom/io/CocoaFileUtils.mm b/xpcom/io/CocoaFileUtils.mm deleted file mode 100644 index a02b82ac1d..0000000000 --- a/xpcom/io/CocoaFileUtils.mm +++ /dev/null @@ -1,267 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -// vim:set ts=2 sts=2 sw=2 et cin: -/* 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/. */ - -#include "CocoaFileUtils.h" -#include "nsCocoaFeatures.h" -#include "nsCocoaUtils.h" -#include -#include "nsObjCExceptions.h" -#include "nsDebug.h" - -// Need to cope with us using old versions of the SDK and needing this on 10.10+ -#if !defined(MAC_OS_X_VERSION_10_10) || (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_10) -const CFStringRef kCFURLQuarantinePropertiesKey = CFSTR("NSURLQuarantinePropertiesKey"); -#endif - -namespace CocoaFileUtils { - -nsresult RevealFileInFinder(CFURLRef url) -{ - NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT; - - if (NS_WARN_IF(!url)) - return NS_ERROR_INVALID_ARG; - - NSAutoreleasePool* ap = [[NSAutoreleasePool alloc] init]; - BOOL success = [[NSWorkspace sharedWorkspace] selectFile:[(NSURL*)url path] inFileViewerRootedAtPath:@""]; - [ap release]; - - return (success ? NS_OK : NS_ERROR_FAILURE); - - NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT; -} - -nsresult OpenURL(CFURLRef url) -{ - NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT; - - if (NS_WARN_IF(!url)) - return NS_ERROR_INVALID_ARG; - - NSAutoreleasePool* ap = [[NSAutoreleasePool alloc] init]; - BOOL success = [[NSWorkspace sharedWorkspace] openURL:(NSURL*)url]; - [ap release]; - - return (success ? NS_OK : NS_ERROR_FAILURE); - - NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT; -} - -nsresult GetFileCreatorCode(CFURLRef url, OSType *creatorCode) -{ - NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT; - - if (NS_WARN_IF(!url) || NS_WARN_IF(!creatorCode)) - return NS_ERROR_INVALID_ARG; - - nsAutoreleasePool localPool; - - NSString *resolvedPath = [[(NSURL*)url path] stringByResolvingSymlinksInPath]; - if (!resolvedPath) { - return NS_ERROR_FAILURE; - } - - NSDictionary* dict = [[NSFileManager defaultManager] attributesOfItemAtPath:resolvedPath error:nil]; - if (!dict) { - return NS_ERROR_FAILURE; - } - - NSNumber* creatorNum = (NSNumber*)[dict objectForKey:NSFileHFSCreatorCode]; - if (!creatorNum) { - return NS_ERROR_FAILURE; - } - - *creatorCode = [creatorNum unsignedLongValue]; - return NS_OK; - - NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT; -} - -nsresult SetFileCreatorCode(CFURLRef url, OSType creatorCode) -{ - NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT; - - if (NS_WARN_IF(!url)) - return NS_ERROR_INVALID_ARG; - - NSAutoreleasePool* ap = [[NSAutoreleasePool alloc] init]; - NSDictionary* dict = [NSDictionary dictionaryWithObject:[NSNumber numberWithUnsignedLong:creatorCode] forKey:NSFileHFSCreatorCode]; - BOOL success = [[NSFileManager defaultManager] setAttributes:dict ofItemAtPath:[(NSURL*)url path] error:nil]; - [ap release]; - return (success ? NS_OK : NS_ERROR_FAILURE); - - NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT; -} - -nsresult GetFileTypeCode(CFURLRef url, OSType *typeCode) -{ - NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT; - - if (NS_WARN_IF(!url) || NS_WARN_IF(!typeCode)) - return NS_ERROR_INVALID_ARG; - - nsAutoreleasePool localPool; - - NSString *resolvedPath = [[(NSURL*)url path] stringByResolvingSymlinksInPath]; - if (!resolvedPath) { - return NS_ERROR_FAILURE; - } - - NSDictionary* dict = [[NSFileManager defaultManager] attributesOfItemAtPath:resolvedPath error:nil]; - if (!dict) { - return NS_ERROR_FAILURE; - } - - NSNumber* typeNum = (NSNumber*)[dict objectForKey:NSFileHFSTypeCode]; - if (!typeNum) { - return NS_ERROR_FAILURE; - } - - *typeCode = [typeNum unsignedLongValue]; - return NS_OK; - - NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT; -} - -nsresult SetFileTypeCode(CFURLRef url, OSType typeCode) -{ - NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT; - - if (NS_WARN_IF(!url)) - return NS_ERROR_INVALID_ARG; - - NSAutoreleasePool* ap = [[NSAutoreleasePool alloc] init]; - NSDictionary* dict = [NSDictionary dictionaryWithObject:[NSNumber numberWithUnsignedLong:typeCode] forKey:NSFileHFSTypeCode]; - BOOL success = [[NSFileManager defaultManager] setAttributes:dict ofItemAtPath:[(NSURL*)url path] error:nil]; - [ap release]; - return (success ? NS_OK : NS_ERROR_FAILURE); - - NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT; -} - -void AddOriginMetadataToFile(const CFStringRef filePath, - const CFURLRef sourceURL, - const CFURLRef referrerURL) { - typedef OSStatus (*MDItemSetAttribute_type)(MDItemRef, CFStringRef, CFTypeRef); - static MDItemSetAttribute_type mdItemSetAttributeFunc = NULL; - - static bool did_symbol_lookup = false; - if (!did_symbol_lookup) { - did_symbol_lookup = true; - - CFBundleRef metadata_bundle = ::CFBundleGetBundleWithIdentifier(CFSTR("com.apple.Metadata")); - if (!metadata_bundle) { - return; - } - - mdItemSetAttributeFunc = (MDItemSetAttribute_type) - ::CFBundleGetFunctionPointerForName(metadata_bundle, CFSTR("MDItemSetAttribute")); - } - if (!mdItemSetAttributeFunc) { - return; - } - - MDItemRef mdItem = ::MDItemCreate(NULL, filePath); - if (!mdItem) { - return; - } - - CFMutableArrayRef list = ::CFArrayCreateMutable(kCFAllocatorDefault, 2, NULL); - if (!list) { - ::CFRelease(mdItem); - return; - } - - // The first item in the list is the source URL of the downloaded file. - if (sourceURL) { - ::CFArrayAppendValue(list, ::CFURLGetString(sourceURL)); - } - - // If the referrer is known, store that in the second position. - if (referrerURL) { - ::CFArrayAppendValue(list, ::CFURLGetString(referrerURL)); - } - - mdItemSetAttributeFunc(mdItem, kMDItemWhereFroms, list); - - ::CFRelease(list); - ::CFRelease(mdItem); -} - -void AddQuarantineMetadataToFile(const CFStringRef filePath, - const CFURLRef sourceURL, - const CFURLRef referrerURL, - const bool isFromWeb) { - CFURLRef fileURL = ::CFURLCreateWithFileSystemPath(kCFAllocatorDefault, - filePath, - kCFURLPOSIXPathStyle, - false); - - // The properties key changed in 10.10: - CFStringRef quarantinePropKey; - if (nsCocoaFeatures::OnYosemiteOrLater()) { - quarantinePropKey = kCFURLQuarantinePropertiesKey; - } else { - quarantinePropKey = kLSItemQuarantineProperties; - } - CFDictionaryRef quarantineProps = NULL; - Boolean success = ::CFURLCopyResourcePropertyForKey(fileURL, - quarantinePropKey, - &quarantineProps, - NULL); - - // If there aren't any quarantine properties then the user probably - // set up an exclusion and we don't need to add metadata. - if (!success || !quarantineProps) { - ::CFRelease(fileURL); - return; - } - - // We don't know what to do if the props aren't a dictionary. - if (::CFGetTypeID(quarantineProps) != ::CFDictionaryGetTypeID()) { - ::CFRelease(fileURL); - ::CFRelease(quarantineProps); - return; - } - - // Make a mutable copy of the properties. - CFMutableDictionaryRef mutQuarantineProps = - ::CFDictionaryCreateMutableCopy(kCFAllocatorDefault, 0, (CFDictionaryRef)quarantineProps); - ::CFRelease(quarantineProps); - - // Add metadata that the OS couldn't infer. - - if (!::CFDictionaryGetValue(mutQuarantineProps, kLSQuarantineTypeKey)) { - CFStringRef type = isFromWeb ? kLSQuarantineTypeWebDownload : kLSQuarantineTypeOtherDownload; - ::CFDictionarySetValue(mutQuarantineProps, kLSQuarantineTypeKey, type); - } - - if (!::CFDictionaryGetValue(mutQuarantineProps, kLSQuarantineOriginURLKey) && referrerURL) { - ::CFDictionarySetValue(mutQuarantineProps, kLSQuarantineOriginURLKey, referrerURL); - } - - if (!::CFDictionaryGetValue(mutQuarantineProps, kLSQuarantineDataURLKey) && sourceURL) { - ::CFDictionarySetValue(mutQuarantineProps, kLSQuarantineDataURLKey, sourceURL); - } - - // Set quarantine properties on file. - ::CFURLSetResourcePropertyForKey(fileURL, - quarantinePropKey, - mutQuarantineProps, - NULL); - - ::CFRelease(fileURL); - ::CFRelease(mutQuarantineProps); -} - -CFURLRef GetTemporaryFolderCFURLRef() -{ - NSString* tempDir = ::NSTemporaryDirectory(); - return tempDir == nil ? NULL : (CFURLRef)[NSURL fileURLWithPath:tempDir - isDirectory:YES]; -} - -} // namespace CocoaFileUtils diff --git a/xpcom/io/moz.build b/xpcom/io/moz.build index 43ce517c45..467d61682b 100644 --- a/xpcom/io/moz.build +++ b/xpcom/io/moz.build @@ -37,11 +37,6 @@ XPIDL_SOURCES += [ 'nsIUnicharOutputStream.idl', ] -if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': - XPIDL_SOURCES += [ - 'nsILocalFileMac.idl', - ] - if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows': EXPORTS += ['nsLocalFileWin.h'] EXPORTS.mozilla += [ @@ -123,11 +118,6 @@ SOURCES += [ 'FilePreferences.cpp', ] -if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': - SOURCES += [ - 'CocoaFileUtils.mm', - ] - include('/ipc/chromium/chromium-config.mozbuild') FINAL_LIBRARY = 'xul' diff --git a/xpcom/io/nsILocalFileMac.idl b/xpcom/io/nsILocalFileMac.idl deleted file mode 100644 index d8655449bb..0000000000 --- a/xpcom/io/nsILocalFileMac.idl +++ /dev/null @@ -1,179 +0,0 @@ -/* -*- 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/. */ - -#include "nsILocalFile.idl" - -%{C++ -#include -#include -%} - - native OSType(OSType); - native FSSpec(FSSpec); - native FSRef(FSRef); -[ptr] native FSRefPtr(FSRef); - native CFURLRef(CFURLRef); - -[scriptable, builtinclass, uuid(623eca5b-c25d-4e27-be5a-789a66c4b2f7)] -interface nsILocalFileMac : nsILocalFile -{ - /** - * initWithCFURL - * - * Init this object with a CFURLRef - * - * NOTE: Supported only for XP_MACOSX - * NOTE: If the path of the CFURL is /a/b/c, at least a/b must exist beforehand. - * - * @param aCFURL the CoreFoundation URL - * - */ - [noscript] void initWithCFURL(in CFURLRef aCFURL); - - /** - * initWithFSRef - * - * Init this object with an FSRef - * - * NOTE: Supported only for XP_MACOSX - * - * @param aFSRef the native FSRef - * - */ - [noscript] void initWithFSRef([const] in FSRefPtr aFSRef); - - /** - * getCFURL - * - * Returns the CFURLRef of the file object. The caller is - * responsible for calling CFRelease() on it. - * - * NOTE: Observes the state of the followLinks attribute. - * If the file object is an alias and followLinks is TRUE, returns - * the target of the alias. If followLinks is FALSE, returns - * the unresolved alias file. - * - * NOTE: Supported only for XP_MACOSX - * - * @return - * - */ - [noscript] CFURLRef getCFURL(); - - /** - * getFSRef - * - * Returns the FSRef of the file object. - * - * NOTE: Observes the state of the followLinks attribute. - * If the file object is an alias and followLinks is TRUE, returns - * the target of the alias. If followLinks is FALSE, returns - * the unresolved alias file. - * - * NOTE: Supported only for XP_MACOSX - * - * @return - * - */ - [noscript] FSRef getFSRef(); - - /** - * getFSSpec - * - * Returns the FSSpec of the file object. - * - * NOTE: Observes the state of the followLinks attribute. - * If the file object is an alias and followLinks is TRUE, returns - * the target of the alias. If followLinks is FALSE, returns - * the unresolved alias file. - * - * @return - * - */ - [noscript] FSSpec getFSSpec(); - - /** - * fileSizeWithResFork - * - * Returns the combined size of both the data fork and the resource - * fork (if present) rather than just the size of the data fork - * as returned by GetFileSize() - * - */ - readonly attribute int64_t fileSizeWithResFork; - - /** - * fileType, creator - * - * File type and creator attributes - * - */ - [noscript] attribute OSType fileType; - [noscript] attribute OSType fileCreator; - - /** - * launchWithDoc - * - * Launch the application that this file points to with a document. - * - * @param aDocToLoad Must not be NULL. If no document, use nsIFile::launch - * @param aLaunchInBackground TRUE if the application should not come to the front. - * - */ - void launchWithDoc(in nsIFile aDocToLoad, in boolean aLaunchInBackground); - - /** - * openDocWithApp - * - * Open the document that this file points to with the given application. - * - * @param aAppToOpenWith The application with which to open the document. - * If NULL, the creator code of the document is used - * to determine the application. - * @param aLaunchInBackground TRUE if the application should not come to the front. - * - */ - void openDocWithApp(in nsIFile aAppToOpenWith, in boolean aLaunchInBackground); - - /** - * isPackage - * - * returns true if a directory is determined to be a package under Mac OS 9/X - * - */ - boolean isPackage(); - - /** - * bundleDisplayName - * - * returns the display name of the application bundle (usually the human - * readable name of the application) - */ - readonly attribute AString bundleDisplayName; - - /** - * bundleIdentifier - * - * returns the identifier of the bundle - */ - readonly attribute AUTF8String bundleIdentifier; - - /** - * Last modified time of a bundle's contents (as opposed to its package - * directory). Our convention is to make the bundle's Info.plist file - * stand in for the rest of its contents -- since this file contains the - * bundle's version information and other identifiers. For non-bundles - * this is the same as lastModifiedTime. - */ - readonly attribute int64_t bundleContentsLastModifiedTime; -}; - -%{C++ -extern "C" -{ -NS_EXPORT nsresult NS_NewLocalFileWithFSRef(const FSRef* aFSRef, bool aFollowSymlinks, nsILocalFileMac** result); -NS_EXPORT nsresult NS_NewLocalFileWithCFURL(const CFURLRef aURL, bool aFollowSymlinks, nsILocalFileMac** result); -} -%} diff --git a/xpcom/io/nsLocalFileUnix.h b/xpcom/io/nsLocalFileUnix.h index c49f448fd1..5bdc6a3da0 100644 --- a/xpcom/io/nsLocalFileUnix.h +++ b/xpcom/io/nsLocalFileUnix.h @@ -61,9 +61,7 @@ #define F_BSIZE f_bsize #endif -// stat64 and lstat64 are deprecated on OS X. Normal stat and lstat are -// 64-bit by default on OS X 10.6+. -#if defined(HAVE_STAT64) && defined(HAVE_LSTAT64) && !defined(XP_DARWIN) +#if defined(HAVE_STAT64) && defined(HAVE_LSTAT64) #define STAT stat64 #define LSTAT lstat64 #define HAVE_STATS64 1 diff --git a/xpcom/io/nsNativeCharsetUtils.cpp b/xpcom/io/nsNativeCharsetUtils.cpp index 7aab8d18f1..927e8cd591 100644 --- a/xpcom/io/nsNativeCharsetUtils.cpp +++ b/xpcom/io/nsNativeCharsetUtils.cpp @@ -5,44 +5,10 @@ #include "xpcom-private.h" -//----------------------------------------------------------------------------- -// XP_MACOSX -//----------------------------------------------------------------------------- -#if defined(XP_MACOSX) - -#include "nsAString.h" -#include "nsReadableUtils.h" -#include "nsString.h" - -nsresult -NS_CopyNativeToUnicode(const nsACString& aInput, nsAString& aOutput) -{ - CopyUTF8toUTF16(aInput, aOutput); - return NS_OK; -} - -nsresult -NS_CopyUnicodeToNative(const nsAString& aInput, nsACString& aOutput) -{ - CopyUTF16toUTF8(aInput, aOutput); - return NS_OK; -} - -void -NS_StartupNativeCharsetUtils() -{ -} - -void -NS_ShutdownNativeCharsetUtils() -{ -} - - //----------------------------------------------------------------------------- // XP_UNIX //----------------------------------------------------------------------------- -#elif defined(XP_UNIX) +#if defined(XP_UNIX) #include // mbtowc, wctomb #include // setlocale diff --git a/xpcom/io/nsNativeCharsetUtils.h b/xpcom/io/nsNativeCharsetUtils.h index b481571330..bee533cbef 100644 --- a/xpcom/io/nsNativeCharsetUtils.h +++ b/xpcom/io/nsNativeCharsetUtils.h @@ -33,22 +33,17 @@ nsresult NS_CopyUnicodeToNative(const nsAString& aInput, nsACString& aOutput); * name in UTF-8 out of nsIFile, we can just use |GetNativeLeafName| rather * than using |GetLeafName| and converting the result to UTF-8 if the file * system encoding is UTF-8. - * On Unix (but not on Mac OS X), it depends on the locale and is not known - * in advance (at the compilation time) so that this function needs to be - * a real function. On Mac OS X it's always UTF-8 while on Windows - * and other platforms (e.g. OS2), it's never UTF-8. + * On Unix, it depends on the locale and is not known in advance (at the + * compilation time) so that this function needs to be a real function. + * On Windows and other platforms (e.g. OS2), it's never UTF-8. */ -#if defined(XP_UNIX) && !defined(XP_MACOSX) +#if defined(XP_UNIX) bool NS_IsNativeUTF8(); #else inline bool NS_IsNativeUTF8() { -#if defined(XP_MACOSX) - return true; -#else return false; -#endif } #endif diff --git a/xpcom/reflect/xptcall/md/unix/xptcinvoke_arm.cpp b/xpcom/reflect/xptcall/md/unix/xptcinvoke_arm.cpp index ef725e5e32..6475132bcf 100644 --- a/xpcom/reflect/xptcall/md/unix/xptcinvoke_arm.cpp +++ b/xpcom/reflect/xptcall/md/unix/xptcinvoke_arm.cpp @@ -9,8 +9,8 @@ #include "mozilla/Compiler.h" -#if !defined(__arm__) && !(defined(LINUX) || defined(XP_IOS)) -#error "This code is for Linux/iOS ARM only. Check that it works on your system, too.\nBeware that this code is highly compiler dependent." +#if !defined(__arm__) && !(defined(LINUX) +#error "This code is for Linux ARM only. Check that it works on your system, too.\nBeware that this code is highly compiler dependent." #endif #if MOZ_IS_GCC diff --git a/xpcom/reflect/xptcall/md/unix/xptcinvoke_asm_x86_64_unix.S b/xpcom/reflect/xptcall/md/unix/xptcinvoke_asm_x86_64_unix.S index 131cfc3343..92788667cd 100644 --- a/xpcom/reflect/xptcall/md/unix/xptcinvoke_asm_x86_64_unix.S +++ b/xpcom/reflect/xptcall/md/unix/xptcinvoke_asm_x86_64_unix.S @@ -2,16 +2,6 @@ # 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/. -# Darwin gives a leading '_' to symbols defined in C code. -#ifdef XP_DARWIN -#define SYM(x) _ ## x -#define CFI_STARTPROC -#define CFI_ENDPROC -#define CFI_DEF_CFA_OFFSET(offset) -#define CFI_OFFSET(reg, offset) -#define CFI_DEF_CFA_REGISTER(reg) -#define CFI_DEF_CFA(reg, offset) -#else #define SYM(x) x #define CFI_STARTPROC .cfi_startproc #define CFI_ENDPROC .cfi_endproc @@ -19,7 +9,6 @@ #define CFI_OFFSET(reg, offset) .cfi_offset reg, offset #define CFI_DEF_CFA_REGISTER(reg) .cfi_def_cfa_register reg #define CFI_DEF_CFA(reg, offset) .cfi_def_cfa reg, offset -#endif .intel_syntax noprefix @@ -27,9 +16,7 @@ # uint32_t argc, nsXPTCVariant* argv); .text .global SYM(NS_InvokeByIndex) -#ifndef XP_DARWIN .type NS_InvokeByIndex, @function -#endif .align 4 SYM(NS_InvokeByIndex): CFI_STARTPROC @@ -116,7 +103,5 @@ SYM(NS_InvokeByIndex): ret CFI_ENDPROC -#ifndef XP_DARWIN // Magic indicating no need for an executable stack .section .note.GNU-stack, "", @progbits ; .previous -#endif diff --git a/xpcom/reflect/xptcall/md/unix/xptcinvoke_gcc_x86_unix.cpp b/xpcom/reflect/xptcall/md/unix/xptcinvoke_gcc_x86_unix.cpp index d4a8a12fbc..b6afb00ed2 100644 --- a/xpcom/reflect/xptcall/md/unix/xptcinvoke_gcc_x86_unix.cpp +++ b/xpcom/reflect/xptcall/md/unix/xptcinvoke_gcc_x86_unix.cpp @@ -53,9 +53,7 @@ __asm__ ( is what xptcstubs uses. */ ".align 2\n\t" ".globl " SYMBOL_UNDERSCORE "NS_InvokeByIndex\n\t" -#ifndef XP_MACOSX ".type " SYMBOL_UNDERSCORE "NS_InvokeByIndex,@function\n" -#endif SYMBOL_UNDERSCORE "NS_InvokeByIndex:\n\t" "pushl %ebp\n\t" "movl %esp, %ebp\n\t" @@ -91,7 +89,5 @@ __asm__ ( "movl %ebp, %esp\n\t" "popl %ebp\n\t" "ret\n" -#ifndef XP_MACOSX ".size " SYMBOL_UNDERSCORE "NS_InvokeByIndex, . -" SYMBOL_UNDERSCORE "NS_InvokeByIndex\n\t" -#endif ); diff --git a/xpcom/reflect/xptcall/md/unix/xptcstubs_arm.cpp b/xpcom/reflect/xptcall/md/unix/xptcstubs_arm.cpp index 78664dfcfb..cf68c0d6eb 100644 --- a/xpcom/reflect/xptcall/md/unix/xptcstubs_arm.cpp +++ b/xpcom/reflect/xptcall/md/unix/xptcstubs_arm.cpp @@ -8,8 +8,8 @@ #include "xptcprivate.h" #include "xptiprivate.h" -#if !defined(__arm__) && !(defined(LINUX) || defined(XP_DARWIN)) -#error "This code is for Linux/iOS ARM only. Please check if it works for you, too.\nDepends strongly on gcc behaviour." +#if !defined(__arm__) && !defined(LINUX) +#error "This code is for Linux ARM only. Please check if it works for you, too.\nDepends strongly on gcc behaviour." #endif /* Specify explicitly a symbol for this function, don't try to guess the c++ mangled symbol. */ diff --git a/xpcom/reflect/xptcall/md/unix/xptcstubs_gcc_x86_unix.cpp b/xpcom/reflect/xptcall/md/unix/xptcstubs_gcc_x86_unix.cpp index 6811a26ad6..5e2a9c17f8 100644 --- a/xpcom/reflect/xptcall/md/unix/xptcstubs_gcc_x86_unix.cpp +++ b/xpcom/reflect/xptcall/md/unix/xptcstubs_gcc_x86_unix.cpp @@ -66,20 +66,11 @@ PrepareAndDispatch(uint32_t methodIndex, nsXPTCStubBase* self, uint32_t* args) } } // extern "C" -#if !defined(XP_MACOSX) - #define STUB_HEADER(a, b) ".hidden " SYMBOL_UNDERSCORE "_ZN14nsXPTCStubBase" #a "Stub" #b "Ev\n\t" \ ".type " SYMBOL_UNDERSCORE "_ZN14nsXPTCStubBase" #a "Stub" #b "Ev,@function\n" #define STUB_SIZE(a, b) ".size " SYMBOL_UNDERSCORE "_ZN14nsXPTCStubBase" #a "Stub" #b "Ev,.-" SYMBOL_UNDERSCORE "_ZN14nsXPTCStubBase" #a "Stub" #b "Ev\n\t" -#else - -#define STUB_HEADER(a, b) -#define STUB_SIZE(a, b) - -#endif - // gcc3 mangling tends to insert the length of the method name #define STUB_ENTRY(n) \ asm(".text\n\t" \ @@ -112,16 +103,12 @@ asm(".text\n\t" \ // static nsresult SharedStub(uint32_t methodIndex) __attribute__((regparm(1))) asm(".text\n\t" ".align 2\n\t" -#if !defined(XP_MACOSX) ".type " SYMBOL_UNDERSCORE "SharedStub,@function\n\t" -#endif SYMBOL_UNDERSCORE "SharedStub:\n\t" "leal 0x08(%esp), %ecx\n\t" "movl 0x04(%esp), %edx\n\t" "jmp " SYMBOL_UNDERSCORE "PrepareAndDispatch\n\t" -#if !defined(XP_MACOSX) ".size " SYMBOL_UNDERSCORE "SharedStub,.-" SYMBOL_UNDERSCORE "SharedStub" -#endif ); #define SENTINEL_ENTRY(n) \ diff --git a/xpcom/threads/SharedThreadPool.h b/xpcom/threads/SharedThreadPool.h index e4e07e2ccd..46227b3fd7 100644 --- a/xpcom/threads/SharedThreadPool.h +++ b/xpcom/threads/SharedThreadPool.h @@ -87,7 +87,7 @@ public: // Use the system default in ASAN builds, because the default is assumed to be // larger than the size we want to use and is hopefully sufficient for ASAN. static const uint32_t kStackSize = nsIThreadManager::DEFAULT_STACK_SIZE; -#elif defined(XP_WIN) || defined(XP_MACOSX) || defined(LINUX) +#elif defined(XP_WIN) || defined(LINUX) static const uint32_t kStackSize = (256 * 1024); #else // All other platforms use their system defaults. diff --git a/xpcom/threads/ThreadStackHelper.cpp b/xpcom/threads/ThreadStackHelper.cpp index a41c92f61c..72d82e4daa 100644 --- a/xpcom/threads/ThreadStackHelper.cpp +++ b/xpcom/threads/ThreadStackHelper.cpp @@ -41,7 +41,7 @@ # pragma GCC diagnostic pop // -Wshadow #endif -#if defined(XP_LINUX) || defined(XP_MACOSX) +#if defined(XP_LINUX) #include #endif @@ -97,8 +97,6 @@ ThreadStackHelper::ThreadStackHelper() THREAD_SUSPEND_RESUME , FALSE, 0); MOZ_ASSERT(mInitialized); -#elif defined(XP_MACOSX) - mThreadID = mach_thread_self(); #endif } @@ -176,26 +174,6 @@ ThreadStackHelper::GetStack(Stack& aStack) } MOZ_ALWAYS_TRUE(::ResumeThread(mThreadID) != DWORD(-1)); - -#elif defined(XP_MACOSX) -# if defined(MOZ_VALGRIND) && defined(RUNNING_ON_VALGRIND) - if (RUNNING_ON_VALGRIND) { - /* thread_suspend and thread_resume sometimes hang runs on Valgrind, - for unknown reasons. So, just avoid them. See bug 1100911. */ - return; - } -# endif - - if (::thread_suspend(mThreadID) != KERN_SUCCESS) { - MOZ_ASSERT(false); - return; - } - - FillStackBuffer(); - FillThreadContext(); - - MOZ_ALWAYS_TRUE(::thread_resume(mThreadID) == KERN_SUCCESS); - #endif } diff --git a/xpcom/threads/ThreadStackHelper.h b/xpcom/threads/ThreadStackHelper.h index f37ca8a247..04bcb7b0ab 100644 --- a/xpcom/threads/ThreadStackHelper.h +++ b/xpcom/threads/ThreadStackHelper.h @@ -18,8 +18,6 @@ #include #elif defined(XP_WIN) #include -#elif defined(XP_MACOSX) -#include #endif namespace mozilla { @@ -94,10 +92,6 @@ private: bool mInitialized; HANDLE mThreadID; -#elif defined(XP_MACOSX) -private: - thread_act_t mThreadID; - #endif }; diff --git a/xpcom/threads/nsProcess.h b/xpcom/threads/nsProcess.h index b9d0641770..21d28f1019 100644 --- a/xpcom/threads/nsProcess.h +++ b/xpcom/threads/nsProcess.h @@ -19,9 +19,7 @@ #include "nsIWeakReferenceUtils.h" #include "nsIObserver.h" #include "nsString.h" -#ifndef XP_MACOSX #include "prproces.h" -#endif #if defined(PROCESSMODEL_WINAPI) #include #include @@ -73,7 +71,7 @@ private: int32_t mExitValue; #if defined(PROCESSMODEL_WINAPI) HANDLE mProcess; -#elif !defined(XP_MACOSX) +#else PRProcess* mProcess; #endif }; diff --git a/xpcom/threads/nsProcessCommon.cpp b/xpcom/threads/nsProcessCommon.cpp index ac82e52a75..e815ec9ea4 100644 --- a/xpcom/threads/nsProcessCommon.cpp +++ b/xpcom/threads/nsProcessCommon.cpp @@ -33,31 +33,12 @@ #include "nsLiteralString.h" #include "nsReadableUtils.h" #else -#ifdef XP_MACOSX -#include -#include -#include -#include -#endif #include #include #endif using namespace mozilla; -#ifdef XP_MACOSX -cpu_type_t pref_cpu_types[2] = { -#if defined(__i386__) - CPU_TYPE_X86, -#elif defined(__x86_64__) - CPU_TYPE_X86_64, -#elif defined(__ppc__) - CPU_TYPE_POWERPC, -#endif - CPU_TYPE_ANY -}; -#endif - //-------------------------------------------------------------------// // nsIProcess implementation //-------------------------------------------------------------------// @@ -74,9 +55,7 @@ nsProcess::nsProcess() , mObserver(nullptr) , mWeakObserver(nullptr) , mExitValue(-1) -#if !defined(XP_MACOSX) , mProcess(nullptr) -#endif { } @@ -261,34 +240,16 @@ nsProcess::Monitor(void* aArg) return; } } -#else -#ifdef XP_MACOSX - int exitCode = -1; - int status = 0; - pid_t result; - do { - result = waitpid(process->mPid, &status, 0); - } while (result == -1 && errno == EINTR); - if (result == process->mPid) { - if (WIFEXITED(status)) { - exitCode = WEXITSTATUS(status); - } else if (WIFSIGNALED(status)) { - exitCode = 256; // match NSPR's signal exit status - } - } #else int32_t exitCode = -1; if (PR_WaitProcess(process->mProcess, &exitCode) != PR_SUCCESS) { exitCode = -1; } -#endif // Lock in case Kill or GetExitCode are called during this { MutexAutoLock lock(process->mLock); -#if !defined(XP_MACOSX) process->mProcess = nullptr; -#endif process->mExitValue = exitCode; if (process->mShutdown) { return; @@ -499,34 +460,6 @@ nsProcess::RunProcess(bool aBlocking, char** aMyArgv, nsIObserver* aObserver, } mPid = GetProcessId(mProcess); -#elif defined(XP_MACOSX) - // Initialize spawn attributes. - posix_spawnattr_t spawnattr; - if (posix_spawnattr_init(&spawnattr) != 0) { - return NS_ERROR_FAILURE; - } - - // Set spawn attributes. - size_t attr_count = ArrayLength(pref_cpu_types); - size_t attr_ocount = 0; - if (posix_spawnattr_setbinpref_np(&spawnattr, attr_count, pref_cpu_types, - &attr_ocount) != 0 || - attr_ocount != attr_count) { - posix_spawnattr_destroy(&spawnattr); - return NS_ERROR_FAILURE; - } - - // Note: |aMyArgv| is already null-terminated as required by posix_spawnp. - pid_t newPid = 0; - int result = posix_spawnp(&newPid, aMyArgv[0], nullptr, &spawnattr, aMyArgv, - *_NSGetEnviron()); - mPid = static_cast(newPid); - - posix_spawnattr_destroy(&spawnattr); - - if (result != 0) { - return NS_ERROR_FAILURE; - } #else mProcess = PR_CreateProcess(aMyArgv[0], aMyArgv, nullptr, nullptr); if (!mProcess) { @@ -605,10 +538,6 @@ nsProcess::Kill() if (TerminateProcess(mProcess, 0) == 0) { return NS_ERROR_FAILURE; } -#elif defined(XP_MACOSX) - if (kill(mPid, SIGKILL) != 0) { - return NS_ERROR_FAILURE; - } #else if (!mProcess || (PR_KillProcess(mProcess) != PR_SUCCESS)) { return NS_ERROR_FAILURE; diff --git a/xpcom/threads/nsThread.cpp b/xpcom/threads/nsThread.cpp index bf9423116c..5e5b89d18f 100644 --- a/xpcom/threads/nsThread.cpp +++ b/xpcom/threads/nsThread.cpp @@ -52,11 +52,6 @@ #define HAVE_SCHED_SETAFFINITY #endif -#ifdef XP_MACOSX -#include -#include -#endif - #ifdef MOZ_CANARY # include # include @@ -375,16 +370,6 @@ SetThreadAffinity(unsigned int cpu) sched_setaffinity(0, sizeof(cpus), &cpus); // Don't assert sched_setaffinity's return value because it intermittently (?) // fails with EINVAL on Linux x64 try runs. -#elif defined(XP_MACOSX) - // OS X does not provide APIs to pin threads to specific processors, but you - // can tag threads as belonging to the same "affinity set" and the OS will try - // to run them on the same processor. To run threads on different processors, - // tag them as belonging to different affinity sets. Tag 0, the default, means - // "no affinity" so let's pretend each CPU has its own tag `cpu+1`. - thread_affinity_policy_data_t policy; - policy.affinity_tag = cpu + 1; - MOZ_ALWAYS_TRUE(thread_policy_set(mach_thread_self(), THREAD_AFFINITY_POLICY, - &policy.affinity_tag, 1) == KERN_SUCCESS); #elif defined(XP_WIN) MOZ_ALWAYS_TRUE(SetThreadIdealProcessor(GetCurrentThread(), cpu) != -1); #endif