author | Ed Morley <emorley@mozilla.com> |
Mon, 02 Sep 2013 14:57:00 +0100 | |
changeset 145230 | d54e0cce6c17e334a483c13c910c04410cf63b13 |
parent 145229 | 616d5df5723faf95a2fc4c1245be6eb778a5083f (current diff) |
parent 145218 | 66991961691dc2d954f817b809b451283991a6ef (diff) |
child 145231 | ab9d8591f4dd57f906040c1a579cbedf005d0a98 |
child 145276 | 2fb0c9d14d464b467938b4af4851ae77ee1977d5 |
child 145287 | 0169b1c99f312bb1b01e4ad501eaa4b6d42f89ae |
child 155766 | c7e2dcb1a8eb85427cecfb6207cdb5f31b70349a |
push id | 33203 |
push user | emorley@mozilla.com |
push date | Mon, 02 Sep 2013 13:57:58 +0000 |
treeherder | mozilla-inbound@ab9d8591f4dd [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
milestone | 26.0a1 |
first release with | nightly linux32
d54e0cce6c17
/
26.0a1
/
20130903030201
/
files
nightly linux64
d54e0cce6c17
/
26.0a1
/
20130903030201
/
files
nightly mac
d54e0cce6c17
/
26.0a1
/
20130903030201
/
files
nightly win32
d54e0cce6c17
/
26.0a1
/
20130903030201
/
files
nightly win64
d54e0cce6c17
/
26.0a1
/
20130903030201
/
files
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
releases | nightly linux32
26.0a1
/
20130903030201
/
pushlog to previous
nightly linux64
26.0a1
/
20130903030201
/
pushlog to previous
nightly mac
26.0a1
/
20130903030201
/
pushlog to previous
nightly win32
26.0a1
/
20130903030201
/
pushlog to previous
nightly win64
26.0a1
/
20130903030201
/
pushlog to previous
|
dom/network/src/TCPSocketParent.h | file | annotate | diff | comparison | revisions | |
js/public/IdForward.h | file | annotate | diff | comparison | revisions |
--- a/browser/base/content/content.js +++ b/browser/base/content/content.js @@ -11,28 +11,16 @@ Cu.import("resource://gre/modules/XPCOMU XPCOMUtils.defineLazyModuleGetter(this, "LoginManagerContent", "resource://gre/modules/LoginManagerContent.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "InsecurePasswordUtils", "resource://gre/modules/InsecurePasswordUtils.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils", "resource://gre/modules/PrivateBrowsingUtils.jsm"); -// Bug 671101 - directly using webNavigation in this context -// causes docshells to leak -this.__defineGetter__("webNavigation", function () { - return docShell.QueryInterface(Ci.nsIWebNavigation); -}); - -addMessageListener("WebNavigation:LoadURI", function (message) { - let flags = message.json.flags || webNavigation.LOAD_FLAGS_NONE; - - webNavigation.loadURI(message.json.uri, flags, null, null, null); -}); - addMessageListener("Browser:HideSessionRestoreButton", function (message) { // Hide session restore button on about:home let doc = content.document; let container; if (doc.documentURI.toLowerCase() == "about:home" && (container = doc.getElementById("sessionRestoreContainer"))){ container.hidden = true; }
--- a/caps/idl/nsIPrincipal.idl +++ b/caps/idl/nsIPrincipal.idl @@ -3,17 +3,16 @@ * 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/. */ /* Defines the abstract interface for a principal. */ #include "nsISerializable.idl" %{C++ -struct JSContext; struct JSPrincipals; #include "nsCOMPtr.h" #include "nsTArray.h" %} interface nsIURI; interface nsIContentSecurityPolicy;
--- a/caps/include/nsScriptSecurityManager.h +++ b/caps/include/nsScriptSecurityManager.h @@ -13,23 +13,20 @@ #include "nsInterfaceHashtable.h" #include "nsHashtable.h" #include "nsCOMPtr.h" #include "nsIChannelEventSink.h" #include "nsIObserver.h" #include "pldhash.h" #include "plstr.h" #include "nsIScriptExternalNameSet.h" +#include "js/TypeDecls.h" #include <stdint.h> -namespace JS { -template <typename T> class Handle; -template <typename T> class MutableHandle; -} class nsIDocShell; class nsString; class nsIClassInfo; class nsIIOService; class nsIStringBundle; class nsSystemPrincipal; struct ClassPolicy; class ClassInfoData;
--- a/content/base/public/nsContentUtils.h +++ b/content/base/public/nsContentUtils.h @@ -13,16 +13,17 @@ #if defined(XP_WIN) || defined(XP_OS2) #include <float.h> #endif #if defined(SOLARIS) #include <ieeefp.h> #endif +#include "js/TypeDecls.h" #include "js/RootingAPI.h" #include "mozilla/Assertions.h" #include "mozilla/GuardObjects.h" #include "mozilla/TimeStamp.h" #include "nsContentListDeclarations.h" #include "nsMathUtils.h" class imgICache; @@ -87,31 +88,26 @@ class nsNodeInfoManager; class nsPIDOMWindow; class nsPresContext; class nsScriptObjectTracer; class nsStringHashKey; class nsTextFragment; class nsViewportInfo; class nsWrapperCache; -struct JSContext; struct JSPropertyDescriptor; struct JSRuntime; struct nsIntMargin; template<class E> class nsCOMArray; template<class E> class nsTArray; template<class K, class V> class nsDataHashtable; template<class K, class V> class nsRefPtrHashtable; template<class T> class nsReadingIterator; -namespace JS { -class Value; -} // namespace JS - namespace mozilla { class ErrorResult; class Selection; namespace dom { class DocumentFragment; class Element; class EventTarget;
--- a/content/base/public/nsINode.h +++ b/content/base/public/nsINode.h @@ -14,16 +14,17 @@ #include "nsIVariant.h" // for use in GetUserData() #include "nsNodeInfoManager.h" // for use in NodePrincipal() #include "nsPropertyTable.h" // for typedefs #include "nsTObserverArray.h" // for member #include "nsWindowMemoryReporter.h" // for NS_DECL_SIZEOF_EXCLUDING_THIS #include "mozilla/ErrorResult.h" #include "mozilla/MemoryReporting.h" #include "mozilla/dom/EventTarget.h" // for base class +#include "js/TypeDecls.h" // for Handle, Value, JSObject, JSContext // Including 'windows.h' will #define GetClassInfo to something else. #ifdef XP_WIN #ifdef GetClassInfo #undef GetClassInfo #endif #endif @@ -62,21 +63,16 @@ inline bool IsSpaceCharacter(char aChar) } class Element; class EventHandlerNonNull; class OnErrorEventHandlerNonNull; template<typename T> class Optional; } // namespace dom } // namespace mozilla -namespace JS { -class Value; -template<typename T> class Handle; -} - #define NODE_FLAG_BIT(n_) (1U << (WRAPPER_CACHE_FLAGS_BITS_USED + (n_))) enum { // This bit will be set if the node has a listener manager. NODE_HAS_LISTENERMANAGER = NODE_FLAG_BIT(0), // Whether this node has had any properties set on it NODE_HAS_PROPERTIES = NODE_FLAG_BIT(1),
--- a/content/base/src/nsFrameMessageManager.h +++ b/content/base/src/nsFrameMessageManager.h @@ -103,18 +103,16 @@ protected: StructuredCloneData UnpackClonedMessageDataForParent(const ClonedMessageData& aData); StructuredCloneData UnpackClonedMessageDataForChild(const ClonedMessageData& aData); } // namespace ipc } // namespace dom } // namespace mozilla class nsAXPCNativeCallContext; -struct JSContext; -class JSObject; struct nsMessageListenerInfo { // Exactly one of mStrongListener and mWeakListener must be non-null. nsCOMPtr<nsIMessageListener> mStrongListener; nsWeakPtr mWeakListener; nsCOMPtr<nsIAtom> mMessage; };
--- a/content/base/src/nsNodeUtils.h +++ b/content/base/src/nsNodeUtils.h @@ -3,20 +3,19 @@ * 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 nsNodeUtils_h___ #define nsNodeUtils_h___ #include "nsIContent.h" // for use in inline function (ParentChainChanged) #include "nsIMutationObserver.h" // for use in inline function (ParentChainChanged) +#include "js/TypeDecls.h" struct CharacterDataChangeInfo; -struct JSContext; -class JSObject; class nsIVariant; class nsIDOMNode; class nsIDOMUserDataHandler; template<class E> class nsCOMArray; class nsCycleCollectionTraversalCallback; class nsNodeUtils {
--- a/content/canvas/src/WebGLActiveInfo.h +++ b/content/canvas/src/WebGLActiveInfo.h @@ -4,22 +4,17 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef WEBGLACTIVEINFO_H_ #define WEBGLACTIVEINFO_H_ #include "WebGLTypes.h" #include "nsISupports.h" #include "nsString.h" - -struct JSContext; -class JSObject; -namespace JS { -template <typename T> class Handle; -} +#include "js/TypeDecls.h" namespace mozilla { class WebGLActiveInfo MOZ_FINAL { public: WebGLActiveInfo(WebGLint size, WebGLenum type, const nsACString& name) : mSize(size),
--- a/content/events/src/nsDOMEvent.h +++ b/content/events/src/nsDOMEvent.h @@ -13,22 +13,21 @@ #include "nsPIDOMWindow.h" #include "nsPoint.h" #include "nsGUIEvent.h" #include "nsCycleCollectionParticipant.h" #include "nsAutoPtr.h" #include "mozilla/dom/EventBinding.h" #include "nsIScriptGlobalObject.h" #include "Units.h" +#include "js/TypeDecls.h" class nsIContent; class nsIDOMEventTarget; class nsPresContext; -struct JSContext; -class JSObject; namespace mozilla { namespace dom { class EventTarget; } } // Dummy class so we can cast through it to get from nsISupports to
--- a/content/events/src/nsDOMUIEvent.cpp +++ b/content/events/src/nsDOMUIEvent.cpp @@ -343,17 +343,17 @@ nsDOMUIEvent::GetIsChar(bool* aIsChar) bool nsDOMUIEvent::IsChar() const { switch (mEvent->eventStructType) { case NS_KEY_EVENT: return static_cast<nsKeyEvent*>(mEvent)->isChar; case NS_TEXT_EVENT: - return static_cast<nsKeyEvent*>(mEvent)->isChar; + return static_cast<nsTextEvent*>(mEvent)->isChar; default: return false; } MOZ_CRASH("Switch handles all cases."); } NS_IMETHODIMP nsDOMUIEvent::DuplicatePrivateData()
--- a/content/html/content/public/nsIHTMLCollection.h +++ b/content/html/content/public/nsIHTMLCollection.h @@ -3,19 +3,18 @@ * 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 nsIHTMLCollection_h___ #define nsIHTMLCollection_h___ #include "nsIDOMHTMLCollection.h" #include "nsWrapperCache.h" +#include "js/TypeDecls.h" -struct JSContext; -class JSObject; class nsINode; class nsString; template<class> class nsTArray; namespace mozilla { class ErrorResult; namespace dom {
--- a/content/html/content/src/HTMLCanvasElement.cpp +++ b/content/html/content/src/HTMLCanvasElement.cpp @@ -1,16 +1,16 @@ /* -*- 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 "mozilla/dom/HTMLCanvasElement.h" -#include "BasicLayers.h" +#include "Layers.h" #include "imgIEncoder.h" #include "jsapi.h" #include "jsfriendapi.h" #include "mozilla/Base64.h" #include "mozilla/CheckedInt.h" #include "mozilla/dom/CanvasRenderingContext2D.h" #include "mozilla/dom/HTMLCanvasElementBinding.h" #include "mozilla/dom/UnionTypes.h"
--- a/content/html/content/src/HTMLMediaElement.cpp +++ b/content/html/content/src/HTMLMediaElement.cpp @@ -49,17 +49,17 @@ #include "nsIDOMHTMLVideoElement.h" #include "nsIContentPolicy.h" #include "nsContentPolicyUtils.h" #include "nsCrossSiteListenerProxy.h" #include "nsCycleCollectionParticipant.h" #include "nsICachingChannel.h" #include "nsLayoutUtils.h" #include "nsVideoFrame.h" -#include "BasicLayers.h" +#include "Layers.h" #include <limits> #include "nsIAsyncVerifyRedirectCallback.h" #include "nsIAppShell.h" #include "nsWidgetsCID.h" #include "nsIDOMNotifyAudioAvailableEvent.h" #include "nsMediaFragmentURIParser.h" #include "nsURIHashKey.h" #include "nsJSUtils.h"
--- a/content/html/content/src/ValidityState.h +++ b/content/html/content/src/ValidityState.h @@ -4,19 +4,17 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef mozilla_dom_ValidityState_h #define mozilla_dom_ValidityState_h #include "nsIDOMValidityState.h" #include "nsIConstraintValidation.h" #include "nsWrapperCache.h" - -class JSObject; -struct JSContext; +#include "js/TypeDecls.h" namespace mozilla { namespace dom { class ValidityState MOZ_FINAL : public nsIDOMValidityState, public nsWrapperCache { public:
--- a/content/media/AudioNodeEngineNEON.cpp +++ b/content/media/AudioNodeEngineNEON.cpp @@ -169,82 +169,58 @@ AudioBlockPanStereoToStereo_NEON(const f float aOutputL[WEBAUDIO_BLOCK_SIZE], float aOutputR[WEBAUDIO_BLOCK_SIZE]) { ASSERT_ALIGNED(aInputL); ASSERT_ALIGNED(aInputR); ASSERT_ALIGNED(aOutputL); ASSERT_ALIGNED(aOutputR); - float32x4_t vinL0, vinL1, vinL2, vinL3; - float32x4_t vinR0, vinR1, vinR2, vinR3; - float32x4_t voutL0, voutL1, voutL2, voutL3; - float32x4_t voutR0, voutR1, voutR2, voutR3; + float32x4_t vinL0, vinL1; + float32x4_t vinR0, vinR1; + float32x4_t voutL0, voutL1; + float32x4_t voutR0, voutR1; float32x4_t vscaleL = vmovq_n_f32(aGainL); float32x4_t vscaleR = vmovq_n_f32(aGainR); if (aIsOnTheLeft) { - for (uint32_t i = 0; i < WEBAUDIO_BLOCK_SIZE; i+=16) { + for (uint32_t i = 0; i < WEBAUDIO_BLOCK_SIZE; i+=8) { vinL0 = vld1q_f32(ADDRESS_OF(aInputL, i)); vinL1 = vld1q_f32(ADDRESS_OF(aInputL, i+4)); - vinL2 = vld1q_f32(ADDRESS_OF(aInputL, i+8)); - vinL3 = vld1q_f32(ADDRESS_OF(aInputL, i+12)); vinR0 = vld1q_f32(ADDRESS_OF(aInputR, i)); vinR1 = vld1q_f32(ADDRESS_OF(aInputR, i+4)); - vinR2 = vld1q_f32(ADDRESS_OF(aInputR, i+8)); - vinR3 = vld1q_f32(ADDRESS_OF(aInputR, i+12)); voutL0 = vmlaq_f32(vinL0, vinR0, vscaleL); voutL1 = vmlaq_f32(vinL1, vinR1, vscaleL); - voutL2 = vmlaq_f32(vinL2, vinR2, vscaleL); - voutL3 = vmlaq_f32(vinL3, vinR3, vscaleL); vst1q_f32(ADDRESS_OF(aOutputL, i), voutL0); vst1q_f32(ADDRESS_OF(aOutputL, i+4), voutL1); - vst1q_f32(ADDRESS_OF(aOutputL, i+8), voutL2); - vst1q_f32(ADDRESS_OF(aOutputL, i+12), voutL3); voutR0 = vmulq_f32(vinR0, vscaleR); voutR1 = vmulq_f32(vinR1, vscaleR); - voutR2 = vmulq_f32(vinR2, vscaleR); - voutR3 = vmulq_f32(vinR3, vscaleR); vst1q_f32(ADDRESS_OF(aOutputR, i), voutR0); vst1q_f32(ADDRESS_OF(aOutputR, i+4), voutR1); - vst1q_f32(ADDRESS_OF(aOutputR, i+8), voutR2); - vst1q_f32(ADDRESS_OF(aOutputR, i+12), voutR3); } } else { - for (uint32_t i = 0; i < WEBAUDIO_BLOCK_SIZE; i+=16) { + for (uint32_t i = 0; i < WEBAUDIO_BLOCK_SIZE; i+=8) { vinL0 = vld1q_f32(ADDRESS_OF(aInputL, i)); vinL1 = vld1q_f32(ADDRESS_OF(aInputL, i+4)); - vinL2 = vld1q_f32(ADDRESS_OF(aInputL, i+8)); - vinL3 = vld1q_f32(ADDRESS_OF(aInputL, i+12)); vinR0 = vld1q_f32(ADDRESS_OF(aInputR, i)); vinR1 = vld1q_f32(ADDRESS_OF(aInputR, i+4)); - vinR2 = vld1q_f32(ADDRESS_OF(aInputR, i+8)); - vinR3 = vld1q_f32(ADDRESS_OF(aInputR, i+12)); voutL0 = vmulq_f32(vinL0, vscaleL); voutL1 = vmulq_f32(vinL1, vscaleL); - voutL2 = vmulq_f32(vinL2, vscaleL); - voutL3 = vmulq_f32(vinL3, vscaleL); vst1q_f32(ADDRESS_OF(aOutputL, i), voutL0); vst1q_f32(ADDRESS_OF(aOutputL, i+4), voutL1); - vst1q_f32(ADDRESS_OF(aOutputL, i+8), voutL2); - vst1q_f32(ADDRESS_OF(aOutputL, i+12), voutL3); voutR0 = vmlaq_f32(vinR0, vinL0, vscaleR); voutR1 = vmlaq_f32(vinR1, vinL1, vscaleR); - voutR2 = vmlaq_f32(vinR2, vinL2, vscaleR); - voutR3 = vmlaq_f32(vinR3, vinL3, vscaleR); vst1q_f32(ADDRESS_OF(aOutputR, i), voutR0); vst1q_f32(ADDRESS_OF(aOutputR, i+4), voutR1); - vst1q_f32(ADDRESS_OF(aOutputR, i+8), voutR2); - vst1q_f32(ADDRESS_OF(aOutputR, i+12), voutR3); } } } -} \ No newline at end of file +}
--- a/content/media/webaudio/AudioBuffer.h +++ b/content/media/webaudio/AudioBuffer.h @@ -9,19 +9,17 @@ #include "nsWrapperCache.h" #include "nsCycleCollectionParticipant.h" #include "mozilla/Attributes.h" #include "EnableWebAudioCheck.h" #include "nsAutoPtr.h" #include "nsTArray.h" #include "AudioContext.h" - -struct JSContext; -class JSObject; +#include "js/TypeDecls.h" namespace mozilla { class ErrorResult; class ThreadSharedFloatArrayBufferList; namespace dom {
--- a/content/media/webaudio/AudioContext.h +++ b/content/media/webaudio/AudioContext.h @@ -12,25 +12,24 @@ #include "mozilla/Attributes.h" #include "mozilla/dom/TypedArray.h" #include "nsAutoPtr.h" #include "nsCOMPtr.h" #include "nsCycleCollectionParticipant.h" #include "nsDOMEventTargetHelper.h" #include "nsHashKeys.h" #include "nsTHashtable.h" +#include "js/TypeDecls.h" // X11 has a #define for CurrentTime. Unbelievable :-(. // See content/media/DOMMediaStream.h for more fun! #ifdef CurrentTime #undef CurrentTime #endif -struct JSContext; -class JSObject; class nsPIDOMWindow; namespace mozilla { class DOMMediaStream; class ErrorResult; class MediaStream; class MediaStreamGraph;
--- a/content/media/webaudio/AudioListener.h +++ b/content/media/webaudio/AudioListener.h @@ -11,18 +11,17 @@ #include "nsCycleCollectionParticipant.h" #include "mozilla/Attributes.h" #include "EnableWebAudioCheck.h" #include "nsAutoPtr.h" #include "ThreeDPoint.h" #include "AudioContext.h" #include "PannerNode.h" #include "WebAudioUtils.h" - -struct JSContext; +#include "js/TypeDecls.h" namespace mozilla { namespace dom { class AudioListener MOZ_FINAL : public nsWrapperCache, public EnableWebAudioCheck {
--- a/content/media/webaudio/AudioParam.h +++ b/content/media/webaudio/AudioParam.h @@ -10,18 +10,17 @@ #include "AudioParamTimeline.h" #include "nsWrapperCache.h" #include "nsCycleCollectionParticipant.h" #include "EnableWebAudioCheck.h" #include "nsAutoPtr.h" #include "AudioNode.h" #include "mozilla/dom/TypedArray.h" #include "WebAudioUtils.h" - -struct JSContext; +#include "js/TypeDecls.h" namespace mozilla { namespace dom { class AudioParam MOZ_FINAL : public nsWrapperCache, public EnableWebAudioCheck, public AudioParamTimeline
--- a/content/media/webaudio/DelayProcessor.cpp +++ b/content/media/webaudio/DelayProcessor.cpp @@ -33,19 +33,17 @@ DelayProcessor::Process(const double *aP const float* input = aInputChannels ? aInputChannels[channel] : nullptr; float* output = aOutputChannels[channel]; for (int i = 0; i < aFramesToProcess; ++i) { currentDelayFrames = clamped(aPerFrameDelays[i], 0.0, static_cast<double>(mMaxDelayFrames)); // Write the input sample to the correct location in our buffer - if (input) { - buffer[writeIndex] = input[i]; - } + buffer[writeIndex] = input ? input[i] : 0.0f; // Now, determine the correct read position. We adjust the read position to be // from currentDelayFrames frames in the past. We also interpolate the two input // frames in case the read position does not match an integer index. double readPosition = writeIndex + bufferLength - currentDelayFrames; if (readPosition >= bufferLength) { readPosition -= bufferLength; } @@ -104,17 +102,20 @@ DelayProcessor::EnsureBuffer(uint32_t aN { if (aNumberOfChannels == 0) { return false; } if (mBuffer.Length() == 0) { if (!mBuffer.SetLength(aNumberOfChannels)) { return false; } - const int numFrames = mMaxDelayFrames; + // The length of the buffer is one greater than the maximum delay so that + // writing an input frame does not overwrite the frame that would + // subsequently be read at maximum delay. + const int numFrames = mMaxDelayFrames + 1; for (uint32_t channel = 0; channel < aNumberOfChannels; ++channel) { if (!mBuffer[channel].SetLength(numFrames)) { return false; } PodZero(mBuffer[channel].Elements(), numFrames); } } else if (mBuffer.Length() != aNumberOfChannels) { // TODO: Handle changes in the channel count
--- a/content/media/webaudio/test/Makefile.in +++ b/content/media/webaudio/test/Makefile.in @@ -52,19 +52,21 @@ MOCHITEST_FILES := \ test_audioBufferSourceNodeNullBuffer.html \ test_badConnect.html \ test_biquadFilterNode.html \ test_channelMergerNode.html \ test_channelMergerNodeWithVolume.html \ test_channelSplitterNode.html \ test_channelSplitterNodeWithVolume.html \ test_convolverNode.html \ + test_convolverNodeWithGain.html \ test_convolverNode_mono_mono.html \ test_currentTime.html \ test_delayNode.html \ + test_delayNodeAtMax.html \ test_delayNodeSmallMaxDelay.html \ test_delayNodeWithGain.html \ test_dynamicsCompressorNode.html \ test_gainNode.html \ test_gainNodeInLoop.html \ test_maxChannelCount.html \ test_mediaDecoding.html \ test_decodeMultichannel.html \
new file mode 100644 --- /dev/null +++ b/content/media/webaudio/test/test_convolverNodeWithGain.html @@ -0,0 +1,62 @@ +<!DOCTYPE HTML> +<html> +<head> + <title>Test ConvolverNode after a GainNode - Bug 891254 </title> + <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> +</head> +<body> +<pre id="test"> +<script src="webaudio.js" type="text/javascript"></script> +<script class="testbody" type="text/javascript"> + +const signalLength = 2048; +const responseLength = 100; +const outputLength = 4096; // > signalLength + responseLength + +var gTest = { + length: outputLength, + numberOfChannels: 1, + createGraph: function(context) { + var buffer = context.createBuffer(1, signalLength, context.sampleRate); + for (var i = 0; i < signalLength; ++i) { + buffer.getChannelData(0)[i] = Math.sin(2 * Math.PI * i / signalLength); + } + + var source = context.createBufferSource(); + source.buffer = buffer; + source.start(0); + + var response = context.createBuffer(1, responseLength, context.sampleRate); + for (var i = 0; i < responseLength; ++i) { + response.getChannelData(0)[i] = i / responseLength; + } + + var gain = context.createGain(); + gain.gain.value = -1; + source.connect(gain); + + var convolver1 = context.createConvolver(); + convolver1.buffer = response; + gain.connect(convolver1); + + var convolver2 = context.createConvolver(); + convolver2.buffer = response; + source.connect(convolver2); + + // The output of convolver1 should be the inverse of convolver2, so blend + // them together and expect silence. + var blend = context.createGain(); + convolver1.connect(blend); + convolver2.connect(blend); + + return blend; + }, +}; + +runTest(); + +</script> +</pre> +</body> +</html>
new file mode 100644 --- /dev/null +++ b/content/media/webaudio/test/test_delayNodeAtMax.html @@ -0,0 +1,53 @@ +<!DOCTYPE HTML> +<html> +<head> + <title>Test DelayNode with maxDelayTime delay - bug 890528</title> + <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> +</head> +<body> +<pre id="test"> +<script src="webaudio.js" type="text/javascript"></script> +<script class="testbody" type="text/javascript"> + +const signalLength = 2048; +const delayLength = 1000; // Not on a block boundary +const outputLength = 4096 // > signalLength + 2 * delayLength; + +function applySignal(buffer, offset) { + for (var i = 0; i < signalLength; ++i) { + buffer.getChannelData(0)[offset + i] = Math.cos(Math.PI * i / signalLength); + } +} + +var gTest = { + numberOfChannels: 1, + createGraph: function(context) { + var buffer = context.createBuffer(1, signalLength, context.sampleRate); + applySignal(buffer, 0); + + var source = context.createBufferSource(); + source.buffer = buffer; + + const delayTime = delayLength / context.sampleRate; + var delay = context.createDelay(delayTime); + delay.delayTime.value = delayTime; + + source.connect(delay); + + source.start(0); + return delay; + }, + createExpectedBuffers: function(context) { + var expectedBuffer = context.createBuffer(1, outputLength, context.sampleRate); + applySignal(expectedBuffer, delayLength); + return expectedBuffer; + }, +}; + +runTest(); + +</script> +</pre> +</body> +</html>
--- a/content/media/webaudio/test/webaudio.js +++ b/content/media/webaudio/test/webaudio.js @@ -63,35 +63,41 @@ function compareBuffers(buf1, buf2, function getEmptyBuffer(context, length) { return context.createBuffer(gTest.numberOfChannels, length, context.sampleRate); } /** * This function assumes that the test file defines a single gTest variable with * the following properties and methods: * - * + length: mandatory property equal to the total number of frames which we - * are waiting to see in the output. * + numberOfChannels: optional property which specifies the number of channels * in the output. The default value is 2. * + createGraph: mandatory method which takes a context object and does * everything needed in order to set up the Web Audio graph. * This function returns the node to be inspected. * + createGraphAsync: async version of createGraph. This function takes * a callback which should be called with an argument * set to the node to be inspected when the callee is * ready to proceed with the test. Either this function * or createGraph must be provided. * + createExpectedBuffers: optional method which takes a context object and * returns either one expected buffer or an array of * them, designating what is expected to be observed * in the output. If omitted, the output is expected - * to be silence. The sum of the length of the expected - * buffers should be equal to gTest.length. This - * function is guaranteed to be called before createGraph. + * to be silence. All buffers must have the same + * length, which must be a bufferSize supported by + * ScriptProcessorNode. This function is guaranteed + * to be called before createGraph. + * + length: property equal to the total number of frames which we are waiting + * to see in the output, mandatory if createExpectedBuffers is not + * provided, in which case it must be a bufferSize supported by + * ScriptProcessorNode (256, 512, 1024, 2048, 4096, 8192, or 16384). + * If createExpectedBuffers is provided then this must be equal to + * the number of expected buffers * the expected buffer length. + * * + skipOfflineContextTests: optional. when true, skips running tests on an offline * context by circumventing testOnOfflineContext. */ function runTest() { function done() { SimpleTest.finish(); } @@ -115,17 +121,19 @@ function runTest() expectedBuffers = [expectedBuffers]; } var expectedFrames = 0; for (var i = 0; i < expectedBuffers.length; ++i) { is(expectedBuffers[i].numberOfChannels, gTest.numberOfChannels, "Correct number of channels for expected buffer " + i); expectedFrames += expectedBuffers[i].length; } - is(expectedFrames, gTest.length, "Correct number of expected frames"); + if (gTest.length && gTest.createExpectedBuffers) { + is(expectedFrames, gTest.length, "Correct number of expected frames"); + } if (gTest.createGraphAsync) { gTest.createGraphAsync(context, function(nodeToInspect) { testOutput(nodeToInspect, expectedBuffers, callback); }); } else { testOutput(gTest.createGraph(context), expectedBuffers, callback); }
--- a/content/media/webspeech/recognition/SpeechGrammar.h +++ b/content/media/webspeech/recognition/SpeechGrammar.h @@ -5,24 +5,23 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #pragma once #include "nsCOMPtr.h" #include "nsCycleCollectionParticipant.h" #include "nsString.h" #include "nsWrapperCache.h" +#include "js/TypeDecls.h" #include "mozilla/Attributes.h" #include "mozilla/ErrorResult.h" #include "EnableWebSpeechRecognitionCheck.h" -struct JSContext; - namespace mozilla { namespace dom { class GlobalObject; class SpeechGrammar MOZ_FINAL : public nsISupports, public nsWrapperCache, public EnableWebSpeechRecognitionCheck
--- a/content/media/webspeech/recognition/SpeechGrammarList.h +++ b/content/media/webspeech/recognition/SpeechGrammarList.h @@ -4,25 +4,24 @@ * 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/. */ #pragma once #include "nsCOMPtr.h" #include "nsCycleCollectionParticipant.h" #include "nsWrapperCache.h" +#include "js/TypeDecls.h" #include "mozilla/Attributes.h" #include "mozilla/dom/BindingUtils.h" #include "EnableWebSpeechRecognitionCheck.h" #include "SpeechGrammar.h" -struct JSContext; - namespace mozilla { namespace dom { class GlobalObject; class SpeechGrammarList MOZ_FINAL : public nsISupports, public nsWrapperCache, public EnableWebSpeechRecognitionCheck {
--- a/content/media/webspeech/recognition/SpeechRecognition.h +++ b/content/media/webspeech/recognition/SpeechRecognition.h @@ -7,16 +7,17 @@ #pragma once #include "mozilla/Attributes.h" #include "nsCOMPtr.h" #include "nsDOMEventTargetHelper.h" #include "nsString.h" #include "nsWrapperCache.h" #include "nsTArray.h" +#include "js/TypeDecls.h" #include "nsIDOMNavigatorUserMedia.h" #include "nsITimer.h" #include "MediaEngine.h" #include "MediaStreamGraph.h" #include "AudioSegment.h" #include "mozilla/WeakPtr.h" #include "mozilla/Preferences.h" @@ -25,17 +26,16 @@ #include "SpeechGrammarList.h" #include "SpeechRecognitionResultList.h" #include "SpeechStreamListener.h" #include "nsISpeechRecognitionService.h" #include "endpointer.h" #include "mozilla/dom/SpeechRecognitionError.h" -struct JSContext; class nsIDOMWindow; namespace mozilla { namespace dom { #define TEST_PREFERENCE_ENABLE "media.webspeech.test.enable" #define TEST_PREFERENCE_FAKE_FSM_EVENTS "media.webspeech.test.fake_fsm_events"
--- a/content/media/webspeech/recognition/SpeechRecognitionAlternative.h +++ b/content/media/webspeech/recognition/SpeechRecognitionAlternative.h @@ -5,23 +5,22 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #pragma once #include "nsCycleCollectionParticipant.h" #include "nsString.h" #include "nsWrapperCache.h" #include "nsAutoPtr.h" +#include "js/TypeDecls.h" #include "mozilla/Attributes.h" #include "EnableWebSpeechRecognitionCheck.h" -struct JSContext; - namespace mozilla { namespace dom { class SpeechRecognition; class SpeechRecognitionAlternative MOZ_FINAL : public nsISupports, public nsWrapperCache, public EnableWebSpeechRecognitionCheck
--- a/content/media/webspeech/recognition/SpeechRecognitionResult.h +++ b/content/media/webspeech/recognition/SpeechRecognitionResult.h @@ -6,24 +6,23 @@ #pragma once #include "nsCOMPtr.h" #include "nsCycleCollectionParticipant.h" #include "nsWrapperCache.h" #include "nsAutoPtr.h" #include "nsTArray.h" +#include "js/TypeDecls.h" #include "mozilla/Attributes.h" #include "EnableWebSpeechRecognitionCheck.h" #include "SpeechRecognitionAlternative.h" -struct JSContext; - namespace mozilla { namespace dom { class SpeechRecognitionResult MOZ_FINAL : public nsISupports, public nsWrapperCache, public EnableWebSpeechRecognitionCheck { public:
--- a/content/media/webspeech/recognition/SpeechRecognitionResultList.h +++ b/content/media/webspeech/recognition/SpeechRecognitionResultList.h @@ -5,24 +5,23 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #pragma once #include "nsCycleCollectionParticipant.h" #include "nsWrapperCache.h" #include "nsAutoPtr.h" #include "nsTArray.h" +#include "js/TypeDecls.h" #include "mozilla/Attributes.h" #include "EnableWebSpeechRecognitionCheck.h" #include "SpeechRecognitionResult.h" -struct JSContext; - namespace mozilla { namespace dom { class SpeechRecognition; class SpeechRecognitionResultList MOZ_FINAL : public nsISupports, public nsWrapperCache, public EnableWebSpeechRecognitionCheck
--- a/content/media/webspeech/synth/SpeechSynthesis.h +++ b/content/media/webspeech/synth/SpeechSynthesis.h @@ -5,22 +5,22 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #pragma once #include "nsCOMPtr.h" #include "nsString.h" #include "nsWrapperCache.h" #include "nsRefPtrHashtable.h" +#include "js/TypeDecls.h" #include "EnableSpeechSynthesisCheck.h" #include "SpeechSynthesisUtterance.h" #include "SpeechSynthesisVoice.h" -struct JSContext; class nsIDOMWindow; namespace mozilla { namespace dom { class nsSpeechTask; class SpeechSynthesis MOZ_FINAL : public nsISupports,
--- a/content/media/webspeech/synth/SpeechSynthesisUtterance.h +++ b/content/media/webspeech/synth/SpeechSynthesisUtterance.h @@ -4,22 +4,21 @@ * 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/. */ #pragma once #include "nsCOMPtr.h" #include "nsDOMEventTargetHelper.h" #include "nsString.h" +#include "js/TypeDecls.h" #include "EnableSpeechSynthesisCheck.h" #include "nsSpeechTask.h" -struct JSContext; - namespace mozilla { namespace dom { class SpeechSynthesisVoice; class SpeechSynthesis; class nsSynthVoiceRegistry; class SpeechSynthesisUtterance MOZ_FINAL : public nsDOMEventTargetHelper,
--- a/content/media/webspeech/synth/SpeechSynthesisVoice.h +++ b/content/media/webspeech/synth/SpeechSynthesisVoice.h @@ -4,22 +4,21 @@ * 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/. */ #pragma once #include "nsCOMPtr.h" #include "nsString.h" #include "nsWrapperCache.h" +#include "js/TypeDecls.h" #include "EnableSpeechSynthesisCheck.h" #include "nsISpeechService.h" -struct JSContext; - namespace mozilla { namespace dom { class nsSynthVoiceRegistry; class SpeechSynthesis; class SpeechSynthesisVoice MOZ_FINAL : public nsISupports, public nsWrapperCache,
--- a/content/xbl/src/nsXBLBinding.h +++ b/content/xbl/src/nsXBLBinding.h @@ -10,34 +10,33 @@ #include "nsCOMPtr.h" #include "nsAutoPtr.h" #include "nsINodeList.h" #include "nsIStyleRuleProcessor.h" #include "nsClassHashtable.h" #include "nsTArray.h" #include "nsCycleCollectionParticipant.h" #include "nsISupportsImpl.h" +#include "js/TypeDecls.h" class nsXBLPrototypeBinding; class nsIContent; class nsIAtom; class nsIDocument; class nsIScriptContext; namespace mozilla { namespace dom { class XBLChildrenElement; } } class nsAnonymousContentList; -struct JSContext; -class JSObject; // *********************************************************************/ // The XBLBinding class class nsXBLBinding { public: nsXBLBinding(nsXBLPrototypeBinding* aProtoBinding);
--- a/content/xbl/src/nsXBLPrototypeHandler.h +++ b/content/xbl/src/nsXBLPrototypeHandler.h @@ -10,31 +10,27 @@ #include "nsString.h" #include "nsCOMPtr.h" #include "nsIController.h" #include "nsAutoPtr.h" #include "nsXBLEventHandler.h" #include "nsIWeakReference.h" #include "nsIScriptGlobalObject.h" #include "nsCycleCollectionParticipant.h" +#include "js/TypeDecls.h" -class JSObject; class nsIDOMEvent; class nsIContent; class nsIDOMUIEvent; class nsIDOMKeyEvent; class nsIDOMMouseEvent; class nsIObjectInputStream; class nsIObjectOutputStream; class nsXBLPrototypeBinding; -namespace JS { -template <typename T> class MutableHandle; -} - namespace mozilla { namespace dom { class EventTarget; } } #define NS_HANDLER_TYPE_XBL_JS (1 << 0) #define NS_HANDLER_TYPE_XBL_COMMAND (1 << 1)
--- a/content/xbl/src/nsXBLSerialize.h +++ b/content/xbl/src/nsXBLSerialize.h @@ -4,21 +4,17 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef nsXBLSerialize_h__ #define nsXBLSerialize_h__ #include "nsIObjectInputStream.h" #include "nsIObjectOutputStream.h" #include "nsINameSpaceManager.h" - -namespace JS { -template <typename T> class Handle; -template <typename T> class MutableHandle; -} +#include "js/TypeDecls.h" typedef uint8_t XBLBindingSerializeDetails; // A version number to ensure we don't load cached data in a different // file format. #define XBLBinding_Serialize_Version 0x00000002 // Set for the first binding in a document
--- a/content/xul/document/src/XULDocument.h +++ b/content/xul/document/src/XULDocument.h @@ -20,32 +20,33 @@ #include "nsIURI.h" #include "nsIXULDocument.h" #include "nsScriptLoader.h" #include "nsIStreamListener.h" #include "nsICSSLoaderObserver.h" #include "mozilla/Attributes.h" +#include "js/TypeDecls.h" + class nsIRDFResource; class nsIRDFService; class nsPIWindowRoot; #if 0 // XXXbe save me, scc (need NSCAP_FORWARD_DECL(nsXULPrototypeScript)) class nsIObjectInputStream; class nsIObjectOutputStream; class nsIXULPrototypeScript; #else #include "nsIObjectInputStream.h" #include "nsIObjectOutputStream.h" #include "nsXULElement.h" #endif #include "nsURIHashKey.h" #include "nsInterfaceHashtable.h" -class JSObject; struct JSTracer; struct PRLogModuleInfo; class nsRefMapEntry : public nsStringHashKey { public: nsRefMapEntry(const nsAString& aKey) : nsStringHashKey(&aKey)
--- a/docshell/base/nsIDocShell.idl +++ b/docshell/base/nsIDocShell.idl @@ -4,19 +4,19 @@ * 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 "domstubs.idl" #include "nsIDocShellTreeItem.idl" #include "nsIAtom.idl" %{ C++ +#include "js/TypeDecls.h" class nsPresContext; class nsIPresShell; -struct JSContext; %} /** * The nsIDocShell interface. */ [ptr] native nsPresContext(nsPresContext); [ptr] native nsIPresShell(nsIPresShell);
--- a/dom/base/nsIGlobalObject.h +++ b/dom/base/nsIGlobalObject.h @@ -3,18 +3,17 @@ * 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 nsIGlobalObject_h__ #define nsIGlobalObject_h__ #include "nsISupports.h" #include "nsIScriptObjectPrincipal.h" - -class JSObject; +#include "js/TypeDecls.h" #define NS_IGLOBALOBJECT_IID \ { 0x8503e9a9, 0x530, 0x4b26, \ { 0xae, 0x24, 0x18, 0xca, 0x38, 0xe5, 0xed, 0x17 } } class nsIGlobalObject : public nsIScriptObjectPrincipal { public:
--- a/dom/base/nsIScriptGlobalObject.h +++ b/dom/base/nsIScriptGlobalObject.h @@ -5,21 +5,21 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef nsIScriptGlobalObject_h__ #define nsIScriptGlobalObject_h__ #include "nsISupports.h" #include "nsEvent.h" #include "nsIGlobalObject.h" +#include "js/TypeDecls.h" class nsIScriptContext; class nsScriptErrorEvent; class nsIScriptGlobalObject; -class JSObject; // A helper function for nsIScriptGlobalObject implementations to use // when handling a script error. Generally called by the global when a context // notifies it of an error via nsIScriptGlobalObject::HandleScriptError. // Returns true if HandleDOMEvent was actually called, in which case // aStatus will be filled in with the status. bool NS_HandleScriptError(nsIScriptGlobalObject *aScriptGlobal,
--- a/dom/base/nsIScriptTimeoutHandler.h +++ b/dom/base/nsIScriptTimeoutHandler.h @@ -2,20 +2,18 @@ /* vim: set ts=2 sw=2 et tw=80: */ /* 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 nsIScriptTimeoutHandler_h___ #define nsIScriptTimeoutHandler_h___ #include "nsTArray.h" +#include "js/TypeDecls.h" -namespace JS { -class Value; -} // namespace JS namespace mozilla { namespace dom { class Function; } // namespace dom } // namespace mozilla #define NS_ISCRIPTTIMEOUTHANDLER_IID \ { 0x53c8e80e, 0xcc78, 0x48bc, \
--- a/dom/base/nsLocation.h +++ b/dom/base/nsLocation.h @@ -7,20 +7,20 @@ #ifndef nsLocation_h__ #define nsLocation_h__ #include "nsIDOMLocation.h" #include "nsString.h" #include "nsIWeakReferenceUtils.h" #include "nsWrapperCache.h" #include "nsCycleCollectionParticipant.h" +#include "js/TypeDecls.h" class nsIURI; class nsIDocShell; -struct JSContext; class nsIDocShellLoadInfo; //***************************************************************************** // nsLocation: Script "location" object //***************************************************************************** class nsLocation : public nsIDOMLocation , public nsWrapperCache
--- a/dom/base/nsPIDOMWindow.h +++ b/dom/base/nsPIDOMWindow.h @@ -9,39 +9,35 @@ #define nsPIDOMWindow_h__ #include "nsIDOMWindow.h" #include "nsCOMPtr.h" #include "nsAutoPtr.h" #include "nsTArray.h" #include "mozilla/dom/EventTarget.h" +#include "js/TypeDecls.h" #define DOM_WINDOW_DESTROYED_TOPIC "dom-window-destroyed" #define DOM_WINDOW_FROZEN_TOPIC "dom-window-frozen" #define DOM_WINDOW_THAWED_TOPIC "dom-window-thawed" -class JSObject; class nsIArray; class nsIContent; class nsIDocShell; class nsIDocument; class nsIIdleObserver; class nsIPrincipal; class nsIScriptTimeoutHandler; class nsIURI; class nsPerformance; class nsPIWindowRoot; class nsXBLPrototypeHandler; struct nsTimeout; -namespace JS { -template<typename> class Handle; -} - namespace mozilla { namespace dom { class AudioContext; class Element; } } // Popup control state enum. The values in this enum must go from most
--- a/dom/base/nsPIWindowRoot.h +++ b/dom/base/nsPIWindowRoot.h @@ -8,17 +8,16 @@ #define nsPIWindowRoot_h__ #include "nsISupports.h" #include "mozilla/dom/EventTarget.h" class nsPIDOMWindow; class nsIControllers; class nsIController; -struct JSContext; #define NS_IWINDOWROOT_IID \ { 0x3f71f50c, 0xa7e0, 0x43bc, \ { 0xac, 0x25, 0x4d, 0xbb, 0x88, 0x7b, 0x21, 0x09 } } class nsPIWindowRoot : public mozilla::dom::EventTarget { public:
--- a/dom/base/nsPerformance.h +++ b/dom/base/nsPerformance.h @@ -7,21 +7,20 @@ #include "nsCOMPtr.h" #include "nsAutoPtr.h" #include "mozilla/Attributes.h" #include "nsWrapperCache.h" #include "nsDOMNavigationTiming.h" #include "nsContentUtils.h" #include "nsIDOMWindow.h" +#include "js/TypeDecls.h" class nsITimedChannel; class nsPerformance; -class JSObject; -struct JSContext; // Script "performance.timing" object class nsPerformanceTiming MOZ_FINAL : public nsWrapperCache { public: nsPerformanceTiming(nsPerformance* aPerformance, nsITimedChannel* aChannel); NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(nsPerformanceTiming)
--- a/dom/base/nsWrapperCache.h +++ b/dom/base/nsWrapperCache.h @@ -8,18 +8,16 @@ #include "nsCycleCollectionParticipant.h" #include "mozilla/Assertions.h" #include "js/Id.h" // must come before js/RootingAPI.h #include "js/Value.h" // must come before js/RootingAPI.h #include "js/RootingAPI.h" struct JSTracer; -class JSObject; -struct JSContext; class XPCWrappedNativeScope; namespace mozilla { namespace dom { namespace workers { class DOMBindingBase;
--- a/dom/bindings/BindingDeclarations.h +++ b/dom/bindings/BindingDeclarations.h @@ -18,18 +18,16 @@ #include "js/RootingAPI.h" #include "mozilla/Maybe.h" #include "nsCOMPtr.h" #include "nsDOMString.h" #include "nsStringBuffer.h" #include "nsTArray.h" #include "nsAutoPtr.h" // for nsRefPtr member variables -struct JSContext; -class JSObject; class nsWrapperCache; // nsGlobalWindow implements nsWrapperCache, but doesn't always use it. Don't // try to use it without fixing that first. class nsGlobalWindow; namespace mozilla { namespace dom {
--- a/dom/bindings/Date.h +++ b/dom/bindings/Date.h @@ -4,23 +4,17 @@ * 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/. */ /* Representation for dates. */ #ifndef mozilla_dom_Date_h #define mozilla_dom_Date_h -class JSObject; -struct JSContext; - -namespace JS { -class Value; -template<typename> class MutableHandle; -} // namespace JS +#include "js/TypeDecls.h" namespace mozilla { namespace dom { class Date { public: // Not inlining much here to avoid the includes we'd need.
--- a/dom/bindings/ErrorResult.h +++ b/dom/bindings/ErrorResult.h @@ -13,18 +13,16 @@ #include <stdarg.h> #include "js/Value.h" #include "nscore.h" #include "nsStringGlue.h" #include "mozilla/Assertions.h" -struct JSContext; - namespace mozilla { namespace dom { enum ErrNum { #define MSG_DEF(_name, _argc, _str) \ _name, #include "mozilla/dom/Errors.msg"
--- a/dom/bluetooth/BluetoothUtils.h +++ b/dom/bluetooth/BluetoothUtils.h @@ -3,19 +3,17 @@ /* 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_bluetooth_bluetoothutils_h__ #define mozilla_dom_bluetooth_bluetoothutils_h__ #include "BluetoothCommon.h" - -struct JSContext; -class JSObject; +#include "js/TypeDecls.h" BEGIN_BLUETOOTH_NAMESPACE class BluetoothNamedValue; class BluetoothValue; class BluetoothReplyRunnable; bool
--- a/dom/cellbroadcast/src/CellBroadcast.h +++ b/dom/cellbroadcast/src/CellBroadcast.h @@ -5,19 +5,17 @@ #ifndef mozilla_dom_CellBroadcast_h__ #define mozilla_dom_CellBroadcast_h__ #include "mozilla/Attributes.h" #include "mozilla/ErrorResult.h" #include "nsDOMEventTargetHelper.h" #include "nsICellBroadcastProvider.h" - -class JSObject; -struct JSContext; +#include "js/TypeDecls.h" class nsPIDOMWindow; namespace mozilla { namespace dom { class CellBroadcast MOZ_FINAL : public nsDOMEventTargetHelper {
--- a/dom/interfaces/base/nsIDOMHistory.idl +++ b/dom/interfaces/base/nsIDOMHistory.idl @@ -1,16 +1,12 @@ /* -*- Mode: IDL; 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 "domstubs.idl" -%{ C++ -struct JSContext; -%} - [scriptable, uuid(55226663-fe68-48ba-addf-08e32eaab569)] interface nsIDOMHistory : nsISupports { // Empty interface that exists only for extension backwards compat };
--- a/dom/interfaces/base/nsIStructuredCloneContainer.idl +++ b/dom/interfaces/base/nsIStructuredCloneContainer.idl @@ -6,17 +6,17 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "nsISupports.idl" interface nsIVariant; interface nsIDocument; %{C++ -struct JSContext; +#include "js/TypeDecls.h" %} /** * This interface acts as a container for an object serialized using the * structured clone algorithm. * * You can copy an object into an nsIStructuredCloneContainer using * initFromVariant or initFromBase64. It's an error to initialize an
--- a/dom/interfaces/events/nsIDOMEventTarget.idl +++ b/dom/interfaces/events/nsIDOMEventTarget.idl @@ -3,29 +3,29 @@ * 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 "domstubs.idl" %{C++ #include "nsEvent.h" #include "mozilla/dom/Nullable.h" +#include "js/TypeDecls.h" using mozilla::dom::Nullable; namespace mozilla { namespace dom { class EventTarget; } // namespace dom } // namespace mozilla class nsPresContext; class nsEventChainPreVisitor; class nsEventChainPostVisitor; -struct JSContext; class nsEventListenerManager; %} /** * The nsIDOMEventTarget interface is the interface implemented by all * event targets in the Document Object Model. * * For more information on this interface please see
--- a/dom/interfaces/json/nsIJSON.idl +++ b/dom/interfaces/json/nsIJSON.idl @@ -8,17 +8,17 @@ interface nsIInputStream; interface nsIOutputStream; interface nsIScriptGlobalObject; [ptr] native JSValPtr(JS::Value); [ptr] native JSContext(JSContext); %{C++ -namespace JS { class Value; } +#include "js/TypeDecls.h" %} /** * Don't use this! Use JSON.parse and JSON.stringify directly. */ [scriptable, uuid(083aebb0-7790-43b2-ae81-9e404e626236)] interface nsIJSON : nsISupports {
--- a/dom/ipc/TabChild.cpp +++ b/dom/ipc/TabChild.cpp @@ -3,17 +3,17 @@ /* 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 "base/basictypes.h" #include "TabChild.h" -#include "BasicLayers.h" +#include "Layers.h" #include "Blob.h" #include "ContentChild.h" #include "IndexedDBChild.h" #include "mozilla/ClearOnShutdown.h" #include "mozilla/IntentionalCrash.h" #include "mozilla/docshell/OfflineCacheUpdateChild.h" #include "mozilla/dom/PContentChild.h" #include "mozilla/dom/PContentDialogChild.h"
--- a/dom/ipc/TabParent.h +++ b/dom/ipc/TabParent.h @@ -17,20 +17,19 @@ #include "nsCOMPtr.h" #include "nsIAuthPromptProvider.h" #include "nsIBrowserDOMWindow.h" #include "nsIDialogParamBlock.h" #include "nsISecureBrowserUI.h" #include "nsITabParent.h" #include "nsWeakReference.h" #include "Units.h" +#include "js/TypeDecls.h" struct gfxMatrix; -struct JSContext; -class JSObject; class mozIApplication; class nsFrameLoader; class nsIURI; class CpowHolder; namespace mozilla { namespace layers {
--- a/dom/network/src/TCPServerSocketChild.h +++ b/dom/network/src/TCPServerSocketChild.h @@ -6,18 +6,16 @@ #include "nsITCPServerSocketChild.h" #include "nsCycleCollectionParticipant.h" #include "nsCOMPtr.h" #define TCPSERVERSOCKETCHILD_CID \ { 0x41a77ec8, 0xfd86, 0x409e, { 0xae, 0xa9, 0xaf, 0x2c, 0xa4, 0x07, 0xef, 0x8e } } class nsITCPServerSocketInternal; -struct JSContext; -struct JSObject; namespace mozilla { namespace dom { class TCPServerSocketChildBase : public nsITCPServerSocketChild { public: NS_DECL_CYCLE_COLLECTION_CLASS(TCPServerSocketChildBase) NS_DECL_CYCLE_COLLECTING_ISUPPORTS
--- a/dom/network/src/TCPServerSocketParent.h +++ b/dom/network/src/TCPServerSocketParent.h @@ -5,19 +5,16 @@ #include "mozilla/net/PNeckoParent.h" #include "mozilla/net/PTCPServerSocketParent.h" #include "nsITCPSocketParent.h" #include "nsITCPServerSocketParent.h" #include "nsCycleCollectionParticipant.h" #include "nsCOMPtr.h" #include "nsIDOMTCPSocket.h" -struct JSContext; -struct JSObject; - namespace mozilla { namespace dom { class PBrowserParent; class TCPServerSocketParent : public mozilla::net::PTCPServerSocketParent , public nsITCPServerSocketParent {
--- a/dom/network/src/TCPSocketChild.h +++ b/dom/network/src/TCPSocketChild.h @@ -1,23 +1,22 @@ /* 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/net/PTCPSocketChild.h" #include "nsITCPSocketChild.h" #include "nsCycleCollectionParticipant.h" #include "nsCOMPtr.h" +#include "js/TypeDecls.h" #define TCPSOCKETCHILD_CID \ { 0xa589d96f, 0x7e09, 0x4edf, { 0xa0, 0x1a, 0xeb, 0x49, 0x51, 0xf4, 0x2f, 0x37 } } class nsITCPSocketInternal; -struct JSContext; -class JSObject; namespace mozilla { namespace dom { class TCPSocketChildBase : public nsITCPSocketChild { public: NS_DECL_CYCLE_COLLECTION_CLASS(TCPSocketChildBase) NS_DECL_CYCLE_COLLECTING_ISUPPORTS
--- a/dom/network/src/TCPSocketParent.h +++ b/dom/network/src/TCPSocketParent.h @@ -2,19 +2,17 @@ * 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/net/PTCPSocketParent.h" #include "nsITCPSocketParent.h" #include "nsCycleCollectionParticipant.h" #include "nsCOMPtr.h" #include "nsIDOMTCPSocket.h" - -struct JSContext; -class JSObject; +#include "js/TypeDecls.h" #define TCPSOCKETPARENT_CID \ { 0x4e7246c6, 0xa8b3, 0x426d, { 0x9c, 0x17, 0x76, 0xda, 0xb1, 0xe1, 0xe1, 0x4a } } namespace mozilla { namespace dom { class PBrowserParent;
--- a/dom/plugins/base/nsNPAPIPluginInstance.h +++ b/dom/plugins/base/nsNPAPIPluginInstance.h @@ -11,32 +11,31 @@ #include "nsPIDOMWindow.h" #include "nsITimer.h" #include "nsIPluginTagInfo.h" #include "nsIURI.h" #include "nsIChannel.h" #include "nsInterfaceHashtable.h" #include "nsHashKeys.h" #include <prinrval.h> +#include "js/TypeDecls.h" #ifdef MOZ_WIDGET_ANDROID #include "nsAutoPtr.h" #include "nsIRunnable.h" #include "GLContext.h" #include "nsSurfaceTexture.h" #include "AndroidBridge.h" #include <map> class PluginEventRunnable; class SharedPluginTexture; #endif #include "mozilla/TimeStamp.h" #include "mozilla/PluginLibrary.h" -class JSObject; - class nsPluginStreamListenerPeer; // browser-initiated stream class class nsNPAPIPluginStreamListener; // plugin-initiated stream class class nsIPluginInstanceOwner; class nsIOutputStream; class nsPluginInstanceOwner; #if defined(OS_WIN) const NPDrawingModel kDefaultDrawingModel = NPDrawingModelSyncWin;
--- a/dom/promise/Promise.h +++ b/dom/promise/Promise.h @@ -10,18 +10,17 @@ #include "mozilla/Attributes.h" #include "mozilla/ErrorResult.h" #include "mozilla/dom/BindingDeclarations.h" #include "nsCycleCollectionParticipant.h" #include "mozilla/dom/PromiseBinding.h" #include "nsWrapperCache.h" #include "nsAutoPtr.h" #include "nsPIDOMWindow.h" - -struct JSContext; +#include "js/TypeDecls.h" namespace mozilla { namespace dom { class PromiseInit; class PromiseCallback; class AnyCallback; class PromiseResolver;
--- a/dom/promise/PromiseResolver.h +++ b/dom/promise/PromiseResolver.h @@ -7,18 +7,17 @@ #ifndef mozilla_dom_PromiseResolver_h #define mozilla_dom_PromiseResolver_h #include "mozilla/dom/Promise.h" #include "mozilla/Attributes.h" #include "mozilla/dom/BindingDeclarations.h" #include "nsCycleCollectionParticipant.h" #include "nsWrapperCache.h" - -struct JSContext; +#include "js/TypeDecls.h" namespace mozilla { namespace dom { class PromiseResolver MOZ_FINAL : public nsWrapperCache { friend class PromiseResolverTask; friend class WrapperPromiseCallback;
--- a/dom/src/geolocation/nsGeoPosition.h +++ b/dom/src/geolocation/nsGeoPosition.h @@ -9,18 +9,17 @@ #include "nsAutoPtr.h" #include "nsIDOMGeoPositionCoords.h" #include "nsIDOMGeoPosition.h" #include "nsString.h" #include "mozilla/Attributes.h" #include "nsCycleCollectionParticipant.h" #include "nsWrapperCache.h" #include "mozilla/dom/Nullable.h" - -struct JSContext; +#include "js/TypeDecls.h" //////////////////////////////////////////////////// // nsGeoPositionCoords //////////////////////////////////////////////////// /** * Simple object that holds a single point in space. */
--- a/dom/workers/test/Makefile.in +++ b/dom/workers/test/Makefile.in @@ -88,32 +88,38 @@ MOCHITEST_FILES = \ test_workersDisabled.html \ workersDisabled_worker.js \ test_xhr_implicit_cancel.html \ xhr_implicit_cancel_worker.js \ test_xhr_parameters.html \ test_xhr_parameters.js \ test_xhr_system.html \ test_xhr_system.js \ - test_xhr_timeout.html \ test_blobConstructor.html \ test_csp.html \ test_csp.js \ test_csp.html^headers^ \ csp_worker.js \ test_transferable.html \ transferable_worker.js \ test_errorwarning.html \ errorwarning_worker.js \ test_contentWorker.html \ content_worker.js \ test_url.html \ url_worker.js \ $(NULL) +# Bug 842386 - Disabled on OSX due to intermittent failures. +ifneq ($(OS_ARCH), Darwin) +MOCHITEST_FILES += \ + test_xhr_timeout.html \ + $(NULL) +endif + MOCHITEST_CHROME_FILES = \ test_chromeWorker.xul \ test_chromeWorkerJSM.xul \ test_extension.xul \ test_extensionBootstrap.xul \ test_file.xul \ test_fileSlice.xul \ test_fileBlobPosting.xul \
--- a/embedding/components/windowwatcher/src/nsWindowWatcher.h +++ b/embedding/components/windowwatcher/src/nsWindowWatcher.h @@ -12,27 +12,26 @@ #include "nsCOMPtr.h" #include "mozilla/Mutex.h" #include "nsIWindowCreator.h" // for stupid compilers #include "nsIWindowWatcher.h" #include "nsIPromptFactory.h" #include "nsPIWindowWatcher.h" #include "nsTArray.h" +#include "js/TypeDecls.h" class nsIURI; class nsIDocShellTreeItem; class nsIDocShellTreeOwner; class nsIWebBrowserChrome; class nsString; class nsWatcherWindowEnumerator; class nsIScriptContext; class nsPromptService; -struct JSContext; -class JSObject; struct nsWatcherWindowEntry; struct SizeSpec; class nsWindowWatcher : public nsIWindowWatcher, public nsPIWindowWatcher, public nsIPromptFactory {
--- a/gfx/layers/Layers.cpp +++ b/gfx/layers/Layers.cpp @@ -708,16 +708,131 @@ ContainerLayer::ContainerLayer(LayerMana mMayHaveReadbackChild(false) { mContentFlags = 0; // Clear NO_TEXT, NO_TEXT_OVER_TRANSPARENT } ContainerLayer::~ContainerLayer() {} void +ContainerLayer::InsertAfter(Layer* aChild, Layer* aAfter) +{ + NS_ASSERTION(aChild->Manager() == Manager(), + "Child has wrong manager"); + NS_ASSERTION(!aChild->GetParent(), + "aChild already in the tree"); + NS_ASSERTION(!aChild->GetNextSibling() && !aChild->GetPrevSibling(), + "aChild already has siblings?"); + NS_ASSERTION(!aAfter || + (aAfter->Manager() == Manager() && + aAfter->GetParent() == this), + "aAfter is not our child"); + + aChild->SetParent(this); + if (aAfter == mLastChild) { + mLastChild = aChild; + } + if (!aAfter) { + aChild->SetNextSibling(mFirstChild); + if (mFirstChild) { + mFirstChild->SetPrevSibling(aChild); + } + mFirstChild = aChild; + NS_ADDREF(aChild); + DidInsertChild(aChild); + return; + } + + Layer* next = aAfter->GetNextSibling(); + aChild->SetNextSibling(next); + aChild->SetPrevSibling(aAfter); + if (next) { + next->SetPrevSibling(aChild); + } + aAfter->SetNextSibling(aChild); + NS_ADDREF(aChild); + DidInsertChild(aChild); +} + +void +ContainerLayer::RemoveChild(Layer *aChild) +{ + NS_ASSERTION(aChild->Manager() == Manager(), + "Child has wrong manager"); + NS_ASSERTION(aChild->GetParent() == this, + "aChild not our child"); + + Layer* prev = aChild->GetPrevSibling(); + Layer* next = aChild->GetNextSibling(); + if (prev) { + prev->SetNextSibling(next); + } else { + this->mFirstChild = next; + } + if (next) { + next->SetPrevSibling(prev); + } else { + this->mLastChild = prev; + } + + aChild->SetNextSibling(nullptr); + aChild->SetPrevSibling(nullptr); + aChild->SetParent(nullptr); + + this->DidRemoveChild(aChild); + NS_RELEASE(aChild); +} + + +void +ContainerLayer::RepositionChild(Layer* aChild, Layer* aAfter) +{ + NS_ASSERTION(aChild->Manager() == Manager(), + "Child has wrong manager"); + NS_ASSERTION(aChild->GetParent() == this, + "aChild not our child"); + NS_ASSERTION(!aAfter || + (aAfter->Manager() == Manager() && + aAfter->GetParent() == this), + "aAfter is not our child"); + + Layer* prev = aChild->GetPrevSibling(); + Layer* next = aChild->GetNextSibling(); + if (prev == aAfter) { + // aChild is already in the correct position, nothing to do. + return; + } + if (prev) { + prev->SetNextSibling(next); + } + if (next) { + next->SetPrevSibling(prev); + } + if (!aAfter) { + aChild->SetPrevSibling(nullptr); + aChild->SetNextSibling(mFirstChild); + if (mFirstChild) { + mFirstChild->SetPrevSibling(aChild); + } + mFirstChild = aChild; + return; + } + + Layer* afterNext = aAfter->GetNextSibling(); + if (afterNext) { + afterNext->SetPrevSibling(aChild); + } else { + mLastChild = aChild; + } + aAfter->SetNextSibling(aChild); + aChild->SetPrevSibling(aAfter); + aChild->SetNextSibling(afterNext); +} + +void ContainerLayer::FillSpecificAttributes(SpecificLayerAttributes& aAttrs) { aAttrs = ContainerLayerAttributes(GetFrameMetrics(), mPreXScale, mPreYScale, mInheritedXScale, mInheritedYScale); } bool ContainerLayer::HasMultipleChildren() @@ -822,16 +937,26 @@ ContainerLayer::DefaultComputeEffectiveT void ContainerLayer::ComputeEffectiveTransformsForChildren(const gfx3DMatrix& aTransformToSurface) { for (Layer* l = mFirstChild; l; l = l->GetNextSibling()) { l->ComputeEffectiveTransforms(aTransformToSurface); } } +/* static */ bool +ContainerLayer::HasOpaqueAncestorLayer(Layer* aLayer) +{ + for (Layer* l = aLayer->GetParent(); l; l = l->GetParent()) { + if (l->GetContentFlags() & Layer::CONTENT_OPAQUE) + return true; + } + return false; +} + void ContainerLayer::DidRemoveChild(Layer* aLayer) { ThebesLayer* tl = aLayer->AsThebesLayer(); if (tl && tl->UsedForReadback()) { for (Layer* l = mFirstChild; l; l = l->GetNextSibling()) { if (l->GetType() == TYPE_READBACK) { static_cast<ReadbackLayer*>(l)->NotifyThebesLayerRemoved(tl);
--- a/gfx/layers/Layers.h +++ b/gfx/layers/Layers.h @@ -1406,31 +1406,31 @@ public: /** * CONSTRUCTION PHASE ONLY * Insert aChild into the child list of this container. aChild must * not be currently in any child list or the root for the layer manager. * If aAfter is non-null, it must be a child of this container and * we insert after that layer. If it's null we insert at the start. */ - virtual void InsertAfter(Layer* aChild, Layer* aAfter) = 0; + virtual void InsertAfter(Layer* aChild, Layer* aAfter); /** * CONSTRUCTION PHASE ONLY * Remove aChild from the child list of this container. aChild must * be a child of this container. */ - virtual void RemoveChild(Layer* aChild) = 0; + virtual void RemoveChild(Layer* aChild); /** * CONSTRUCTION PHASE ONLY * Reposition aChild from the child list of this container. aChild must * be a child of this container. * If aAfter is non-null, it must be a child of this container and we * reposition after that layer. If it's null, we reposition at the start. */ - virtual void RepositionChild(Layer* aChild, Layer* aAfter) = 0; + virtual void RepositionChild(Layer* aChild, Layer* aAfter); /** * CONSTRUCTION PHASE ONLY * Set the (sub)document metrics used to render the Layer subtree * rooted at this. */ void SetFrameMetrics(const FrameMetrics& aFrameMetrics) { @@ -1525,16 +1525,18 @@ public: * Returns true if this container supports children with component alpha. * Should only be called while painting a child of this layer. */ bool SupportsComponentAlphaChildren() { return mSupportsComponentAlphaChildren; } protected: friend class ReadbackProcessor; + static bool HasOpaqueAncestorLayer(Layer* aLayer); + void DidInsertChild(Layer* aLayer); void DidRemoveChild(Layer* aLayer); ContainerLayer(LayerManager* aManager, void* aImplData); /** * A default implementation of ComputeEffectiveTransforms for use by OpenGL * and D3D.
--- a/gfx/layers/basic/BasicContainerLayer.cpp +++ b/gfx/layers/basic/BasicContainerLayer.cpp @@ -10,31 +10,70 @@ #include "basic/BasicLayers.h" // for BasicLayerManager #include "mozilla/gfx/BaseRect.h" // for BaseRect #include "mozilla/mozalloc.h" // for operator new #include "nsAutoPtr.h" // for nsRefPtr #include "nsCOMPtr.h" // for already_AddRefed #include "nsISupportsImpl.h" // for Layer::AddRef, etc #include "nsPoint.h" // for nsIntPoint #include "nsRect.h" // for nsIntRect +#include "gfx3DMatrix.h" // for gfx3DMatrix +#include "gfxMatrix.h" // for gfxMatrix +#include "nsRegion.h" // for nsIntRegion using namespace mozilla::gfx; namespace mozilla { namespace layers { BasicContainerLayer::~BasicContainerLayer() { while (mFirstChild) { - ContainerRemoveChild(mFirstChild, this); + ContainerLayer::RemoveChild(mFirstChild); } MOZ_COUNT_DTOR(BasicContainerLayer); } +void +BasicContainerLayer::ComputeEffectiveTransforms(const gfx3DMatrix& aTransformToSurface) +{ + // We push groups for container layers if we need to, which always + // are aligned in device space, so it doesn't really matter how we snap + // containers. + gfxMatrix residual; + gfx3DMatrix idealTransform = GetLocalTransform()*aTransformToSurface; + idealTransform.ProjectTo2D(); + + if (!idealTransform.CanDraw2D()) { + mEffectiveTransform = idealTransform; + ComputeEffectiveTransformsForChildren(gfx3DMatrix()); + ComputeEffectiveTransformForMaskLayer(gfx3DMatrix()); + mUseIntermediateSurface = true; + return; + } + + mEffectiveTransform = SnapTransformTranslation(idealTransform, &residual); + // We always pass the ideal matrix down to our children, so there is no + // need to apply any compensation using the residual from SnapTransformTranslation. + ComputeEffectiveTransformsForChildren(idealTransform); + + ComputeEffectiveTransformForMaskLayer(aTransformToSurface); + + /* If we have a single child, it can just inherit our opacity, + * otherwise we need a PushGroup and we need to mark ourselves as using + * an intermediate surface so our children don't inherit our opacity + * via GetEffectiveOpacity. + * Having a mask layer always forces our own push group + */ + mUseIntermediateSurface = + GetMaskLayer() || (GetEffectiveOpacity() != 1.0 && + HasMultipleChildren()); +} + bool BasicContainerLayer::ChildrenPartitionVisibleRegion(const nsIntRect& aInRect) { gfxMatrix transform; if (!GetEffectiveTransform().CanDraw2D(&transform) || transform.HasNonIntegerTranslation()) return false;
--- a/gfx/layers/basic/BasicContainerLayer.h +++ b/gfx/layers/basic/BasicContainerLayer.h @@ -4,191 +4,25 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef GFX_BASICCONTAINERLAYER_H #define GFX_BASICCONTAINERLAYER_H #include "BasicImplData.h" // for BasicImplData #include "BasicLayers.h" // for BasicLayerManager #include "Layers.h" // for Layer, ContainerLayer -#include "gfx3DMatrix.h" // for gfx3DMatrix -#include "gfxMatrix.h" // for gfxMatrix #include "nsDebug.h" // for NS_ASSERTION #include "nsISupportsUtils.h" // for NS_ADDREF, NS_RELEASE -#include "nsRegion.h" // for nsIntRegion #include "nsTraceRefcnt.h" // for MOZ_COUNT_CTOR struct nsIntRect; namespace mozilla { namespace layers { -template<class Container> void -ContainerInsertAfter(Layer* aChild, Layer* aAfter, Container* aContainer) -{ - NS_ASSERTION(aChild->Manager() == aContainer->Manager(), - "Child has wrong manager"); - NS_ASSERTION(!aChild->GetParent(), - "aChild already in the tree"); - NS_ASSERTION(!aChild->GetNextSibling() && !aChild->GetPrevSibling(), - "aChild already has siblings?"); - NS_ASSERTION(!aAfter || - (aAfter->Manager() == aContainer->Manager() && - aAfter->GetParent() == aContainer), - "aAfter is not our child"); - - aChild->SetParent(aContainer); - if (aAfter == aContainer->mLastChild) { - aContainer->mLastChild = aChild; - } - if (!aAfter) { - aChild->SetNextSibling(aContainer->mFirstChild); - if (aContainer->mFirstChild) { - aContainer->mFirstChild->SetPrevSibling(aChild); - } - aContainer->mFirstChild = aChild; - NS_ADDREF(aChild); - aContainer->DidInsertChild(aChild); - return; - } - - Layer* next = aAfter->GetNextSibling(); - aChild->SetNextSibling(next); - aChild->SetPrevSibling(aAfter); - if (next) { - next->SetPrevSibling(aChild); - } - aAfter->SetNextSibling(aChild); - NS_ADDREF(aChild); - aContainer->DidInsertChild(aChild); -} - -template<class Container> void -ContainerRemoveChild(Layer* aChild, Container* aContainer) -{ - NS_ASSERTION(aChild->Manager() == aContainer->Manager(), - "Child has wrong manager"); - NS_ASSERTION(aChild->GetParent() == aContainer, - "aChild not our child"); - - Layer* prev = aChild->GetPrevSibling(); - Layer* next = aChild->GetNextSibling(); - if (prev) { - prev->SetNextSibling(next); - } else { - aContainer->mFirstChild = next; - } - if (next) { - next->SetPrevSibling(prev); - } else { - aContainer->mLastChild = prev; - } - - aChild->SetNextSibling(nullptr); - aChild->SetPrevSibling(nullptr); - aChild->SetParent(nullptr); - - aContainer->DidRemoveChild(aChild); - NS_RELEASE(aChild); -} - -template<class Container> void -ContainerRepositionChild(Layer* aChild, Layer* aAfter, Container* aContainer) -{ - NS_ASSERTION(aChild->Manager() == aContainer->Manager(), - "Child has wrong manager"); - NS_ASSERTION(aChild->GetParent() == aContainer, - "aChild not our child"); - NS_ASSERTION(!aAfter || - (aAfter->Manager() == aContainer->Manager() && - aAfter->GetParent() == aContainer), - "aAfter is not our child"); - - Layer* prev = aChild->GetPrevSibling(); - Layer* next = aChild->GetNextSibling(); - if (prev == aAfter) { - // aChild is already in the correct position, nothing to do. - return; - } - if (prev) { - prev->SetNextSibling(next); - } - if (next) { - next->SetPrevSibling(prev); - } - if (!aAfter) { - aChild->SetPrevSibling(nullptr); - aChild->SetNextSibling(aContainer->mFirstChild); - if (aContainer->mFirstChild) { - aContainer->mFirstChild->SetPrevSibling(aChild); - } - aContainer->mFirstChild = aChild; - return; - } - - Layer* afterNext = aAfter->GetNextSibling(); - if (afterNext) { - afterNext->SetPrevSibling(aChild); - } else { - aContainer->mLastChild = aChild; - } - aAfter->SetNextSibling(aChild); - aChild->SetPrevSibling(aAfter); - aChild->SetNextSibling(afterNext); -} - -template<class Container> -static void -ContainerComputeEffectiveTransforms(const gfx3DMatrix& aTransformToSurface, - Container* aContainer) -{ - // We push groups for container layers if we need to, which always - // are aligned in device space, so it doesn't really matter how we snap - // containers. - gfxMatrix residual; - gfx3DMatrix idealTransform = aContainer->GetLocalTransform()*aTransformToSurface; - idealTransform.ProjectTo2D(); - - if (!idealTransform.CanDraw2D()) { - aContainer->mEffectiveTransform = idealTransform; - aContainer->ComputeEffectiveTransformsForChildren(gfx3DMatrix()); - aContainer->ComputeEffectiveTransformForMaskLayer(gfx3DMatrix()); - aContainer->mUseIntermediateSurface = true; - return; - } - - aContainer->mEffectiveTransform = - aContainer->SnapTransformTranslation(idealTransform, &residual); - // We always pass the ideal matrix down to our children, so there is no - // need to apply any compensation using the residual from SnapTransformTranslation. - aContainer->ComputeEffectiveTransformsForChildren(idealTransform); - - aContainer->ComputeEffectiveTransformForMaskLayer(aTransformToSurface); - - /* If we have a single child, it can just inherit our opacity, - * otherwise we need a PushGroup and we need to mark ourselves as using - * an intermediate surface so our children don't inherit our opacity - * via GetEffectiveOpacity. - * Having a mask layer always forces our own push group - */ - aContainer->mUseIntermediateSurface = - aContainer->GetMaskLayer() || (aContainer->GetEffectiveOpacity() != 1.0 && - aContainer->HasMultipleChildren()); -} - class BasicContainerLayer : public ContainerLayer, public BasicImplData { - template<class Container> - friend void ContainerInsertAfter(Layer* aChild, Layer* aAfter, Container* aContainer); - template<class Container> - friend void ContainerRemoveChild(Layer* aChild, Container* aContainer); - template<class Container> - friend void ContainerRepositionChild(Layer* aChild, Layer* aAfter, Container* aContainer); - template<class Container> - friend void ContainerComputeEffectiveTransforms(const gfx3DMatrix& aTransformToSurface, - Container* aContainer); - public: BasicContainerLayer(BasicLayerManager* aManager) : ContainerLayer(aManager, static_cast<BasicImplData*>(MOZ_THIS_IN_INITIALIZER_LIST())) { MOZ_COUNT_CTOR(BasicContainerLayer); mSupportsComponentAlphaChildren = true; } @@ -199,37 +33,34 @@ public: NS_ASSERTION(BasicManager()->InConstruction(), "Can only set properties in construction phase"); ContainerLayer::SetVisibleRegion(aRegion); } virtual void InsertAfter(Layer* aChild, Layer* aAfter) { NS_ASSERTION(BasicManager()->InConstruction(), "Can only set properties in construction phase"); - ContainerInsertAfter(aChild, aAfter, this); + ContainerLayer::InsertAfter(aChild, aAfter); } virtual void RemoveChild(Layer* aChild) { NS_ASSERTION(BasicManager()->InConstruction(), "Can only set properties in construction phase"); - ContainerRemoveChild(aChild, this); + ContainerLayer::RemoveChild(aChild); } virtual void RepositionChild(Layer* aChild, Layer* aAfter) { NS_ASSERTION(BasicManager()->InConstruction(), "Can only set properties in construction phase"); - ContainerRepositionChild(aChild, aAfter, this); + ContainerLayer::RepositionChild(aChild, aAfter); } - virtual void ComputeEffectiveTransforms(const gfx3DMatrix& aTransformToSurface) - { - ContainerComputeEffectiveTransforms(aTransformToSurface, this); - } + virtual void ComputeEffectiveTransforms(const gfx3DMatrix& aTransformToSurface); /** * Returns true when: * a) no (non-hidden) childrens' visible areas overlap in * (aInRect intersected with this layer's visible region). * b) the (non-hidden) childrens' visible areas cover * (aInRect intersected with this layer's visible region). * c) this layer and all (non-hidden) children have transforms that are translations
--- a/gfx/layers/client/ClientContainerLayer.h +++ b/gfx/layers/client/ClientContainerLayer.h @@ -18,162 +18,31 @@ #include "nsTArray.h" // for nsAutoTArray #include "nsTraceRefcnt.h" // for MOZ_COUNT_CTOR, etc namespace mozilla { namespace layers { class ShadowableLayer; -template<class Container> void -ContainerInsertAfter(Layer* aChild, Layer* aAfter, Container* aContainer) -{ - NS_ASSERTION(aChild->Manager() == aContainer->Manager(), - "Child has wrong manager"); - NS_ASSERTION(!aChild->GetParent(), - "aChild already in the tree"); - NS_ASSERTION(!aChild->GetNextSibling() && !aChild->GetPrevSibling(), - "aChild already has siblings?"); - NS_ASSERTION(!aAfter || - (aAfter->Manager() == aContainer->Manager() && - aAfter->GetParent() == aContainer), - "aAfter is not our child"); - - aChild->SetParent(aContainer); - if (aAfter == aContainer->mLastChild) { - aContainer->mLastChild = aChild; - } - if (!aAfter) { - aChild->SetNextSibling(aContainer->mFirstChild); - if (aContainer->mFirstChild) { - aContainer->mFirstChild->SetPrevSibling(aChild); - } - aContainer->mFirstChild = aChild; - NS_ADDREF(aChild); - aContainer->DidInsertChild(aChild); - return; - } - - Layer* next = aAfter->GetNextSibling(); - aChild->SetNextSibling(next); - aChild->SetPrevSibling(aAfter); - if (next) { - next->SetPrevSibling(aChild); - } - aAfter->SetNextSibling(aChild); - NS_ADDREF(aChild); - aContainer->DidInsertChild(aChild); -} - -template<class Container> void -ContainerRemoveChild(Layer* aChild, Container* aContainer) -{ - NS_ASSERTION(aChild->Manager() == aContainer->Manager(), - "Child has wrong manager"); - NS_ASSERTION(aChild->GetParent() == aContainer, - "aChild not our child"); - - Layer* prev = aChild->GetPrevSibling(); - Layer* next = aChild->GetNextSibling(); - if (prev) { - prev->SetNextSibling(next); - } else { - aContainer->mFirstChild = next; - } - if (next) { - next->SetPrevSibling(prev); - } else { - aContainer->mLastChild = prev; - } - - aChild->SetNextSibling(nullptr); - aChild->SetPrevSibling(nullptr); - aChild->SetParent(nullptr); - - aContainer->DidRemoveChild(aChild); - NS_RELEASE(aChild); -} - -template<class Container> void -ContainerRepositionChild(Layer* aChild, Layer* aAfter, Container* aContainer) -{ - NS_ASSERTION(aChild->Manager() == aContainer->Manager(), - "Child has wrong manager"); - NS_ASSERTION(aChild->GetParent() == aContainer, - "aChild not our child"); - NS_ASSERTION(!aAfter || - (aAfter->Manager() == aContainer->Manager() && - aAfter->GetParent() == aContainer), - "aAfter is not our child"); - - Layer* prev = aChild->GetPrevSibling(); - Layer* next = aChild->GetNextSibling(); - if (prev == aAfter) { - // aChild is already in the correct position, nothing to do. - return; - } - if (prev) { - prev->SetNextSibling(next); - } - if (next) { - next->SetPrevSibling(prev); - } - if (!aAfter) { - aChild->SetPrevSibling(nullptr); - aChild->SetNextSibling(aContainer->mFirstChild); - if (aContainer->mFirstChild) { - aContainer->mFirstChild->SetPrevSibling(aChild); - } - aContainer->mFirstChild = aChild; - return; - } - - Layer* afterNext = aAfter->GetNextSibling(); - if (afterNext) { - afterNext->SetPrevSibling(aChild); - } else { - aContainer->mLastChild = aChild; - } - aAfter->SetNextSibling(aChild); - aChild->SetPrevSibling(aAfter); - aChild->SetNextSibling(afterNext); -} - -static bool -HasOpaqueAncestorLayer(Layer* aLayer) -{ - for (Layer* l = aLayer->GetParent(); l; l = l->GetParent()) { - if (l->GetContentFlags() & Layer::CONTENT_OPAQUE) - return true; - } - return false; -} - class ClientContainerLayer : public ContainerLayer, public ClientLayer { - template<class Container> - friend void ContainerInsertAfter(Layer* aChild, Layer* aAfter, Container* aContainer); - template<class Container> - friend void ContainerRemoveChild(Layer* aChild, Container* aContainer); - template<class Container> - friend void ContainerRepositionChild(Layer* aChild, Layer* aAfter, Container* aContainer); - public: ClientContainerLayer(ClientLayerManager* aManager) : ContainerLayer(aManager, static_cast<ClientLayer*>(MOZ_THIS_IN_INITIALIZER_LIST())) { MOZ_COUNT_CTOR(ClientContainerLayer); mSupportsComponentAlphaChildren = true; } virtual ~ClientContainerLayer() { while (mFirstChild) { - ContainerRemoveChild(mFirstChild, this); + ContainerLayer::RemoveChild(mFirstChild); } MOZ_COUNT_DTOR(ClientContainerLayer); } virtual void RenderLayer() { if (GetMaskLayer()) { @@ -214,43 +83,43 @@ public: } virtual void SetVisibleRegion(const nsIntRegion& aRegion) { NS_ASSERTION(ClientManager()->InConstruction(), "Can only set properties in construction phase"); ContainerLayer::SetVisibleRegion(aRegion); } - virtual void InsertAfter(Layer* aChild, Layer* aAfter) + virtual void InsertAfter(Layer* aChild, Layer* aAfter) MOZ_OVERRIDE { NS_ASSERTION(ClientManager()->InConstruction(), "Can only set properties in construction phase"); ClientManager()->InsertAfter(ClientManager()->Hold(this), ClientManager()->Hold(aChild), aAfter ? ClientManager()->Hold(aAfter) : nullptr); - ContainerInsertAfter(aChild, aAfter, this); + ContainerLayer::InsertAfter(aChild, aAfter); } - virtual void RemoveChild(Layer* aChild) + virtual void RemoveChild(Layer* aChild) MOZ_OVERRIDE { NS_ASSERTION(ClientManager()->InConstruction(), "Can only set properties in construction phase"); ClientManager()->RemoveChild(ClientManager()->Hold(this), ClientManager()->Hold(aChild)); - ContainerRemoveChild(aChild, this); + ContainerLayer::RemoveChild(aChild); } - virtual void RepositionChild(Layer* aChild, Layer* aAfter) + virtual void RepositionChild(Layer* aChild, Layer* aAfter) MOZ_OVERRIDE { NS_ASSERTION(ClientManager()->InConstruction(), "Can only set properties in construction phase"); ClientManager()->RepositionChild(ClientManager()->Hold(this), ClientManager()->Hold(aChild), aAfter ? ClientManager()->Hold(aAfter) : nullptr); - ContainerRepositionChild(aChild, aAfter, this); + ContainerLayer::RepositionChild(aChild, aAfter); } virtual Layer* AsLayer() { return this; } virtual ShadowableLayer* AsShadowableLayer() { return this; } virtual void ComputeEffectiveTransforms(const gfx3DMatrix& aTransformToSurface) { DefaultComputeEffectiveTransforms(aTransformToSurface);
--- a/gfx/layers/composite/ContainerLayerComposite.cpp +++ b/gfx/layers/composite/ContainerLayerComposite.cpp @@ -111,16 +111,21 @@ ContainerRender(ContainerT* aContainer, } surfaceRect -= gfx::IntPoint(aOffset.x, aOffset.y); if (surfaceCopyNeeded) { surface = compositor->CreateRenderTargetFromSource(surfaceRect, previousTarget); } else { surface = compositor->CreateRenderTarget(surfaceRect, mode); } + + if (!surface) { + return; + } + compositor->SetRenderTarget(surface); childOffset.x = visibleRect.x; childOffset.y = visibleRect.y; } else { surface = previousTarget; aContainer->mSupportsComponentAlphaChildren = (aContainer->GetContentFlags() & Layer::CONTENT_OPAQUE) || (aContainer->GetParent() && aContainer->GetParent()->SupportsComponentAlphaChildren()); } @@ -212,85 +217,16 @@ ContainerLayerComposite::~ContainerLayer // *ContainerLayerComposite::Destroy(), or Disconnect() will trigger // cleanup of our resources. while (mFirstChild) { RemoveChild(mFirstChild); } } void -ContainerLayerComposite::InsertAfter(Layer* aChild, Layer* aAfter) -{ - NS_ASSERTION(aChild->Manager() == Manager(), - "Child has wrong manager"); - NS_ASSERTION(!aChild->GetParent(), - "aChild already in the tree"); - NS_ASSERTION(!aChild->GetNextSibling() && !aChild->GetPrevSibling(), - "aChild already has siblings?"); - NS_ASSERTION(!aAfter || - (aAfter->Manager() == Manager() && - aAfter->GetParent() == this), - "aAfter is not our child"); - - aChild->SetParent(this); - if (aAfter == mLastChild) { - mLastChild = aChild; - } - if (!aAfter) { - aChild->SetNextSibling(mFirstChild); - if (mFirstChild) { - mFirstChild->SetPrevSibling(aChild); - } - mFirstChild = aChild; - NS_ADDREF(aChild); - DidInsertChild(aChild); - return; - } - - Layer* next = aAfter->GetNextSibling(); - aChild->SetNextSibling(next); - aChild->SetPrevSibling(aAfter); - if (next) { - next->SetPrevSibling(aChild); - } - aAfter->SetNextSibling(aChild); - NS_ADDREF(aChild); - DidInsertChild(aChild); -} - -void -ContainerLayerComposite::RemoveChild(Layer *aChild) -{ - NS_ASSERTION(aChild->Manager() == Manager(), - "Child has wrong manager"); - NS_ASSERTION(aChild->GetParent() == this, - "aChild not our child"); - - Layer* prev = aChild->GetPrevSibling(); - Layer* next = aChild->GetNextSibling(); - if (prev) { - prev->SetNextSibling(next); - } else { - this->mFirstChild = next; - } - if (next) { - next->SetPrevSibling(prev); - } else { - this->mLastChild = prev; - } - - aChild->SetNextSibling(nullptr); - aChild->SetPrevSibling(nullptr); - aChild->SetParent(nullptr); - - this->DidRemoveChild(aChild); - NS_RELEASE(aChild); -} - -void ContainerLayerComposite::Destroy() { if (!mDestroyed) { while (mFirstChild) { static_cast<LayerComposite*>(GetFirstChild()->ImplData())->Destroy(); RemoveChild(mFirstChild); } mDestroyed = true; @@ -302,61 +238,16 @@ ContainerLayerComposite::GetFirstChildCo { if (!mFirstChild) { return nullptr; } return static_cast<LayerComposite*>(mFirstChild->ImplData()); } void -ContainerLayerComposite::RepositionChild(Layer* aChild, Layer* aAfter) -{ - NS_ASSERTION(aChild->Manager() == Manager(), - "Child has wrong manager"); - NS_ASSERTION(aChild->GetParent() == this, - "aChild not our child"); - NS_ASSERTION(!aAfter || - (aAfter->Manager() == Manager() && - aAfter->GetParent() == this), - "aAfter is not our child"); - - Layer* prev = aChild->GetPrevSibling(); - Layer* next = aChild->GetNextSibling(); - if (prev == aAfter) { - // aChild is already in the correct position, nothing to do. - return; - } - if (prev) { - prev->SetNextSibling(next); - } - if (next) { - next->SetPrevSibling(prev); - } - if (!aAfter) { - aChild->SetPrevSibling(nullptr); - aChild->SetNextSibling(mFirstChild); - if (mFirstChild) { - mFirstChild->SetPrevSibling(aChild); - } - mFirstChild = aChild; - return; - } - - Layer* afterNext = aAfter->GetNextSibling(); - if (afterNext) { - afterNext->SetPrevSibling(aChild); - } else { - mLastChild = aChild; - } - aAfter->SetNextSibling(aChild); - aChild->SetPrevSibling(aAfter); - aChild->SetNextSibling(afterNext); -} - -void ContainerLayerComposite::RenderLayer(const nsIntPoint& aOffset, const nsIntRect& aClipRect) { ContainerRender(this, aOffset, mCompositeManager, aClipRect); } void ContainerLayerComposite::CleanupResources()
--- a/gfx/layers/composite/ContainerLayerComposite.h +++ b/gfx/layers/composite/ContainerLayerComposite.h @@ -28,22 +28,16 @@ class ContainerLayerComposite : public C const nsIntPoint& aOffset, LayerManagerComposite* aManager, const nsIntRect& aClipRect); public: ContainerLayerComposite(LayerManagerComposite *aManager); ~ContainerLayerComposite(); - void InsertAfter(Layer* aChild, Layer* aAfter); - - void RemoveChild(Layer* aChild); - - void RepositionChild(Layer* aChild, Layer* aAfter); - // LayerComposite Implementation virtual Layer* GetLayer() MOZ_OVERRIDE { return this; } virtual void Destroy() MOZ_OVERRIDE; LayerComposite* GetFirstChildComposite(); virtual void RenderLayer(const nsIntPoint& aOffset,
--- a/gfx/layers/d3d10/ContainerLayerD3D10.cpp +++ b/gfx/layers/d3d10/ContainerLayerD3D10.cpp @@ -23,150 +23,16 @@ ContainerLayerD3D10::ContainerLayerD3D10 } ContainerLayerD3D10::~ContainerLayerD3D10() { while (mFirstChild) { RemoveChild(mFirstChild); } } -template<class Container> -static void -ContainerInsertAfter(Container* aContainer, Layer* aChild, Layer* aAfter) -{ - NS_ASSERTION(aChild->Manager() == aContainer->Manager(), - "Child has wrong manager"); - NS_ASSERTION(!aChild->GetParent(), - "aChild already in the tree"); - NS_ASSERTION(!aChild->GetNextSibling() && !aChild->GetPrevSibling(), - "aChild already has siblings?"); - NS_ASSERTION(!aAfter || - (aAfter->Manager() == aContainer->Manager() && - aAfter->GetParent() == aContainer), - "aAfter is not our child"); - - aChild->SetParent(aContainer); - if (aAfter == aContainer->mLastChild) { - aContainer->mLastChild = aChild; - } - if (!aAfter) { - aChild->SetNextSibling(aContainer->mFirstChild); - if (aContainer->mFirstChild) { - aContainer->mFirstChild->SetPrevSibling(aChild); - } - aContainer->mFirstChild = aChild; - NS_ADDREF(aChild); - aContainer->DidInsertChild(aChild); - return; - } - - Layer* next = aAfter->GetNextSibling(); - aChild->SetNextSibling(next); - aChild->SetPrevSibling(aAfter); - if (next) { - next->SetPrevSibling(aChild); - } - aAfter->SetNextSibling(aChild); - NS_ADDREF(aChild); - aContainer->DidInsertChild(aChild); -} - -template<class Container> -static void -ContainerRemoveChild(Container* aContainer, Layer* aChild) -{ - NS_ASSERTION(aChild->Manager() == aContainer->Manager(), - "Child has wrong manager"); - NS_ASSERTION(aChild->GetParent() == aContainer, - "aChild not our child"); - - Layer* prev = aChild->GetPrevSibling(); - Layer* next = aChild->GetNextSibling(); - if (prev) { - prev->SetNextSibling(next); - } else { - aContainer->mFirstChild = next; - } - if (next) { - next->SetPrevSibling(prev); - } else { - aContainer->mLastChild = prev; - } - - aChild->SetNextSibling(nullptr); - aChild->SetPrevSibling(nullptr); - aChild->SetParent(nullptr); - - aContainer->DidRemoveChild(aChild); - NS_RELEASE(aChild); -} - -template<class Container> -static void -ContainerRepositionChild(Container* aContainer, Layer* aChild, Layer* aAfter) -{ - NS_ASSERTION(aChild->Manager() == aContainer->Manager(), - "Child has wrong manager"); - NS_ASSERTION(aChild->GetParent() == aContainer, - "aChild not our child"); - NS_ASSERTION(!aAfter || - (aAfter->Manager() == aContainer->Manager() && - aAfter->GetParent() == aContainer), - "aAfter is not our child"); - - Layer* prev = aChild->GetPrevSibling(); - Layer* next = aChild->GetNextSibling(); - if (prev == aAfter) { - // aChild is already in the correct position, nothing to do. - return; - } - if (prev) { - prev->SetNextSibling(next); - } - if (next) { - next->SetPrevSibling(prev); - } - if (!aAfter) { - aChild->SetPrevSibling(nullptr); - aChild->SetNextSibling(aContainer->mFirstChild); - if (aContainer->mFirstChild) { - aContainer->mFirstChild->SetPrevSibling(aChild); - } - aContainer->mFirstChild = aChild; - return; - } - - Layer* afterNext = aAfter->GetNextSibling(); - if (afterNext) { - afterNext->SetPrevSibling(aChild); - } else { - aContainer->mLastChild = aChild; - } - aAfter->SetNextSibling(aChild); - aChild->SetPrevSibling(aAfter); - aChild->SetNextSibling(afterNext); -} - -void -ContainerLayerD3D10::InsertAfter(Layer* aChild, Layer* aAfter) -{ - ContainerInsertAfter(this, aChild, aAfter); -} - -void -ContainerLayerD3D10::RemoveChild(Layer *aChild) -{ - ContainerRemoveChild(this, aChild); -} - -void -ContainerLayerD3D10::RepositionChild(Layer* aChild, Layer* aAfter) -{ - ContainerRepositionChild(this, aChild, aAfter); -} Layer* ContainerLayerD3D10::GetLayer() { return this; } LayerD3D10*
--- a/gfx/layers/d3d10/ContainerLayerD3D10.h +++ b/gfx/layers/d3d10/ContainerLayerD3D10.h @@ -6,45 +6,25 @@ #ifndef GFX_CONTAINERLAYERD3D10_H #define GFX_CONTAINERLAYERD3D10_H #include "LayerManagerD3D10.h" namespace mozilla { namespace layers { -template<class Container> -static void ContainerInsertAfter(Container* aContainer, Layer* aChild, Layer* aAfter); -template<class Container> -static void ContainerRemoveChild(Container* aContainer, Layer* aChild); -template<class Container> -static void ContainerRepositionChild(Container* aContainer, Layer* aChild, Layer* aAfter); - class ContainerLayerD3D10 : public ContainerLayer, public LayerD3D10 { - template<class Container> - friend void ContainerInsertAfter(Container* aContainer, Layer* aChild, Layer* aAfter); - template<class Container> - friend void ContainerRemoveChild(Container* aContainer, Layer* aChild); - template<class Container> - friend void ContainerRepositionChild(Container* aContainer, Layer* aChild, Layer* aAfter); public: ContainerLayerD3D10(LayerManagerD3D10 *aManager); ~ContainerLayerD3D10(); nsIntRect GetVisibleRect() { return mVisibleRegion.GetBounds(); } - /* ContainerLayer implementation */ - virtual void InsertAfter(Layer* aChild, Layer* aAfter); - - virtual void RemoveChild(Layer* aChild); - - virtual void RepositionChild(Layer* aChild, Layer* aAfter); - /* LayerD3D10 implementation */ virtual Layer* GetLayer(); virtual LayerD3D10* GetFirstChildD3D10(); virtual void RenderLayer(); virtual void Validate();
--- a/gfx/layers/d3d11/CompositorD3D11.cpp +++ b/gfx/layers/d3d11/CompositorD3D11.cpp @@ -366,16 +366,20 @@ TemporaryRef<CompositingRenderTarget> CompositorD3D11::CreateRenderTarget(const gfx::IntRect& aRect, SurfaceInitMode aInit) { CD3D11_TEXTURE2D_DESC desc(DXGI_FORMAT_B8G8R8A8_UNORM, aRect.width, aRect.height, 1, 1, D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET); RefPtr<ID3D11Texture2D> texture; mDevice->CreateTexture2D(&desc, nullptr, byRef(texture)); + NS_ASSERTION(texture, "Could not create texture"); + if (!texture) { + return nullptr; + } RefPtr<CompositingRenderTargetD3D11> rt = new CompositingRenderTargetD3D11(texture); rt->SetSize(IntSize(aRect.width, aRect.height)); if (aInit == INIT_MODE_CLEAR) { FLOAT clear[] = { 0, 0, 0, 0 }; mContext->ClearRenderTargetView(rt->mRTView, clear); } @@ -388,16 +392,20 @@ CompositorD3D11::CreateRenderTargetFromS const CompositingRenderTarget* aSource) { CD3D11_TEXTURE2D_DESC desc(DXGI_FORMAT_B8G8R8A8_UNORM, aRect.width, aRect.height, 1, 1, D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET); RefPtr<ID3D11Texture2D> texture; mDevice->CreateTexture2D(&desc, nullptr, byRef(texture)); + NS_ASSERTION(texture, "Could not create texture"); + if (!texture) { + return nullptr; + } if (aSource) { const CompositingRenderTargetD3D11* sourceD3D11 = static_cast<const CompositingRenderTargetD3D11*>(aSource); D3D11_BOX srcBox; srcBox.left = aRect.x; srcBox.top = aRect.y;
--- a/gfx/layers/d3d9/ContainerLayerD3D9.cpp +++ b/gfx/layers/d3d9/ContainerLayerD3D9.cpp @@ -7,270 +7,152 @@ #include "gfxUtils.h" #include "nsRect.h" #include "ThebesLayerD3D9.h" #include "ReadbackProcessor.h" namespace mozilla { namespace layers { -template<class Container> -static void -ContainerInsertAfter(Container* aContainer, Layer* aChild, Layer* aAfter) +ContainerLayerD3D9::ContainerLayerD3D9(LayerManagerD3D9 *aManager) + : ContainerLayer(aManager, nullptr) + , LayerD3D9(aManager) { - NS_ASSERTION(aChild->Manager() == aContainer->Manager(), - "Child has wrong manager"); - NS_ASSERTION(!aChild->GetParent(), - "aChild already in the tree"); - NS_ASSERTION(!aChild->GetNextSibling() && !aChild->GetPrevSibling(), - "aChild already has siblings?"); - NS_ASSERTION(!aAfter || - (aAfter->Manager() == aContainer->Manager() && - aAfter->GetParent() == aContainer), - "aAfter is not our child"); - - aChild->SetParent(aContainer); - if (aAfter == aContainer->mLastChild) { - aContainer->mLastChild = aChild; - } - if (!aAfter) { - aChild->SetNextSibling(aContainer->mFirstChild); - if (aContainer->mFirstChild) { - aContainer->mFirstChild->SetPrevSibling(aChild); - } - aContainer->mFirstChild = aChild; - NS_ADDREF(aChild); - aContainer->DidInsertChild(aChild); - return; - } - - Layer* next = aAfter->GetNextSibling(); - aChild->SetNextSibling(next); - aChild->SetPrevSibling(aAfter); - if (next) { - next->SetPrevSibling(aChild); - } - aAfter->SetNextSibling(aChild); - NS_ADDREF(aChild); - aContainer->DidInsertChild(aChild); + mImplData = static_cast<LayerD3D9*>(this); } -template<class Container> -static void -ContainerRemoveChild(Container* aContainer, Layer* aChild) +ContainerLayerD3D9::~ContainerLayerD3D9() { - NS_ASSERTION(aChild->Manager() == aContainer->Manager(), - "Child has wrong manager"); - NS_ASSERTION(aChild->GetParent() == aContainer, - "aChild not our child"); - - Layer* prev = aChild->GetPrevSibling(); - Layer* next = aChild->GetNextSibling(); - if (prev) { - prev->SetNextSibling(next); - } else { - aContainer->mFirstChild = next; + while (mFirstChild) { + RemoveChild(mFirstChild); } - if (next) { - next->SetPrevSibling(prev); - } else { - aContainer->mLastChild = prev; - } - - aChild->SetNextSibling(nullptr); - aChild->SetPrevSibling(nullptr); - aChild->SetParent(nullptr); - - aContainer->DidRemoveChild(aChild); - NS_RELEASE(aChild); } -template<class Container> -static void -ContainerRepositionChild(Container* aContainer, Layer* aChild, Layer* aAfter) +Layer* +ContainerLayerD3D9::GetLayer() { - NS_ASSERTION(aChild->Manager() == aContainer->Manager(), - "Child has wrong manager"); - NS_ASSERTION(aChild->GetParent() == aContainer, - "aChild not our child"); - NS_ASSERTION(!aAfter || - (aAfter->Manager() == aContainer->Manager() && - aAfter->GetParent() == aContainer), - "aAfter is not our child"); - - Layer* prev = aChild->GetPrevSibling(); - Layer* next = aChild->GetNextSibling(); - if (prev == aAfter) { - // aChild is already in the correct position, nothing to do. - return; - } - if (prev) { - prev->SetNextSibling(next); - } - if (next) { - next->SetPrevSibling(prev); - } - if (!aAfter) { - aChild->SetPrevSibling(nullptr); - aChild->SetNextSibling(aContainer->mFirstChild); - if (aContainer->mFirstChild) { - aContainer->mFirstChild->SetPrevSibling(aChild); - } - aContainer->mFirstChild = aChild; - return; - } - - Layer* afterNext = aAfter->GetNextSibling(); - if (afterNext) { - afterNext->SetPrevSibling(aChild); - } else { - aContainer->mLastChild = aChild; - } - aAfter->SetNextSibling(aChild); - aChild->SetPrevSibling(aAfter); - aChild->SetNextSibling(afterNext); + return this; } -static inline LayerD3D9* -GetNextSibling(LayerD3D9* aLayer) +LayerD3D9* +ContainerLayerD3D9::GetFirstChildD3D9() { - Layer* layer = aLayer->GetLayer()->GetNextSibling(); - return layer ? static_cast<LayerD3D9*>(layer-> - ImplData()) - : nullptr; + if (!mFirstChild) { + return nullptr; + } + return static_cast<LayerD3D9*>(mFirstChild->ImplData()); } -static bool -HasOpaqueAncestorLayer(Layer* aLayer) -{ - for (Layer* l = aLayer->GetParent(); l; l = l->GetParent()) { - if (l->GetContentFlags() & Layer::CONTENT_OPAQUE) - return true; - } - return false; -} - -static inline LayerD3D9* -GetNextSiblingD3D9(LayerD3D9* aLayer) -{ - Layer* layer = aLayer->GetLayer()->GetNextSibling(); - return layer ? static_cast<LayerD3D9*>(layer-> - ImplData()) - : nullptr; -} - -template<class Container> -static void -ContainerRender(Container* aContainer, - LayerManagerD3D9* aManager) +void +ContainerLayerD3D9::RenderLayer() { nsRefPtr<IDirect3DSurface9> previousRenderTarget; nsRefPtr<IDirect3DTexture9> renderTexture; float previousRenderTargetOffset[4]; float renderTargetOffset[] = { 0, 0, 0, 0 }; float oldViewMatrix[4][4]; RECT containerD3D9ClipRect; - aManager->device()->GetScissorRect(&containerD3D9ClipRect); + device()->GetScissorRect(&containerD3D9ClipRect); // Convert scissor to an nsIntRect. RECT's are exclusive on the bottom and // right values. nsIntRect oldScissor(containerD3D9ClipRect.left, containerD3D9ClipRect.top, containerD3D9ClipRect.right - containerD3D9ClipRect.left, containerD3D9ClipRect.bottom - containerD3D9ClipRect.top); ReadbackProcessor readback; - readback.BuildUpdates(aContainer); + readback.BuildUpdates(this); - nsIntRect visibleRect = aContainer->GetEffectiveVisibleRegion().GetBounds(); - bool useIntermediate = aContainer->UseIntermediateSurface(); + nsIntRect visibleRect = GetEffectiveVisibleRegion().GetBounds(); + bool useIntermediate = UseIntermediateSurface(); - aContainer->mSupportsComponentAlphaChildren = false; + mSupportsComponentAlphaChildren = false; if (useIntermediate) { nsRefPtr<IDirect3DSurface9> renderSurface; - if (!aManager->CompositingDisabled()) { - aManager->device()->GetRenderTarget(0, getter_AddRefs(previousRenderTarget)); - HRESULT hr = aManager->device()->CreateTexture(visibleRect.width, visibleRect.height, 1, - D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, - D3DPOOL_DEFAULT, getter_AddRefs(renderTexture), - nullptr); + if (!mD3DManager->CompositingDisabled()) { + device()->GetRenderTarget(0, getter_AddRefs(previousRenderTarget)); + HRESULT hr = device()->CreateTexture(visibleRect.width, visibleRect.height, 1, + D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, + D3DPOOL_DEFAULT, getter_AddRefs(renderTexture), + nullptr); if (FAILED(hr)) { - aManager->ReportFailure(NS_LITERAL_CSTRING("ContainerLayerD3D9::ContainerRender(): Failed to create texture"), + ReportFailure(NS_LITERAL_CSTRING("ContainerLayerD3D9::ContainerRender(): Failed to create texture"), hr); return; } nsRefPtr<IDirect3DSurface9> renderSurface; renderTexture->GetSurfaceLevel(0, getter_AddRefs(renderSurface)); - aManager->device()->SetRenderTarget(0, renderSurface); + device()->SetRenderTarget(0, renderSurface); } - if (aContainer->mVisibleRegion.GetNumRects() == 1 && - (aContainer->GetContentFlags() & aContainer->CONTENT_OPAQUE)) { + if (mVisibleRegion.GetNumRects() == 1 && + (GetContentFlags() & CONTENT_OPAQUE)) { // don't need a background, we're going to paint all opaque stuff - aContainer->mSupportsComponentAlphaChildren = true; + mSupportsComponentAlphaChildren = true; } else { - const gfx3DMatrix& transform3D = aContainer->GetEffectiveTransform(); + const gfx3DMatrix& transform3D = GetEffectiveTransform(); gfxMatrix transform; // If we have an opaque ancestor layer, then we can be sure that // all the pixels we draw into are either opaque already or will be // covered by something opaque. Otherwise copying up the background is // not safe. HRESULT hr = E_FAIL; - if (HasOpaqueAncestorLayer(aContainer) && + if (HasOpaqueAncestorLayer(this) && transform3D.Is2D(&transform) && !transform.HasNonIntegerTranslation()) { // Copy background up from below RECT dest = { 0, 0, visibleRect.width, visibleRect.height }; RECT src = dest; ::OffsetRect(&src, visibleRect.x + int32_t(transform.x0), visibleRect.y + int32_t(transform.y0)); - if (!aManager->CompositingDisabled()) { - hr = aManager->device()-> + if (!mD3DManager->CompositingDisabled()) { + hr = device()-> StretchRect(previousRenderTarget, &src, renderSurface, &dest, D3DTEXF_NONE); } } if (hr == S_OK) { - aContainer->mSupportsComponentAlphaChildren = true; - } else if (!aManager->CompositingDisabled()) { - aManager->device()-> + mSupportsComponentAlphaChildren = true; + } else if (!mD3DManager->CompositingDisabled()) { + device()-> Clear(0, 0, D3DCLEAR_TARGET, D3DCOLOR_RGBA(0, 0, 0, 0), 0, 0); } } - aManager->device()-> + device()-> GetVertexShaderConstantF(CBvRenderTargetOffset, previousRenderTargetOffset, 1); renderTargetOffset[0] = (float)visibleRect.x; renderTargetOffset[1] = (float)visibleRect.y; - aManager->device()-> + device()-> SetVertexShaderConstantF(CBvRenderTargetOffset, renderTargetOffset, 1); gfx3DMatrix viewMatrix; /* * Matrix to transform to viewport space ( <-1.0, 1.0> topleft, * <1.0, -1.0> bottomright) */ viewMatrix._11 = 2.0f / visibleRect.width; viewMatrix._22 = -2.0f / visibleRect.height; viewMatrix._41 = -1.0f; viewMatrix._42 = 1.0f; - aManager->device()-> + device()-> GetVertexShaderConstantF(CBmProjection, &oldViewMatrix[0][0], 4); - aManager->device()-> + device()-> SetVertexShaderConstantF(CBmProjection, &viewMatrix._11, 4); } else { - aContainer->mSupportsComponentAlphaChildren = - (aContainer->GetContentFlags() & aContainer->CONTENT_OPAQUE) || - (aContainer->mParent && - aContainer->mParent->SupportsComponentAlphaChildren()); + mSupportsComponentAlphaChildren = + (GetContentFlags() & CONTENT_OPAQUE) || + (mParent && + mParent->SupportsComponentAlphaChildren()); } nsAutoTArray<Layer*, 12> children; - aContainer->SortChildrenBy3DZOrder(children); + SortChildrenBy3DZOrder(children); /* * Render this container's contents. */ for (uint32_t i = 0; i < children.Length(); i++) { LayerD3D9* layerToRender = static_cast<LayerD3D9*>(children.ElementAt(i)->ImplData()); if (layerToRender->GetLayer()->GetEffectiveVisibleRegion().IsEmpty()) { @@ -283,102 +165,48 @@ ContainerRender(Container* aContainer, continue; } RECT d3drect; d3drect.left = scissorRect.x; d3drect.top = scissorRect.y; d3drect.right = scissorRect.x + scissorRect.width; d3drect.bottom = scissorRect.y + scissorRect.height; - aManager->device()->SetScissorRect(&d3drect); + device()->SetScissorRect(&d3drect); - if (layerToRender->GetLayer()->GetType() == aContainer->TYPE_THEBES) { + if (layerToRender->GetLayer()->GetType() == TYPE_THEBES) { static_cast<ThebesLayerD3D9*>(layerToRender)->RenderThebesLayer(&readback); } else { layerToRender->RenderLayer(); } } - if (useIntermediate && !aManager->CompositingDisabled()) { - aManager->device()->SetRenderTarget(0, previousRenderTarget); - aManager->device()->SetVertexShaderConstantF(CBvRenderTargetOffset, previousRenderTargetOffset, 1); - aManager->device()->SetVertexShaderConstantF(CBmProjection, &oldViewMatrix[0][0], 4); + if (useIntermediate && !mD3DManager->CompositingDisabled()) { + device()->SetRenderTarget(0, previousRenderTarget); + device()->SetVertexShaderConstantF(CBvRenderTargetOffset, previousRenderTargetOffset, 1); + device()->SetVertexShaderConstantF(CBmProjection, &oldViewMatrix[0][0], 4); - aManager->device()->SetVertexShaderConstantF(CBvLayerQuad, + device()->SetVertexShaderConstantF(CBvLayerQuad, ShaderConstantRect(visibleRect.x, visibleRect.y, visibleRect.width, visibleRect.height), 1); - aContainer->SetShaderTransformAndOpacity(); - aManager->SetShaderMode(DeviceManagerD3D9::RGBALAYER, - aContainer->GetMaskLayer(), - aContainer->GetTransform().CanDraw2D()); - - aManager->device()->SetTexture(0, renderTexture); - aManager->device()->SetScissorRect(&containerD3D9ClipRect); - aManager->device()->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2); - } else { - aManager->device()->SetScissorRect(&containerD3D9ClipRect); - } -} - - -ContainerLayerD3D9::ContainerLayerD3D9(LayerManagerD3D9 *aManager) - : ContainerLayer(aManager, nullptr) - , LayerD3D9(aManager) -{ - mImplData = static_cast<LayerD3D9*>(this); -} - -ContainerLayerD3D9::~ContainerLayerD3D9() -{ - while (mFirstChild) { - RemoveChild(mFirstChild); - } -} + SetShaderTransformAndOpacity(); + mD3DManager->SetShaderMode(DeviceManagerD3D9::RGBALAYER, + GetMaskLayer(), + GetTransform().CanDraw2D()); -void -ContainerLayerD3D9::InsertAfter(Layer* aChild, Layer* aAfter) -{ - ContainerInsertAfter(this, aChild, aAfter); -} - -void -ContainerLayerD3D9::RemoveChild(Layer *aChild) -{ - ContainerRemoveChild(this, aChild); -} - -void -ContainerLayerD3D9::RepositionChild(Layer* aChild, Layer* aAfter) -{ - ContainerRepositionChild(this, aChild, aAfter); -} - -Layer* -ContainerLayerD3D9::GetLayer() -{ - return this; -} - -LayerD3D9* -ContainerLayerD3D9::GetFirstChildD3D9() -{ - if (!mFirstChild) { - return nullptr; + device()->SetTexture(0, renderTexture); + device()->SetScissorRect(&containerD3D9ClipRect); + device()->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2); + } else { + device()->SetScissorRect(&containerD3D9ClipRect); } - return static_cast<LayerD3D9*>(mFirstChild->ImplData()); -} - -void -ContainerLayerD3D9::RenderLayer() -{ - ContainerRender(this, mD3DManager); } void ContainerLayerD3D9::LayerManagerDestroyed() { while (mFirstChild) { GetFirstChildD3D9()->LayerManagerDestroyed(); RemoveChild(mFirstChild);
--- a/gfx/layers/d3d9/ContainerLayerD3D9.h +++ b/gfx/layers/d3d9/ContainerLayerD3D9.h @@ -7,50 +7,25 @@ #define GFX_CONTAINERLAYERD3D9_H #include "Layers.h" #include "LayerManagerD3D9.h" namespace mozilla { namespace layers { -template<class Container> -static void ContainerInsertAfter(Container* aContainer, Layer* aChild, Layer* aAfter); -template<class Container> -static void ContainerRemoveChild(Container* aContainer, Layer* aChild); -template<class Container> -static void ContainerRepositionChild(Container* aContainer, Layer* aChild, Layer* aAfter); -template<class Container> -static void ContainerRender(Container* aContainer, LayerManagerD3D9* aManager); - class ContainerLayerD3D9 : public ContainerLayer, public LayerD3D9 { - template<class Container> - friend void ContainerInsertAfter(Container* aContainer, Layer* aChild, Layer* aAfter); - template<class Container> - friend void ContainerRemoveChild(Container* aContainer, Layer* aChild); - template<class Container> - friend void ContainerRepositionChild(Container* aContainer, Layer* aChild, Layer* aAfter); - template<class Container> - friend void ContainerRender(Container* aContainer, LayerManagerD3D9* aManager); - public: ContainerLayerD3D9(LayerManagerD3D9 *aManager); ~ContainerLayerD3D9(); nsIntRect GetVisibleRect() { return mVisibleRegion.GetBounds(); } - /* ContainerLayer implementation */ - virtual void InsertAfter(Layer* aChild, Layer* aAfter); - - virtual void RemoveChild(Layer* aChild); - - virtual void RepositionChild(Layer* aChild, Layer* aAfter); - /* LayerD3D9 implementation */ Layer* GetLayer(); LayerD3D9* GetFirstChildD3D9(); bool IsEmpty(); void RenderLayer();
--- a/gfx/layers/opengl/ContainerLayerOGL.cpp +++ b/gfx/layers/opengl/ContainerLayerOGL.cpp @@ -23,403 +23,234 @@ #include "nsTArray.h" // for nsAutoTArray #include "LayerManagerOGL.h" // for LayerManagerOGL, LayerOGL, etc #include "LayerManagerOGLProgram.h" // for ShaderProgramOGL class gfxImageSurface; namespace mozilla { namespace layers { -template<class Container> -static void -ContainerInsertAfter(Container* aContainer, Layer* aChild, Layer* aAfter) -{ - NS_ASSERTION(aChild->Manager() == aContainer->Manager(), - "Child has wrong manager"); - NS_ASSERTION(!aChild->GetParent(), - "aChild already in the tree"); - NS_ASSERTION(!aChild->GetNextSibling() && !aChild->GetPrevSibling(), - "aChild already has siblings?"); - NS_ASSERTION(!aAfter || - (aAfter->Manager() == aContainer->Manager() && - aAfter->GetParent() == aContainer), - "aAfter is not our child"); - - aChild->SetParent(aContainer); - if (aAfter == aContainer->mLastChild) { - aContainer->mLastChild = aChild; - } - if (!aAfter) { - aChild->SetNextSibling(aContainer->mFirstChild); - if (aContainer->mFirstChild) { - aContainer->mFirstChild->SetPrevSibling(aChild); - } - aContainer->mFirstChild = aChild; - NS_ADDREF(aChild); - aContainer->DidInsertChild(aChild); - return; - } - - Layer* next = aAfter->GetNextSibling(); - aChild->SetNextSibling(next); - aChild->SetPrevSibling(aAfter); - if (next) { - next->SetPrevSibling(aChild); - } - aAfter->SetNextSibling(aChild); - NS_ADDREF(aChild); - aContainer->DidInsertChild(aChild); -} - -template<class Container> -static void -ContainerRemoveChild(Container* aContainer, Layer* aChild) -{ - NS_ASSERTION(aChild->Manager() == aContainer->Manager(), - "Child has wrong manager"); - NS_ASSERTION(aChild->GetParent() == aContainer, - "aChild not our child"); - - Layer* prev = aChild->GetPrevSibling(); - Layer* next = aChild->GetNextSibling(); - if (prev) { - prev->SetNextSibling(next); - } else { - aContainer->mFirstChild = next; - } - if (next) { - next->SetPrevSibling(prev); - } else { - aContainer->mLastChild = prev; - } - - aChild->SetNextSibling(nullptr); - aChild->SetPrevSibling(nullptr); - aChild->SetParent(nullptr); - - aContainer->DidRemoveChild(aChild); - NS_RELEASE(aChild); -} - -template<class Container> -static void -ContainerRepositionChild(Container* aContainer, Layer* aChild, Layer* aAfter) -{ - NS_ASSERTION(aChild->Manager() == aContainer->Manager(), - "Child has wrong manager"); - NS_ASSERTION(aChild->GetParent() == aContainer, - "aChild not our child"); - NS_ASSERTION(!aAfter || - (aAfter->Manager() == aContainer->Manager() && - aAfter->GetParent() == aContainer), - "aAfter is not our child"); - - Layer* prev = aChild->GetPrevSibling(); - Layer* next = aChild->GetNextSibling(); - if (prev == aAfter) { - // aChild is already in the correct position, nothing to do. - return; - } - if (prev) { - prev->SetNextSibling(next); - } - if (next) { - next->SetPrevSibling(prev); - } - if (!aAfter) { - aChild->SetPrevSibling(nullptr); - aChild->SetNextSibling(aContainer->mFirstChild); - if (aContainer->mFirstChild) { - aContainer->mFirstChild->SetPrevSibling(aChild); - } - aContainer->mFirstChild = aChild; - return; - } - - Layer* afterNext = aAfter->GetNextSibling(); - if (afterNext) { - afterNext->SetPrevSibling(aChild); - } else { - aContainer->mLastChild = aChild; - } - aAfter->SetNextSibling(aChild); - aChild->SetPrevSibling(aAfter); - aChild->SetNextSibling(afterNext); -} - -template<class Container> -static void -ContainerDestroy(Container* aContainer) - { - if (!aContainer->mDestroyed) { - while (aContainer->mFirstChild) { - aContainer->GetFirstChildOGL()->Destroy(); - aContainer->RemoveChild(aContainer->mFirstChild); - } - aContainer->mDestroyed = true; - } -} - -template<class Container> -static void -ContainerCleanupResources(Container* aContainer) -{ - for (Layer* l = aContainer->GetFirstChild(); l; l = l->GetNextSibling()) { - LayerOGL* layerToRender = static_cast<LayerOGL*>(l->ImplData()); - layerToRender->CleanupResources(); - } -} - static inline LayerOGL* GetNextSibling(LayerOGL* aLayer) { Layer* layer = aLayer->GetLayer()->GetNextSibling(); return layer ? static_cast<LayerOGL*>(layer-> ImplData()) : nullptr; } -static bool -HasOpaqueAncestorLayer(Layer* aLayer) -{ - for (Layer* l = aLayer->GetParent(); l; l = l->GetParent()) { - if (l->GetContentFlags() & Layer::CONTENT_OPAQUE) - return true; - } - return false; -} - -template<class Container> -static void -ContainerRender(Container* aContainer, - int aPreviousFrameBuffer, - const nsIntPoint& aOffset, - LayerManagerOGL* aManager) -{ - /** - * Setup our temporary texture for rendering the contents of this container. - */ - GLuint containerSurface; - GLuint frameBuffer; - - nsIntPoint childOffset(aOffset); - nsIntRect visibleRect = aContainer->GetEffectiveVisibleRegion().GetBounds(); - - nsIntRect cachedScissor = aContainer->gl()->ScissorRect(); - aContainer->gl()->PushScissorRect(); - aContainer->mSupportsComponentAlphaChildren = false; - - float opacity = aContainer->GetEffectiveOpacity(); - const gfx3DMatrix& transform = aContainer->GetEffectiveTransform(); - bool needsFramebuffer = aContainer->UseIntermediateSurface(); - if (needsFramebuffer) { - nsIntRect framebufferRect = visibleRect; - // we're about to create a framebuffer backed by textures to use as an intermediate - // surface. What to do if its size (as given by framebufferRect) would exceed the - // maximum texture size supported by the GL? The present code chooses the compromise - // of just clamping the framebuffer's size to the max supported size. - // This gives us a lower resolution rendering of the intermediate surface (children layers). - // See bug 827170 for a discussion. - GLint maxTexSize; - aContainer->gl()->fGetIntegerv(LOCAL_GL_MAX_TEXTURE_SIZE, &maxTexSize); - framebufferRect.width = std::min(framebufferRect.width, maxTexSize); - framebufferRect.height = std::min(framebufferRect.height, maxTexSize); - - LayerManagerOGL::InitMode mode = LayerManagerOGL::InitModeClear; - if (aContainer->GetEffectiveVisibleRegion().GetNumRects() == 1 && - (aContainer->GetContentFlags() & Layer::CONTENT_OPAQUE)) - { - // don't need a background, we're going to paint all opaque stuff - aContainer->mSupportsComponentAlphaChildren = true; - mode = LayerManagerOGL::InitModeNone; - } else { - const gfx3DMatrix& transform3D = aContainer->GetEffectiveTransform(); - gfxMatrix transform; - // If we have an opaque ancestor layer, then we can be sure that - // all the pixels we draw into are either opaque already or will be - // covered by something opaque. Otherwise copying up the background is - // not safe. - if (HasOpaqueAncestorLayer(aContainer) && - transform3D.Is2D(&transform) && !transform.HasNonIntegerTranslation()) { - mode = gfxPlatform::ComponentAlphaEnabled() ? - LayerManagerOGL::InitModeCopy : - LayerManagerOGL::InitModeClear; - framebufferRect.x += transform.x0; - framebufferRect.y += transform.y0; - aContainer->mSupportsComponentAlphaChildren = gfxPlatform::ComponentAlphaEnabled(); - } - } - - aContainer->gl()->PushViewportRect(); - framebufferRect -= childOffset; - if (!aManager->CompositingDisabled()) { - if (!aManager->CreateFBOWithTexture(framebufferRect, - mode, - aPreviousFrameBuffer, - &frameBuffer, - &containerSurface)) { - aContainer->gl()->PopViewportRect(); - aContainer->gl()->PopScissorRect(); - aContainer->gl()->fBindFramebuffer(LOCAL_GL_FRAMEBUFFER, aPreviousFrameBuffer); - return; - } - } - childOffset.x = visibleRect.x; - childOffset.y = visibleRect.y; - } else { - frameBuffer = aPreviousFrameBuffer; - aContainer->mSupportsComponentAlphaChildren = (aContainer->GetContentFlags() & Layer::CONTENT_OPAQUE) || - (aContainer->GetParent() && aContainer->GetParent()->SupportsComponentAlphaChildren()); - } - - nsAutoTArray<Layer*, 12> children; - aContainer->SortChildrenBy3DZOrder(children); - - /** - * Render this container's contents. - */ - for (uint32_t i = 0; i < children.Length(); i++) { - LayerOGL* layerToRender = static_cast<LayerOGL*>(children.ElementAt(i)->ImplData()); - - if (layerToRender->GetLayer()->GetEffectiveVisibleRegion().IsEmpty()) { - continue; - } - - nsIntRect scissorRect = layerToRender->GetLayer()-> - CalculateScissorRect(cachedScissor, &aManager->GetWorldTransform()); - if (scissorRect.IsEmpty()) { - continue; - } - - aContainer->gl()->fScissor(scissorRect.x, - scissorRect.y, - scissorRect.width, - scissorRect.height); - - layerToRender->RenderLayer(frameBuffer, childOffset); - aContainer->gl()->MakeCurrent(); - } - - - if (needsFramebuffer) { - // Unbind the current framebuffer and rebind the previous one. -#ifdef MOZ_DUMP_PAINTING - if (gfxUtils::sDumpPainting) { - nsRefPtr<gfxImageSurface> surf = - aContainer->gl()->GetTexImage(containerSurface, true, aManager->GetFBOTextureFormat()); - - WriteSnapshotToDumpFile(aContainer, surf); - } -#endif - - // Restore the viewport - aContainer->gl()->PopViewportRect(); - nsIntRect viewport = aContainer->gl()->ViewportRect(); - aManager->SetupPipeline(viewport.width, viewport.height, - LayerManagerOGL::ApplyWorldTransform); - aContainer->gl()->PopScissorRect(); - - if (!aManager->CompositingDisabled()) { - aContainer->gl()->fBindFramebuffer(LOCAL_GL_FRAMEBUFFER, aPreviousFrameBuffer); - aContainer->gl()->fDeleteFramebuffers(1, &frameBuffer); - - aContainer->gl()->fActiveTexture(LOCAL_GL_TEXTURE0); - - aContainer->gl()->fBindTexture(aManager->FBOTextureTarget(), containerSurface); - - MaskType maskType = MaskNone; - if (aContainer->GetMaskLayer()) { - if (!aContainer->GetTransform().CanDraw2D()) { - maskType = Mask3d; - } else { - maskType = Mask2d; - } - } - ShaderProgramOGL *rgb = - aManager->GetFBOLayerProgram(maskType); - - rgb->Activate(); - rgb->SetLayerQuadRect(visibleRect); - rgb->SetLayerTransform(transform); - rgb->SetTextureTransform(gfx3DMatrix()); - rgb->SetLayerOpacity(opacity); - rgb->SetRenderOffset(aOffset); - rgb->SetTextureUnit(0); - rgb->LoadMask(aContainer->GetMaskLayer()); - - if (rgb->GetTexCoordMultiplierUniformLocation() != -1) { - // 2DRect case, get the multiplier right for a sampler2DRect - rgb->SetTexCoordMultiplier(visibleRect.width, visibleRect.height); - } - - // Drawing is always flipped, but when copying between surfaces we want to avoid - // this. Pass true for the flip parameter to introduce a second flip - // that cancels the other one out. - aManager->BindAndDrawQuad(rgb, true); - - // Clean up resources. This also unbinds the texture. - aContainer->gl()->fDeleteTextures(1, &containerSurface); - } - } else { - aContainer->gl()->PopScissorRect(); - } -} - -ContainerLayerOGL::ContainerLayerOGL(LayerManagerOGL *aManager) - : ContainerLayer(aManager, nullptr) - , LayerOGL(aManager) +ContainerLayerOGL::ContainerLayerOGL(LayerManagerOGL *mOGLManager) + : ContainerLayer(mOGLManager, nullptr) + , LayerOGL(mOGLManager) { mImplData = static_cast<LayerOGL*>(this); } ContainerLayerOGL::~ContainerLayerOGL() { Destroy(); } void -ContainerLayerOGL::InsertAfter(Layer* aChild, Layer* aAfter) -{ - ContainerInsertAfter(this, aChild, aAfter); -} - -void -ContainerLayerOGL::RemoveChild(Layer *aChild) -{ - ContainerRemoveChild(this, aChild); -} - -void -ContainerLayerOGL::RepositionChild(Layer* aChild, Layer* aAfter) -{ - ContainerRepositionChild(this, aChild, aAfter); -} - -void ContainerLayerOGL::Destroy() { - ContainerDestroy(this); + if (!mDestroyed) { + while (mFirstChild) { + GetFirstChildOGL()->Destroy(); + RemoveChild(mFirstChild); + } + mDestroyed = true; + } } LayerOGL* ContainerLayerOGL::GetFirstChildOGL() { if (!mFirstChild) { return nullptr; } return static_cast<LayerOGL*>(mFirstChild->ImplData()); } void ContainerLayerOGL::RenderLayer(int aPreviousFrameBuffer, const nsIntPoint& aOffset) { - ContainerRender(this, aPreviousFrameBuffer, aOffset, mOGLManager); + /** + * Setup our temporary texture for rendering the contents of this container. + */ + GLuint containerSurface; + GLuint frameBuffer; + + nsIntPoint childOffset(aOffset); + nsIntRect visibleRect = GetEffectiveVisibleRegion().GetBounds(); + + nsIntRect cachedScissor = gl()->ScissorRect(); + gl()->PushScissorRect(); + mSupportsComponentAlphaChildren = false; + + float opacity = GetEffectiveOpacity(); + const gfx3DMatrix& transform = GetEffectiveTransform(); + bool needsFramebuffer = UseIntermediateSurface(); + if (needsFramebuffer) { + nsIntRect framebufferRect = visibleRect; + // we're about to create a framebuffer backed by textures to use as an intermediate + // surface. What to do if its size (as given by framebufferRect) would exceed the + // maximum texture size supported by the GL? The present code chooses the compromise + // of just clamping the framebuffer's size to the max supported size. + // This gives us a lower resolution rendering of the intermediate surface (children layers). + // See bug 827170 for a discussion. + GLint maxTexSize; + gl()->fGetIntegerv(LOCAL_GL_MAX_TEXTURE_SIZE, &maxTexSize); + framebufferRect.width = std::min(framebufferRect.width, maxTexSize); + framebufferRect.height = std::min(framebufferRect.height, maxTexSize); + + LayerManagerOGL::InitMode mode = LayerManagerOGL::InitModeClear; + if (GetEffectiveVisibleRegion().GetNumRects() == 1 && + (GetContentFlags() & Layer::CONTENT_OPAQUE)) + { + // don't need a background, we're going to paint all opaque stuff + mSupportsComponentAlphaChildren = true; + mode = LayerManagerOGL::InitModeNone; + } else { + const gfx3DMatrix& transform3D = GetEffectiveTransform(); + gfxMatrix transform; + // If we have an opaque ancestor layer, then we can be sure that + // all the pixels we draw into are either opaque already or will be + // covered by something opaque. Otherwise copying up the background is + // not safe. + if (HasOpaqueAncestorLayer(this) && + transform3D.Is2D(&transform) && !transform.HasNonIntegerTranslation()) { + mode = gfxPlatform::ComponentAlphaEnabled() ? + LayerManagerOGL::InitModeCopy : + LayerManagerOGL::InitModeClear; + framebufferRect.x += transform.x0; + framebufferRect.y += transform.y0; + mSupportsComponentAlphaChildren = gfxPlatform::ComponentAlphaEnabled(); + } + } + + gl()->PushViewportRect(); + framebufferRect -= childOffset; + if (!mOGLManager->CompositingDisabled()) { + if (!mOGLManager->CreateFBOWithTexture(framebufferRect, + mode, + aPreviousFrameBuffer, + &frameBuffer, + &containerSurface)) { + gl()->PopViewportRect(); + gl()->PopScissorRect(); + gl()->fBindFramebuffer(LOCAL_GL_FRAMEBUFFER, aPreviousFrameBuffer); + return; + } + } + childOffset.x = visibleRect.x; + childOffset.y = visibleRect.y; + } else { + frameBuffer = aPreviousFrameBuffer; + mSupportsComponentAlphaChildren = (GetContentFlags() & Layer::CONTENT_OPAQUE) || + (GetParent() && GetParent()->SupportsComponentAlphaChildren()); + } + + nsAutoTArray<Layer*, 12> children; + SortChildrenBy3DZOrder(children); + + /** + * Render this container's contents. + */ + for (uint32_t i = 0; i < children.Length(); i++) { + LayerOGL* layerToRender = static_cast<LayerOGL*>(children.ElementAt(i)->ImplData()); + + if (layerToRender->GetLayer()->GetEffectiveVisibleRegion().IsEmpty()) { + continue; + } + + nsIntRect scissorRect = layerToRender->GetLayer()-> + CalculateScissorRect(cachedScissor, &mOGLManager->GetWorldTransform()); + if (scissorRect.IsEmpty()) { + continue; + } + + gl()->fScissor(scissorRect.x, + scissorRect.y, + scissorRect.width, + scissorRect.height); + + layerToRender->RenderLayer(frameBuffer, childOffset); + gl()->MakeCurrent(); + } + + + if (needsFramebuffer) { + // Unbind the current framebuffer and rebind the previous one. +#ifdef MOZ_DUMP_PAINTING + if (gfxUtils::sDumpPainting) { + nsRefPtr<gfxImageSurface> surf = + gl()->GetTexImage(containerSurface, true, mOGLManager->GetFBOTextureFormat()); + + WriteSnapshotToDumpFile(this, surf); + } +#endif + + // Restore the viewport + gl()->PopViewportRect(); + nsIntRect viewport = gl()->ViewportRect(); + mOGLManager->SetupPipeline(viewport.width, viewport.height, + LayerManagerOGL::ApplyWorldTransform); + gl()->PopScissorRect(); + + if (!mOGLManager->CompositingDisabled()) { + gl()->fBindFramebuffer(LOCAL_GL_FRAMEBUFFER, aPreviousFrameBuffer); + gl()->fDeleteFramebuffers(1, &frameBuffer); + + gl()->fActiveTexture(LOCAL_GL_TEXTURE0); + + gl()->fBindTexture(mOGLManager->FBOTextureTarget(), containerSurface); + + MaskType maskType = MaskNone; + if (GetMaskLayer()) { + if (!GetTransform().CanDraw2D()) { + maskType = Mask3d; + } else { + maskType = Mask2d; + } + } + ShaderProgramOGL *rgb = + mOGLManager->GetFBOLayerProgram(maskType); + + rgb->Activate(); + rgb->SetLayerQuadRect(visibleRect); + rgb->SetLayerTransform(transform); + rgb->SetTextureTransform(gfx3DMatrix()); + rgb->SetLayerOpacity(opacity); + rgb->SetRenderOffset(aOffset); + rgb->SetTextureUnit(0); + rgb->LoadMask(GetMaskLayer()); + + if (rgb->GetTexCoordMultiplierUniformLocation() != -1) { + // 2DRect case, get the multiplier right for a sampler2DRect + rgb->SetTexCoordMultiplier(visibleRect.width, visibleRect.height); + } + + // Drawing is always flipped, but when copying between surfaces we want to avoid + // this. Pass true for the flip parameter to introduce a second flip + // that cancels the other one out. + mOGLManager->BindAndDrawQuad(rgb, true); + + // Clean up resources. This also unbinds the texture. + gl()->fDeleteTextures(1, &containerSurface); + } + } else { + gl()->PopScissorRect(); + } } void ContainerLayerOGL::CleanupResources() { - ContainerCleanupResources(this); + for (Layer* l = GetFirstChild(); l; l = l->GetNextSibling()) { + LayerOGL* layerToRender = static_cast<LayerOGL*>(l->ImplData()); + layerToRender->CleanupResources(); + } } } /* layers */ } /* mozilla */
--- a/gfx/layers/opengl/ContainerLayerOGL.h +++ b/gfx/layers/opengl/ContainerLayerOGL.h @@ -9,57 +9,23 @@ #include "LayerManagerOGL.h" // for LayerOGL #include "Layers.h" // for Layer (ptr only), etc class gfx3DMatrix; struct nsIntPoint; namespace mozilla { namespace layers { -template<class Container> -static void ContainerInsertAfter(Container* aContainer, Layer* aChild, Layer* aAfter); -template<class Container> -static void ContainerRemoveChild(Container* aContainer, Layer* aChild); -template<class Container> -static void ContainerRepositionChild(Container* aContainer, Layer* aChild, Layer* aAfter); -template<class Container> -static void ContainerDestroy(Container* aContainer); -template<class Container> -static void ContainerRender(Container* aContainer, - int aPreviousFrameBuffer, - const nsIntPoint& aOffset, - LayerManagerOGL* aManager); - class ContainerLayerOGL : public ContainerLayer, public LayerOGL { - template<class Container> - friend void ContainerInsertAfter(Container* aContainer, Layer* aChild, Layer* aAfter); - template<class Container> - friend void ContainerRemoveChild(Container* aContainer, Layer* aChild); - template<class Container> - friend void ContainerRepositionChild(Container* aContainer, Layer* aChild, Layer* aAfter); - template<class Container> - friend void ContainerDestroy(Container* aContainer); - template<class Container> - friend void ContainerRender(Container* aContainer, - int aPreviousFrameBuffer, - const nsIntPoint& aOffset, - LayerManagerOGL* aManager); - public: ContainerLayerOGL(LayerManagerOGL *aManager); ~ContainerLayerOGL(); - void InsertAfter(Layer* aChild, Layer* aAfter); - - void RemoveChild(Layer* aChild); - - void RepositionChild(Layer* aChild, Layer* aAfter); - /** LayerOGL implementation */ Layer* GetLayer() { return this; } void Destroy(); LayerOGL* GetFirstChildOGL(); virtual void RenderLayer(int aPreviousFrameBuffer,
--- a/gfx/src/X11Util.cpp +++ b/gfx/src/X11Util.cpp @@ -1,16 +1,17 @@ /* -*- 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 "X11Util.h" +#include "nsDebug.h" // for NS_ASSERTION, etc namespace mozilla { void FindVisualAndDepth(Display* aDisplay, VisualID aVisualID, Visual** aVisual, int* aDepth) { const Screen* screen = DefaultScreenOfDisplay(aDisplay);
--- a/gfx/src/X11Util.h +++ b/gfx/src/X11Util.h @@ -16,20 +16,19 @@ #elif defined(MOZ_WIDGET_QT) #include "gfxQtPlatform.h" #undef CursorShape # include <X11/Xlib.h> #else # error Unknown toolkit #endif -#include "mozilla/Scoped.h" - -#include "gfxCore.h" -#include "nsDebug.h" +#include <string.h> // for memset +#include "gfxCore.h" // for NS_GFX +#include "mozilla/Scoped.h" // for SCOPED_TEMPLATE namespace mozilla { /** * Return the default X Display created and used by the UI toolkit. */ inline Display* DefaultXDisplay()
--- a/gfx/src/gfxCrashReporterUtils.cpp +++ b/gfx/src/gfxCrashReporterUtils.cpp @@ -5,25 +5,35 @@ #include "gfxCrashReporterUtils.h" #if defined(MOZ_CRASHREPORTER) #define MOZ_GFXFEATUREREPORTER 1 #endif #ifdef MOZ_GFXFEATUREREPORTER -#include "nsExceptionHandler.h" -#include "nsString.h" -#include "nsTArray.h" -#include "nsIObserverService.h" -#include "nsIObserver.h" -#include "nsAutoPtr.h" -#include "nsServiceManagerUtils.h" -#include "mozilla/Services.h" -#include "nsThreadUtils.h" +#include "gfxCrashReporterUtils.h" +#include <string.h> // for strcmp +#include "mozilla/Assertions.h" // for MOZ_ASSERT_HELPER2 +#include "mozilla/Services.h" // for GetObserverService +#include "mozilla/mozalloc.h" // for operator new, etc +#include "nsAutoPtr.h" // for nsRefPtr +#include "nsCOMPtr.h" // for nsCOMPtr +#include "nsError.h" // for NS_OK, NS_FAILED, nsresult +#include "nsExceptionHandler.h" // for AppendAppNotesToCrashReport +#include "nsID.h" +#include "nsIEventTarget.h" // for NS_DISPATCH_NORMAL +#include "nsIObserver.h" // for nsIObserver, etc +#include "nsIObserverService.h" // for nsIObserverService +#include "nsIRunnable.h" // for nsIRunnable +#include "nsISupports.h" +#include "nsStringGlue.h" // for nsAutoCString, nsCString, etc +#include "nsTArray.h" // for nsTArray +#include "nsThreadUtils.h" // for NS_DispatchToMainThread, etc +#include "nscore.h" // for NS_IMETHOD, NS_IMETHODIMP, etc namespace mozilla { static nsTArray<nsCString> *gFeaturesAlreadyReported = nullptr; class ObserverToDestroyFeaturesAlreadyReported : public nsIObserver {
--- a/gfx/src/nsColor.cpp +++ b/gfx/src/nsColor.cpp @@ -1,26 +1,24 @@ /* -*- 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 "mozilla/Util.h" -#include "plstr.h" #include "nsColor.h" -#include "nsColorNames.h" -#include "nsString.h" -#include "nscore.h" -#include "nsCoord.h" -#include "nsCOMPtr.h" -#include "nsIServiceManager.h" -#include <math.h> -#include "prprf.h" +#include <sys/types.h> // for int32_t +#include "mozilla/Util.h" // for ArrayLength +#include "mozilla/mozalloc.h" // for operator delete, etc +#include "nsColorNames.h" // for nsColorNames +#include "nsDebug.h" // for NS_ASSERTION, etc #include "nsStaticNameTable.h" +#include "nsStringGlue.h" // for nsAutoCString, nsString, etc +#include "nscore.h" // for nsAString, etc using namespace mozilla; // define an array of all color names #define GFX_COLOR(_name, _value) #_name, static const char* const kColorNames[] = { #include "nsColorNameList.h" };
--- a/gfx/src/nsColor.h +++ b/gfx/src/nsColor.h @@ -1,18 +1,21 @@ /* -*- 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/. */ #ifndef nsColor_h___ #define nsColor_h___ -#include "gfxCore.h" -#include "nscore.h" +#include <stddef.h> // for size_t +#include <stdint.h> // for uint8_t, uint32_t +#include "gfxCore.h" // for NS_GFX_ +#include "nscore.h" // for nsAString +#include "prtypes.h" // for PR_BEGIN_MACRO, etc class nsAString; class nsString; class nsCString; // A color is a 32 bit unsigned integer with four components: R, G, B // and A. typedef uint32_t nscolor;
--- a/gfx/src/nsDeviceContext.cpp +++ b/gfx/src/nsDeviceContext.cpp @@ -1,32 +1,44 @@ /* -*- 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 "nsDeviceContext.h" - -#include <algorithm> - -#include "gfxImageSurface.h" -#include "mozilla/Attributes.h" -#include "mozilla/Preferences.h" -#include "mozilla/Services.h" -#include "nsCRT.h" -#include "nsFontMetrics.h" -#include "nsIDeviceContextSpec.h" -#include "nsILanguageAtomService.h" -#include "nsIObserver.h" -#include "nsIObserverService.h" -#include "nsIScreen.h" -#include "nsIScreenManager.h" -#include "nsIServiceManager.h" -#include "nsIWidget.h" -#include "nsRenderingContext.h" +#include <algorithm> // for max +#include "gfxASurface.h" // for gfxASurface, etc +#include "gfxFont.h" // for gfxFontGroup +#include "gfxImageSurface.h" // for gfxImageSurface +#include "gfxPoint.h" // for gfxSize +#include "mozilla/Attributes.h" // for MOZ_FINAL +#include "mozilla/Preferences.h" // for Preferences +#include "mozilla/Services.h" // for GetObserverService +#include "mozilla/mozalloc.h" // for operator new +#include "nsCRT.h" // for nsCRT +#include "nsDebug.h" // for NS_NOTREACHED, NS_ASSERTION, etc +#include "nsFont.h" // for nsFont +#include "nsFontMetrics.h" // for nsFontMetrics +#include "nsIAtom.h" // for nsIAtom, do_GetAtom +#include "nsID.h" +#include "nsIDeviceContextSpec.h" // for nsIDeviceContextSpec +#include "nsILanguageAtomService.h" // for nsILanguageAtomService, etc +#include "nsIObserver.h" // for nsIObserver, etc +#include "nsIObserverService.h" // for nsIObserverService +#include "nsIScreen.h" // for nsIScreen +#include "nsIScreenManager.h" // for nsIScreenManager +#include "nsISupportsUtils.h" // for NS_ADDREF, NS_RELEASE +#include "nsIWidget.h" // for nsIWidget, NS_NATIVE_WINDOW +#include "nsRect.h" // for nsRect +#include "nsRenderingContext.h" // for nsRenderingContext +#include "nsServiceManagerUtils.h" // for do_GetService +#include "nsStringGlue.h" // for nsDependentString +#include "nsTArray.h" // for nsTArray, nsTArray_Impl +#include "nsThreadUtils.h" // for NS_IsMainThread +#include "nsTraceRefcnt.h" // for MOZ_COUNT_CTOR, etc #if !XP_MACOSX #include "gfxPDFSurface.h" #endif #ifdef MOZ_WIDGET_GTK #include "gfxPSSurface.h" #elif XP_WIN
--- a/gfx/src/nsDeviceContext.h +++ b/gfx/src/nsDeviceContext.h @@ -1,21 +1,27 @@ /* -*- Mode: C++; 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 _NS_DEVICECONTEXT_H_ #define _NS_DEVICECONTEXT_H_ -#include "gfxTypes.h" -#include "nsAutoPtr.h" -#include "nsCOMPtr.h" -#include "nsCoord.h" -#include "nsMathUtils.h" +#include <stdint.h> // for uint32_t +#include <sys/types.h> // for int32_t +#include "gfxTypes.h" // for gfxFloat +#include "mozilla/Assertions.h" // for MOZ_ASSERT_HELPER2 +#include "nsAutoPtr.h" // for nsRefPtr +#include "nsCOMPtr.h" // for nsCOMPtr +#include "nsCoord.h" // for nscoord +#include "nsError.h" // for nsresult +#include "nsISupports.h" // for NS_INLINE_DECL_REFCOUNTING +#include "nsMathUtils.h" // for NS_round +#include "nscore.h" // for PRUnichar, nsAString class gfxASurface; class gfxUserFontSet; class nsFont; class nsFontCache; class nsFontMetrics; class nsIAtom; class nsIDeviceContextSpec;
--- a/gfx/src/nsFont.cpp +++ b/gfx/src/nsFont.cpp @@ -1,18 +1,25 @@ /* -*- 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 "nsFont.h" -#include "nsString.h" +#include "gfxFont.h" // for gfxFontStyle +#include "gfxFontConstants.h" // for NS_FONT_KERNING_AUTO, etc +#include "gfxFontFeatures.h" // for gfxFontFeature, etc +#include "gfxFontUtils.h" // for TRUETYPE_TAG +#include "nsCRT.h" // for nsCRT +#include "nsDebug.h" // for NS_ASSERTION +#include "nsISupports.h" +#include "nsMemory.h" // for NS_ARRAY_LENGTH #include "nsUnicharUtils.h" -#include "nsCRT.h" -#include "gfxFont.h" +#include "nscore.h" // for PRUnichar +#include "prtypes.h" // for PR_STATIC_ASSERT nsFont::nsFont(const char* aName, uint8_t aStyle, uint8_t aVariant, uint16_t aWeight, int16_t aStretch, uint8_t aDecoration, nscoord aSize) { NS_ASSERTION(aName && IsASCII(nsDependentCString(aName)), "Must only pass ASCII names here"); name.AssignASCII(aName);
--- a/gfx/src/nsFont.h +++ b/gfx/src/nsFont.h @@ -1,23 +1,27 @@ /* -*- 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/. */ #ifndef nsFont_h___ #define nsFont_h___ -#include "gfxCore.h" -#include "nsCoord.h" -#include "nsStringGlue.h" -#include "nsTArray.h" -#include "gfxFontConstants.h" +#include <stdint.h> // for uint8_t, uint16_t +#include <sys/types.h> // for int16_t +#include "gfxCore.h" // for NS_GFX #include "gfxFontFeatures.h" -#include "nsAutoPtr.h" +#include "nsAutoPtr.h" // for nsRefPtr +#include "nsCoord.h" // for nscoord +#include "nsStringFwd.h" // for nsSubstring +#include "nsStringGlue.h" // for nsString +#include "nsTArray.h" // for nsTArray + +struct gfxFontStyle; // XXX we need a method to enumerate all of the possible fonts on the // system across family, weight, style, size, etc. But not here! // Enumerator callback function. Return false to stop typedef bool (*nsFontFamilyEnumFunc)(const nsString& aFamily, bool aGeneric, void *aData); // IDs for generic fonts @@ -29,18 +33,16 @@ const uint8_t kGenericFont_moz_variable const uint8_t kGenericFont_moz_fixed = 0x01; // our special "use the user's fixed font" // CSS const uint8_t kGenericFont_serif = 0x02; const uint8_t kGenericFont_sans_serif = 0x04; const uint8_t kGenericFont_monospace = 0x08; const uint8_t kGenericFont_cursive = 0x10; const uint8_t kGenericFont_fantasy = 0x20; -struct gfxFontStyle; - // Font structure. struct NS_GFX nsFont { // The family name of the font nsString name; // The style of font (normal, italic, oblique; see gfxFontConstants.h) uint8_t style;
--- a/gfx/src/nsFontMetrics.cpp +++ b/gfx/src/nsFontMetrics.cpp @@ -1,19 +1,30 @@ /* -*- 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 "nsFontMetrics.h" -#include "nsBoundingMetrics.h" -#include "nsRenderingContext.h" -#include "nsDeviceContext.h" -#include "nsStyleConsts.h" -#include <algorithm> +#include <math.h> // for floor, ceil +#include <algorithm> // for max +#include "gfxPlatform.h" // for gfxPlatform +#include "gfxPoint.h" // for gfxPoint +#include "gfxRect.h" // for gfxRect +#include "gfxTypes.h" // for gfxFloat +#include "nsBoundingMetrics.h" // for nsBoundingMetrics +#include "nsDebug.h" // for NS_ERROR, NS_ABORT_IF_FALSE +#include "nsDeviceContext.h" // for nsDeviceContext +#include "nsIAtom.h" // for nsIAtom +#include "nsMathUtils.h" // for NS_round +#include "nsRenderingContext.h" // for nsRenderingContext +#include "nsStringGlue.h" // for nsString +#include "nsStyleConsts.h" // for NS_STYLE_HYPHENS_NONE + +class gfxUserFontSet; namespace { class AutoTextRun { public: AutoTextRun(nsFontMetrics* aMetrics, nsRenderingContext* aRC, const char* aString, int32_t aLength) {
--- a/gfx/src/nsFontMetrics.h +++ b/gfx/src/nsFontMetrics.h @@ -1,23 +1,31 @@ /* -*- 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 NSFONTMETRICS__H__ #define NSFONTMETRICS__H__ -#include "nsCOMPtr.h" -#include "nsCoord.h" -#include "nsFont.h" -#include "gfxFont.h" +#include <stdint.h> // for uint32_t +#include <sys/types.h> // for int32_t +#include "gfxFont.h" // for gfxFont, gfxFontGroup +#include "mozilla/Assertions.h" // for MOZ_ASSERT_HELPER2 +#include "nsAutoPtr.h" // for nsRefPtr +#include "nsCOMPtr.h" // for nsCOMPtr +#include "nsCoord.h" // for nscoord +#include "nsError.h" // for nsresult +#include "nsFont.h" // for nsFont +#include "nsISupports.h" // for NS_INLINE_DECL_REFCOUNTING +#include "nscore.h" // for PRUnichar +class gfxUserFontSet; +class nsDeviceContext; class nsIAtom; -class nsDeviceContext; class nsRenderingContext; struct nsBoundingMetrics; /** * Font metrics * * This class may be somewhat misnamed. A better name might be * nsFontList. The style system uses the nsFont struct for various
--- a/gfx/src/nsRect.cpp +++ b/gfx/src/nsRect.cpp @@ -1,17 +1,18 @@ /* -*- 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 "nsRect.h" -#include "nsString.h" -#include "nsDeviceContext.h" -#include "prlog.h" +#include "mozilla/gfx/Types.h" // for NS_SIDE_BOTTOM, etc +#include "nsDeviceContext.h" // for nsDeviceContext +#include "nsStringGlue.h" // for nsAutoString, etc +#include "prtypes.h" // for PR_STATIC_ASSERT // the mozilla::css::Side sequence must match the nsMargin nscoord sequence PR_STATIC_ASSERT((NS_SIDE_TOP == 0) && (NS_SIDE_RIGHT == 1) && (NS_SIDE_BOTTOM == 2) && (NS_SIDE_LEFT == 3)); #ifdef DEBUG // Diagnostics FILE* operator<<(FILE* out, const nsRect& rect)
--- a/gfx/src/nsRect.h +++ b/gfx/src/nsRect.h @@ -2,27 +2,30 @@ /* 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 NSRECT_H #define NSRECT_H -#include <stdio.h> -#include "nsCoord.h" -#include "nsPoint.h" -#include "nsSize.h" -#include "nsMargin.h" -#include "gfxCore.h" -#include "nsTraceRefcnt.h" -#include "mozilla/gfx/BaseRect.h" -#include "mozilla/Likely.h" -#include <climits> -#include <algorithm> +#include <stdio.h> // for FILE +#include <sys/types.h> // for int32_t, int64_t +#include <algorithm> // for max, min +#include <climits> // for INT_MAX +#include "gfxCore.h" // for NS_GFX +#include "mozilla/Likely.h" // for MOZ_UNLIKELY +#include "mozilla/gfx/BaseRect.h" // for BaseRect +#include "nsCoord.h" // for nscoord, etc +#include "nsDebug.h" // for NS_WARNING +#include "nsMargin.h" // for nsMargin, etc +#include "nsPoint.h" // for nsIntPoint, nsPoint +#include "nsSize.h" // for nsIntSize, nsSize +#include "nsTraceRefcnt.h" // for MOZ_COUNT_CTOR, etc +#include "nscore.h" // for NS_BUILD_REFCNT_LOGGING struct nsIntRect; struct NS_GFX nsRect : public mozilla::gfx::BaseRect<nscoord, nsRect, nsPoint, nsSize, nsMargin> { typedef mozilla::gfx::BaseRect<nscoord, nsRect, nsPoint, nsSize, nsMargin> Super; static void VERIFY_COORD(nscoord aValue) { ::VERIFY_COORD(aValue); }
--- a/gfx/src/nsRegion.cpp +++ b/gfx/src/nsRegion.cpp @@ -1,18 +1,21 @@ /* 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 "nsRegion.h" -#include "nsISupportsImpl.h" -#include "nsTArray.h" -#include "mozilla/ThreadLocal.h" -#include "nsPrintfCString.h" -#include <algorithm> +#include <algorithm> // for max, min +#include "mozilla/Assertions.h" // for MOZ_ASSERT_HELPER2, etc +#include "mozilla/ThreadLocal.h" // for ThreadLocal +#include "mozilla/mozalloc.h" // for operator delete, etc +#include "nsDebug.h" // for NS_ASSERTION, NS_ERROR +#include "nsISupports.h" // for NS_ASSERT_OWNINGTHREAD, etc +#include "nsPrintfCString.h" // for nsPrintfCString +#include "nsTArray.h" // for nsTArray, nsTArray_Impl, etc /* * The SENTINEL values below guaranties that a < or > * comparison with it will be false for all values of the * underlying nscoord type. E.g. this is always false: * aCoord > NS_COORD_GREATER_SENTINEL * Setting the mRectListHead dummy rectangle to these values * allows us to loop without checking for the list end.
--- a/gfx/src/nsRegion.h +++ b/gfx/src/nsRegion.h @@ -1,19 +1,26 @@ /* 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 nsRegion_h__ #define nsRegion_h__ -#include "nsRect.h" -#include "nsPoint.h" -#include "nsString.h" +#include <stddef.h> // for size_t +#include <stdint.h> // for uint32_t, uint64_t +#include <sys/types.h> // for int32_t +#include "gfxCore.h" // for NS_GFX +#include "nsCoord.h" // for nscoord +#include "nsError.h" // for nsresult +#include "nsPoint.h" // for nsIntPoint, nsPoint +#include "nsRect.h" // for nsIntRect, nsRect +#include "nsStringGlue.h" // for nsCString +#include "xpcom-config.h" // for CPP_THROW_NEW class nsIntRegion; /** * Implementation of regions. * A region is represented as circular double-linked list of nsRegion::RgnRect structures. * Rectangles in this list do not overlap and are sorted by (y, x) coordinates. *
--- a/gfx/src/nsRenderingContext.cpp +++ b/gfx/src/nsRenderingContext.cpp @@ -1,17 +1,31 @@ /* -*- 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 "nsRenderingContext.h" -#include "nsBoundingMetrics.h" -#include "nsRegion.h" -#include <algorithm> +#include <string.h> // for strlen +#include <algorithm> // for min +#include "gfxColor.h" // for gfxRGBA +#include "gfxMatrix.h" // for gfxMatrix +#include "gfxPoint.h" // for gfxPoint, gfxSize +#include "gfxRect.h" // for gfxRect +#include "gfxTypes.h" // for gfxFloat +#include "mozilla/gfx/BasePoint.h" // for BasePoint +#include "mozilla/mozalloc.h" // for operator delete[], etc +#include "nsBoundingMetrics.h" // for nsBoundingMetrics +#include "nsCharTraits.h" // for NS_IS_LOW_SURROGATE +#include "nsDebug.h" // for NS_ERROR +#include "nsPoint.h" // for nsPoint +#include "nsRect.h" // for nsRect, nsIntRect +#include "nsRegion.h" // for nsIntRegionRectIterator, etc + +class gfxASurface; // XXXTodo: rename FORM_TWIPS to FROM_APPUNITS #define FROM_TWIPS(_x) ((gfxFloat)((_x)/(mP2A))) #define FROM_TWIPS_INT(_x) (NSToIntRound((gfxFloat)((_x)/(mP2A)))) #define TO_TWIPS(_x) ((nscoord)((_x)*(mP2A))) #define GFX_RECT_FROM_TWIPS_RECT(_r) (gfxRect(FROM_TWIPS((_r).x), FROM_TWIPS((_r).y), FROM_TWIPS((_r).width), FROM_TWIPS((_r).height))) // Hard limit substring lengths to 8000 characters ... this lets us statically
--- a/gfx/src/nsRenderingContext.h +++ b/gfx/src/nsRenderingContext.h @@ -1,26 +1,35 @@ /* -*- 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 NSRENDERINGCONTEXT__H__ #define NSRENDERINGCONTEXT__H__ -#include "nsAutoPtr.h" -#include "nsDeviceContext.h" -#include "nsFontMetrics.h" -#include "nsColor.h" -#include "nsCoord.h" -#include "gfxContext.h" -#include "mozilla/gfx/UserData.h" +#include <stdint.h> // for uint32_t +#include <sys/types.h> // for int32_t +#include "gfxContext.h" // for gfxContext +#include "mozilla/Assertions.h" // for MOZ_ASSERT_HELPER2 +#include "mozilla/gfx/UserData.h" // for UserData, UserDataKey +#include "nsAutoPtr.h" // for nsRefPtr +#include "nsBoundingMetrics.h" // for nsBoundingMetrics +#include "nsColor.h" // for nscolor +#include "nsCoord.h" // for nscoord, NSToIntRound +#include "nsDeviceContext.h" // for nsDeviceContext +#include "nsFontMetrics.h" // for nsFontMetrics +#include "nsISupports.h" // for NS_INLINE_DECL_REFCOUNTING, etc +#include "nsStringGlue.h" // for nsString +#include "nscore.h" // for PRUnichar +class gfxASurface; +class nsIntRegion; struct nsPoint; -class nsIntRegion; +struct nsRect; typedef enum { nsLineStyle_kNone = 0, nsLineStyle_kSolid = 1, nsLineStyle_kDashed = 2, nsLineStyle_kDotted = 3 } nsLineStyle;
--- a/gfx/src/nsScriptableRegion.cpp +++ b/gfx/src/nsScriptableRegion.cpp @@ -1,19 +1,28 @@ /* -*- 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 "nsScriptableRegion.h" -#include "nsCOMPtr.h" -#include "nsIXPConnect.h" -#include "nsServiceManagerUtils.h" -#include "jsapi.h" +#include <stdint.h> // for uint32_t +#include <sys/types.h> // for int32_t +#include "js/RootingAPI.h" // for Rooted +#include "js/Value.h" // for INT_TO_JSVAL, etc +#include "jsapi.h" // for JS_DefineElement, etc +#include "mozilla/Assertions.h" // for MOZ_ASSERT_HELPER2 +#include "nsError.h" // for NS_OK, NS_ERROR_FAILURE, etc +#include "nsID.h" +#include "nsRect.h" // for nsIntRect +#include "nscore.h" // for NS_IMETHODIMP + +class JSObject; +struct JSContext; nsScriptableRegion::nsScriptableRegion() { } NS_IMPL_ISUPPORTS1(nsScriptableRegion, nsIScriptableRegion) NS_IMETHODIMP nsScriptableRegion::Init()
--- a/gfx/src/nsThebesFontEnumerator.cpp +++ b/gfx/src/nsThebesFontEnumerator.cpp @@ -1,20 +1,26 @@ /* -*- 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 "nsThebesFontEnumerator.h" - -#include "nsMemory.h" - -#include "gfxPlatform.h" -#include "nsTArray.h" -#include "nsIAtom.h" +#include <stdint.h> // for uint32_t +#include "gfxPlatform.h" // for gfxPlatform +#include "mozilla/Assertions.h" // for MOZ_ASSERT_HELPER2 +#include "nsCOMPtr.h" // for nsCOMPtr +#include "nsDebug.h" // for NS_ENSURE_ARG_POINTER +#include "nsError.h" // for NS_OK, NS_FAILED, nsresult +#include "nsIAtom.h" // for nsIAtom, do_GetAtom +#include "nsID.h" +#include "nsMemory.h" // for nsMemory +#include "nsStringGlue.h" // for nsAutoCString, nsAutoString, etc +#include "nsTArray.h" // for nsTArray, nsTArray_Impl, etc +#include "nscore.h" // for PRUnichar, NS_IMETHODIMP NS_IMPL_ISUPPORTS1(nsThebesFontEnumerator, nsIFontEnumerator) nsThebesFontEnumerator::nsThebesFontEnumerator() { } NS_IMETHODIMP
--- a/gfx/src/nsThebesFontEnumerator.h +++ b/gfx/src/nsThebesFontEnumerator.h @@ -1,18 +1,19 @@ /* -*- 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 _NSTHEBESFONTENUMERATOR_H_ #define _NSTHEBESFONTENUMERATOR_H_ -#include "nsIFontEnumerator.h" -#include "mozilla/Attributes.h" +#include "mozilla/Attributes.h" // for MOZ_FINAL +#include "nsIFontEnumerator.h" // for NS_DECL_NSIFONTENUMERATOR, etc +#include "nsISupports.h" // for NS_DECL_ISUPPORTS class nsThebesFontEnumerator MOZ_FINAL : public nsIFontEnumerator { public: nsThebesFontEnumerator(); NS_DECL_ISUPPORTS
--- a/gfx/src/nsThebesGfxFactory.cpp +++ b/gfx/src/nsThebesGfxFactory.cpp @@ -1,22 +1,27 @@ /* -*- 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 "gfxPlatform.h" // for gfxPlatform +#include "mozilla/Assertions.h" // for MOZ_ASSERT_HELPER2 +#include "mozilla/Attributes.h" // for MOZ_FINAL +#include "mozilla/Module.h" // for Module, Module::CIDEntry, etc #include "mozilla/ModuleUtils.h" -#include "mozilla/Attributes.h" -#include "nsCOMPtr.h" -#include "nsGfxCIID.h" - -#include "nsThebesFontEnumerator.h" -#include "nsScriptableRegion.h" - -#include "gfxPlatform.h" +#include "mozilla/mozalloc.h" // for operator new +#include "nsCOMPtr.h" // for nsCOMPtr +#include "nsError.h" // for NS_ERROR_NO_AGGREGATION, etc +#include "nsGfxCIID.h" // for NS_FONT_ENUMERATOR_CID, etc +#include "nsID.h" // for NS_DEFINE_NAMED_CID, etc +#include "nsIScriptableRegion.h" // for nsIScriptableRegion +#include "nsISupports.h" // for NS_DECL_ISUPPORTS, etc +#include "nsScriptableRegion.h" // for nsScriptableRegion +#include "nsThebesFontEnumerator.h" // for nsThebesFontEnumerator // This class doesn't do anything; its only purpose is to give // gfxPlatform::Init a way to force this component to be registered, // so that gfxPlatform::Shutdown will be called at an appropriate // time. (Component teardown is the only shutdown hook that runs // late enough; see bug 651498.) namespace {
--- a/gfx/thebes/gfxASurface.cpp +++ b/gfx/thebes/gfxASurface.cpp @@ -518,17 +518,17 @@ gfxASurface::MovePixels(const nsIntRect& // Assume the backend can't handle self copying well and allocate // a temporary surface instead. nsRefPtr<gfxASurface> tmp = CreateSimilarSurface(GetContentType(), gfxIntSize(aSourceRect.width, aSourceRect.height)); // CreateSimilarSurface can return nullptr if the current surface is // in an error state. This isn't good, but its better to carry // on with the error surface instead of crashing. - NS_ASSERTION(tmp, "Must have temporary surface to move pixels!"); + NS_WARN_IF_FALSE(tmp, "Must have temporary surface to move pixels!"); if (!tmp) { return; } nsRefPtr<gfxContext> ctx = new gfxContext(tmp); ctx->SetOperator(gfxContext::OPERATOR_SOURCE); ctx->SetSource(this, gfxPoint(-aSourceRect.x, -aSourceRect.y)); ctx->Paint();
--- a/ipc/chromium/src/base/dir_reader_bsd.h +++ b/ipc/chromium/src/base/dir_reader_bsd.h @@ -54,29 +54,21 @@ class DirReaderBSD { #else offset_ += dirent->d_reclen; #endif } if (offset_ != size_) return true; -#ifdef OS_OPENBSD - const int r = getdirentries(fd_, buf_, sizeof(buf_), basep_); -#else const int r = getdents(fd_, buf_, sizeof(buf_)); -#endif if (r == 0) return false; if (r == -1) { -#ifdef OS_OPENBSD - DLOG(ERROR) << "getdirentries returned an error: " << errno; -#else DLOG(ERROR) << "getdents returned an error: " << errno; -#endif return false; } size_ = r; offset_ = 0; return true; } const char* name() const { @@ -94,19 +86,16 @@ class DirReaderBSD { static bool IsFallback() { return false; } private: const int fd_; char buf_[512]; -#ifdef OS_OPENBSD - off_t *basep_; -#endif size_t offset_, size_; DISALLOW_COPY_AND_ASSIGN(DirReaderBSD); }; } // namespace base #endif // BASE_DIR_READER_BSD_H_
--- a/ipc/testshell/TestShellParent.h +++ b/ipc/testshell/TestShellParent.h @@ -6,22 +6,20 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef ipc_testshell_TestShellParent_h #define ipc_testshell_TestShellParent_h 1 #include "mozilla/ipc/PTestShellParent.h" #include "mozilla/ipc/PTestShellCommandParent.h" +#include "js/TypeDecls.h" #include "nsAutoJSValHolder.h" #include "nsStringGlue.h" -struct JSContext; -class JSObject; - namespace mozilla { namespace ipc { class TestShellCommandParent; class TestShellParent : public PTestShellParent {
--- a/ipc/testshell/XPCShellEnvironment.h +++ b/ipc/testshell/XPCShellEnvironment.h @@ -11,19 +11,18 @@ #include <stdio.h> #include "nsAutoJSValHolder.h" #include "nsCOMPtr.h" #include "nsDebug.h" #include "nsStringGlue.h" #include "nsJSPrincipals.h" #include "nsContentUtils.h" +#include "js/TypeDecls.h" -struct JSContext; -class JSObject; struct JSPrincipals; namespace mozilla { namespace ipc { class XPCShellEnvironment { public:
--- a/js/public/Anchor.h +++ b/js/public/Anchor.h @@ -6,22 +6,17 @@ /* JS::Anchor implementation. */ #ifndef js_Anchor_h #define js_Anchor_h #include "mozilla/Attributes.h" -class JSFunction; -class JSObject; -class JSScript; -class JSString; - -namespace JS { class Value; } +#include "js/TypeDecls.h" namespace JS { /* * Protecting non-Value, non-JSObject *, non-JSString * values from collection * * Most of the time, the garbage collector's conservative stack scanner works * behind the scenes, finding all live values and protecting them from being
--- a/js/public/CallArgs.h +++ b/js/public/CallArgs.h @@ -33,19 +33,16 @@ #include "mozilla/Attributes.h" #include "mozilla/TypeTraits.h" #include "jstypes.h" #include "js/RootingAPI.h" #include "js/Value.h" -struct JSContext; -class JSObject; - /* Typedef for native functions called by the JS VM. */ typedef bool (* JSNative)(JSContext *cx, unsigned argc, JS::Value *vp); /* Typedef for native functions that may be called in parallel. */ typedef js::ParallelResult (* JSParallelNative)(js::ForkJoinSlice *slice, unsigned argc, JS::Value *vp);
--- a/js/public/Class.h +++ b/js/public/Class.h @@ -4,43 +4,31 @@ * 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/. */ /* JSClass definition and its component types, plus related interfaces. */ #ifndef js_Class_h #define js_Class_h -#include "jspubtd.h" #include "jstypes.h" #include "js/CallArgs.h" #include "js/Id.h" +#include "js/TypeDecls.h" /* * A JSClass acts as a vtable for JS objects that allows JSAPI clients to * control various aspects of the behavior of an object like property lookup. * js::Class is an engine-private extension that allows more control over * object behavior and, e.g., allows custom slow layout. */ class JSFreeOp; -namespace JS { -template <typename T> class Handle; -template <typename T> class MutableHandle; -class Value; - -typedef JS::Handle<JSObject*> HandleObject; -typedef JS::Handle<jsid> HandleId; -typedef JS::Handle<JS::Value> HandleValue; -typedef JS::MutableHandle<JSObject*> MutableHandleObject; -typedef JS::MutableHandle<JS::Value> MutableHandleValue; -} - namespace js { class Class; class FreeOp; class PropertyId; class PropertyName; class Shape; class SpecialId;
--- a/js/public/Id.h +++ b/js/public/Id.h @@ -2,24 +2,34 @@ * vim: set ts=8 sts=4 et sw=4 tw=99: * 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 js_Id_h #define js_Id_h +// A jsid is an identifier for a property or method of an object which is +// either a 31-bit signed integer, interned string or object. +// +// Also, there is an additional jsid value, JSID_VOID, which does not occur in +// JS scripts but may be used to indicate the absence of a valid jsid. A void +// jsid is not a valid id and only arises as an exceptional API return value, +// such as in JS_NextProperty. Embeddings must not pass JSID_VOID into JSAPI +// entry points expecting a jsid and do not need to handle JSID_VOID in hooks +// receiving a jsid except when explicitly noted in the API contract. +// +// A jsid is not implicitly convertible to or from a jsval; JS_ValueToId or +// JS_IdToValue must be used instead. + #include "jstypes.h" -#include "js/IdForward.h" +#include "js/TypeDecls.h" #include "js/Utility.h" -class JSObject; -class JSString; - #ifdef JS_USE_JSID_STRUCT_TYPES struct jsid { size_t asBits; bool operator==(jsid rhs) const { return asBits == rhs.asBits; } bool operator!=(jsid rhs) const { return asBits != rhs.asBits; } }; # define JSID_BITS(id) (id.asBits)
deleted file mode 100644 --- a/js/public/IdForward.h +++ /dev/null @@ -1,55 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * vim: set ts=8 sts=4 et sw=4 tw=99: - * 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 js_IdForward_h -#define js_IdForward_h - -#include <stddef.h> - -// A jsid is an identifier for a property or method of an object which is -// either a 31-bit signed integer, interned string or object. -// -// Also, there is an additional jsid value, JSID_VOID, which does not occur in -// JS scripts but may be used to indicate the absence of a valid jsid. A void -// jsid is not a valid id and only arises as an exceptional API return value, -// such as in JS_NextProperty. Embeddings must not pass JSID_VOID into JSAPI -// entry points expecting a jsid and do not need to handle JSID_VOID in hooks -// receiving a jsid except when explicitly noted in the API contract. -// -// A jsid is not implicitly convertible to or from a jsval; JS_ValueToId or -// JS_IdToValue must be used instead. -// -// In release builds, jsid is defined to be an integral type. This -// prevents many bugs from being caught at compile time. E.g.: -// -// jsid id = ... -// if (id) // error -// ... -// -// size_t n = id; // error -// -// To catch more errors, jsid is given a struct type in C++ debug builds. -// Struct assignment and (in C++) operator== allow correct code to be mostly -// oblivious to the change. This feature can be explicitly disabled in debug -// builds by defining JS_NO_JSVAL_JSID_STRUCT_TYPES. -// -// Note: if jsid was always a struct, we could just forward declare it in -// places where its declaration is needed. But the fact that it's a typedef in -// non-debug builds prevents that. So we have this file, which is morally -// equivalent to a forward declaration, and should be included by any file that -// uses jsid but doesn't need its definition. - -#if defined(DEBUG) && !defined(JS_NO_JSVAL_JSID_STRUCT_TYPES) -# define JS_USE_JSID_STRUCT_TYPES -#endif - -#ifdef JS_USE_JSID_STRUCT_TYPES -struct jsid; -#else -typedef ptrdiff_t jsid; -#endif - -#endif /* js_IdForward_h */
--- a/js/public/OldDebugAPI.h +++ b/js/public/OldDebugAPI.h @@ -9,17 +9,17 @@ /* * JS debugger API. */ #include "jsbytecode.h" #include "js/CallArgs.h" -#include "js/IdForward.h" +#include "js/TypeDecls.h" class JSAtom; class JSFreeOp; namespace js { class StackFrame; } namespace JS {
--- a/js/public/ProfilingStack.h +++ b/js/public/ProfilingStack.h @@ -8,17 +8,16 @@ #define js_ProfilingStack_h #include "jsbytecode.h" #include "jstypes.h" #include "js/Utility.h" struct JSRuntime; -class JSScript; namespace js { // A call stack can be specified to the JS engine such that all JS entry/exits // to functions push/pop an entry to/from the specified stack. // // For more detailed information, see vm/SPSProfiler.h. //
--- a/js/public/PropertyKey.h +++ b/js/public/PropertyKey.h @@ -4,20 +4,19 @@ * 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/. */ /* JS::PropertyKey implementation. */ #ifndef js_PropertyKey_h #define js_PropertyKey_h +#include "js/TypeDecls.h" #include "js/Value.h" -struct JSContext; - namespace JS { class PropertyKey; namespace detail { extern JS_PUBLIC_API(bool) ToPropertyKeySlow(JSContext *cx, HandleValue v, PropertyKey *key);
--- a/js/public/RootingAPI.h +++ b/js/public/RootingAPI.h @@ -7,17 +7,17 @@ #ifndef js_RootingAPI_h #define js_RootingAPI_h #include "mozilla/GuardObjects.h" #include "mozilla/TypeTraits.h" #include "jspubtd.h" -#include "js/IdForward.h" +#include "js/TypeDecls.h" #include "js/Utility.h" /* * Moving GC Stack Rooting * * A moving GC may change the physical location of GC allocated things, even * when they are rooted, updating all pointers to the thing to refer to its new * location. The GC must therefore know about all live pointers to a thing, @@ -93,17 +93,16 @@ * +---> MutableHandle<T> * (via &) * * All of these types have an implicit conversion to raw pointers. */ namespace js { -class Module; class ScriptSourceObject; template <typename T> struct GCMethods {}; template <typename T> class RootedBase {}; @@ -139,19 +138,16 @@ struct Cell; } /* namespace gc */ } /* namespace js */ namespace JS { template <typename T> class Rooted; -template <typename T> class Handle; -template <typename T> class MutableHandle; - /* This is exposing internal state of the GC for inlining purposes. */ JS_FRIEND_API(bool) isGCEnabled(); #if defined(DEBUG) && defined(JS_GC_ZEAL) && defined(JSGC_ROOT_ANALYSIS) && !defined(JS_THREADSAFE) extern void CheckStackRoots(JSContext *cx); #endif @@ -462,25 +458,16 @@ class MOZ_NONHEAP_CLASS Handle : public Handle() {} const T *ptr; template <typename S> void operator=(S v) MOZ_DELETE; }; -typedef Handle<JSObject*> HandleObject; -typedef Handle<js::Module*> HandleModule; -typedef Handle<js::ScriptSourceObject *> HandleScriptSource; -typedef Handle<JSFunction*> HandleFunction; -typedef Handle<JSScript*> HandleScript; -typedef Handle<JSString*> HandleString; -typedef Handle<jsid> HandleId; -typedef Handle<Value> HandleValue; - /* * Similar to a handle, but the underlying storage can be changed. This is * useful for outparams. * * If you want to add additional methods to MutableHandle for a specific * specialization, define a MutableHandleBase<T> specialization containing * them. */ @@ -522,23 +509,16 @@ class MOZ_STACK_CLASS MutableHandle : pu MutableHandle() {} T *ptr; template <typename S> void operator=(S v) MOZ_DELETE; void operator=(MutableHandle other) MOZ_DELETE; }; -typedef MutableHandle<JSObject*> MutableHandleObject; -typedef MutableHandle<JSFunction*> MutableHandleFunction; -typedef MutableHandle<JSScript*> MutableHandleScript; -typedef MutableHandle<JSString*> MutableHandleString; -typedef MutableHandle<jsid> MutableHandleId; -typedef MutableHandle<Value> MutableHandleValue; - #ifdef JSGC_GENERATIONAL JS_PUBLIC_API(void) HeapCellPostBarrier(js::gc::Cell **cellp); JS_PUBLIC_API(void) HeapCellRelocate(js::gc::Cell **cellp); #endif } /* namespace JS */ namespace js { @@ -798,18 +778,16 @@ class MOZ_STACK_CLASS Rooted : public js #if !(defined(JSGC_ROOT_ANALYSIS) || defined(JSGC_USE_EXACT_ROOTING)) // Defined in vm/String.h. template <> class Rooted<JSStableString *>; #endif typedef Rooted<JSObject*> RootedObject; -typedef Rooted<js::Module*> RootedModule; -typedef Rooted<js::ScriptSourceObject *> RootedScriptSource; typedef Rooted<JSFunction*> RootedFunction; typedef Rooted<JSScript*> RootedScript; typedef Rooted<JSString*> RootedString; typedef Rooted<jsid> RootedId; typedef Rooted<JS::Value> RootedValue; } /* namespace JS */
--- a/js/public/StructuredClone.h +++ b/js/public/StructuredClone.h @@ -6,27 +6,22 @@ #ifndef js_StructuredClone_h #define js_StructuredClone_h #include <stdint.h> #include "jstypes.h" -struct JSContext; -class JSObject; +#include "js/TypeDecls.h" + struct JSRuntime; struct JSStructuredCloneReader; struct JSStructuredCloneWriter; -namespace JS { -template <typename T> class Handle; -class Value; -} - // API for the HTML5 internal structured cloning algorithm. // Read structured data from the reader r. This hook is used to read a value // previously serialized by a call to the WriteStructuredCloneOp hook. // // tag and data are the pair of uint32_t values from the header. The callback // may use the JS_Read* APIs to read any other relevant parts of the object // from the reader r. closure is any value passed to the JS_ReadStructuredClone
new file mode 100644 --- /dev/null +++ b/js/public/TypeDecls.h @@ -0,0 +1,81 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * vim: set ts=8 sts=4 et sw=4 tw=99: + * 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 file contains public type declarations that are used *frequently*. If +// it doesn't occur at least 10 times in Gecko, it probably shouldn't be in +// here. +// +// It includes only: +// - forward declarations of structs and classes; +// - typedefs; +// - enums (maybe). +// It does *not* contain any struct or class definitions. + +#ifndef js_TypeDecls_h +#define js_TypeDecls_h + +#include <stddef.h> +#include <stdint.h> + +struct JSContext; +class JSFunction; +class JSObject; +class JSScript; +class JSString; + +// In release builds, jsid is defined to be an integral type. This +// prevents many bugs from being caught at compile time. E.g.: +// +// jsid id = ... +// if (id) // error +// ... +// +// size_t n = id; // error +// +// To catch more errors, jsid is given a struct type in C++ debug builds. +// Struct assignment and (in C++) operator== allow correct code to be mostly +// oblivious to the change. This feature can be explicitly disabled in debug +// builds by defining JS_NO_JSVAL_JSID_STRUCT_TYPES. +// +#if defined(DEBUG) && !defined(JS_NO_JSVAL_JSID_STRUCT_TYPES) +# define JS_USE_JSID_STRUCT_TYPES +#endif + +#ifdef JS_USE_JSID_STRUCT_TYPES +struct jsid; +#else +typedef ptrdiff_t jsid; +#endif + +#ifdef WIN32 +typedef wchar_t jschar; +#else +typedef uint16_t jschar; +#endif + +namespace JS { + +class Value; +template <typename T> class Handle; +template <typename T> class MutableHandle; + +typedef Handle<JSFunction*> HandleFunction; +typedef Handle<jsid> HandleId; +typedef Handle<JSObject*> HandleObject; +typedef Handle<JSScript*> HandleScript; +typedef Handle<JSString*> HandleString; +typedef Handle<Value> HandleValue; + +typedef MutableHandle<JSFunction*> MutableHandleFunction; +typedef MutableHandle<jsid> MutableHandleId; +typedef MutableHandle<JSObject*> MutableHandleObject; +typedef MutableHandle<JSScript*> MutableHandleScript; +typedef MutableHandle<JSString*> MutableHandleString; +typedef MutableHandle<Value> MutableHandleValue; + +} // namespace JS + +#endif /* js_TypeDecls_h */
--- a/js/src/TraceLogging.h +++ b/js/src/TraceLogging.h @@ -5,18 +5,16 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef TraceLogging_h #define TraceLogging_h #include <stdint.h> #include <stdio.h> -class JSScript; - namespace JS { class CompileOptions; } namespace js { class TraceLogging {
--- a/js/src/builtin/Intl.h +++ b/js/src/builtin/Intl.h @@ -6,32 +6,28 @@ #ifndef builtin_Intl_h #define builtin_Intl_h #include "jsapi.h" #include "js/RootingAPI.h" -struct JSContext; -class JSObject; - /* * The Intl module specified by standard ECMA-402, * ECMAScript Internationalization API Specification. */ /** * Initializes the Intl Object and its standard built-in properties. * Spec: ECMAScript Internationalization API Specification, 8.0, 8.1 */ extern JSObject * js_InitIntlClass(JSContext *cx, js::HandleObject obj); - namespace js { /* * The following functions are for use by self-hosted code. */ /******************** Collator ********************/
--- a/js/src/builtin/Module.cpp +++ b/js/src/builtin/Module.cpp @@ -5,16 +5,20 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "builtin/Module.h" #include "jsobjinlines.h" using namespace js; +namespace js { +typedef Rooted<Module*> RootedModule; +} + Class Module::class_ = { "Module", JSCLASS_HAS_RESERVED_SLOTS(2) | JSCLASS_IS_ANONYMOUS, JS_PropertyStub, /* addProperty */ JS_DeletePropertyStub, /* delProperty */ JS_PropertyStub, /* getProperty */ JS_StrictPropertyStub, /* setProperty */ JS_EnumerateStub,
--- a/js/src/ds/LifoAlloc.cpp +++ b/js/src/ds/LifoAlloc.cpp @@ -119,24 +119,26 @@ LifoAlloc::getOrCreateChunk(size_t n) return newChunk; } void LifoAlloc::transferFrom(LifoAlloc *other) { JS_ASSERT(!markCount); - JS_ASSERT(latest == first); JS_ASSERT(!other->markCount); if (!other->first) return; incrementCurSize(other->curSize_); - append(other->first, other->last); + if (other->isEmpty()) + appendUnused(other->first, other->last); + else + appendUsed(other->first, other->latest, other->last); other->first = other->last = other->latest = NULL; other->curSize_ = 0; } void LifoAlloc::transferUnusedFrom(LifoAlloc *other) { JS_ASSERT(!markCount); @@ -156,13 +158,13 @@ LifoAlloc::transferUnusedFrom(LifoAlloc } else { for (BumpChunk *chunk = other->latest->next(); chunk; chunk = chunk->next()) { size_t size = chunk->computedSizeOfIncludingThis(); incrementCurSize(size); other->decrementCurSize(size); } } - append(other->latest->next(), other->last); + appendUnused(other->latest->next(), other->last); other->latest->setNext(NULL); other->last = other->latest; } }
--- a/js/src/ds/LifoAlloc.h +++ b/js/src/ds/LifoAlloc.h @@ -182,25 +182,38 @@ class LifoAlloc void reset(size_t defaultChunkSize) { JS_ASSERT(mozilla::RoundUpPow2(defaultChunkSize) == defaultChunkSize); first = latest = last = NULL; defaultChunkSize_ = defaultChunkSize; markCount = 0; curSize_ = 0; } - void append(BumpChunk *start, BumpChunk *end) { + // Append unused chunks to the end of this LifoAlloc. + void appendUnused(BumpChunk *start, BumpChunk *end) { JS_ASSERT(start && end); if (last) last->setNext(start); else first = latest = start; last = end; } + // Append used chunks to the end of this LifoAlloc. We act as if all the + // chunks in |this| are used, even if they're not, so memory may be wasted. + void appendUsed(BumpChunk *start, BumpChunk *latest, BumpChunk *end) { + JS_ASSERT(start && latest && end); + if (last) + last->setNext(start); + else + first = latest = start; + last = end; + this->latest = latest; + } + void incrementCurSize(size_t size) { curSize_ += size; if (curSize_ > peakSize_) peakSize_ = curSize_; } void decrementCurSize(size_t size) { JS_ASSERT(curSize_ >= size); curSize_ -= size;
--- a/js/src/frontend/BytecodeCompiler.cpp +++ b/js/src/frontend/BytecodeCompiler.cpp @@ -183,17 +183,17 @@ frontend::CompileScript(ExclusiveContext return NULL; JS_ASSERT_IF(staticLevel != 0, options.sourcePolicy != CompileOptions::LAZY_SOURCE); ScriptSource *ss = cx->new_<ScriptSource>(options.originPrincipals()); if (!ss) return NULL; if (options.filename && !ss->setFilename(cx, options.filename)) return NULL; - JS::RootedScriptSource sourceObject(cx, ScriptSourceObject::create(cx, ss)); + RootedScriptSource sourceObject(cx, ScriptSourceObject::create(cx, ss)); if (!sourceObject) return NULL; SourceCompressionTask mysct(cx); SourceCompressionTask *sct = extraSct ? extraSct : &mysct; switch (options.sourcePolicy) { case CompileOptions::SAVE_SOURCE: @@ -411,17 +411,17 @@ frontend::CompileLazyFunction(JSContext lazy->generatorKind()); if (!pn) return false; if (!NameFunctions(cx, pn)) return false; RootedObject enclosingScope(cx, lazy->enclosingScope()); - JS::RootedScriptSource sourceObject(cx, lazy->sourceObject()); + RootedScriptSource sourceObject(cx, lazy->sourceObject()); JS_ASSERT(sourceObject); Rooted<JSScript*> script(cx, JSScript::Create(cx, enclosingScope, false, options, staticLevel, sourceObject, lazy->begin(), lazy->end())); if (!script) return false; @@ -463,17 +463,17 @@ CompileFunctionBody(JSContext *cx, Mutab if (!CheckLength(cx, length)) return false; ScriptSource *ss = cx->new_<ScriptSource>(options.originPrincipals()); if (!ss) return false; if (options.filename && !ss->setFilename(cx, options.filename)) return false; - JS::RootedScriptSource sourceObject(cx, ScriptSourceObject::create(cx, ss)); + RootedScriptSource sourceObject(cx, ScriptSourceObject::create(cx, ss)); if (!sourceObject) return false; SourceCompressionTask sct(cx); JS_ASSERT(options.sourcePolicy != CompileOptions::LAZY_SOURCE); if (options.sourcePolicy == CompileOptions::SAVE_SOURCE) { if (!ss->setSourceCopy(cx, chars, length, true, &sct)) return false; }
--- a/js/src/frontend/NameFunctions.h +++ b/js/src/frontend/NameFunctions.h @@ -2,17 +2,17 @@ * vim: set ts=8 sts=4 et sw=4 tw=99: * 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 frontend_NameFunctions_h #define frontend_NameFunctions_h -struct JSContext; +#include "js/TypeDecls.h" namespace js { namespace frontend { class ParseNode; bool NameFunctions(JSContext *cx, ParseNode *pn);
--- a/js/src/gc/Marking.h +++ b/js/src/gc/Marking.h @@ -4,23 +4,17 @@ * 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 gc_Marking_h #define gc_Marking_h #include "gc/Barrier.h" #include "jit/IonCode.h" - -extern "C" { -struct JSContext; -class JSFunction; -class JSObject; -class JSScript; -} +#include "js/TypeDecls.h" class JSAtom; class JSLinearString; namespace js { class ArgumentsObject; class ArrayBufferObject;
--- a/js/src/gc/Rooting.h +++ b/js/src/gc/Rooting.h @@ -19,20 +19,22 @@ class Shape; namespace types { struct TypeObject; } // These are internal counterparts to the public types such as HandleObject. typedef JS::Handle<Shape*> HandleShape; typedef JS::Handle<types::TypeObject*> HandleTypeObject; typedef JS::Handle<JSAtom*> HandleAtom; typedef JS::Handle<PropertyName*> HandlePropertyName; +typedef JS::Handle<js::ScriptSourceObject*> HandleScriptSource; typedef JS::MutableHandle<Shape*> MutableHandleShape; typedef JS::MutableHandle<JSAtom*> MutableHandleAtom; typedef JS::Rooted<Shape*> RootedShape; typedef JS::Rooted<types::TypeObject*> RootedTypeObject; typedef JS::Rooted<JSAtom*> RootedAtom; typedef JS::Rooted<PropertyName*> RootedPropertyName; +typedef Rooted<js::ScriptSourceObject*> RootedScriptSource; } /* namespace js */ #endif /* gc_Rooting_h */
--- a/js/src/jit/IonCaches.h +++ b/js/src/jit/IonCaches.h @@ -9,19 +9,16 @@ #ifdef JS_CPU_ARM # include "jit/arm/Assembler-arm.h" #endif #include "jit/IonCode.h" #include "jit/Registers.h" #include "jit/shared/Assembler-shared.h" -class JSFunction; -class JSScript; - namespace js { class LockedJSContext; class TypedArrayObject; namespace jit { #define IONCACHE_KIND_LIST(_) \
--- a/js/src/jit/IonCode.h +++ b/js/src/jit/IonCode.h @@ -14,18 +14,16 @@ #include "gc/Heap.h" #include "jit/IonTypes.h" namespace JSC { class ExecutablePool; } -class JSScript; - namespace js { class AsmJSModule; namespace jit { // The maximum size of any buffer associated with an assembler or code object. // This is chosen to not overflow a signed integer, leaving room for an extra
--- a/js/src/jit/IonFrames.h +++ b/js/src/jit/IonFrames.h @@ -15,19 +15,16 @@ #include "jsfun.h" #include "jstypes.h" #include "jsutil.h" #include "jit/IonCode.h" #include "jit/IonFrameIterator.h" #include "jit/Registers.h" -class JSFunction; -class JSScript; - namespace js { namespace jit { typedef void * CalleeToken; enum CalleeTokenTag { CalleeToken_Function = 0x0, // untagged
--- a/js/src/jit/JSONSpewer.h +++ b/js/src/jit/JSONSpewer.h @@ -4,17 +4,17 @@ * 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 jit_JSONSpewer_h #define jit_JSONSpewer_h #include <stdio.h> -class JSScript; +#include "js/TypeDecls.h" namespace js { namespace jit { class MDefinition; class MInstruction; class MBasicBlock; class MIRGraph;
--- a/js/src/jit/PerfSpewer.h +++ b/js/src/jit/PerfSpewer.h @@ -6,18 +6,16 @@ #ifndef jit_PerfSpewer_h #define jit_PerfSpewer_h #include <stdio.h> #include "jit/IonMacroAssembler.h" -class JSScript; - namespace js { namespace jit { class MBasicBlock; class MacroAssembler; #ifdef JS_ION_PERF void CheckPerf();
--- a/js/src/jsalloc.h +++ b/js/src/jsalloc.h @@ -4,20 +4,19 @@ * 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/. */ /* JS allocation policies. */ #ifndef jsalloc_h #define jsalloc_h +#include "js/TypeDecls.h" #include "js/Utility.h" -struct JSContext; - namespace js { class ContextFriendFields; /* Policy for using system memory functions and doing no error reporting. */ class SystemAllocPolicy { public:
--- a/js/src/jsanalyze.h +++ b/js/src/jsanalyze.h @@ -6,18 +6,16 @@ /* Definitions for javascript analysis. */ #ifndef jsanalyze_h #define jsanalyze_h #include "jscompartment.h" -class JSScript; - namespace js { namespace analyze { class LoopAnalysis; class SlotValue; class SSAValue; class SSAUseChain;
--- a/js/src/jsapi.h +++ b/js/src/jsapi.h @@ -4632,26 +4632,24 @@ using JS::CallArgs; using JS::IsAcceptableThis; using JS::NativeImpl; using JS::CallReceiver; using JS::CompileOptions; using JS::CallNonGenericMethod; using JS::Rooted; using JS::RootedObject; -using JS::RootedModule; using JS::RootedFunction; using JS::RootedScript; using JS::RootedString; using JS::RootedId; using JS::RootedValue; using JS::Handle; using JS::HandleObject; -using JS::HandleModule; using JS::HandleFunction; using JS::HandleScript; using JS::HandleString; using JS::HandleId; using JS::HandleValue; using JS::MutableHandle; using JS::MutableHandleObject;
--- a/js/src/jsdate.h +++ b/js/src/jsdate.h @@ -9,25 +9,17 @@ */ #ifndef jsdate_h #define jsdate_h #include "jstypes.h" #include "js/RootingAPI.h" - -extern "C" { -class JSObject; -struct JSContext; -} - -namespace JS { -class Value; -} +#include "js/TypeDecls.h" extern JSObject * js_InitDateClass(JSContext *cx, JS::HandleObject obj); /* * These functions provide a C interface to the date/time object */
--- a/js/src/jsgc.h +++ b/js/src/jsgc.h @@ -16,17 +16,16 @@ #include "jslock.h" #include "jsobj.h" #include "js/GCAPI.h" #include "js/Vector.h" class JSAtom; struct JSCompartment; -class JSFunction; class JSFlatString; class JSLinearString; namespace js { class ArgumentsObject; class ArrayBufferObject; class ArrayBufferViewObject;
--- a/js/src/jsinfer.h +++ b/js/src/jsinfer.h @@ -13,18 +13,16 @@ #include "jsfriendapi.h" #include "ds/IdValuePair.h" #include "ds/LifoAlloc.h" #include "gc/Barrier.h" #include "js/Utility.h" -class JSScript; - namespace js { class TypeRepresentation; class TaggedProto { public: TaggedProto() : proto(NULL) {}
--- a/js/src/jsnum.h +++ b/js/src/jsnum.h @@ -37,18 +37,16 @@ js_InitNumberClass(JSContext *cx, js::Ha /* * String constants for global function names, used in jsapi.c and jsnum.c. */ extern const char js_isNaN_str[]; extern const char js_isFinite_str[]; extern const char js_parseFloat_str[]; extern const char js_parseInt_str[]; -class JSString; - /* * When base == 10, this function implements ToString() as specified by * ECMA-262-5 section 9.8.1; but note that it handles integers specially for * performance. See also js::NumberToCString(). */ template <js::AllowGC allowGC> extern JSString * js_NumberToString(js::ThreadSafeContext *cx, double d);
--- a/js/src/jspubtd.h +++ b/js/src/jspubtd.h @@ -10,53 +10,40 @@ /* * JS public API typedefs. */ #include "mozilla/PodOperations.h" #include "jsprototypes.h" #include "jstypes.h" -#include "jsversion.h" // #include here so it's seen everywhere -#include "js/IdForward.h" +#include "js/TypeDecls.h" #if defined(JSGC_ROOT_ANALYSIS) || defined(JSGC_USE_EXACT_ROOTING) || defined(DEBUG) # define JSGC_TRACK_EXACT_ROOTS #endif namespace JS { -/* - * Allow headers to reference JS::Value without #including the whole jsapi.h. - * Unfortunately, typedefs (hence jsval) cannot be declared. - */ -class Value; - class AutoIdVector; class CallArgs; template <typename T> class Rooted; class JS_PUBLIC_API(AutoGCRooter); class JS_PUBLIC_API(CompileOptions); class JS_PUBLIC_API(CompartmentOptions); struct Zone; } /* namespace JS */ -#ifdef WIN32 -typedef wchar_t jschar; -#else -typedef uint16_t jschar; -#endif - /* * Run-time version enumeration. For compile-time version checking, please use * the JS_HAS_* macros in jsversion.h, or use MOZJS_MAJOR_VERSION, * MOZJS_MINOR_VERSION, MOZJS_PATCH_VERSION, and MOZJS_ALPHA definitions. */ typedef enum JSVersion { JSVERSION_ECMA_3 = 148, JSVERSION_1_6 = 160, @@ -145,17 +132,16 @@ typedef enum { JSTRACE_TYPE_OBJECT, JSTRACE_LAST = JSTRACE_TYPE_OBJECT } JSGCTraceKind; /* Struct typedefs and class forward declarations. */ typedef struct JSClass JSClass; typedef struct JSCompartment JSCompartment; typedef struct JSConstDoubleSpec JSConstDoubleSpec; -typedef struct JSContext JSContext; typedef struct JSCrossCompartmentCall JSCrossCompartmentCall; typedef struct JSErrorReport JSErrorReport; typedef struct JSExceptionState JSExceptionState; typedef struct JSFunctionSpec JSFunctionSpec; typedef struct JSIdArray JSIdArray; typedef struct JSLocaleCallbacks JSLocaleCallbacks; typedef struct JSObjectMap JSObjectMap; typedef struct JSPrincipals JSPrincipals; @@ -165,21 +151,17 @@ typedef struct JSPropertySpec typedef struct JSRuntime JSRuntime; typedef struct JSSecurityCallbacks JSSecurityCallbacks; typedef struct JSStructuredCloneCallbacks JSStructuredCloneCallbacks; typedef struct JSStructuredCloneReader JSStructuredCloneReader; typedef struct JSStructuredCloneWriter JSStructuredCloneWriter; typedef struct JSTracer JSTracer; class JSFlatString; -class JSFunction; -class JSObject; -class JSScript; class JSStableString; // long story -class JSString; #ifdef JS_THREADSAFE typedef struct PRCallOnceType JSCallOnceType; #else typedef bool JSCallOnceType; #endif typedef bool (*JSInitCallback)(void);
--- a/js/src/jsscript.cpp +++ b/js/src/jsscript.cpp @@ -541,17 +541,17 @@ js::XDRScript(XDRState<mode> *xdr, Handl JSVersion version_ = JSVersion(version & JS_BITMASK(16)); JS_ASSERT((version_ & VersionFlags::MASK) == unsigned(version_)); // staticLevel is set below. CompileOptions options(cx); options.setVersion(version_) .setNoScriptRval(!!(scriptBits & (1 << NoScriptRval))) .setSelfHostingMode(!!(scriptBits & (1 << SelfHosted))); - JS::RootedScriptSource sourceObject(cx); + RootedScriptSource sourceObject(cx); if (scriptBits & (1 << OwnSource)) { ScriptSource *ss = cx->new_<ScriptSource>(xdr->originPrincipals()); if (!ss) return false; sourceObject = ScriptSourceObject::create(cx, ss); if (!sourceObject) return false; } else { @@ -957,17 +957,17 @@ Class ScriptSourceObject::class_ = { }; ScriptSourceObject * ScriptSourceObject::create(ExclusiveContext *cx, ScriptSource *source) { RootedObject object(cx, NewObjectWithGivenProto(cx, &class_, NULL, cx->global())); if (!object) return NULL; - JS::RootedScriptSource sourceObject(cx, &object->as<ScriptSourceObject>()); + RootedScriptSource sourceObject(cx, &object->as<ScriptSourceObject>()); sourceObject->setSlot(SOURCE_SLOT, PrivateValue(source)); source->incref(); return sourceObject; } static const unsigned char emptySource[] = ""; /* Adjust the amount of memory this script source uses for source data, @@ -1605,17 +1605,17 @@ void JSScript::initCompartment(ExclusiveContext *cx) { compartment_ = cx->compartment_; } JSScript * JSScript::Create(ExclusiveContext *cx, HandleObject enclosingScope, bool savedCallerFun, const CompileOptions &options, unsigned staticLevel, - JS::HandleScriptSource sourceObject, uint32_t bufStart, uint32_t bufEnd) + HandleScriptSource sourceObject, uint32_t bufStart, uint32_t bufEnd) { JS_ASSERT(bufStart <= bufEnd); RootedScript script(cx, js_NewGCScript(cx)); if (!script) return NULL; PodZero(script.get()); @@ -2286,17 +2286,17 @@ js::CloneScript(JSContext *cx, HandleObj options.setPrincipals(cx->compartment()->principals) .setOriginPrincipals(src->originPrincipals()) .setCompileAndGo(src->compileAndGo) .setSelfHostingMode(src->selfHosted) .setNoScriptRval(src->noScriptRval) .setVersion(src->getVersion()); /* Make sure we clone the script source object with the script */ - JS::RootedScriptSource sourceObject(cx, ScriptSourceObject::create(cx, src->scriptSource())); + RootedScriptSource sourceObject(cx, ScriptSourceObject::create(cx, src->scriptSource())); if (!sourceObject) return NULL; RootedScript dst(cx, JSScript::Create(cx, enclosingScope, src->savedCallerFun, options, src->staticLevel, sourceObject, src->sourceStart, src->sourceEnd)); if (!dst) { js_free(data);
--- a/js/src/jsscript.h +++ b/js/src/jsscript.h @@ -15,16 +15,17 @@ #include "jsatom.h" #ifdef JS_THREADSAFE #include "jslock.h" #endif #include "jsobj.h" #include "jsopcode.h" #include "gc/Barrier.h" +#include "gc/Rooting.h" #include "vm/Shape.h" namespace js { namespace jit { struct IonScript; struct BaselineScript; struct IonScriptCounts; @@ -625,17 +626,17 @@ class JSScript : public js::gc::Cell // // End of fields. Start methods. // public: static JSScript *Create(js::ExclusiveContext *cx, js::HandleObject enclosingScope, bool savedCallerFun, const JS::CompileOptions &options, unsigned staticLevel, - JS::HandleScriptSource sourceObject, uint32_t sourceStart, + js::HandleScriptSource sourceObject, uint32_t sourceStart, uint32_t sourceEnd); void initCompartment(js::ExclusiveContext *cx); // Three ways ways to initialize a JSScript. Callers of partiallyInit() // and fullyInitTrivial() are responsible for notifying the debugger after // successfully creating any kind (function or other) of new JSScript. // However, callers of fullyInitFromEmitter() do not need to do this.
--- a/js/src/jsutil.h +++ b/js/src/jsutil.h @@ -15,19 +15,16 @@ #include "mozilla/GuardObjects.h" #ifdef USE_ZLIB #include <zlib.h> #endif #include "js/Utility.h" -/* Forward declarations. */ -struct JSContext; - static JS_ALWAYS_INLINE void * js_memcpy(void *dst_, const void *src_, size_t len) { char *dst = (char *) dst_; const char *src = (const char *) src_; JS_ASSERT_IF(dst >= src, (size_t) (dst - src) >= len); JS_ASSERT_IF(src >= dst, (size_t) (src - dst) >= len);
--- a/js/src/moz.build +++ b/js/src/moz.build @@ -63,25 +63,25 @@ EXPORTS.js += [ '../public/CallNonGenericMethod.h', '../public/CharacterEncoding.h', '../public/Class.h', '../public/Date.h', '../public/GCAPI.h', '../public/HashTable.h', '../public/HeapAPI.h', '../public/Id.h', - '../public/IdForward.h', '../public/LegacyIntTypes.h', '../public/MemoryMetrics.h', '../public/OldDebugAPI.h', '../public/ProfilingStack.h', '../public/PropertyKey.h', '../public/RequiredDefines.h', '../public/RootingAPI.h', '../public/StructuredClone.h', + '../public/TypeDecls.h', '../public/Utility.h', '../public/Value.h', '../public/Vector.h', ] CPP_SOURCES += [ 'ArgumentsObject.cpp', 'BinaryData.cpp',
--- a/js/src/vm/Debugger.cpp +++ b/js/src/vm/Debugger.cpp @@ -2854,17 +2854,17 @@ DebuggerScript_getLineCount(JSContext *c } static bool DebuggerScript_getSource(JSContext *cx, unsigned argc, Value *vp) { THIS_DEBUGSCRIPT_SCRIPT(cx, argc, vp, "(get source)", args, obj, script); Debugger *dbg = Debugger::fromChildJSObject(obj); - JS::RootedScriptSource source(cx, script->sourceObject()); + RootedScriptSource source(cx, script->sourceObject()); RootedObject sourceObject(cx, dbg->wrapSource(cx, source)); if (!sourceObject) return false; args.rval().setObject(*sourceObject); return true; } @@ -3619,33 +3619,33 @@ Class DebuggerSource_class = { NULL, /* checkAccess */ NULL, /* call */ NULL, /* hasInstance */ NULL, /* construct */ DebuggerSource_trace }; JSObject * -Debugger::newDebuggerSource(JSContext *cx, JS::HandleScriptSource source) +Debugger::newDebuggerSource(JSContext *cx, HandleScriptSource source) { assertSameCompartment(cx, object.get()); JSObject *proto = &object->getReservedSlot(JSSLOT_DEBUG_SOURCE_PROTO).toObject(); JS_ASSERT(proto); JSObject *sourceobj = NewObjectWithGivenProto(cx, &DebuggerSource_class, proto, NULL); if (!sourceobj) return NULL; sourceobj->setReservedSlot(JSSLOT_DEBUGSOURCE_OWNER, ObjectValue(*object)); sourceobj->setPrivateGCThing(source); return sourceobj; } JSObject * -Debugger::wrapSource(JSContext *cx, JS::HandleScriptSource source) +Debugger::wrapSource(JSContext *cx, HandleScriptSource source) { assertSameCompartment(cx, object.get()); JS_ASSERT(cx->compartment() != source->compartment()); SourceWeakMap::AddPtr p = sources.lookupForAdd(source); if (!p) { JSObject *sourceobj = newDebuggerSource(cx, source); if (!sourceobj) return NULL; @@ -3699,17 +3699,17 @@ DebuggerSource_checkThis(JSContext *cx, return thisobj; } #define THIS_DEBUGSOURCE_REFERENT(cx, argc, vp, fnname, args, obj, sourceObject) \ CallArgs args = CallArgsFromVp(argc, vp); \ RootedObject obj(cx, DebuggerSource_checkThis(cx, args, fnname)); \ if (!obj) \ return false; \ - JS::RootedScriptSource sourceObject(cx, GetSourceReferent(obj)); \ + RootedScriptSource sourceObject(cx, GetSourceReferent(obj)); \ if (!sourceObject) \ return false; static bool DebuggerSource_getText(JSContext *cx, unsigned argc, Value *vp) { THIS_DEBUGSOURCE_REFERENT(cx, argc, vp, "(get text)", args, obj, sourceObject);
--- a/js/src/vm/Debugger.h +++ b/js/src/vm/Debugger.h @@ -360,17 +360,17 @@ class Debugger : private mozilla::Linked * |script|. */ JSObject *newDebuggerScript(JSContext *cx, HandleScript script); /* * Allocate and initialize a Debugger.Source instance whose referent is * |source|. */ - JSObject *newDebuggerSource(JSContext *cx, JS::HandleScriptSource source); + JSObject *newDebuggerSource(JSContext *cx, js::HandleScriptSource source); /* * Receive a "new script" event from the engine. A new script was compiled * or deserialized. */ void fireNewScript(JSContext *cx, HandleScript script); inline Breakpoint *firstBreakpoint() const; @@ -523,17 +523,17 @@ class Debugger : private mozilla::Linked */ JSObject *wrapScript(JSContext *cx, HandleScript script); /* * Return the Debugger.Source object for |source|, or create a new one if * needed. The context |cx| must be in the debugger compartment; |source| * must be a script source object in a debuggee compartment. */ - JSObject *wrapSource(JSContext *cx, JS::HandleScriptSource source); + JSObject *wrapSource(JSContext *cx, js::HandleScriptSource source); private: Debugger(const Debugger &) MOZ_DELETE; Debugger & operator=(const Debugger &) MOZ_DELETE; }; class BreakpointSite { friend class Breakpoint;
--- a/js/src/vm/GlobalObject.cpp +++ b/js/src/vm/GlobalObject.cpp @@ -227,17 +227,17 @@ GlobalObject::initFunctionAndObjectClass jschar *source = InflateString(cx, rawSource, &sourceLen); if (!source) return NULL; ScriptSource *ss = cx->new_<ScriptSource>(/* originPrincipals = */ (JSPrincipals*) NULL); if (!ss) { js_free(source); return NULL; } - JS::RootedScriptSource sourceObject(cx, ScriptSourceObject::create(cx, ss)); + RootedScriptSource sourceObject(cx, ScriptSourceObject::create(cx, ss)); if (!sourceObject) return NULL; ss->setSource(source, sourceLen); CompileOptions options(cx); options.setNoScriptRval(true) .setVersion(JSVERSION_DEFAULT);
--- a/js/src/vm/SPSProfiler.h +++ b/js/src/vm/SPSProfiler.h @@ -98,18 +98,16 @@ * As an invariant, if the pc is NULL, then the JIT is currently executing * generated code. Otherwise execution is in another JS function or in C++. With * this in place, only the top entry of the stack can ever have NULL as its pc. * Additionally with this invariant, it is possible to maintain mappings of JIT * code to pc which can be accessed safely because they will only be accessed * from a signal handler when the JIT code is executing. */ -class JSFunction; - namespace js { class ProfileEntry; typedef HashMap<JSScript*, const char*, DefaultHasher<JSScript*>, SystemAllocPolicy> ProfileStringMap; class SPSEntryMarker;
--- a/js/src/vm/Shape.h +++ b/js/src/vm/Shape.h @@ -88,18 +88,16 @@ * trees are more space-efficient than alternatives. This was removed in bug * 631138; see that bug for the full details. * * Because many Shapes have similar data, there is actually a secondary type * called a BaseShape that holds some of a Shape's data. Many shapes can share * a single BaseShape. */ -class JSObject; - namespace js { class Bindings; class Nursery; class StaticBlockObject; /* Limit on the number of slotful properties in an object. */ static const uint32_t SHAPE_INVALID_SLOT = JS_BIT(24) - 1;
--- a/js/src/vm/Stack.h +++ b/js/src/vm/Stack.h @@ -13,17 +13,16 @@ #include "jsscript.h" #include "jit/IonFrameIterator.h" #ifdef CHECK_OSIPOINT_REGISTERS #include "jit/Registers.h" // for RegisterDump #endif #include "js/OldDebugAPI.h" -struct JSContext; struct JSCompartment; struct JSGenerator; namespace js { class StackFrame; class FrameRegs;
--- a/js/src/vm/String.h +++ b/js/src/vm/String.h @@ -20,17 +20,16 @@ #include "js/CharacterEncoding.h" #include "js/RootingAPI.h" class JSDependentString; class JSExtensibleString; class JSExternalString; class JSInlineString; class JSStableString; -class JSString; class JSRope; namespace js { class StaticStrings; class PropertyName; /* The buffer length required to contain any unsigned 32-bit integer. */
--- a/js/src/vm/ThreadPool.h +++ b/js/src/vm/ThreadPool.h @@ -15,20 +15,18 @@ #ifdef JS_THREADSAFE # include "prcvar.h" # include "prlock.h" # include "prtypes.h" #endif #include "js/Vector.h" -struct JSContext; struct JSRuntime; struct JSCompartment; -class JSScript; namespace js { class ThreadPoolWorker; typedef void (*TaskFun)(void *userdata, uint32_t workerId, uintptr_t stackLimit); class TaskExecutor
--- a/js/xpconnect/idl/nsIXPConnect.idl +++ b/js/xpconnect/idl/nsIXPConnect.idl @@ -15,26 +15,22 @@ #include "nsIInterfaceInfoManager.idl" #include "nsIExceptionService.idl" #include "nsIVariant.idl" #include "nsIObjectOutputStream.idl" #include "nsIObjectInputStream.idl" %{ C++ #include "jspubtd.h" +#include "js/TypeDecls.h" #include "xptinfo.h" #include "nsAXPCNativeCallContext.h" struct JSFreeOp; -namespace JS { -template <typename T> class Handle; -template <typename T> class MutableHandle; -} - class nsWrapperCache; %} /***************************************************************************/ // NB: jsval and jsid are declared in nsrootidl.idl [ptr] native JSContextPtr(JSContext);
--- a/js/xpconnect/idl/xpcIJSModuleLoader.idl +++ b/js/xpconnect/idl/xpcIJSModuleLoader.idl @@ -3,17 +3,17 @@ * 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" [ptr] native nsAXPCNativeCallContextPtr(nsAXPCNativeCallContext); %{C++ -class JSObject; +#include "js/TypeDecls.h" %} [ptr] native JSObjectPtr(JSObject); [scriptable, uuid(243d1a31-db9f-47a1-9922-55a1ad5515fb)] interface xpcIJSModuleLoader : nsISupports { /**
--- a/js/xpconnect/idl/xpcexception.idl +++ b/js/xpconnect/idl/xpcexception.idl @@ -3,20 +3,17 @@ * 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" #include "nsIException.idl" %{ C++ -struct JSContext; -namespace JS { -class Value; -} +#include "js/TypeDecls.h" %} [ptr] native xpcexJSContextPtr(JSContext); native xpcexJSVal(JS::Value); [scriptable, uuid(cac29630-7bf2-4e22-811b-46855a7d5af0)] interface nsIXPCException : nsIException {
--- a/layout/base/nsPresContext.h +++ b/layout/base/nsPresContext.h @@ -11,16 +11,17 @@ #include "mozilla/Attributes.h" #include "nsColor.h" #include "nsCoord.h" #include "nsCOMPtr.h" #include "nsIPresShell.h" #include "nsRect.h" #include "nsDeviceContext.h" #include "nsFont.h" +#include "gfxFontConstants.h" #include "nsIAtom.h" #include "nsIObserver.h" #include "nsITimer.h" #include "nsCRT.h" #include "FramePropertyTable.h" #include "nsGkAtoms.h" #include "nsCycleCollectionParticipant.h" #include "nsChangeHint.h"
--- a/netwerk/base/src/ProxyAutoConfig.h +++ b/netwerk/base/src/ProxyAutoConfig.h @@ -7,20 +7,17 @@ #ifndef ProxyAutoConfig_h__ #define ProxyAutoConfig_h__ #include "nsString.h" #include "prio.h" #include "nsITimer.h" #include "nsAutoPtr.h" #include "mozilla/net/DNS.h" - -namespace JS { -class Value; -} +#include "js/TypeDecls.h" namespace mozilla { namespace net { class JSRuntimeWrapper; // The ProxyAutoConfig class is meant to be created and run on a // non main thread. It synchronously resolves PAC files by blocking that // thread and running nested event loops. GetProxyForURI is not re-entrant.
--- a/python/mozbuild/mozbuild/base.py +++ b/python/mozbuild/mozbuild/base.py @@ -159,21 +159,22 @@ class MozbuildObject(ProcessExecutionMix topsrcdir, config) # If we're inside a objdir and the found mozconfig resolves to # another objdir, we abort. The reasoning here is that if you are # inside an objdir you probably want to perform actions on that objdir, # not another one. This prevents accidental usage of the wrong objdir # when the current objdir is ambiguous. if topobjdir and config_topobjdir \ - and not samepath(topobjdir, config_topobjdir): + and not samepath(topobjdir, config_topobjdir) \ + and not samepath(topobjdir, os.path.join(config_topobjdir, "mozilla")): raise ObjdirMismatchException(topobjdir, config_topobjdir) - topobjdir = config_topobjdir or topobjdir + topobjdir = topobjdir or config_topobjdir if topobjdir: topobjdir = os.path.normpath(topobjdir) # If we can't resolve topobjdir, oh well. The constructor will figure # it out via config.guess. return cls(topsrcdir, None, None, topobjdir=topobjdir) @staticmethod
--- a/storage/src/mozStoragePrivateHelpers.h +++ b/storage/src/mozStoragePrivateHelpers.h @@ -10,26 +10,23 @@ /** * This file contains convenience methods for mozStorage. */ #include "sqlite3.h" #include "nsIVariant.h" #include "nsError.h" #include "nsAutoPtr.h" +#include "js/TypeDecls.h" class mozIStorageCompletionCallback; class mozIStorageBaseStatement; class mozIStorageBindingParams; class nsIRunnable; -namespace JS { -class Value; -} - namespace mozilla { namespace storage { //////////////////////////////////////////////////////////////////////////////// //// Macros #define ENSURE_INDEX_VALUE(aIndex, aCount) \ NS_ENSURE_TRUE(aIndex < aCount, NS_ERROR_INVALID_ARG)
--- a/tools/profiler/GeckoProfiler.h +++ b/tools/profiler/GeckoProfiler.h @@ -45,28 +45,26 @@ * 't' - Elapse time since recording started. * */ #ifndef SAMPLER_H #define SAMPLER_H #include "mozilla/NullPtr.h" +#include "js/TypeDecls.h" namespace mozilla { class TimeStamp; } #ifndef MOZ_ENABLE_PROFILER_SPS #include <stdint.h> -struct JSContext; -class JSObject; - // Insert a RAII in this scope to active a pseudo label. Any samples collected // in this scope will contain this annotation. For dynamic strings use // PROFILER_LABEL_PRINTF. Arguments must be string literals. #define PROFILER_LABEL(name_space, info) do {} while (0) // Format a dynamic string as a pseudo label. These labels will a considerable // storage size in the circular buffer compared to regular labels. This function // can be used to annotate custom information such as URL for the resource being
--- a/tools/profiler/GeckoProfilerFunc.h +++ b/tools/profiler/GeckoProfilerFunc.h @@ -2,29 +2,27 @@ /* 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 PROFILER_FUNCS_H #define PROFILER_FUNCS_H #include "mozilla/NullPtr.h" +#include "js/TypeDecls.h" #include <stdint.h> namespace mozilla { class TimeDuration; class TimeStamp; } using mozilla::TimeStamp; using mozilla::TimeDuration; -struct JSContext; -class JSObject; - // Returns a handle to pass on exit. This can check that we are popping the // correct callstack. inline void* mozilla_sampler_call_enter(const char *aInfo, void *aFrameAddress = NULL, bool aCopy = false, uint32_t line = 0); inline void mozilla_sampler_call_exit(void* handle); inline void mozilla_sampler_add_marker(const char *aInfo); void mozilla_sampler_start(int aEntries, double aInterval,
--- a/tools/profiler/JSObjectBuilder.h +++ b/tools/profiler/JSObjectBuilder.h @@ -2,21 +2,20 @@ /* 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 JSOBJECTBUILDER_H #define JSOBJECTBUILDER_H #include "JSAObjectBuilder.h" +#include "js/TypeDecls.h" class JSCustomObject; class JSCustomObjectBuilder; -struct JSContext; -class JSObject; class nsAString; /* this is handy wrapper around JSAPI to make it more pleasant to use. * We collect the JSAPI errors and so that callers don't need to */ class JSObjectBuilder : public JSAObjectBuilder { public: // We need to ensure that this object lives on the stack so that GC sees it properly
--- a/widget/android/nsWindow.cpp +++ b/widget/android/nsWindow.cpp @@ -32,17 +32,16 @@ using mozilla::unused; #include "nsGkAtoms.h" #include "nsWidgetsCID.h" #include "nsGfxCIID.h" #include "gfxImageSurface.h" #include "gfxContext.h" #include "Layers.h" -#include "BasicLayers.h" #include "LayerManagerOGL.h" #include "mozilla/layers/LayerManagerComposite.h" #include "mozilla/layers/AsyncCompositionManager.h" #include "GLContext.h" #include "GLContextProvider.h" #include "nsTArray.h"
--- a/widget/gtk2/nsWindow.cpp +++ b/widget/gtk2/nsWindow.cpp @@ -85,17 +85,16 @@ using namespace mozilla::widget; /* SetCursor(imgIContainer*) */ #include <gdk/gdk.h> #include <wchar.h> #include "imgIContainer.h" #include "nsGfxCIID.h" #include "nsImageToPixbuf.h" #include "nsIInterfaceRequestorUtils.h" #include "nsAutoPtr.h" -#include "BasicLayers.h" #include "ClientLayerManager.h" extern "C" { #define PIXMAN_DONT_DEFINE_STDINT #include "pixman.h" } #include "gfxPlatformGtk.h" #include "gfxContext.h" @@ -6123,18 +6122,17 @@ nsWindow::GetLayerManager(PLayerTransact aPersistence, aAllowRetaining); } void nsWindow::ClearCachedResources() { if (mLayerManager && mLayerManager->GetBackendType() == mozilla::layers::LAYERS_BASIC) { - static_cast<mozilla::layers::BasicLayerManager*> (mLayerManager.get())-> - ClearCachedResources(); + mLayerManager->ClearCachedResources(); } GList* children = gdk_window_peek_children(mGdkWindow); for (GList* list = children; list; list = list->next) { nsWindow* window = get_window_for_gdk_window(GDK_WINDOW(list->data)); if (window) { window->ClearCachedResources(); }
--- a/widget/qt/nsWindow.cpp +++ b/widget/qt/nsWindow.cpp @@ -90,17 +90,16 @@ using namespace QtMobility; #ifdef MOZ_X11 #include "keysym2ucs.h" #endif #include "gfxUtils.h" #include "Layers.h" #include "GLContextProvider.h" -#include "BasicLayers.h" #include "LayerManagerOGL.h" #include "nsFastStartupQt.h" // If embedding clients want to create widget without real parent window // then nsIBaseWindow->Init() should have parent argument equal to PARENTLESS_WIDGET #define PARENTLESS_WIDGET (void*)0x13579 #include "nsShmImage.h" @@ -436,18 +435,17 @@ nsWindow::Destroy(void) return NS_OK; } void nsWindow::ClearCachedResources() { if (mLayerManager && mLayerManager->GetBackendType() == mozilla::layers::LAYERS_BASIC) { - static_cast<mozilla::layers::BasicLayerManager*> (mLayerManager.get())-> - ClearCachedResources(); + statimLayerManager->ClearCachedResources(); } for (nsIWidget* kid = mFirstChild; kid; ) { nsIWidget* next = kid->GetNextSibling(); static_cast<nsWindow*>(kid)->ClearCachedResources(); kid = next; } }
--- a/widget/windows/nsWindow.cpp +++ b/widget/windows/nsWindow.cpp @@ -129,17 +129,16 @@ #endif #ifdef MOZ_ENABLE_D3D10_LAYER #include "LayerManagerD3D10.h" #endif #include "LayerManagerOGL.h" #include "nsIGfxInfo.h" -#include "BasicLayers.h" #include "nsUXThemeConstants.h" #include "KeyboardLayout.h" #include "nsNativeDragTarget.h" #include <mmsystem.h> // needed for WIN32_LEAN_AND_MEAN #include <zmouse.h> #include <richedit.h> #if defined(ACCESSIBILITY) @@ -7171,18 +7170,17 @@ BOOL CALLBACK nsWindow::ClearResourcesCa void nsWindow::ClearCachedResources() { #ifdef CAIRO_HAS_D2D_SURFACE mD2DWindowSurface = nullptr; #endif if (mLayerManager && mLayerManager->GetBackendType() == LAYERS_BASIC) { - static_cast<BasicLayerManager*>(mLayerManager.get())-> - ClearCachedResources(); + mLayerManager->ClearCachedResources(); } ::EnumChildWindows(mWnd, nsWindow::ClearResourcesCallback, 0); } static bool IsDifferentThreadWindow(HWND aWnd) { return ::GetCurrentThreadId() != ::GetWindowThreadProcessId(aWnd, NULL); }
--- a/widget/windows/nsWindowGfx.cpp +++ b/widget/windows/nsWindowGfx.cpp @@ -33,17 +33,16 @@ using mozilla::plugins::PluginInstancePa #include "gfxContext.h" #include "nsRenderingContext.h" #include "prmem.h" #include "WinUtils.h" #include "nsIWidgetListener.h" #include "mozilla/unused.h" #include "LayerManagerOGL.h" -#include "BasicLayers.h" #ifdef MOZ_ENABLE_D3D9_LAYER #include "LayerManagerD3D9.h" #endif #ifdef MOZ_ENABLE_D3D10_LAYER #include "LayerManagerD3D10.h" #endif #include "nsUXThemeData.h"
--- a/widget/xpwidgets/nsBaseWidget.cpp +++ b/widget/xpwidgets/nsBaseWidget.cpp @@ -1045,17 +1045,17 @@ LayerManager* nsBaseWidget::GetLayerMana LayerManager* usedLayerManager = mTemporarilyUseBasicLayerManager ? mBasicLayerManager : mLayerManager; if (aAllowRetaining) { *aAllowRetaining = (usedLayerManager == mLayerManager); } return usedLayerManager; } -BasicLayerManager* nsBaseWidget::CreateBasicLayerManager() +LayerManager* nsBaseWidget::CreateBasicLayerManager() { return new BasicLayerManager(this); } CompositorChild* nsBaseWidget::GetRemoteRenderer() { return mCompositorChild; }
--- a/widget/xpwidgets/nsBaseWidget.h +++ b/widget/xpwidgets/nsBaseWidget.h @@ -327,17 +327,17 @@ protected: virtual already_AddRefed<nsIWidget> AllocateChildPopupWidget() { static NS_DEFINE_IID(kCPopUpCID, NS_CHILD_CID); nsCOMPtr<nsIWidget> widget = do_CreateInstance(kCPopUpCID); return widget.forget(); } - BasicLayerManager* CreateBasicLayerManager(); + LayerManager* CreateBasicLayerManager(); nsPopupType PopupType() const { return mPopupType; } void NotifyRollupGeometryChange() { // XULPopupManager isn't interested in this notification, so only // send it if gRollupListener is set. if (gRollupListener) {
--- a/xpcom/build/nsXULAppAPI.h +++ b/xpcom/build/nsXULAppAPI.h @@ -7,16 +7,17 @@ #define _nsXULAppAPI_h__ #include "nsID.h" #include "xrecore.h" #include "nsXPCOM.h" #include "nsISupports.h" #include "prlog.h" #include "nsXREAppData.h" +#include "js/TypeDecls.h" #include "mozilla/Assertions.h" /** * A directory service key which provides the platform-correct "application * data" directory as follows, where $name and $vendor are as defined above and * $vendor is optional: * @@ -421,25 +422,20 @@ XRE_API(nsresult, class MessageLoop; XRE_API(void, XRE_ShutdownChildProcess, ()) XRE_API(MessageLoop*, XRE_GetIOMessageLoop, ()) -struct JSContext; -class JSString; - XRE_API(bool, XRE_SendTestShellCommand, (JSContext* aCx, JSString* aCommand, void* aCallback)) -class JSObject; - XRE_API(bool, XRE_ShutdownTestShell, ()) XRE_API(void, XRE_InstallX11ErrorHandler, ()) #if defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64)) #define XRE_HAS_DLL_BLOCKLIST
--- a/xpcom/ds/nsStaticNameTable.h +++ b/xpcom/ds/nsStaticNameTable.h @@ -5,16 +5,18 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /* Classes to manage lookup of static names in a table. */ #ifndef nsStaticNameTable_h___ #define nsStaticNameTable_h___ #include "pldhash.h" +#include "nsString.h" + /* This class supports case insensitive lookup. * * It differs from atom tables: * - It supports case insensitive lookup. * - It has minimal footprint by not copying the string table. * - It does no locking. * - It returns zero based indexes and const nsCString& as required by its * callers in the parser.
--- a/xpfe/appshell/public/nsIAppShellService.idl +++ b/xpfe/appshell/public/nsIAppShellService.idl @@ -9,17 +9,17 @@ interface nsIXULWindow; interface nsIWebNavigation; interface nsIURI; interface nsIDOMWindow; interface nsIAppShell; [ptr] native JSContext(JSContext); %{C++ -struct JSContext; +#include "js/TypeDecls.h" %} [scriptable, uuid(5c19ab54-67bf-46d0-ac5b-21abd9050c3b)] interface nsIAppShellService : nsISupports { /** * Create a window, which will be initially invisible. * @param aParent the parent window. Can be null.