From 219b9d4294633b635540c800621a477b4ec7a084 Mon Sep 17 00:00:00 2001 From: Mats Palmgren Date: Mon, 4 Jul 2011 07:47:59 +0200 Subject: [PATCH 01/10] Bug 667010 - "ASSERTION: unexpected block frame" with text-overflow: ellipsis,
. r=roc --- layout/generic/TextOverflow.cpp | 14 ++-- .../text-overflow/clipped-elements-ref.html | 78 ++++++++++++++++++ .../text-overflow/clipped-elements.html | 80 +++++++++++++++++++ layout/reftests/text-overflow/reftest.list | 1 + 4 files changed, 164 insertions(+), 9 deletions(-) create mode 100644 layout/reftests/text-overflow/clipped-elements-ref.html create mode 100644 layout/reftests/text-overflow/clipped-elements.html diff --git a/layout/generic/TextOverflow.cpp b/layout/generic/TextOverflow.cpp index 1ec77c8e20b9..44a78493d519 100644 --- a/layout/generic/TextOverflow.cpp +++ b/layout/generic/TextOverflow.cpp @@ -87,14 +87,9 @@ IsAtomicElement(nsIFrame* aFrame, const nsIAtom* aFrameType) { NS_PRECONDITION(!aFrame->GetStyleDisplay()->IsBlockOutside(), "unexpected block frame"); - - if (aFrame->IsFrameOfType(nsIFrame::eReplaced)) { - if (aFrameType != nsGkAtoms::textFrame && - aFrameType != nsGkAtoms::brFrame) { - return true; - } - } - return aFrame->GetStyleDisplay()->mDisplay != NS_STYLE_DISPLAY_INLINE; + NS_PRECONDITION(aFrameType != nsGkAtoms::placeholderFrame, + "unexpected placeholder frame"); + return !aFrame->IsFrameOfType(nsIFrame::eLineParticipant); } static bool @@ -317,7 +312,8 @@ TextOverflow::ExamineFrameSubtree(nsIFrame* aFrame, AlignmentEdges* aAlignmentEdges) { const nsIAtom* frameType = aFrame->GetType(); - if (frameType == nsGkAtoms::brFrame) { + if (frameType == nsGkAtoms::brFrame || + frameType == nsGkAtoms::placeholderFrame) { return; } const bool isAtomic = IsAtomicElement(aFrame, frameType); diff --git a/layout/reftests/text-overflow/clipped-elements-ref.html b/layout/reftests/text-overflow/clipped-elements-ref.html new file mode 100644 index 000000000000..3abd4988b95e --- /dev/null +++ b/layout/reftests/text-overflow/clipped-elements-ref.html @@ -0,0 +1,78 @@ + + + + +
+
+
+
+ +
+
+
+
+ +
+
+
+ +
+
+
+ +
+
+ +
+
+
+ +
+
+
+ +
 …
+
 …
+
+ +
+
+

+ +
+
+
+
+
+
1
+
2
+
3
+
4
+
+
+
+
+ + diff --git a/layout/reftests/text-overflow/clipped-elements.html b/layout/reftests/text-overflow/clipped-elements.html new file mode 100644 index 000000000000..ab4292ee64c8 --- /dev/null +++ b/layout/reftests/text-overflow/clipped-elements.html @@ -0,0 +1,80 @@ + + + + +
+
+
+
+ +
+
+
+
+ +
+
+
+ +
+
+
+ +
+
+ +
+
+
+ +
+
+
+ +
 
+
 
+
+ +

+

+

+ +
+
+
+
+
+
1
+
2
+
3
+
4abs4
+
+
+
+
+ + diff --git a/layout/reftests/text-overflow/reftest.list b/layout/reftests/text-overflow/reftest.list index fc2353e2a980..3de443d77d0b 100644 --- a/layout/reftests/text-overflow/reftest.list +++ b/layout/reftests/text-overflow/reftest.list @@ -14,3 +14,4 @@ HTTP(..) == standards-decorations.html standards-decorations-ref.html HTTP(..) == standards-line-height.html standards-line-height-ref.html HTTP(..) == selection.html selection-ref.html HTTP(..) == marker-shadow.html marker-shadow-ref.html +== clipped-elements.html clipped-elements-ref.html From 9bb2d0e9ec923362bc5480a1dff43e7fc5f3cce2 Mon Sep 17 00:00:00 2001 From: Mats Palmgren Date: Mon, 4 Jul 2011 07:47:59 +0200 Subject: [PATCH 02/10] Bug 668919 - The ellipsis with text-overflow: ellipsis is sometimes one pixel too low. r=roc --- layout/base/nsLayoutUtils.cpp | 12 +++ layout/base/nsLayoutUtils.h | 4 + layout/generic/TextOverflow.cpp | 8 +- layout/generic/nsTextFrame.h | 2 - layout/generic/nsTextFrameThebes.cpp | 13 +-- .../text-overflow/aligned-baseline-ref.html | 100 ++++++++++++++++++ .../text-overflow/aligned-baseline.html | 100 ++++++++++++++++++ layout/reftests/text-overflow/reftest.list | 1 + 8 files changed, 221 insertions(+), 19 deletions(-) create mode 100644 layout/reftests/text-overflow/aligned-baseline-ref.html create mode 100644 layout/reftests/text-overflow/aligned-baseline.html diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index 05768b941044..6745f9663d2c 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -2830,6 +2830,18 @@ nsLayoutUtils::GetTextColor(nsIFrame* aFrame) return color; } +gfxFloat +nsLayoutUtils::GetSnappedBaselineY(nsIFrame* aFrame, gfxContext* aContext, + nscoord aY, nscoord aAscent) +{ + gfxFloat appUnitsPerDevUnit = aFrame->PresContext()->AppUnitsPerDevPixel(); + gfxFloat baseline = gfxFloat(aY) + aAscent; + gfxRect putativeRect(0, baseline/appUnitsPerDevUnit, 1, 1); + if (!aContext->UserToDevicePixelSnapped(putativeRect, PR_TRUE)) + return baseline; + return aContext->DeviceToUser(putativeRect.TopLeft()).y * appUnitsPerDevUnit; +} + void nsLayoutUtils::DrawString(const nsIFrame* aFrame, nsRenderingContext* aContext, diff --git a/layout/base/nsLayoutUtils.h b/layout/base/nsLayoutUtils.h index 736063d1c8de..18d448f6315f 100644 --- a/layout/base/nsLayoutUtils.h +++ b/layout/base/nsLayoutUtils.h @@ -934,6 +934,10 @@ public: // Get a suitable foreground color for painting text for the frame. static nscolor GetTextColor(nsIFrame* aFrame); + // Get a baseline y position in app units that is snapped to device pixels. + static gfxFloat GetSnappedBaselineY(nsIFrame* aFrame, gfxContext* aContext, + nscoord aY, nscoord aAscent); + static void DrawString(const nsIFrame* aFrame, nsRenderingContext* aContext, const PRUnichar* aString, diff --git a/layout/generic/TextOverflow.cpp b/layout/generic/TextOverflow.cpp index 44a78493d519..791ad3527a60 100644 --- a/layout/generic/TextOverflow.cpp +++ b/layout/generic/TextOverflow.cpp @@ -235,7 +235,6 @@ nsDisplayTextOverflowMarker::Paint(nsDisplayListBuilder* aBuilder, nsLayoutUtils::PaintTextShadow(mFrame, aCtx, mRect, mVisibleRect, foregroundColor, PaintTextShadowCallback, (void*)this); - aCtx->SetColor(foregroundColor); PaintTextToContext(aCtx, nsPoint(0, 0)); } @@ -246,10 +245,9 @@ nsDisplayTextOverflowMarker::PaintTextToContext(nsRenderingContext* aCtx, { nsStyleContext* sc = mFrame->GetStyleContext(); nsLayoutUtils::SetFontFromStyle(aCtx, sc); - - nsPoint baselinePt = mRect.TopLeft(); - baselinePt.y += mAscent; - + gfxFloat y = nsLayoutUtils::GetSnappedBaselineY(mFrame, aCtx->ThebesContext(), + mRect.y, mAscent); + nsPoint baselinePt(mRect.x, NSToCoordFloor(y)); nsLayoutUtils::DrawString(mFrame, aCtx, mString.get(), mString.Length(), baselinePt + aOffsetFromRect); } diff --git a/layout/generic/nsTextFrame.h b/layout/generic/nsTextFrame.h index 2b402d5cc7d5..013b7db6b4a0 100644 --- a/layout/generic/nsTextFrame.h +++ b/layout/generic/nsTextFrame.h @@ -271,8 +271,6 @@ public: void AddInlinePrefWidthForFlow(nsRenderingContext *aRenderingContext, InlinePrefWidthData *aData); - gfxFloat GetSnappedBaselineY(gfxContext* aContext, gfxFloat aY); - /** * Calculate the horizontal bounds of the grapheme clusters that fit entirely * inside the given left/right edges (which are positive lengths from the diff --git a/layout/generic/nsTextFrameThebes.cpp b/layout/generic/nsTextFrameThebes.cpp index 99cc671a6763..46d37b8ea48a 100644 --- a/layout/generic/nsTextFrameThebes.cpp +++ b/layout/generic/nsTextFrameThebes.cpp @@ -5121,17 +5121,6 @@ ComputeTransformedLength(PropertyProvider& aProvider) return iter.GetSkippedOffset() - start; } -gfxFloat -nsTextFrame::GetSnappedBaselineY(gfxContext* aContext, gfxFloat aY) -{ - gfxFloat appUnitsPerDevUnit = mTextRun->GetAppUnitsPerDevUnit(); - gfxFloat baseline = aY + mAscent; - gfxRect putativeRect(0, baseline/appUnitsPerDevUnit, 1, 1); - if (!aContext->UserToDevicePixelSnapped(putativeRect, PR_TRUE)) - return baseline; - return aContext->DeviceToUser(putativeRect.TopLeft()).y*appUnitsPerDevUnit; -} - bool nsTextFrame::MeasureCharClippedText(gfxContext* aCtx, nscoord aLeftEdge, nscoord aRightEdge, @@ -5258,7 +5247,7 @@ nsTextFrame::PaintText(nsRenderingContext* aRenderingContext, nsPoint aPt, const nscoord frameWidth = GetSize().width; gfxPoint framePt(aPt.x, aPt.y); gfxPoint textBaselinePt(rtl ? gfxFloat(aPt.x + frameWidth) : framePt.x, - GetSnappedBaselineY(ctx, aPt.y)); + nsLayoutUtils::GetSnappedBaselineY(this, ctx, aPt.y, mAscent)); PRUint32 startOffset = provider.GetStart().GetSkippedOffset(); PRUint32 maxLength = ComputeTransformedLength(provider); nscoord snappedLeftEdge, snappedRightEdge; diff --git a/layout/reftests/text-overflow/aligned-baseline-ref.html b/layout/reftests/text-overflow/aligned-baseline-ref.html new file mode 100644 index 000000000000..458731f88d78 --- /dev/null +++ b/layout/reftests/text-overflow/aligned-baseline-ref.html @@ -0,0 +1,100 @@ + + + + Testcase for bug 668919 + + + + + +
+
CSS is awesome
+
CSS is awesome
+
CSS is awesome
+
+ +
+
CSS is awesome
+
CSS is awesome
+
CSS is awesome
+
+ +
+
CSS is awesome
+
CSS is awesome
+
CSS is awesome
+
+ +
+
CSS is awesome
+
CSS is awesome
+
CSS is awesome
+
+ +
+
CSS is awesome
+
CSS is awesome
+
CSS is awesome
+
+ +
+
+
CSS is awesome
+
CSS is awesome
+
CSS is awesome
+
+ +
+
CSS is awesome
+
CSS is awesome
+
CSS is awesome
+
+ +
+
CSS is awesome
+
CSS is awesome
+
CSS is awesome
+
+ +
+
CSS is awesome
+
CSS is awesome
+
CSS is awesome
+
+ +
+
CSS is awesome
+
CSS is awesome
+
CSS is awesome
+
+
+ + + + diff --git a/layout/reftests/text-overflow/aligned-baseline.html b/layout/reftests/text-overflow/aligned-baseline.html new file mode 100644 index 000000000000..070340303228 --- /dev/null +++ b/layout/reftests/text-overflow/aligned-baseline.html @@ -0,0 +1,100 @@ + + + + Testcase for bug 668919 + + + + + +
+
CSS is awesome
+
CSS is awesome
+
CSS is awesome
+
+ +
+
CSS is awesome
+
CSS is awesome
+
CSS is awesome
+
+ +
+
CSS is awesome
+
CSS is awesome
+
CSS is awesome
+
+ +
+
CSS is awesome
+
CSS is awesome
+
CSS is awesome
+
+ +
+
CSS is awesome
+
CSS is awesome
+
CSS is awesome
+
+ +
+
+
CSS is awesome
+
CSS is awesome
+
CSS is awesome
+
+ +
+
CSS is awesome
+
CSS is awesome
+
CSS is awesome
+
+ +
+
CSS is awesome
+
CSS is awesome
+
CSS is awesome
+
+ +
+
CSS is awesome
+
CSS is awesome
+
CSS is awesome
+
+ +
+
CSS is awesome
+
CSS is awesome
+
CSS is awesome
+
+
+ + + + diff --git a/layout/reftests/text-overflow/reftest.list b/layout/reftests/text-overflow/reftest.list index 3de443d77d0b..c7d80bdfff27 100644 --- a/layout/reftests/text-overflow/reftest.list +++ b/layout/reftests/text-overflow/reftest.list @@ -14,4 +14,5 @@ HTTP(..) == standards-decorations.html standards-decorations-ref.html HTTP(..) == standards-line-height.html standards-line-height-ref.html HTTP(..) == selection.html selection-ref.html HTTP(..) == marker-shadow.html marker-shadow-ref.html +== aligned-baseline.html aligned-baseline-ref.html == clipped-elements.html clipped-elements-ref.html From 30c8c2f0ad8ef35ec3c48e0e1cc401639c8e048c Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Mon, 4 Jul 2011 16:16:01 +1000 Subject: [PATCH 03/10] Bug 663423 - Add two more memory measurements to TelemetryPing.js. r=taras. --- .../telemetry/TelemetryHistograms.h | 6 ++++- toolkit/components/telemetry/TelemetryPing.js | 25 ++++++++++++------- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/toolkit/components/telemetry/TelemetryHistograms.h b/toolkit/components/telemetry/TelemetryHistograms.h index 14bd59213c80..bb01f5d8ad26 100644 --- a/toolkit/components/telemetry/TelemetryHistograms.h +++ b/toolkit/components/telemetry/TelemetryHistograms.h @@ -39,7 +39,7 @@ /** * This file lists Telemetry histograms collected by Firefox. The format is * - * HISTOGRAM(id, minium, maximum, bucket count, histogram kind, + * HISTOGRAM(id, minimum, maximum, bucket count, histogram kind, * human-readable description for about:telemetry) * */ @@ -53,6 +53,10 @@ HISTOGRAM(TELEMETRY_SUCCESS, 0, 1, 2, BOOLEAN, "Successful telemetry submission HISTOGRAM(MEMORY_JS_GC_HEAP, 1024, 512 * 1024, 10, EXPONENTIAL, "Memory used by the garbage-collected JavaScript heap (KB)") HISTOGRAM(MEMORY_RESIDENT, 32 * 1024, 1024 * 1024, 10, EXPONENTIAL, "Resident memory size (KB)") HISTOGRAM(MEMORY_LAYOUT_ALL, 1024, 64 * 1024, 10, EXPONENTIAL, "Memory used by layout (KB)") +HISTOGRAM(MEMORY_IMAGES_CONTENT_USED_UNCOMPRESSED, 1024, 1024 * 1024, 10, EXPONENTIAL, "Memory used for uncompressed, in-use content images (KB)") +HISTOGRAM(MEMORY_HEAP_USED, 1024, 1024 * 1024, 10, EXPONENTIAL, "Heap memory used (KB)") +// XXX: bug 660731 will enable this +//HISTOGRAM(MEMORY_EXPLICIT, 1024, 1024 * 1024, 10, EXPONENTIAL, "Explicit memory allocations (KB)") #if defined(XP_WIN) HISTOGRAM(EARLY_GLUESTARTUP_READ_OPS, 1, 100, 12, LINEAR, "ProcessIoCounters.ReadOperationCount before glue startup") HISTOGRAM(EARLY_GLUESTARTUP_READ_TRANSFER, 1, 50 * 1024, 12, EXPONENTIAL, "ProcessIoCounters.ReadTransferCount before glue startup (KB)") diff --git a/toolkit/components/telemetry/TelemetryPing.js b/toolkit/components/telemetry/TelemetryPing.js index 155e48ecb509..db9c73e0dc3b 100644 --- a/toolkit/components/telemetry/TelemetryPing.js +++ b/toolkit/components/telemetry/TelemetryPing.js @@ -57,6 +57,9 @@ const MEM_HISTOGRAMS = { "js-gc-heap": "MEMORY_JS_GC_HEAP", "resident": "MEMORY_RESIDENT", "explicit/layout/all": "MEMORY_LAYOUT_ALL", + "explicit/images/content/used/uncompressed": + "MEMORY_IMAGES_CONTENT_USED_UNCOMPRESSED", + "heap-used": "MEMORY_HEAP_USED", "hard-page-faults": "HARD_PAGE_FAULTS" }; @@ -191,6 +194,15 @@ TelemetryPing.prototype = { _initialized: false, _prevValues: {}, + addValue: function addValue(name, id, val) { + let h = this._histograms[name]; + if (!h) { + h = Telemetry.getHistogramById(id); + this._histograms[name] = h; + } + h.add(val); + }, + /** * Pull values from about:memory into corresponding histograms */ @@ -205,7 +217,6 @@ TelemetryPing.prototype = { } let e = mgr.enumerateReporters(); - let memReporters = {}; while (e.hasMoreElements()) { let mr = e.getNext().QueryInterface(Ci.nsIMemoryReporter); let id = MEM_HISTOGRAMS[mr.path]; @@ -238,15 +249,11 @@ TelemetryPing.prototype = { NS_ASSERT(false, "Can't handle memory reporter with units " + mr.units); continue; } - - let h = this._histograms[mr.path]; - if (!h) { - h = Telemetry.getHistogramById(id); - this._histograms[mr.path] = h; - } - h.add(val); + this.addValue(mr.path, id, val); } - return memReporters; + // XXX: bug 660731 will enable this + // "explicit" is found differently. + //this.addValue("explicit", "MEMORY_EXPLICIT", Math.floor(mgr.explicit / 1024)); }, /** From 220be93ebc5b0a6fbb1315b26eecaf60cabcd548 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Mon, 4 Jul 2011 16:16:02 +1000 Subject: [PATCH 04/10] Bug 660731 - Add GetExplicit and GetResident methods to NSIMemoryReporterManager. r=khuey, sr=bz. --- dom/ipc/ContentChild.cpp | 8 +- .../tests/chrome/test_aboutmemory.xul | 27 +++- .../telemetry/TelemetryHistograms.h | 3 +- toolkit/components/telemetry/TelemetryPing.js | 3 +- xpcom/base/nsIMemoryReporter.idl | 19 ++- xpcom/base/nsMemoryReporterManager.cpp | 153 ++++++++++++++++++ 6 files changed, 201 insertions(+), 12 deletions(-) diff --git a/dom/ipc/ContentChild.cpp b/dom/ipc/ContentChild.cpp index 41e1c5ff89be..d9147bd85286 100644 --- a/dom/ipc/ContentChild.cpp +++ b/dom/ipc/ContentChild.cpp @@ -377,13 +377,13 @@ ContentChild::RecvPMemoryReportRequestConstructor(PMemoryReportRequestChild* chi // one, whereupon the callback will turn each measurement into a // MemoryReport. mgr->EnumerateMultiReporters(getter_AddRefs(e)); - MemoryReportsWrapper wrappedReports(&reports); - MemoryReportCallback cb(process); + nsRefPtr wrappedReports = + new MemoryReportsWrapper(&reports); + nsRefPtr cb = new MemoryReportCallback(process); while (NS_SUCCEEDED(e->HasMoreElements(&more)) && more) { nsCOMPtr r; e->GetNext(getter_AddRefs(r)); - - r->CollectReports(&cb, &wrappedReports); + r->CollectReports(cb, wrappedReports); } child->Send__delete__(child, reports); diff --git a/toolkit/components/aboutmemory/tests/chrome/test_aboutmemory.xul b/toolkit/components/aboutmemory/tests/chrome/test_aboutmemory.xul index 47d85af651e2..602032589f3a 100644 --- a/toolkit/components/aboutmemory/tests/chrome/test_aboutmemory.xul +++ b/toolkit/components/aboutmemory/tests/chrome/test_aboutmemory.xul @@ -77,6 +77,8 @@ f("", "explicit/b/b", HEAP, 75 * MB), f("", "explicit/b/c/a", HEAP, 70 * MB), f("", "explicit/b/c/b", HEAP, 2 * MB), // omitted + f("", "explicit/c", MAPPED, 100 * MB), + f("", "explicit/c/d", MAPPED, 13 * MB), // subsumed by parent f("", "explicit/g", HEAP, 1 * MB), // internal, dup: merge f("", "explicit/g/a", HEAP, 6 * MB), f("", "explicit/g/b", HEAP, 5 * MB), @@ -87,7 +89,9 @@ var fakeMultiReporters = [ { collectReports: function(cbObj, closure) { function f(p, k, u, a) { cbObj.callback("", p, k, u, a, "(desc)", closure); } - f("explicit/c", MAPPED, BYTES, 123 * MB); + f("explicit/c/d", MAPPED, BYTES, 10 * MB), // dup, subsumed by parent + f("explicit/cc", MAPPED, BYTES, 13 * MB); + f("explicit/cc", MAPPED, BYTES, 10 * MB); // dup f("explicit/d", MAPPED, BYTES, 499 * KB); // omitted f("explicit/e", MAPPED, BYTES, 100 * KB); // omitted f("explicit/f/g/h/i", HEAP, BYTES, 20 * MB); @@ -108,6 +112,17 @@ mgr.registerMultiReporter(fakeMultiReporters[i]); } + // mgr.explicit sums "heap-used" and all the appropriate MAPPED ones: + // - "explicit/c", "explicit/cc" x 2, "explicit/d", "explicit/e" + // - but *not* "explicit/c/d" x 2 + // Check explicit now before we add the fake reporters for the fake 2nd + // and subsequent processes. + is(mgr.explicit, 500*MB + (100 + 13 + 10)*MB + 599*KB, "mgr.explicit"); + + // Access mgr.resident just to make sure it doesn't crash. We can't check + // its actual value because it's non-deterministic. + dummy = mgr.resident; + var fakeReporters2 = [ f("2nd", "heap-used", OTHER, 1000 * MB), f("2nd", "heap-unused", OTHER, 100 * MB), @@ -157,7 +172,10 @@ Explicit Allocations\n\ │ ├──70.00 MB (11.23%) -- a\n\ │ └───2.00 MB (00.32%) -- (1 omitted)\n\ ├──222.00 MB (35.60%) -- a\n\ -├──123.00 MB (19.72%) -- c\n\ +├──100.00 MB (16.04%) -- c\n\ +│ ├───77.00 MB (12.35%) -- other\n\ +│ └───23.00 MB (03.69%) -- d\n\ +├───23.00 MB (03.69%) -- cc\n\ ├───20.00 MB (03.21%) -- f\n\ │ └──20.00 MB (03.21%) -- g\n\ │ └──20.00 MB (03.21%) -- h\n\ @@ -224,7 +242,10 @@ Explicit Allocations\n\ │ ├──73,400,320 B (11.23%) -- a\n\ │ └───2,097,152 B (00.32%) -- b\n\ ├──232,783,872 B (35.60%) -- a\n\ -├──128,974,848 B (19.72%) -- c\n\ +├──104,857,600 B (16.04%) -- c\n\ +│ ├───80,740,352 B (12.35%) -- other\n\ +│ └───24,117,248 B (03.69%) -- d\n\ +├───24,117,248 B (03.69%) -- cc\n\ ├───20,971,520 B (03.21%) -- f\n\ │ └──20,971,520 B (03.21%) -- g\n\ │ └──20,971,520 B (03.21%) -- h\n\ diff --git a/toolkit/components/telemetry/TelemetryHistograms.h b/toolkit/components/telemetry/TelemetryHistograms.h index bb01f5d8ad26..65e5e572a43d 100644 --- a/toolkit/components/telemetry/TelemetryHistograms.h +++ b/toolkit/components/telemetry/TelemetryHistograms.h @@ -55,8 +55,7 @@ HISTOGRAM(MEMORY_RESIDENT, 32 * 1024, 1024 * 1024, 10, EXPONENTIAL, "Resident me HISTOGRAM(MEMORY_LAYOUT_ALL, 1024, 64 * 1024, 10, EXPONENTIAL, "Memory used by layout (KB)") HISTOGRAM(MEMORY_IMAGES_CONTENT_USED_UNCOMPRESSED, 1024, 1024 * 1024, 10, EXPONENTIAL, "Memory used for uncompressed, in-use content images (KB)") HISTOGRAM(MEMORY_HEAP_USED, 1024, 1024 * 1024, 10, EXPONENTIAL, "Heap memory used (KB)") -// XXX: bug 660731 will enable this -//HISTOGRAM(MEMORY_EXPLICIT, 1024, 1024 * 1024, 10, EXPONENTIAL, "Explicit memory allocations (KB)") +HISTOGRAM(MEMORY_EXPLICIT, 1024, 1024 * 1024, 10, EXPONENTIAL, "Explicit memory allocations (KB)") #if defined(XP_WIN) HISTOGRAM(EARLY_GLUESTARTUP_READ_OPS, 1, 100, 12, LINEAR, "ProcessIoCounters.ReadOperationCount before glue startup") HISTOGRAM(EARLY_GLUESTARTUP_READ_TRANSFER, 1, 50 * 1024, 12, EXPONENTIAL, "ProcessIoCounters.ReadTransferCount before glue startup (KB)") diff --git a/toolkit/components/telemetry/TelemetryPing.js b/toolkit/components/telemetry/TelemetryPing.js index db9c73e0dc3b..01fc192cdd1e 100644 --- a/toolkit/components/telemetry/TelemetryPing.js +++ b/toolkit/components/telemetry/TelemetryPing.js @@ -251,9 +251,8 @@ TelemetryPing.prototype = { } this.addValue(mr.path, id, val); } - // XXX: bug 660731 will enable this // "explicit" is found differently. - //this.addValue("explicit", "MEMORY_EXPLICIT", Math.floor(mgr.explicit / 1024)); + this.addValue("explicit", "MEMORY_EXPLICIT", Math.floor(mgr.explicit / 1024)); }, /** diff --git a/xpcom/base/nsIMemoryReporter.idl b/xpcom/base/nsIMemoryReporter.idl index 13f7bc4e1a87..9bba1e0b1b10 100644 --- a/xpcom/base/nsIMemoryReporter.idl +++ b/xpcom/base/nsIMemoryReporter.idl @@ -178,7 +178,7 @@ interface nsIMemoryMultiReporter : nsISupports in nsISupports closure); }; -[scriptable, uuid(80a93b4c-6fff-4acd-8598-3891074a30ab)] +[scriptable, uuid(84ba9c85-3372-4423-b7ab-74708b9269a6)] interface nsIMemoryReporterManager : nsISupports { /* @@ -221,6 +221,23 @@ interface nsIMemoryReporterManager : nsISupports * Initialize. */ void init (); + + /* + * Get the resident size (aka. RSS, physical memory used). This reporter + * is special-cased because it's interesting, is available on all + * platforms, and returns a meaningful result on all common platforms. + */ + readonly attribute PRInt64 resident; + + /* + * Get the total size of explicit memory allocations, both at the OS-level + * (eg. via mmap, VirtualAlloc) and at the heap level (eg. via malloc, + * calloc, operator new). (Nb: it covers all heap allocations, but will + * miss any OS-level ones not covered by memory reporters.) This reporter + * is special-cased because it's interesting, and is moderately difficult + * to compute in JS. + */ + readonly attribute PRInt64 explicit; }; %{C++ diff --git a/xpcom/base/nsMemoryReporterManager.cpp b/xpcom/base/nsMemoryReporterManager.cpp index c29bb82d0c39..a5eb5f94cc60 100644 --- a/xpcom/base/nsMemoryReporterManager.cpp +++ b/xpcom/base/nsMemoryReporterManager.cpp @@ -36,10 +36,12 @@ * * ***** END LICENSE BLOCK ***** */ +#include "nsAutoPtr.h" #include "nsCOMPtr.h" #include "nsServiceManagerUtils.h" #include "nsMemoryReporterManager.h" #include "nsArrayEnumerator.h" +#include "nsISimpleEnumerator.h" #if defined(XP_LINUX) || defined(XP_MACOSX) @@ -507,6 +509,157 @@ nsMemoryReporterManager::UnregisterMultiReporter(nsIMemoryMultiReporter *reporte return NS_OK; } +NS_IMETHODIMP +nsMemoryReporterManager::GetResident(PRInt64 *aResident) +{ + *aResident = ::GetResident(); + return NS_OK; +} + +struct MemoryReport { + MemoryReport(const nsACString &path, PRInt64 amount) + : path(path), amount(amount) + { + MOZ_COUNT_CTOR(MemoryReport); + } + ~MemoryReport() + { + MOZ_COUNT_DTOR(MemoryReport); + } + const nsCString path; + PRInt64 amount; +}; + +// This is just a wrapper for InfallibleTArray that implements +// nsISupports, so it can be passed to nsIMemoryMultiReporter::CollectReports. +class MemoryReportsWrapper : public nsISupports { +public: + NS_DECL_ISUPPORTS + MemoryReportsWrapper(InfallibleTArray *r) : mReports(r) { } + InfallibleTArray *mReports; +}; +NS_IMPL_ISUPPORTS0(MemoryReportsWrapper) + +class MemoryReportCallback : public nsIMemoryMultiReporterCallback +{ +public: + NS_DECL_ISUPPORTS + + NS_IMETHOD Callback(const nsACString &aProcess, const nsACString &aPath, + PRInt32 aKind, PRInt32 aUnits, PRInt64 aAmount, + const nsACString &aDescription, + nsISupports *aWrappedMRs) + { + if (aKind == nsIMemoryReporter::KIND_MAPPED && aAmount != PRInt64(-1)) { + MemoryReportsWrapper *wrappedMRs = + static_cast(aWrappedMRs); + MemoryReport mr(aPath, aAmount); + wrappedMRs->mReports->AppendElement(mr); + } + return NS_OK; + } +}; +NS_IMPL_ISUPPORTS1( + MemoryReportCallback +, nsIMemoryMultiReporterCallback +) + +// Is path1 a prefix, and thus a parent, of path2? Eg. "a/b" is a parent of +// "a/b/c", but "a/bb" is not. +static bool +isParent(const nsACString &path1, const nsACString &path2) +{ + if (path1.Length() >= path2.Length()) + return false; + + const nsACString& subStr = Substring(path2, 0, path1.Length()); + return subStr.Equals(path1) && path2[path1.Length()] == '/'; +} + +NS_IMETHODIMP +nsMemoryReporterManager::GetExplicit(PRInt64 *aExplicit) +{ + InfallibleTArray mapped; + PRInt64 heapUsed = PRInt64(-1); + + // Get "heap-used" and all the KIND_MAPPED measurements from vanilla + // reporters. + nsCOMPtr e; + EnumerateReporters(getter_AddRefs(e)); + + PRBool more; + while (NS_SUCCEEDED(e->HasMoreElements(&more)) && more) { + nsCOMPtr r; + e->GetNext(getter_AddRefs(r)); + + PRInt32 kind; + nsresult rv = r->GetKind(&kind); + NS_ENSURE_SUCCESS(rv, rv); + + if (kind == nsIMemoryReporter::KIND_MAPPED) { + nsCString path; + rv = r->GetPath(getter_Copies(path)); + NS_ENSURE_SUCCESS(rv, rv); + + PRInt64 amount; + rv = r->GetAmount(&amount); + NS_ENSURE_SUCCESS(rv, rv); + + if (amount != PRInt64(-1)) { + MemoryReport mr(path, amount); + mapped.AppendElement(mr); + } + } else { + nsCString path; + rv = r->GetPath(getter_Copies(path)); + NS_ENSURE_SUCCESS(rv, rv); + + if (path.Equals("heap-used")) { + rv = r->GetAmount(&heapUsed); + NS_ENSURE_SUCCESS(rv, rv); + NS_ENSURE_TRUE(heapUsed != PRInt64(-1), NS_ERROR_FAILURE); + } + } + } + + // Get KIND_MAPPED measurements from multi-reporters, too. + nsCOMPtr e2; + EnumerateMultiReporters(getter_AddRefs(e2)); + nsRefPtr wrappedMRs = + new MemoryReportsWrapper(&mapped); + nsRefPtr cb = new MemoryReportCallback(); + + while (NS_SUCCEEDED(e2->HasMoreElements(&more)) && more) { + nsCOMPtr r; + e2->GetNext(getter_AddRefs(r)); + r->CollectReports(cb, wrappedMRs); + } + + // Ignore (by zeroing its amount) any reporter that is a child of another + // reporter. Eg. if we have "explicit/a" and "explicit/a/b", zero the + // latter. This is quadratic in the number of MAPPED reporters, but there + // shouldn't be many. + for (PRUint32 i = 0; i < mapped.Length(); i++) { + const nsCString &iPath = mapped[i].path; + for (PRUint32 j = i + 1; j < mapped.Length(); j++) { + const nsCString &jPath = mapped[j].path; + if (isParent(iPath, jPath)) { + mapped[j].amount = 0; + } else if (isParent(jPath, iPath)) { + mapped[i].amount = 0; + } + } + } + + // Sum all the mapped reporters and heapUsed. + *aExplicit = heapUsed; + for (PRUint32 i = 0; i < mapped.Length(); i++) { + *aExplicit += mapped[i].amount; + } + + return NS_OK; +} + NS_IMPL_ISUPPORTS1(nsMemoryReporter, nsIMemoryReporter) nsMemoryReporter::nsMemoryReporter(nsCString& process, From c8cfed69aa148b900aa20956583646b97a2ba2a7 Mon Sep 17 00:00:00 2001 From: Mats Palmgren Date: Mon, 4 Jul 2011 10:21:50 +0200 Subject: [PATCH 05/10] Disable newly added reftest for bug 667010 on Android to fix orange. r=test-only --- layout/reftests/text-overflow/reftest.list | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layout/reftests/text-overflow/reftest.list b/layout/reftests/text-overflow/reftest.list index c7d80bdfff27..acd74b233fd1 100644 --- a/layout/reftests/text-overflow/reftest.list +++ b/layout/reftests/text-overflow/reftest.list @@ -15,4 +15,4 @@ HTTP(..) == standards-line-height.html standards-line-height-ref.html HTTP(..) == selection.html selection-ref.html HTTP(..) == marker-shadow.html marker-shadow-ref.html == aligned-baseline.html aligned-baseline-ref.html -== clipped-elements.html clipped-elements-ref.html +skip-if(Android) == clipped-elements.html clipped-elements-ref.html From 26f3fbd63d79e7872417fb7df9467149bce288d6 Mon Sep 17 00:00:00 2001 From: Marco Bonardo Date: Mon, 4 Jul 2011 12:41:16 +0200 Subject: [PATCH 06/10] Backout changeset 8ab62172a2cb due to XPCShell test failure. --- dom/ipc/ContentChild.cpp | 8 +- .../tests/chrome/test_aboutmemory.xul | 27 +--- .../telemetry/TelemetryHistograms.h | 3 +- toolkit/components/telemetry/TelemetryPing.js | 3 +- xpcom/base/nsIMemoryReporter.idl | 19 +-- xpcom/base/nsMemoryReporterManager.cpp | 153 ------------------ 6 files changed, 12 insertions(+), 201 deletions(-) diff --git a/dom/ipc/ContentChild.cpp b/dom/ipc/ContentChild.cpp index d9147bd85286..41e1c5ff89be 100644 --- a/dom/ipc/ContentChild.cpp +++ b/dom/ipc/ContentChild.cpp @@ -377,13 +377,13 @@ ContentChild::RecvPMemoryReportRequestConstructor(PMemoryReportRequestChild* chi // one, whereupon the callback will turn each measurement into a // MemoryReport. mgr->EnumerateMultiReporters(getter_AddRefs(e)); - nsRefPtr wrappedReports = - new MemoryReportsWrapper(&reports); - nsRefPtr cb = new MemoryReportCallback(process); + MemoryReportsWrapper wrappedReports(&reports); + MemoryReportCallback cb(process); while (NS_SUCCEEDED(e->HasMoreElements(&more)) && more) { nsCOMPtr r; e->GetNext(getter_AddRefs(r)); - r->CollectReports(cb, wrappedReports); + + r->CollectReports(&cb, &wrappedReports); } child->Send__delete__(child, reports); diff --git a/toolkit/components/aboutmemory/tests/chrome/test_aboutmemory.xul b/toolkit/components/aboutmemory/tests/chrome/test_aboutmemory.xul index 602032589f3a..47d85af651e2 100644 --- a/toolkit/components/aboutmemory/tests/chrome/test_aboutmemory.xul +++ b/toolkit/components/aboutmemory/tests/chrome/test_aboutmemory.xul @@ -77,8 +77,6 @@ f("", "explicit/b/b", HEAP, 75 * MB), f("", "explicit/b/c/a", HEAP, 70 * MB), f("", "explicit/b/c/b", HEAP, 2 * MB), // omitted - f("", "explicit/c", MAPPED, 100 * MB), - f("", "explicit/c/d", MAPPED, 13 * MB), // subsumed by parent f("", "explicit/g", HEAP, 1 * MB), // internal, dup: merge f("", "explicit/g/a", HEAP, 6 * MB), f("", "explicit/g/b", HEAP, 5 * MB), @@ -89,9 +87,7 @@ var fakeMultiReporters = [ { collectReports: function(cbObj, closure) { function f(p, k, u, a) { cbObj.callback("", p, k, u, a, "(desc)", closure); } - f("explicit/c/d", MAPPED, BYTES, 10 * MB), // dup, subsumed by parent - f("explicit/cc", MAPPED, BYTES, 13 * MB); - f("explicit/cc", MAPPED, BYTES, 10 * MB); // dup + f("explicit/c", MAPPED, BYTES, 123 * MB); f("explicit/d", MAPPED, BYTES, 499 * KB); // omitted f("explicit/e", MAPPED, BYTES, 100 * KB); // omitted f("explicit/f/g/h/i", HEAP, BYTES, 20 * MB); @@ -112,17 +108,6 @@ mgr.registerMultiReporter(fakeMultiReporters[i]); } - // mgr.explicit sums "heap-used" and all the appropriate MAPPED ones: - // - "explicit/c", "explicit/cc" x 2, "explicit/d", "explicit/e" - // - but *not* "explicit/c/d" x 2 - // Check explicit now before we add the fake reporters for the fake 2nd - // and subsequent processes. - is(mgr.explicit, 500*MB + (100 + 13 + 10)*MB + 599*KB, "mgr.explicit"); - - // Access mgr.resident just to make sure it doesn't crash. We can't check - // its actual value because it's non-deterministic. - dummy = mgr.resident; - var fakeReporters2 = [ f("2nd", "heap-used", OTHER, 1000 * MB), f("2nd", "heap-unused", OTHER, 100 * MB), @@ -172,10 +157,7 @@ Explicit Allocations\n\ │ ├──70.00 MB (11.23%) -- a\n\ │ └───2.00 MB (00.32%) -- (1 omitted)\n\ ├──222.00 MB (35.60%) -- a\n\ -├──100.00 MB (16.04%) -- c\n\ -│ ├───77.00 MB (12.35%) -- other\n\ -│ └───23.00 MB (03.69%) -- d\n\ -├───23.00 MB (03.69%) -- cc\n\ +├──123.00 MB (19.72%) -- c\n\ ├───20.00 MB (03.21%) -- f\n\ │ └──20.00 MB (03.21%) -- g\n\ │ └──20.00 MB (03.21%) -- h\n\ @@ -242,10 +224,7 @@ Explicit Allocations\n\ │ ├──73,400,320 B (11.23%) -- a\n\ │ └───2,097,152 B (00.32%) -- b\n\ ├──232,783,872 B (35.60%) -- a\n\ -├──104,857,600 B (16.04%) -- c\n\ -│ ├───80,740,352 B (12.35%) -- other\n\ -│ └───24,117,248 B (03.69%) -- d\n\ -├───24,117,248 B (03.69%) -- cc\n\ +├──128,974,848 B (19.72%) -- c\n\ ├───20,971,520 B (03.21%) -- f\n\ │ └──20,971,520 B (03.21%) -- g\n\ │ └──20,971,520 B (03.21%) -- h\n\ diff --git a/toolkit/components/telemetry/TelemetryHistograms.h b/toolkit/components/telemetry/TelemetryHistograms.h index 65e5e572a43d..bb01f5d8ad26 100644 --- a/toolkit/components/telemetry/TelemetryHistograms.h +++ b/toolkit/components/telemetry/TelemetryHistograms.h @@ -55,7 +55,8 @@ HISTOGRAM(MEMORY_RESIDENT, 32 * 1024, 1024 * 1024, 10, EXPONENTIAL, "Resident me HISTOGRAM(MEMORY_LAYOUT_ALL, 1024, 64 * 1024, 10, EXPONENTIAL, "Memory used by layout (KB)") HISTOGRAM(MEMORY_IMAGES_CONTENT_USED_UNCOMPRESSED, 1024, 1024 * 1024, 10, EXPONENTIAL, "Memory used for uncompressed, in-use content images (KB)") HISTOGRAM(MEMORY_HEAP_USED, 1024, 1024 * 1024, 10, EXPONENTIAL, "Heap memory used (KB)") -HISTOGRAM(MEMORY_EXPLICIT, 1024, 1024 * 1024, 10, EXPONENTIAL, "Explicit memory allocations (KB)") +// XXX: bug 660731 will enable this +//HISTOGRAM(MEMORY_EXPLICIT, 1024, 1024 * 1024, 10, EXPONENTIAL, "Explicit memory allocations (KB)") #if defined(XP_WIN) HISTOGRAM(EARLY_GLUESTARTUP_READ_OPS, 1, 100, 12, LINEAR, "ProcessIoCounters.ReadOperationCount before glue startup") HISTOGRAM(EARLY_GLUESTARTUP_READ_TRANSFER, 1, 50 * 1024, 12, EXPONENTIAL, "ProcessIoCounters.ReadTransferCount before glue startup (KB)") diff --git a/toolkit/components/telemetry/TelemetryPing.js b/toolkit/components/telemetry/TelemetryPing.js index 01fc192cdd1e..db9c73e0dc3b 100644 --- a/toolkit/components/telemetry/TelemetryPing.js +++ b/toolkit/components/telemetry/TelemetryPing.js @@ -251,8 +251,9 @@ TelemetryPing.prototype = { } this.addValue(mr.path, id, val); } + // XXX: bug 660731 will enable this // "explicit" is found differently. - this.addValue("explicit", "MEMORY_EXPLICIT", Math.floor(mgr.explicit / 1024)); + //this.addValue("explicit", "MEMORY_EXPLICIT", Math.floor(mgr.explicit / 1024)); }, /** diff --git a/xpcom/base/nsIMemoryReporter.idl b/xpcom/base/nsIMemoryReporter.idl index 9bba1e0b1b10..13f7bc4e1a87 100644 --- a/xpcom/base/nsIMemoryReporter.idl +++ b/xpcom/base/nsIMemoryReporter.idl @@ -178,7 +178,7 @@ interface nsIMemoryMultiReporter : nsISupports in nsISupports closure); }; -[scriptable, uuid(84ba9c85-3372-4423-b7ab-74708b9269a6)] +[scriptable, uuid(80a93b4c-6fff-4acd-8598-3891074a30ab)] interface nsIMemoryReporterManager : nsISupports { /* @@ -221,23 +221,6 @@ interface nsIMemoryReporterManager : nsISupports * Initialize. */ void init (); - - /* - * Get the resident size (aka. RSS, physical memory used). This reporter - * is special-cased because it's interesting, is available on all - * platforms, and returns a meaningful result on all common platforms. - */ - readonly attribute PRInt64 resident; - - /* - * Get the total size of explicit memory allocations, both at the OS-level - * (eg. via mmap, VirtualAlloc) and at the heap level (eg. via malloc, - * calloc, operator new). (Nb: it covers all heap allocations, but will - * miss any OS-level ones not covered by memory reporters.) This reporter - * is special-cased because it's interesting, and is moderately difficult - * to compute in JS. - */ - readonly attribute PRInt64 explicit; }; %{C++ diff --git a/xpcom/base/nsMemoryReporterManager.cpp b/xpcom/base/nsMemoryReporterManager.cpp index a5eb5f94cc60..c29bb82d0c39 100644 --- a/xpcom/base/nsMemoryReporterManager.cpp +++ b/xpcom/base/nsMemoryReporterManager.cpp @@ -36,12 +36,10 @@ * * ***** END LICENSE BLOCK ***** */ -#include "nsAutoPtr.h" #include "nsCOMPtr.h" #include "nsServiceManagerUtils.h" #include "nsMemoryReporterManager.h" #include "nsArrayEnumerator.h" -#include "nsISimpleEnumerator.h" #if defined(XP_LINUX) || defined(XP_MACOSX) @@ -509,157 +507,6 @@ nsMemoryReporterManager::UnregisterMultiReporter(nsIMemoryMultiReporter *reporte return NS_OK; } -NS_IMETHODIMP -nsMemoryReporterManager::GetResident(PRInt64 *aResident) -{ - *aResident = ::GetResident(); - return NS_OK; -} - -struct MemoryReport { - MemoryReport(const nsACString &path, PRInt64 amount) - : path(path), amount(amount) - { - MOZ_COUNT_CTOR(MemoryReport); - } - ~MemoryReport() - { - MOZ_COUNT_DTOR(MemoryReport); - } - const nsCString path; - PRInt64 amount; -}; - -// This is just a wrapper for InfallibleTArray that implements -// nsISupports, so it can be passed to nsIMemoryMultiReporter::CollectReports. -class MemoryReportsWrapper : public nsISupports { -public: - NS_DECL_ISUPPORTS - MemoryReportsWrapper(InfallibleTArray *r) : mReports(r) { } - InfallibleTArray *mReports; -}; -NS_IMPL_ISUPPORTS0(MemoryReportsWrapper) - -class MemoryReportCallback : public nsIMemoryMultiReporterCallback -{ -public: - NS_DECL_ISUPPORTS - - NS_IMETHOD Callback(const nsACString &aProcess, const nsACString &aPath, - PRInt32 aKind, PRInt32 aUnits, PRInt64 aAmount, - const nsACString &aDescription, - nsISupports *aWrappedMRs) - { - if (aKind == nsIMemoryReporter::KIND_MAPPED && aAmount != PRInt64(-1)) { - MemoryReportsWrapper *wrappedMRs = - static_cast(aWrappedMRs); - MemoryReport mr(aPath, aAmount); - wrappedMRs->mReports->AppendElement(mr); - } - return NS_OK; - } -}; -NS_IMPL_ISUPPORTS1( - MemoryReportCallback -, nsIMemoryMultiReporterCallback -) - -// Is path1 a prefix, and thus a parent, of path2? Eg. "a/b" is a parent of -// "a/b/c", but "a/bb" is not. -static bool -isParent(const nsACString &path1, const nsACString &path2) -{ - if (path1.Length() >= path2.Length()) - return false; - - const nsACString& subStr = Substring(path2, 0, path1.Length()); - return subStr.Equals(path1) && path2[path1.Length()] == '/'; -} - -NS_IMETHODIMP -nsMemoryReporterManager::GetExplicit(PRInt64 *aExplicit) -{ - InfallibleTArray mapped; - PRInt64 heapUsed = PRInt64(-1); - - // Get "heap-used" and all the KIND_MAPPED measurements from vanilla - // reporters. - nsCOMPtr e; - EnumerateReporters(getter_AddRefs(e)); - - PRBool more; - while (NS_SUCCEEDED(e->HasMoreElements(&more)) && more) { - nsCOMPtr r; - e->GetNext(getter_AddRefs(r)); - - PRInt32 kind; - nsresult rv = r->GetKind(&kind); - NS_ENSURE_SUCCESS(rv, rv); - - if (kind == nsIMemoryReporter::KIND_MAPPED) { - nsCString path; - rv = r->GetPath(getter_Copies(path)); - NS_ENSURE_SUCCESS(rv, rv); - - PRInt64 amount; - rv = r->GetAmount(&amount); - NS_ENSURE_SUCCESS(rv, rv); - - if (amount != PRInt64(-1)) { - MemoryReport mr(path, amount); - mapped.AppendElement(mr); - } - } else { - nsCString path; - rv = r->GetPath(getter_Copies(path)); - NS_ENSURE_SUCCESS(rv, rv); - - if (path.Equals("heap-used")) { - rv = r->GetAmount(&heapUsed); - NS_ENSURE_SUCCESS(rv, rv); - NS_ENSURE_TRUE(heapUsed != PRInt64(-1), NS_ERROR_FAILURE); - } - } - } - - // Get KIND_MAPPED measurements from multi-reporters, too. - nsCOMPtr e2; - EnumerateMultiReporters(getter_AddRefs(e2)); - nsRefPtr wrappedMRs = - new MemoryReportsWrapper(&mapped); - nsRefPtr cb = new MemoryReportCallback(); - - while (NS_SUCCEEDED(e2->HasMoreElements(&more)) && more) { - nsCOMPtr r; - e2->GetNext(getter_AddRefs(r)); - r->CollectReports(cb, wrappedMRs); - } - - // Ignore (by zeroing its amount) any reporter that is a child of another - // reporter. Eg. if we have "explicit/a" and "explicit/a/b", zero the - // latter. This is quadratic in the number of MAPPED reporters, but there - // shouldn't be many. - for (PRUint32 i = 0; i < mapped.Length(); i++) { - const nsCString &iPath = mapped[i].path; - for (PRUint32 j = i + 1; j < mapped.Length(); j++) { - const nsCString &jPath = mapped[j].path; - if (isParent(iPath, jPath)) { - mapped[j].amount = 0; - } else if (isParent(jPath, iPath)) { - mapped[i].amount = 0; - } - } - } - - // Sum all the mapped reporters and heapUsed. - *aExplicit = heapUsed; - for (PRUint32 i = 0; i < mapped.Length(); i++) { - *aExplicit += mapped[i].amount; - } - - return NS_OK; -} - NS_IMPL_ISUPPORTS1(nsMemoryReporter, nsIMemoryReporter) nsMemoryReporter::nsMemoryReporter(nsCString& process, From 5b3036138c0427c72519191278f638cd814f004c Mon Sep 17 00:00:00 2001 From: Benoit Girard Date: Mon, 4 Jul 2011 09:15:05 -0400 Subject: [PATCH 07/10] Bug 648480 - Add shadow-layer support to d3d9 backend. r=cjones --- gfx/layers/Makefile.in | 1 + gfx/layers/d3d9/CanvasLayerD3D9.cpp | 120 ++++++++++-- gfx/layers/d3d9/CanvasLayerD3D9.h | 44 ++++- gfx/layers/d3d9/ColorLayerD3D9.cpp | 39 ++-- gfx/layers/d3d9/ColorLayerD3D9.h | 20 ++ gfx/layers/d3d9/ContainerLayerD3D9.cpp | 261 ++++++++++++++++--------- gfx/layers/d3d9/ContainerLayerD3D9.h | 47 +++++ gfx/layers/d3d9/ImageLayerD3D9.cpp | 149 ++++++++++++++ gfx/layers/d3d9/ImageLayerD3D9.h | 30 +++ gfx/layers/d3d9/LayerManagerD3D9.cpp | 50 +++++ gfx/layers/d3d9/LayerManagerD3D9.h | 44 ++++- gfx/layers/d3d9/ShadowBufferD3D9.cpp | 118 +++++++++++ gfx/layers/d3d9/ShadowBufferD3D9.h | 77 ++++++++ gfx/layers/d3d9/ThebesLayerD3D9.cpp | 105 +++++++++- gfx/layers/d3d9/ThebesLayerD3D9.h | 32 +++ gfx/layers/opengl/CanvasLayerOGL.cpp | 3 + gfx/layers/opengl/CanvasLayerOGL.h | 2 - layout/ipc/RenderFrameParent.cpp | 9 + 18 files changed, 1029 insertions(+), 122 deletions(-) create mode 100644 gfx/layers/d3d9/ShadowBufferD3D9.cpp create mode 100644 gfx/layers/d3d9/ShadowBufferD3D9.h diff --git a/gfx/layers/Makefile.in b/gfx/layers/Makefile.in index daef4cd59425..8d73b9adf5a5 100644 --- a/gfx/layers/Makefile.in +++ b/gfx/layers/Makefile.in @@ -102,6 +102,7 @@ CPPSRCS += \ ImageLayerD3D9.cpp \ ColorLayerD3D9.cpp \ CanvasLayerD3D9.cpp \ + ShadowBufferD3D9.cpp \ DeviceManagerD3D9.cpp \ Nv3DVUtils.cpp \ $(NULL) diff --git a/gfx/layers/d3d9/CanvasLayerD3D9.cpp b/gfx/layers/d3d9/CanvasLayerD3D9.cpp index bed48101e8d3..55386c54f314 100644 --- a/gfx/layers/d3d9/CanvasLayerD3D9.cpp +++ b/gfx/layers/d3d9/CanvasLayerD3D9.cpp @@ -36,12 +36,17 @@ * * ***** END LICENSE BLOCK ***** */ -#include "CanvasLayerD3D9.h" + +#include "mozilla/layers/PLayers.h" +#include "mozilla/layers/ShadowLayers.h" +#include "ShadowBufferD3D9.h" #include "gfxImageSurface.h" #include "gfxWindowsSurface.h" #include "gfxWindowsPlatform.h" +#include "CanvasLayerD3D9.h" + namespace mozilla { namespace layers { @@ -93,14 +98,14 @@ CanvasLayerD3D9::UpdateSurface() if (mGLContext) { // WebGL reads entire surface. - D3DLOCKED_RECT r; - HRESULT hr = mTexture->LockRect(0, &r, NULL, 0); - - if (FAILED(hr)) { + LockTextureRectD3D9 textureLock(mTexture); + if (!textureLock.HasLock()) { NS_WARNING("Failed to lock CanvasLayer texture."); return; } + D3DLOCKED_RECT r = textureLock.GetLockRect(); + PRUint8 *destination; if (r.Pitch != mBounds.width * 4) { destination = new PRUint8[mBounds.width * mBounds.height * 4]; @@ -143,7 +148,6 @@ CanvasLayerD3D9::UpdateSurface() } delete [] destination; } - mTexture->UnlockRect(0); } else if (mSurface) { RECT r; r.left = mBounds.x; @@ -151,14 +155,14 @@ CanvasLayerD3D9::UpdateSurface() r.right = mBounds.XMost(); r.bottom = mBounds.YMost(); - D3DLOCKED_RECT lockedRect; - HRESULT hr = mTexture->LockRect(0, &lockedRect, &r, 0); - - if (FAILED(hr)) { + LockTextureRectD3D9 textureLock(mTexture); + if (!textureLock.HasLock()) { NS_WARNING("Failed to lock CanvasLayer texture."); return; } + D3DLOCKED_RECT lockedRect = textureLock.GetLockRect(); + nsRefPtr sourceSurface; if (mSurface->GetType() == gfxASurface::SurfaceTypeWin32) { @@ -168,7 +172,6 @@ CanvasLayerD3D9::UpdateSurface() if (sourceSurface->Format() != gfxASurface::ImageFormatARGB32 && sourceSurface->Format() != gfxASurface::ImageFormatRGB24) { - mTexture->UnlockRect(0); return; } } else { @@ -195,7 +198,6 @@ CanvasLayerD3D9::UpdateSurface() mBounds.width * 4); } - mTexture->UnlockRect(0); } } @@ -287,5 +289,99 @@ CanvasLayerD3D9::CreateTexture() } } +ShadowCanvasLayerD3D9::ShadowCanvasLayerD3D9(LayerManagerD3D9* aManager) + : ShadowCanvasLayer(aManager, nsnull) + , LayerD3D9(aManager) + , mNeedsYFlip(PR_FALSE) +{ + mImplData = static_cast(this); +} + +ShadowCanvasLayerD3D9::~ShadowCanvasLayerD3D9() +{} + +void +ShadowCanvasLayerD3D9::Initialize(const Data& aData) +{ + NS_RUNTIMEABORT("Non-shadow layer API unexpectedly used for shadow layer"); +} + +void +ShadowCanvasLayerD3D9::Init(const SurfaceDescriptor& aNewFront, + const nsIntSize& aSize, bool needYFlip) +{ + + if (!mBuffer) { + mBuffer = new ShadowBufferD3D9(this); + } + + mNeedsYFlip = needYFlip; +} + +void +ShadowCanvasLayerD3D9::Swap(const SurfaceDescriptor& aNewFront, + SurfaceDescriptor* aNewBack) +{ + NS_ASSERTION(aNewFront.type() == SharedImage::TSurfaceDescriptor, + "ShadowCanvasLayerD3D9::Swap expected SharedImage surface"); + + nsRefPtr surf = + ShadowLayerForwarder::OpenDescriptor(aNewFront); + + if (mBuffer) { + mBuffer->Upload(surf, GetVisibleRegion().GetBounds()); + } + + *aNewBack = aNewFront; +} + +void +ShadowCanvasLayerD3D9::DestroyFrontBuffer() +{ + Destroy(); +} + +void +ShadowCanvasLayerD3D9::Disconnect() +{ + Destroy(); +} + +void +ShadowCanvasLayerD3D9::Destroy() +{ + mBuffer = nsnull; +} + +void +ShadowCanvasLayerD3D9::CleanResources() +{ + Destroy(); +} + +void +ShadowCanvasLayerD3D9::LayerManagerDestroyed() +{ + mD3DManager->deviceManager()->mLayersWithResources.RemoveElement(this); + mD3DManager = nsnull; +} + +Layer* +ShadowCanvasLayerD3D9::GetLayer() +{ + return this; +} + +void +ShadowCanvasLayerD3D9::RenderLayer() +{ + if (!mBuffer) { + return; + } + + mBuffer->RenderTo(mD3DManager, GetEffectiveVisibleRegion()); +} + + } /* namespace layers */ } /* namespace mozilla */ diff --git a/gfx/layers/d3d9/CanvasLayerD3D9.h b/gfx/layers/d3d9/CanvasLayerD3D9.h index d3efc49e7616..7637ced48801 100644 --- a/gfx/layers/d3d9/CanvasLayerD3D9.h +++ b/gfx/layers/d3d9/CanvasLayerD3D9.h @@ -39,13 +39,15 @@ #ifndef GFX_CANVASLAYERD3D9_H #define GFX_CANVASLAYERD3D9_H -#include "LayerManagerD3D9.h" -#include "GLContext.h" -#include "gfxASurface.h" +#include "LayerManagerD3D9.h" +#include "GLContext.h" +#include "gfxASurface.h" namespace mozilla { namespace layers { +class ShadowBufferD3D9; + class THEBES_API CanvasLayerD3D9 : public CanvasLayer, public LayerD3D9 @@ -91,6 +93,42 @@ protected: PRPackedBool mHasAlpha; }; +// NB: eventually we'll have separate shadow canvas2d and shadow +// canvas3d layers, but currently they look the same from the +// perspective of the compositor process +class ShadowCanvasLayerD3D9 : public ShadowCanvasLayer, + public LayerD3D9 +{ +public: + ShadowCanvasLayerD3D9(LayerManagerD3D9* aManager); + virtual ~ShadowCanvasLayerD3D9(); + + // CanvasLayer impl + virtual void Initialize(const Data& aData); + virtual void Init(const SurfaceDescriptor& aNewFront, const nsIntSize& aSize, bool needYFlip); + + // This isn't meaningful for shadow canvas. + virtual void Updated(const nsIntRect&) {} + + // ShadowCanvasLayer impl + virtual void Swap(const SurfaceDescriptor& aNewFront, + SurfaceDescriptor* aNewBack); + virtual void DestroyFrontBuffer(); + virtual void Disconnect(); + + virtual void Destroy(); + + // LayerD3D9 implementation + virtual Layer* GetLayer(); + virtual void RenderLayer(); + virtual void CleanResources(); + virtual void LayerManagerDestroyed(); + +private: + PRPackedBool mNeedsYFlip; + nsRefPtr mBuffer; +}; + } /* layers */ } /* mozilla */ #endif /* GFX_CANVASLAYERD3D9_H */ diff --git a/gfx/layers/d3d9/ColorLayerD3D9.cpp b/gfx/layers/d3d9/ColorLayerD3D9.cpp index fa1d3ba4f758..ab69873a8c52 100644 --- a/gfx/layers/d3d9/ColorLayerD3D9.cpp +++ b/gfx/layers/d3d9/ColorLayerD3D9.cpp @@ -47,15 +47,15 @@ ColorLayerD3D9::GetLayer() return this; } -void -ColorLayerD3D9::RenderLayer() +static void +RenderColorLayerD3D9(ColorLayer* aLayer, LayerManagerD3D9 *aManager) { // XXX we might be able to improve performance by using // IDirect3DDevice9::Clear - nsIntRect visibleRect = mVisibleRegion.GetBounds(); + nsIntRect visibleRect = aLayer->GetEffectiveVisibleRegion().GetBounds(); - device()->SetVertexShaderConstantF( + aManager->device()->SetVertexShaderConstantF( CBvLayerQuad, ShaderConstantRect(visibleRect.x, visibleRect.y, @@ -63,23 +63,36 @@ ColorLayerD3D9::RenderLayer() visibleRect.height), 1); - const gfx3DMatrix& transform = GetEffectiveTransform(); - device()->SetVertexShaderConstantF(CBmLayerTransform, &transform._11, 4); + const gfx3DMatrix& transform = aLayer->GetEffectiveTransform(); + aManager->device()->SetVertexShaderConstantF(CBmLayerTransform, &transform._11, 4); + gfxRGBA layerColor(aLayer->GetColor()); float color[4]; - float opacity = GetEffectiveOpacity() * mColor.a; + float opacity = aLayer->GetEffectiveOpacity() * layerColor.a; // output color is premultiplied, so we need to adjust all channels. // mColor is not premultiplied. - color[0] = (float)(mColor.r * opacity); - color[1] = (float)(mColor.g * opacity); - color[2] = (float)(mColor.b * opacity); + color[0] = (float)(layerColor.r * opacity); + color[1] = (float)(layerColor.g * opacity); + color[2] = (float)(layerColor.b * opacity); color[3] = (float)(opacity); - device()->SetPixelShaderConstantF(0, color, 1); + aManager->device()->SetPixelShaderConstantF(0, color, 1); - mD3DManager->SetShaderMode(DeviceManagerD3D9::SOLIDCOLORLAYER); + aManager->SetShaderMode(DeviceManagerD3D9::SOLIDCOLORLAYER); - device()->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2); + aManager->device()->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2); +} + +void +ColorLayerD3D9::RenderLayer() +{ + return RenderColorLayerD3D9(this, mD3DManager); +} + +void +ShadowColorLayerD3D9::RenderLayer() +{ + return RenderColorLayerD3D9(this, mD3DManager); } } /* layers */ diff --git a/gfx/layers/d3d9/ColorLayerD3D9.h b/gfx/layers/d3d9/ColorLayerD3D9.h index 6756ec95f9df..db826c210942 100644 --- a/gfx/layers/d3d9/ColorLayerD3D9.h +++ b/gfx/layers/d3d9/ColorLayerD3D9.h @@ -61,6 +61,26 @@ public: virtual void RenderLayer(); }; +class ShadowColorLayerD3D9 : public ShadowColorLayer, + public LayerD3D9 +{ +public: + ShadowColorLayerD3D9(LayerManagerD3D9 *aManager) + : ShadowColorLayer(aManager, NULL) + , LayerD3D9(aManager) + { + mImplData = static_cast(this); + } + ~ShadowColorLayerD3D9() { Destroy(); } + + // LayerOGL Implementation + virtual Layer* GetLayer() { return this; } + + virtual void Destroy() { } + + virtual void RenderLayer(); +}; + } /* layers */ } /* mozilla */ diff --git a/gfx/layers/d3d9/ContainerLayerD3D9.cpp b/gfx/layers/d3d9/ContainerLayerD3D9.cpp index cc8fe252231d..16f58a0ac5b2 100644 --- a/gfx/layers/d3d9/ContainerLayerD3D9.cpp +++ b/gfx/layers/d3d9/ContainerLayerD3D9.cpp @@ -44,39 +44,26 @@ namespace mozilla { namespace layers { -ContainerLayerD3D9::ContainerLayerD3D9(LayerManagerD3D9 *aManager) - : ContainerLayer(aManager, NULL) - , LayerD3D9(aManager) +template +static void +ContainerInsertAfter(Container* aContainer, Layer* aChild, Layer* aAfter) { - mImplData = static_cast(this); -} - -ContainerLayerD3D9::~ContainerLayerD3D9() -{ - while (mFirstChild) { - RemoveChild(mFirstChild); - } -} - -void -ContainerLayerD3D9::InsertAfter(Layer* aChild, Layer* aAfter) -{ - aChild->SetParent(this); + aChild->SetParent(aContainer); if (!aAfter) { - Layer *oldFirstChild = GetFirstChild(); - mFirstChild = aChild; + Layer *oldFirstChild = aContainer->GetFirstChild(); + aContainer->mFirstChild = aChild; aChild->SetNextSibling(oldFirstChild); aChild->SetPrevSibling(nsnull); if (oldFirstChild) { oldFirstChild->SetPrevSibling(aChild); } else { - mLastChild = aChild; + aContainer->mLastChild = aChild; } NS_ADDREF(aChild); - DidInsertChild(aChild); + aContainer->DidInsertChild(aChild); return; } - for (Layer *child = GetFirstChild(); + for (Layer *child = aContainer->GetFirstChild(); child; child = child->GetNextSibling()) { if (aAfter == child) { Layer *oldNextSibling = child->GetNextSibling(); @@ -85,36 +72,37 @@ ContainerLayerD3D9::InsertAfter(Layer* aChild, Layer* aAfter) if (oldNextSibling) { oldNextSibling->SetPrevSibling(aChild); } else { - mLastChild = aChild; + aContainer->mLastChild = aChild; } aChild->SetPrevSibling(child); NS_ADDREF(aChild); - DidInsertChild(aChild); + aContainer->DidInsertChild(aChild); return; } } NS_WARNING("Failed to find aAfter layer!"); } -void -ContainerLayerD3D9::RemoveChild(Layer *aChild) +template +static void +ContainerRemoveChild(Container* aContainer, Layer* aChild) { - if (GetFirstChild() == aChild) { - mFirstChild = GetFirstChild()->GetNextSibling(); - if (mFirstChild) { - mFirstChild->SetPrevSibling(nsnull); + if (aContainer->GetFirstChild() == aChild) { + aContainer->mFirstChild = aContainer->GetFirstChild()->GetNextSibling(); + if (aContainer->mFirstChild) { + aContainer->mFirstChild->SetPrevSibling(nsnull); } else { - mLastChild = nsnull; + aContainer->mLastChild = nsnull; } aChild->SetNextSibling(nsnull); aChild->SetPrevSibling(nsnull); aChild->SetParent(nsnull); - DidRemoveChild(aChild); + aContainer->DidRemoveChild(aChild); NS_RELEASE(aChild); return; } Layer *lastChild = nsnull; - for (Layer *child = GetFirstChild(); child; + for (Layer *child = aContainer->GetFirstChild(); child; child = child->GetNextSibling()) { if (child == aChild) { // We're sure this is not our first child. So lastChild != NULL. @@ -122,12 +110,12 @@ ContainerLayerD3D9::RemoveChild(Layer *aChild) if (child->GetNextSibling()) { child->GetNextSibling()->SetPrevSibling(lastChild); } else { - mLastChild = lastChild; + aContainer->mLastChild = lastChild; } child->SetNextSibling(nsnull); child->SetPrevSibling(nsnull); child->SetParent(nsnull); - DidRemoveChild(aChild); + aContainer->DidRemoveChild(aChild); NS_RELEASE(aChild); return; } @@ -135,27 +123,12 @@ ContainerLayerD3D9::RemoveChild(Layer *aChild) } } -Layer* -ContainerLayerD3D9::GetLayer() -{ - return this; -} - -LayerD3D9* -ContainerLayerD3D9::GetFirstChildD3D9() -{ - if (!mFirstChild) { - return nsnull; - } - return static_cast(mFirstChild->ImplData()); -} - static inline LayerD3D9* -GetNextSiblingD3D9(LayerD3D9* aLayer) +GetNextSibling(LayerD3D9* aLayer) { Layer* layer = aLayer->GetLayer()->GetNextSibling(); return layer ? static_cast(layer-> - ImplData()) + ImplData()) : nsnull; } @@ -169,8 +142,19 @@ HasOpaqueAncestorLayer(Layer* aLayer) return PR_FALSE; } -void -ContainerLayerD3D9::RenderLayer() +static inline LayerD3D9* +GetNextSiblingD3D9(LayerD3D9* aLayer) +{ + Layer* layer = aLayer->GetLayer()->GetNextSibling(); + return layer ? static_cast(layer-> + ImplData()) + : nsnull; +} + +template +static void +ContainerRender(Container* aContainer, + LayerManagerD3D9* aManager) { nsRefPtr previousRenderTarget; nsRefPtr renderTexture; @@ -179,7 +163,7 @@ ContainerLayerD3D9::RenderLayer() float oldViewMatrix[4][4]; RECT containerD3D9ClipRect; - device()->GetScissorRect(&containerD3D9ClipRect); + aManager->device()->GetScissorRect(&containerD3D9ClipRect); // Convert scissor to an nsIntRect. RECT's are exclusive on the bottom and // right values. nsIntRect oldScissor(containerD3D9ClipRect.left, @@ -188,34 +172,35 @@ ContainerLayerD3D9::RenderLayer() containerD3D9ClipRect.bottom - containerD3D9ClipRect.top); ReadbackProcessor readback; - readback.BuildUpdates(this); + readback.BuildUpdates(aContainer); - nsIntRect visibleRect = mVisibleRegion.GetBounds(); - PRBool useIntermediate = UseIntermediateSurface(); + nsIntRect visibleRect = aContainer->GetEffectiveVisibleRegion().GetBounds(); + PRBool useIntermediate = aContainer->UseIntermediateSurface(); - mSupportsComponentAlphaChildren = PR_FALSE; + aContainer->mSupportsComponentAlphaChildren = PR_FALSE; if (useIntermediate) { - device()->GetRenderTarget(0, getter_AddRefs(previousRenderTarget)); - device()->CreateTexture(visibleRect.width, visibleRect.height, 1, + aManager->device()->GetRenderTarget(0, getter_AddRefs(previousRenderTarget)); + aManager->device()->CreateTexture(visibleRect.width, visibleRect.height, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, getter_AddRefs(renderTexture), NULL); nsRefPtr renderSurface; renderTexture->GetSurfaceLevel(0, getter_AddRefs(renderSurface)); - device()->SetRenderTarget(0, renderSurface); + aManager->device()->SetRenderTarget(0, renderSurface); - if (mVisibleRegion.GetNumRects() == 1 && (GetContentFlags() & CONTENT_OPAQUE)) { + if (aContainer->mVisibleRegion.GetNumRects() == 1 && + (aContainer->GetContentFlags() & aContainer->CONTENT_OPAQUE)) { // don't need a background, we're going to paint all opaque stuff - mSupportsComponentAlphaChildren = PR_TRUE; + aContainer->mSupportsComponentAlphaChildren = PR_TRUE; } else { - const gfx3DMatrix& transform3D = GetEffectiveTransform(); + 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. HRESULT hr = E_FAIL; - if (HasOpaqueAncestorLayer(this) && + if (HasOpaqueAncestorLayer(aContainer) && transform3D.Is2D(&transform) && !transform.HasNonIntegerTranslation()) { // Copy background up from below RECT dest = { 0, 0, visibleRect.width, visibleRect.height }; @@ -223,20 +208,23 @@ ContainerLayerD3D9::RenderLayer() ::OffsetRect(&src, visibleRect.x + PRInt32(transform.x0), visibleRect.y + PRInt32(transform.y0)); - hr = device()-> + hr = aManager->device()-> StretchRect(previousRenderTarget, &src, renderSurface, &dest, D3DTEXF_NONE); } if (hr == S_OK) { - mSupportsComponentAlphaChildren = PR_TRUE; + aContainer->mSupportsComponentAlphaChildren = PR_TRUE; } else { - device()->Clear(0, 0, D3DCLEAR_TARGET, D3DCOLOR_RGBA(0, 0, 0, 0), 0, 0); + aManager->device()-> + Clear(0, 0, D3DCLEAR_TARGET, D3DCOLOR_RGBA(0, 0, 0, 0), 0, 0); } } - device()->GetVertexShaderConstantF(CBvRenderTargetOffset, previousRenderTargetOffset, 1); + aManager->device()-> + GetVertexShaderConstantF(CBvRenderTargetOffset, previousRenderTargetOffset, 1); renderTargetOffset[0] = (float)visibleRect.x; renderTargetOffset[1] = (float)visibleRect.y; - device()->SetVertexShaderConstantF(CBvRenderTargetOffset, renderTargetOffset, 1); + aManager->device()-> + SetVertexShaderConstantF(CBvRenderTargetOffset, renderTargetOffset, 1); gfx3DMatrix viewMatrix; /* @@ -248,17 +236,21 @@ ContainerLayerD3D9::RenderLayer() viewMatrix._41 = -1.0f; viewMatrix._42 = 1.0f; - device()->GetVertexShaderConstantF(CBmProjection, &oldViewMatrix[0][0], 4); - device()->SetVertexShaderConstantF(CBmProjection, &viewMatrix._11, 4); + aManager->device()-> + GetVertexShaderConstantF(CBmProjection, &oldViewMatrix[0][0], 4); + aManager->device()-> + SetVertexShaderConstantF(CBmProjection, &viewMatrix._11, 4); } else { - mSupportsComponentAlphaChildren = (GetContentFlags() & CONTENT_OPAQUE) || - (mParent && mParent->SupportsComponentAlphaChildren()); + aContainer->mSupportsComponentAlphaChildren = + (aContainer->GetContentFlags() & aContainer->CONTENT_OPAQUE) || + (aContainer->mParent && + aContainer->mParent->SupportsComponentAlphaChildren()); } /* * Render this container's contents. */ - for (LayerD3D9* layerToRender = GetFirstChildD3D9(); + for (LayerD3D9* layerToRender = aContainer->GetFirstChildD3D9(); layerToRender != nsnull; layerToRender = GetNextSiblingD3D9(layerToRender)) { @@ -277,38 +269,86 @@ ContainerLayerD3D9::RenderLayer() d3drect.top = scissorRect.y; d3drect.right = scissorRect.x + scissorRect.width; d3drect.bottom = scissorRect.y + scissorRect.height; - device()->SetScissorRect(&d3drect); + aManager->device()->SetScissorRect(&d3drect); - if (layerToRender->GetLayer()->GetType() == TYPE_THEBES) { + if (layerToRender->GetLayer()->GetType() == aContainer->TYPE_THEBES) { static_cast(layerToRender)->RenderThebesLayer(&readback); } else { layerToRender->RenderLayer(); } } - device()->SetScissorRect(&containerD3D9ClipRect); + aManager->device()->SetScissorRect(&containerD3D9ClipRect); if (useIntermediate) { - device()->SetRenderTarget(0, previousRenderTarget); - device()->SetVertexShaderConstantF(CBvRenderTargetOffset, previousRenderTargetOffset, 1); - device()->SetVertexShaderConstantF(CBmProjection, &oldViewMatrix[0][0], 4); + aManager->device()->SetRenderTarget(0, previousRenderTarget); + aManager->device()->SetVertexShaderConstantF(CBvRenderTargetOffset, previousRenderTargetOffset, 1); + aManager->device()->SetVertexShaderConstantF(CBmProjection, &oldViewMatrix[0][0], 4); - device()->SetVertexShaderConstantF(CBvLayerQuad, + aManager->device()->SetVertexShaderConstantF(CBvLayerQuad, ShaderConstantRect(visibleRect.x, visibleRect.y, visibleRect.width, visibleRect.height), 1); - SetShaderTransformAndOpacity(); + aContainer->SetShaderTransformAndOpacity(); - mD3DManager->SetShaderMode(DeviceManagerD3D9::RGBALAYER); + aManager->SetShaderMode(DeviceManagerD3D9::RGBALAYER); - device()->SetTexture(0, renderTexture); - device()->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2); + aManager->device()->SetTexture(0, renderTexture); + aManager->device()->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2); } } + +ContainerLayerD3D9::ContainerLayerD3D9(LayerManagerD3D9 *aManager) + : ContainerLayer(aManager, NULL) + , LayerD3D9(aManager) +{ + mImplData = static_cast(this); +} + +ContainerLayerD3D9::~ContainerLayerD3D9() +{ + while (mFirstChild) { + RemoveChild(mFirstChild); + } +} + +void +ContainerLayerD3D9::InsertAfter(Layer* aChild, Layer* aAfter) +{ + ContainerInsertAfter(this, aChild, aAfter); +} + +void +ContainerLayerD3D9::RemoveChild(Layer *aChild) +{ + ContainerRemoveChild(this, aChild); +} + +Layer* +ContainerLayerD3D9::GetLayer() +{ + return this; +} + +LayerD3D9* +ContainerLayerD3D9::GetFirstChildD3D9() +{ + if (!mFirstChild) { + return nsnull; + } + return static_cast(mFirstChild->ImplData()); +} + +void +ContainerLayerD3D9::RenderLayer() +{ + ContainerRender(this, mD3DManager); +} + void ContainerLayerD3D9::LayerManagerDestroyed() { @@ -318,5 +358,52 @@ ContainerLayerD3D9::LayerManagerDestroyed() } } +ShadowContainerLayerD3D9::ShadowContainerLayerD3D9(LayerManagerD3D9 *aManager) + : ShadowContainerLayer(aManager, NULL) + , LayerD3D9(aManager) +{ + mImplData = static_cast(this); +} + +ShadowContainerLayerD3D9::~ShadowContainerLayerD3D9() +{ + Destroy(); +} + +void +ShadowContainerLayerD3D9::InsertAfter(Layer* aChild, Layer* aAfter) +{ + ContainerInsertAfter(this, aChild, aAfter); +} + +void +ShadowContainerLayerD3D9::RemoveChild(Layer *aChild) +{ + ContainerRemoveChild(this, aChild); +} + +void +ShadowContainerLayerD3D9::Destroy() +{ + while (mFirstChild) { + RemoveChild(mFirstChild); + } +} + +LayerD3D9* +ShadowContainerLayerD3D9::GetFirstChildD3D9() +{ + if (!mFirstChild) { + return nsnull; + } + return static_cast(mFirstChild->ImplData()); +} + +void +ShadowContainerLayerD3D9::RenderLayer() +{ + ContainerRender(this, mD3DManager); +} + } /* layers */ } /* mozilla */ diff --git a/gfx/layers/d3d9/ContainerLayerD3D9.h b/gfx/layers/d3d9/ContainerLayerD3D9.h index eb40740cf625..3f39608366d8 100644 --- a/gfx/layers/d3d9/ContainerLayerD3D9.h +++ b/gfx/layers/d3d9/ContainerLayerD3D9.h @@ -43,10 +43,24 @@ namespace mozilla { namespace layers { + +template +static void ContainerInsertAfter(Container* aContainer, Layer* aChild, Layer* aAfter); +template +static void ContainerRemoveChild(Container* aContainer, Layer* aChild); +template +static void ContainerRender(Container* aContainer, LayerManagerD3D9* aManager); class ContainerLayerD3D9 : public ContainerLayer, public LayerD3D9 { + template + friend void ContainerInsertAfter(Container* aContainer, Layer* aChild, Layer* aAfter); + template + friend void ContainerRemoveChild(Container* aContainer, Layer* aChild); + template + friend void ContainerRender(Container* aContainer, LayerManagerD3D9* aManager); + public: ContainerLayerD3D9(LayerManagerD3D9 *aManager); ~ContainerLayerD3D9(); @@ -75,6 +89,39 @@ public: } }; +class ShadowContainerLayerD3D9 : public ShadowContainerLayer, + public LayerD3D9 +{ + template + friend void ContainerInsertAfter(Container* aContainer, Layer* aChild, Layer* aAfter); + template + friend void ContainerRemoveChild(Container* aContainer, Layer* aChild); + template + friend void ContainerRender(Container* aContainer, LayerManagerD3D9* aManager); + +public: + ShadowContainerLayerD3D9(LayerManagerD3D9 *aManager); + ~ShadowContainerLayerD3D9(); + + void InsertAfter(Layer* aChild, Layer* aAfter); + + void RemoveChild(Layer* aChild); + + // LayerD3D9 Implementation + virtual Layer* GetLayer() { return this; } + + virtual void Destroy(); + + LayerD3D9* GetFirstChildD3D9(); + + virtual void RenderLayer(); + + virtual void ComputeEffectiveTransforms(const gfx3DMatrix& aTransformToSurface) + { + DefaultComputeEffectiveTransforms(aTransformToSurface); + } +}; + } /* layers */ } /* mozilla */ diff --git a/gfx/layers/d3d9/ImageLayerD3D9.cpp b/gfx/layers/d3d9/ImageLayerD3D9.cpp index 75ff6e378bdb..198bc1dbb2d4 100644 --- a/gfx/layers/d3d9/ImageLayerD3D9.cpp +++ b/gfx/layers/d3d9/ImageLayerD3D9.cpp @@ -35,7 +35,14 @@ * * ***** END LICENSE BLOCK ***** */ +#include "mozilla/layers/PLayers.h" +#include "mozilla/layers/ShadowLayers.h" +#include "ShadowBufferD3D9.h" +#include "gfxSharedImageSurface.h" + #include "ImageLayerD3D9.h" +#include "ThebesLayerD3D9.h" +#include "gfxPlatform.h" #include "gfxImageSurface.h" #include "yuv_convert.h" #include "nsIServiceManager.h" @@ -643,5 +650,147 @@ CairoImageD3D9::GetAsSurface() return surface.forget(); } +ShadowImageLayerD3D9::ShadowImageLayerD3D9(LayerManagerD3D9* aManager) + : ShadowImageLayer(aManager, nsnull) + , LayerD3D9(aManager) +{ + mImplData = static_cast(this); +} + +ShadowImageLayerD3D9::~ShadowImageLayerD3D9() +{} + +PRBool +ShadowImageLayerD3D9::Init(const SharedImage& aFront, + const nsIntSize& aSize) +{ + if (aFront.type() == SharedImage::TSurfaceDescriptor) { + SurfaceDescriptor desc = aFront.get_SurfaceDescriptor(); + nsRefPtr surf = + ShadowLayerForwarder::OpenDescriptor(desc); + + if (!mBuffer) { + mBuffer = new ShadowBufferD3D9(this); + } + return !!mBuffer; + } else { + if (!mYCbCrImage) { + mYCbCrImage = new PlanarYCbCrImageD3D9(); + } + return !!mYCbCrImage; + } +} + +void +ShadowImageLayerD3D9::Swap(const SharedImage& aNewFront, SharedImage* aNewBack) +{ + + if (aNewFront.type() == SharedImage::TSurfaceDescriptor) { + nsRefPtr surf = + ShadowLayerForwarder::OpenDescriptor(aNewFront.get_SurfaceDescriptor()); + + if (mBuffer) { + mBuffer->Upload(surf, GetVisibleRegion().GetBounds()); + } + } else { + + const YUVImage& yuv = aNewFront.get_YUVImage(); + + nsRefPtr surfY = + gfxSharedImageSurface::Open(yuv.Ydata()); + nsRefPtr surfU = + gfxSharedImageSurface::Open(yuv.Udata()); + nsRefPtr surfV = + gfxSharedImageSurface::Open(yuv.Vdata()); + + PlanarYCbCrImage::Data data; + data.mYChannel = surfY->Data(); + data.mYStride = surfY->Stride(); + data.mYSize = surfY->GetSize(); + data.mCbChannel = surfU->Data(); + data.mCrChannel = surfV->Data(); + data.mCbCrStride = surfU->Stride(); + data.mCbCrSize = surfU->GetSize(); + data.mPicSize = surfY->GetSize(); + data.mPicX = 0; + data.mPicY = 0; + + mYCbCrImage->SetData(data); + + } + + *aNewBack = aNewFront; +} + +void +ShadowImageLayerD3D9::DestroyFrontBuffer() +{ + Destroy(); +} + +void +ShadowImageLayerD3D9::Disconnect() +{ + Destroy(); +} + +void +ShadowImageLayerD3D9::Destroy() +{ + mBuffer = nsnull; + mYCbCrImage = nsnull; +} + +Layer* +ShadowImageLayerD3D9::GetLayer() +{ + return this; +} + +void +ShadowImageLayerD3D9::RenderLayer() +{ + if (mBuffer) { + mBuffer->RenderTo(mD3DManager, GetEffectiveVisibleRegion()); + } else if (mYCbCrImage) { + if (!mYCbCrImage->HasData()) { + return; + } + + mYCbCrImage->AllocateTextures(device()); + + SetShaderTransformAndOpacity(); + + device()->SetVertexShaderConstantF(CBvLayerQuad, + ShaderConstantRect(0, + 0, + mYCbCrImage->mSize.width, + mYCbCrImage->mSize.height), + 1); + + mD3DManager->SetShaderMode(DeviceManagerD3D9::YCBCRLAYER); + + /* + * Send 3d control data and metadata + */ + if (mD3DManager->GetNv3DVUtils()) { + // TODO Add 3D support + } + + // Linear scaling is default here, adhering to mFilter is difficult since + // presumably even with point filtering we'll still want chroma upsampling + // to be linear. In the current approach we can't. + device()->SetTexture(0, mYCbCrImage->mYTexture); + device()->SetTexture(1, mYCbCrImage->mCbTexture); + device()->SetTexture(2, mYCbCrImage->mCrTexture); + + device()->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2); + } else { + NS_ERROR("Unexpected image format."); + } + +} + + } /* layers */ } /* mozilla */ diff --git a/gfx/layers/d3d9/ImageLayerD3D9.h b/gfx/layers/d3d9/ImageLayerD3D9.h index 4c067ffded6d..fe52bdf5a2da 100644 --- a/gfx/layers/d3d9/ImageLayerD3D9.h +++ b/gfx/layers/d3d9/ImageLayerD3D9.h @@ -45,6 +45,8 @@ namespace mozilla { namespace layers { +class ShadowBufferD3D9; + class THEBES_API ImageContainerD3D9 : public ImageContainer { public: @@ -173,6 +175,34 @@ private: LayerManagerD3D9 *mManager; }; +class ShadowImageLayerD3D9 : public ShadowImageLayer, + public LayerD3D9 +{ +public: + ShadowImageLayerD3D9(LayerManagerD3D9* aManager); + virtual ~ShadowImageLayerD3D9(); + + // ShadowImageLayer impl + virtual PRBool Init(const SharedImage& aFront, const nsIntSize& aSize); + + virtual void Swap(const SharedImage& aFront, SharedImage* aNewBack); + + virtual void DestroyFrontBuffer(); + + virtual void Disconnect(); + + // LayerD3D9 impl + virtual void Destroy(); + + virtual Layer* GetLayer(); + + virtual void RenderLayer(); + +private: + nsRefPtr mBuffer; + nsRefPtr mYCbCrImage; +}; + } /* layers */ } /* mozilla */ #endif /* GFX_IMAGELAYERD3D9_H */ diff --git a/gfx/layers/d3d9/LayerManagerD3D9.cpp b/gfx/layers/d3d9/LayerManagerD3D9.cpp index bf645dff6ee3..0abf629e2289 100644 --- a/gfx/layers/d3d9/LayerManagerD3D9.cpp +++ b/gfx/layers/d3d9/LayerManagerD3D9.cpp @@ -245,6 +245,56 @@ LayerManagerD3D9::CreateImageContainer() return container.forget(); } +already_AddRefed +LayerManagerD3D9::CreateShadowThebesLayer() +{ + if (LayerManagerD3D9::mDestroyed) { + NS_WARNING("Call on destroyed layer manager"); + return nsnull; + } + return nsRefPtr(new ShadowThebesLayerD3D9(this)).forget(); +} + +already_AddRefed +LayerManagerD3D9::CreateShadowContainerLayer() +{ + if (LayerManagerD3D9::mDestroyed) { + NS_WARNING("Call on destroyed layer manager"); + return nsnull; + } + return nsRefPtr(new ShadowContainerLayerD3D9(this)).forget(); +} + +already_AddRefed +LayerManagerD3D9::CreateShadowImageLayer() +{ + if (LayerManagerD3D9::mDestroyed) { + NS_WARNING("Call on destroyed layer manager"); + return nsnull; + } + return nsRefPtr(new ShadowImageLayerD3D9(this)).forget(); +} + +already_AddRefed +LayerManagerD3D9::CreateShadowColorLayer() +{ + if (LayerManagerD3D9::mDestroyed) { + NS_WARNING("Call on destroyed layer manager"); + return nsnull; + } + return nsRefPtr(new ShadowColorLayerD3D9(this)).forget(); +} + +already_AddRefed +LayerManagerD3D9::CreateShadowCanvasLayer() +{ + if (LayerManagerD3D9::mDestroyed) { + NS_WARNING("Call on destroyed layer manager"); + return nsnull; + } + return nsRefPtr(new ShadowCanvasLayerD3D9(this)).forget(); +} + void ReleaseTexture(void *texture) { static_cast(texture)->Release(); diff --git a/gfx/layers/d3d9/LayerManagerD3D9.h b/gfx/layers/d3d9/LayerManagerD3D9.h index 7db39487518f..38dfb7eb11c4 100644 --- a/gfx/layers/d3d9/LayerManagerD3D9.h +++ b/gfx/layers/d3d9/LayerManagerD3D9.h @@ -40,6 +40,8 @@ #include "Layers.h" +#include "mozilla/layers/ShadowLayers.h" + #include #include @@ -88,7 +90,7 @@ struct ShaderConstantRect * This is the LayerManager used for Direct3D 9. For now this will render on * the main thread. */ -class THEBES_API LayerManagerD3D9 : public LayerManager { +class THEBES_API LayerManagerD3D9 : public ShadowLayerManager { public: LayerManagerD3D9(nsIWidget *aWidget); virtual ~LayerManagerD3D9(); @@ -153,6 +155,12 @@ public: virtual already_AddRefed CreateImageContainer(); + virtual already_AddRefed CreateShadowThebesLayer(); + virtual already_AddRefed CreateShadowContainerLayer(); + virtual already_AddRefed CreateShadowImageLayer(); + virtual already_AddRefed CreateShadowColorLayer(); + virtual already_AddRefed CreateShadowCanvasLayer(); + virtual LayersBackend GetBackendType() { return LAYERS_D3D9; } virtual void GetBackendName(nsAString& name) { name.AssignLiteral("Direct3D 9"); } bool DeviceWasRemoved() { return deviceManager()->DeviceWasRemoved(); } @@ -283,6 +291,40 @@ protected: LayerManagerD3D9 *mD3DManager; }; +/* + * RAII helper for locking D3D9 textures. + */ +class LockTextureRectD3D9 +{ +public: + LockTextureRectD3D9(IDirect3DTexture9* aTexture) + : mTexture(aTexture) + { + mLockResult = mTexture->LockRect(0, &mR, NULL, 0); + } + + ~LockTextureRectD3D9() + { + mTexture->UnlockRect(0); + } + + bool HasLock() { + return SUCCEEDED(mLockResult); + } + + D3DLOCKED_RECT GetLockRect() + { + return mR; + } +private: + LockTextureRectD3D9 (const LockTextureRectD3D9&); + LockTextureRectD3D9& operator= (const LockTextureRectD3D9&); + + IDirect3DTexture9* mTexture; + D3DLOCKED_RECT mR; + HRESULT mLockResult; +}; + } /* layers */ } /* mozilla */ diff --git a/gfx/layers/d3d9/ShadowBufferD3D9.cpp b/gfx/layers/d3d9/ShadowBufferD3D9.cpp new file mode 100644 index 000000000000..a9109db2f135 --- /dev/null +++ b/gfx/layers/d3d9/ShadowBufferD3D9.cpp @@ -0,0 +1,118 @@ +/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is Mozilla Corporation code. + * + * The Initial Developer of the Original Code is Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2011 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Benoit Girard + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include "LayerManagerD3D9.h" +#include "ShadowBufferD3D9.h" + +#include "gfxWindowsSurface.h" +#include "gfxWindowsPlatform.h" + + +namespace mozilla { +namespace layers { + +void +ShadowBufferD3D9::Upload(gfxASurface* aUpdate, + const nsIntRect& aVisibleRect) +{ + + gfxIntSize size = aUpdate->GetSize(); + + if (GetSize() != nsIntSize(size.width, size.height)) { + mLayer->device()->CreateTexture(size.width, size.height, 1, + D3DUSAGE_DYNAMIC, + D3DFMT_A8R8G8B8, + D3DPOOL_DEFAULT, getter_AddRefs(mTexture), NULL); + + mTextureRect = aVisibleRect; + } + + LockTextureRectD3D9 textureLock(mTexture); + if (!textureLock.HasLock()) { + NS_WARNING("Failed to lock ShadowBufferD3D9 texture."); + return; + } + + D3DLOCKED_RECT r = textureLock.GetLockRect(); + + nsRefPtr imgSurface = + new gfxImageSurface((unsigned char *)r.pBits, + GetSize(), + r.Pitch, + gfxASurface::ImageFormatARGB32); + + nsRefPtr context = new gfxContext(imgSurface); + context->SetSource(aUpdate); + context->SetOperator(gfxContext::OPERATOR_SOURCE); + context->Paint(); + + imgSurface = NULL; +} + +void +ShadowBufferD3D9::RenderTo(LayerManagerD3D9 *aD3DManager, + const nsIntRegion& aVisibleRegion) +{ + mLayer->SetShaderTransformAndOpacity(); + + aD3DManager->SetShaderMode(DeviceManagerD3D9::RGBALAYER); + mLayer->device()->SetTexture(0, mTexture); + + nsIntRegionRectIterator iter(aVisibleRegion); + + const nsIntRect *iterRect; + while ((iterRect = iter.Next())) { + mLayer->device()->SetVertexShaderConstantF(CBvLayerQuad, + ShaderConstantRect(iterRect->x, + iterRect->y, + iterRect->width, + iterRect->height), + 1); + + mLayer->device()->SetVertexShaderConstantF(CBvTextureCoords, + ShaderConstantRect( + (float)(iterRect->x - mTextureRect.x) / (float)mTextureRect.width, + (float)(iterRect->y - mTextureRect.y) / (float)mTextureRect.height, + (float)iterRect->width / (float)mTextureRect.width, + (float)iterRect->height / (float)mTextureRect.height), 1); + + mLayer->device()->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2); + } +} + +} /* namespace layers */ +} /* namespace mozilla */ diff --git a/gfx/layers/d3d9/ShadowBufferD3D9.h b/gfx/layers/d3d9/ShadowBufferD3D9.h new file mode 100644 index 000000000000..4f23d838e14a --- /dev/null +++ b/gfx/layers/d3d9/ShadowBufferD3D9.h @@ -0,0 +1,77 @@ +/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is Mozilla Corporation code. + * + * The Initial Developer of the Original Code is Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2011 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Benoit Girard + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#ifndef GFX_SHADOWBUFFERD3D9_H +#define GFX_SHADOWBUFFERD3D9_H + +#include "LayerManagerD3D9.h" + +namespace mozilla { +namespace layers { + +class LayerManagerD3D9; +class LayerD3D9; + +class ShadowBufferD3D9 +{ + NS_INLINE_DECL_REFCOUNTING(ShadowBufferD3D9) +public: + + ShadowBufferD3D9(LayerD3D9* aLayer) + : mLayer(aLayer) + { + } + virtual ~ShadowBufferD3D9() {} + + void Upload(gfxASurface* aUpdate, const nsIntRect& aVisibleRect); + + void RenderTo(LayerManagerD3D9 *aD3DManager, const nsIntRegion& aVisibleRegion); + + nsIntSize GetSize() { + if (mTexture) + return nsIntSize(mTextureRect.Width(), mTextureRect.Height()); + return nsIntSize(0, 0); + } +protected: + nsRefPtr mTexture; + nsIntRect mTextureRect; + LayerD3D9* mLayer; +}; + +} /* layers */ +} /* mozilla */ +#endif /* GFX_SHADOWBUFFERD3D9_H */ diff --git a/gfx/layers/d3d9/ThebesLayerD3D9.cpp b/gfx/layers/d3d9/ThebesLayerD3D9.cpp index 3dc2e3101299..b34ecfc416b4 100644 --- a/gfx/layers/d3d9/ThebesLayerD3D9.cpp +++ b/gfx/layers/d3d9/ThebesLayerD3D9.cpp @@ -35,6 +35,10 @@ * * ***** END LICENSE BLOCK ***** */ +#include "mozilla/layers/PLayers.h" +#include "mozilla/layers/ShadowLayers.h" +#include "ShadowBufferD3D9.h" + #include "ThebesLayerD3D9.h" #include "gfxPlatform.h" @@ -516,8 +520,13 @@ ThebesLayerD3D9::DrawRegion(nsIntRegion &aRegion, SurfaceMode aMode, break; case SURFACE_SINGLE_CHANNEL_ALPHA: { - D3DLOCKED_RECT r; - tmpTexture->LockRect(0, &r, NULL, 0); + LockTextureRectD3D9 textureLock(tmpTexture); + if (!textureLock.HasLock()) { + NS_WARNING("Failed to lock ThebesLayer tmpTexture texture."); + return; + } + + D3DLOCKED_RECT r = textureLock.GetLockRect(); nsRefPtr imgSurface = new gfxImageSurface((unsigned char *)r.pBits, @@ -534,8 +543,6 @@ ThebesLayerD3D9::DrawRegion(nsIntRegion &aRegion, SurfaceMode aMode, imgSurface = NULL; - tmpTexture->UnlockRect(0); - srcTextures.AppendElement(tmpTexture); destTextures.AppendElement(mTexture); break; @@ -601,5 +608,95 @@ ThebesLayerD3D9::CreateNewTextures(const gfxIntSize &aSize, } } +ShadowThebesLayerD3D9::ShadowThebesLayerD3D9(LayerManagerD3D9 *aManager) + : ShadowThebesLayer(aManager, nsnull) + , LayerD3D9(aManager) +{ + mImplData = static_cast(this); +} + +ShadowThebesLayerD3D9::~ShadowThebesLayerD3D9() +{} + +void +ShadowThebesLayerD3D9::SetFrontBuffer(const OptionalThebesBuffer& aNewFront, + const nsIntRegion& aValidRegion) +{ + if (!mBuffer) { + mBuffer = new ShadowBufferD3D9(this); + } + + NS_ASSERTION(OptionalThebesBuffer::Tnull_t == aNewFront.type(), + "Only one system-memory buffer expected"); +} + +void +ShadowThebesLayerD3D9::Swap(const ThebesBuffer& aNewFront, + const nsIntRegion& aUpdatedRegion, + ThebesBuffer* aNewBack, + nsIntRegion* aNewBackValidRegion, + OptionalThebesBuffer* aReadOnlyFront, + nsIntRegion* aFrontUpdatedRegion) +{ + if (mBuffer) { + nsRefPtr surf = ShadowLayerForwarder::OpenDescriptor(aNewFront.buffer()); + mBuffer->Upload(surf, GetVisibleRegion().GetBounds()); + } + + *aNewBack = aNewFront; + *aNewBackValidRegion = mValidRegion; + *aReadOnlyFront = null_t(); + aFrontUpdatedRegion->SetEmpty(); +} + +void +ShadowThebesLayerD3D9::DestroyFrontBuffer() +{ + mBuffer = nsnull; +} + +void +ShadowThebesLayerD3D9::Disconnect() +{ + mBuffer = nsnull; +} + +Layer* +ShadowThebesLayerD3D9::GetLayer() +{ + return this; +} + +PRBool +ShadowThebesLayerD3D9::IsEmpty() +{ + return !mBuffer; +} + +void +ShadowThebesLayerD3D9::RenderThebesLayer() +{ + if (!mBuffer) { + return; + } + NS_ABORT_IF_FALSE(mBuffer, "should have a buffer here"); + + mBuffer->RenderTo(mD3DManager, GetEffectiveVisibleRegion()); +} + +void +ShadowThebesLayerD3D9::CleanResources() +{ + mBuffer = nsnull; + mValidRegion.SetEmpty(); +} + +void +ShadowThebesLayerD3D9::LayerManagerDestroyed() +{ + mD3DManager->deviceManager()->mLayersWithResources.RemoveElement(this); + mD3DManager = nsnull; +} + } /* namespace layers */ } /* namespace mozilla */ diff --git a/gfx/layers/d3d9/ThebesLayerD3D9.h b/gfx/layers/d3d9/ThebesLayerD3D9.h index 9bbf1257f2c3..f75eb5f104e7 100644 --- a/gfx/layers/d3d9/ThebesLayerD3D9.h +++ b/gfx/layers/d3d9/ThebesLayerD3D9.h @@ -47,6 +47,7 @@ namespace mozilla { namespace layers { class ReadbackProcessor; +class ShadowBufferD3D9; class ThebesLayerD3D9 : public ThebesLayer, public LayerD3D9 @@ -112,6 +113,37 @@ private: const nsIntRegion &aCopyRegion, nsIntRegion* aValidRegion); }; +class ShadowThebesLayerD3D9 : public ShadowThebesLayer, + public LayerD3D9 +{ +public: + ShadowThebesLayerD3D9(LayerManagerD3D9 *aManager); + virtual ~ShadowThebesLayerD3D9(); + + // ShadowThebesLayer impl + virtual void SetFrontBuffer(const OptionalThebesBuffer& aNewFront, + const nsIntRegion& aValidRegion); + virtual void + Swap(const ThebesBuffer& aNewFront, const nsIntRegion& aUpdatedRegion, + ThebesBuffer* aNewBack, nsIntRegion* aNewBackValidRegion, + OptionalThebesBuffer* aReadOnlyFront, nsIntRegion* aFrontUpdatedRegion); + virtual void DestroyFrontBuffer(); + + virtual void Disconnect(); + + // LayerD3D9 impl + Layer* GetLayer(); + virtual PRBool IsEmpty(); + virtual void RenderLayer() { RenderThebesLayer(); } + virtual void CleanResources(); + virtual void LayerManagerDestroyed(); + + void RenderThebesLayer(); + +private: + nsRefPtr mBuffer; +}; + } /* layers */ } /* mozilla */ #endif /* GFX_THEBESLAYERD3D9_H */ diff --git a/gfx/layers/opengl/CanvasLayerOGL.cpp b/gfx/layers/opengl/CanvasLayerOGL.cpp index 8d1dea3ea434..abb332a9d878 100644 --- a/gfx/layers/opengl/CanvasLayerOGL.cpp +++ b/gfx/layers/opengl/CanvasLayerOGL.cpp @@ -35,6 +35,9 @@ * * ***** END LICENSE BLOCK ***** */ +#include "mozilla/layers/PLayers.h" +#include "mozilla/layers/ShadowLayers.h" + #include "gfxSharedImageSurface.h" #include "CanvasLayerOGL.h" diff --git a/gfx/layers/opengl/CanvasLayerOGL.h b/gfx/layers/opengl/CanvasLayerOGL.h index 2ac38f623122..7ec2a8ddce4c 100644 --- a/gfx/layers/opengl/CanvasLayerOGL.h +++ b/gfx/layers/opengl/CanvasLayerOGL.h @@ -38,8 +38,6 @@ #ifndef GFX_CANVASLAYEROGL_H #define GFX_CANVASLAYEROGL_H -#include "mozilla/layers/PLayers.h" -#include "mozilla/layers/ShadowLayers.h" #include "LayerManagerOGL.h" #include "gfxASurface.h" diff --git a/layout/ipc/RenderFrameParent.cpp b/layout/ipc/RenderFrameParent.cpp index e106f9ef1d46..6d7f36cbce74 100644 --- a/layout/ipc/RenderFrameParent.cpp +++ b/layout/ipc/RenderFrameParent.cpp @@ -42,6 +42,9 @@ #include "BasicLayers.h" #include "LayerManagerOGL.h" +#ifdef MOZ_ENABLE_D3D9_LAYER +#include "LayerManagerD3D9.h" +#endif //MOZ_ENABLE_D3D9_LAYER #include "RenderFrameParent.h" #include "gfx3DMatrix.h" @@ -723,6 +726,12 @@ RenderFrameParent::AllocPLayers() LayerManagerOGL* lmo = static_cast(lm); return new ShadowLayersParent(lmo); } +#ifdef MOZ_ENABLE_D3D9_LAYER + case LayerManager::LAYERS_D3D9: { + LayerManagerD3D9* lmd3d9 = static_cast(lm); + return new ShadowLayersParent(lmd3d9); + } +#endif //MOZ_ENABLE_D3D9_LAYER default: { NS_WARNING("shadow layers no sprechen D3D backend yet"); return nsnull; From ba6b25030cd580cd5418bc1a9ca96c15dcbb3113 Mon Sep 17 00:00:00 2001 From: Stephen Horlander Date: Mon, 4 Jul 2011 16:06:16 +0200 Subject: [PATCH 08/10] Bug 659266 - Need a minimalistic Sync glyph for notifications. r=dolske --HG-- rename : browser/themes/gnomestripe/browser/sync-24.png => browser/themes/gnomestripe/browser/sync-notification-24.png --- browser/themes/gnomestripe/browser/browser.css | 2 +- browser/themes/gnomestripe/browser/jar.mn | 2 +- .../{sync-24.png => sync-notification-24.png} | Bin browser/themes/pinstripe/browser/browser.css | 2 +- browser/themes/pinstripe/browser/jar.mn | 2 +- browser/themes/pinstripe/browser/sync-24.png | Bin 1565 -> 0 bytes .../pinstripe/browser/sync-notification-24.png | Bin 0 -> 1146 bytes browser/themes/winstripe/browser/browser.css | 2 +- browser/themes/winstripe/browser/jar.mn | 4 ++-- browser/themes/winstripe/browser/sync-24.png | Bin 1565 -> 0 bytes .../winstripe/browser/sync-notification-24.png | Bin 0 -> 1119 bytes 11 files changed, 7 insertions(+), 7 deletions(-) rename browser/themes/gnomestripe/browser/{sync-24.png => sync-notification-24.png} (100%) delete mode 100644 browser/themes/pinstripe/browser/sync-24.png create mode 100644 browser/themes/pinstripe/browser/sync-notification-24.png delete mode 100644 browser/themes/winstripe/browser/sync-24.png create mode 100644 browser/themes/winstripe/browser/sync-notification-24.png diff --git a/browser/themes/gnomestripe/browser/browser.css b/browser/themes/gnomestripe/browser/browser.css index 2dcc4ed7e897..1e3281848535 100644 --- a/browser/themes/gnomestripe/browser/browser.css +++ b/browser/themes/gnomestripe/browser/browser.css @@ -1422,7 +1422,7 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action- } .panel-promo-icon { - list-style-image: url("chrome://browser/skin/sync-24.png"); + list-style-image: url("chrome://browser/skin/sync-notification-24.png"); -moz-margin-end: 10px; vertical-align: middle; } diff --git a/browser/themes/gnomestripe/browser/jar.mn b/browser/themes/gnomestripe/browser/jar.mn index 35bcd078467b..d2e5fc706d8a 100644 --- a/browser/themes/gnomestripe/browser/jar.mn +++ b/browser/themes/gnomestripe/browser/jar.mn @@ -88,12 +88,12 @@ browser.jar: #ifdef MOZ_SERVICES_SYNC skin/classic/browser/sync-16-throbber.png skin/classic/browser/sync-16.png - skin/classic/browser/sync-24.png skin/classic/browser/sync-24-throbber.png skin/classic/browser/sync-32.png skin/classic/browser/sync-bg.png skin/classic/browser/sync-desktopIcon.png skin/classic/browser/sync-mobileIcon.png + skin/classic/browser/sync-notification-24.png skin/classic/browser/syncSetup.css skin/classic/browser/syncCommon.css skin/classic/browser/syncQuota.css diff --git a/browser/themes/gnomestripe/browser/sync-24.png b/browser/themes/gnomestripe/browser/sync-notification-24.png similarity index 100% rename from browser/themes/gnomestripe/browser/sync-24.png rename to browser/themes/gnomestripe/browser/sync-notification-24.png diff --git a/browser/themes/pinstripe/browser/browser.css b/browser/themes/pinstripe/browser/browser.css index eb4cce9cc054..04a7602a8139 100644 --- a/browser/themes/pinstripe/browser/browser.css +++ b/browser/themes/pinstripe/browser/browser.css @@ -1419,7 +1419,7 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action- } .panel-promo-icon { - list-style-image: url("chrome://browser/skin/sync-24.png"); + list-style-image: url("chrome://browser/skin/sync-notification-24.png"); -moz-margin-end: 10px; vertical-align: middle; } diff --git a/browser/themes/pinstripe/browser/jar.mn b/browser/themes/pinstripe/browser/jar.mn index 9be9c1b950f0..4c16d09c6edb 100644 --- a/browser/themes/pinstripe/browser/jar.mn +++ b/browser/themes/pinstripe/browser/jar.mn @@ -126,11 +126,11 @@ browser.jar: #ifdef MOZ_SERVICES_SYNC skin/classic/browser/sync-throbber.png skin/classic/browser/sync-16.png - skin/classic/browser/sync-24.png skin/classic/browser/sync-32.png skin/classic/browser/sync-bg.png skin/classic/browser/sync-desktopIcon.png skin/classic/browser/sync-mobileIcon.png + skin/classic/browser/sync-notification-24.png skin/classic/browser/syncSetup.css skin/classic/browser/syncCommon.css skin/classic/browser/syncQuota.css diff --git a/browser/themes/pinstripe/browser/sync-24.png b/browser/themes/pinstripe/browser/sync-24.png deleted file mode 100644 index d67eb47ac4a3563e87ef78f88d0dfdd63b007340..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1565 zcmV+&2IBdNP)tAaVb#iQmj-vtQCe<8xs_87?@#nqza;fii(Je3?nLw zD64=_zy)OnkaciDKtZ$$11dYnG9%)W+k1cJn~9qGl9LDjy}9Sz`_Db^>ohdo)&YPw z!0{1cGGaQy1ThQowFX}zW+1*mOhxD+bano3)F`gK2_6vVqyYbzI@4mFAyaOMB=aoKiI6m5at@PkKapBT3+#nVEy{_&bGF;uxoGR zn6jf2x_f$HU~mwg4iCfV*chnQYIy$qIqclCAJVgOptkP%L{*JKwj*p8Uz4H1I|LUm zmuQ#9*u}+VFeNp8r1jo?c-YnsM0C5k1r*nAKy_^$GY5z^!-=F6=Kr>KC3JOn!;Sj- zB2!aSTa01E#9~KY!Figfj-UB%;CWq-G`3U;@`-!a4&CTsMhJ+niIe9ecTUlBCRCwW1dr4_IlwGX^nlsMk zLT2_kA|N8>c}wd(Six}u&oygbuk-cm*tBKa9sFG%kqizEQN}H1W@ZZ*0pMUyZz_?- zXJ9r^bg`I0N?InI$v6w)dk;WjN-9H8QB?yE9=3s_v+E9jL7*&9yhY6yZUS#!00f2X zxQA=wlu3z9eu`qU3e%f8bLQf-%I4QPqt^HuI1{MchBUq{Ep(SZnE_%2>$=j2LAG_>)n$mqja zr&2SRvd~NfM`EQQkw^wKwfuBj=yng3XH<1fZQNT;X?{E*F`r~hza@3$7hY(rsZ~_r zngwn8MiQS;!Uj)1lg`v!dMy5xP$-FkTd>@~XTuF+dG7$kmDwUS%>+4U_`SAF}+uM5$mG0V&dZst9c}dQ#xHeD6 zz`$VM5lMVAG1E(?_duE8>4TV4e|YGHhldA}OsO&Nq6nJqG!t1JuFa(l--hhm-6t=v z7(ajMGUVnLGWz%9`-kZ2>Q2^mDReX5&$ zN~KbfL6T7-K~pjNlBaucJ*A?c;1@SsFlIKf#Nw+rzuj*m~$?Q8rjI1)kPX zlZjzNLj&CZ_W{*;98Iw!Au+j0JNO7%JJ|(6EEaoGmaGJ4IJvkLtX<~=8~g)R3S=Nv zP&O#P{ukhwQ{+fEE=#|nL79M_QLSU2zzp-{&<(5`!-i&Of!njHjKWpv9Z1D zDsCT|7;yjm3(&+m&@Hc5R@dGqlOqcu2PL1vjs`3zV;h~19@Cw{*n0EbR#MQYkB^Td zYZKa6a{;2v`#BPZ(p(CyOP*nhX*#Tl2S-X3gY%Ul;!YA6#GD&N3^{ P00000NkvXXu0mjfLDl2u diff --git a/browser/themes/pinstripe/browser/sync-notification-24.png b/browser/themes/pinstripe/browser/sync-notification-24.png new file mode 100644 index 0000000000000000000000000000000000000000..77f973f91f180f7a840d896f687539b516de65e1 GIT binary patch literal 1146 zcmV-=1cm#FP)y(-f-4s;1UI@-K?~wy2DIqHt*}BU-t@tsfZ~DTi^|lTt`}JRT=@1dtA(jJ&+O z2bY(Z_R-N%gVJfaB6M|iWsHxHKQft2bTGsWDjED73kKh{#aO8n2&WtW?W!Gx)uP7gM))YadGjz_V#v*PNyShG8j;n)9F01TCGp8 zj>z`iVLuHRaRDdcXxL=0}7dlaM>0X z7QW@SIe-?2zY|5#FEcJ}Y;1_7rKP6>0|T#GTU*})i~y)&t{{K!@9!TqG&H=yLpdSQ zz(%0Fy!?BzDF-ls)>n)c8A#x=h-x}GK0ba9-LbW`^=of$uY=`=&iNqkyk76o^z`&Q z$`5lanwy(TVK&?V3Udfk5CDmPcd=@&={*0`F^HagZ>?y|lFS z2h)=_GBYz(V3A3=BLJbStjx#~8{;8D!~IENU>?&&3ZIANNF@UaBoc`avb!Xa>gwt* zZU7t(2akK4Nd%0%%tQY0{eLyn(9qC58T+K5BIzwAo5|zxL{Cmm_$C<*p#9A$`ap2G zT-mbn7Ft?bjBRag)$Cpp@18@-R1 z4u`|Nh`A0Scv)0b^Z*?lW==_rnYN>&<2AbZ8P*pZfJ)3dJ3Cw2)6?^jp%WVk!%RST zx?tE-Qc_~Vcz?+Dh+TkJ9W$<8US3w&?e<@={)>PG+0erXG8KWorK+lmQ{DPB`BI2PS%vtnuCAQav2$~CD&{4p?_>2Zva?E&_V)HP zxO)iWRNj}o+609c8a7w58XFt+larGn3^ktoI2hao13T-Dn+M_3)YQ~m?Ck82=T7+~ z7E)1VIng6z+UDkFslL8GYO~p*$ibHY_<@D)lMfX}hH-3cYz~9)Sl%nbXTEeIW5mNq zxuEVWgM6(xA7q}tmWSta0ROd5%(B?zR4GPAh~?>%57n*zRs18s06uHp{s^~7t^fc4 M07*qoM6N<$g2~btIRF3v literal 0 HcmV?d00001 diff --git a/browser/themes/winstripe/browser/browser.css b/browser/themes/winstripe/browser/browser.css index 0c727ada7e0d..98f14f412d66 100644 --- a/browser/themes/winstripe/browser/browser.css +++ b/browser/themes/winstripe/browser/browser.css @@ -1538,7 +1538,7 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action- } .panel-promo-icon { - list-style-image: url("chrome://browser/skin/sync-24.png"); + list-style-image: url("chrome://browser/skin/sync-notification-24.png"); -moz-margin-end: 10px; vertical-align: middle; } diff --git a/browser/themes/winstripe/browser/jar.mn b/browser/themes/winstripe/browser/jar.mn index 675725a0f673..b0e49bd3a75e 100644 --- a/browser/themes/winstripe/browser/jar.mn +++ b/browser/themes/winstripe/browser/jar.mn @@ -105,11 +105,11 @@ browser.jar: #ifdef MOZ_SERVICES_SYNC skin/classic/browser/sync-throbber.png skin/classic/browser/sync-16.png - skin/classic/browser/sync-24.png skin/classic/browser/sync-32.png skin/classic/browser/sync-bg.png skin/classic/browser/sync-desktopIcon.png skin/classic/browser/sync-mobileIcon.png + skin/classic/browser/sync-notification-24.png skin/classic/browser/syncSetup.css skin/classic/browser/syncCommon.css skin/classic/browser/syncQuota.css @@ -221,11 +221,11 @@ browser.jar: #ifdef MOZ_SERVICES_SYNC skin/classic/aero/browser/sync-throbber.png skin/classic/aero/browser/sync-16.png - skin/classic/aero/browser/sync-24.png skin/classic/aero/browser/sync-32.png skin/classic/aero/browser/sync-bg.png skin/classic/aero/browser/sync-desktopIcon.png skin/classic/aero/browser/sync-mobileIcon.png + skin/classic/aero/browser/sync-notification-24.png skin/classic/aero/browser/syncSetup.css skin/classic/aero/browser/syncCommon.css skin/classic/aero/browser/syncQuota.css diff --git a/browser/themes/winstripe/browser/sync-24.png b/browser/themes/winstripe/browser/sync-24.png deleted file mode 100644 index d67eb47ac4a3563e87ef78f88d0dfdd63b007340..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1565 zcmV+&2IBdNP)tAaVb#iQmj-vtQCe<8xs_87?@#nqza;fii(Je3?nLw zD64=_zy)OnkaciDKtZ$$11dYnG9%)W+k1cJn~9qGl9LDjy}9Sz`_Db^>ohdo)&YPw z!0{1cGGaQy1ThQowFX}zW+1*mOhxD+bano3)F`gK2_6vVqyYbzI@4mFAyaOMB=aoKiI6m5at@PkKapBT3+#nVEy{_&bGF;uxoGR zn6jf2x_f$HU~mwg4iCfV*chnQYIy$qIqclCAJVgOptkP%L{*JKwj*p8Uz4H1I|LUm zmuQ#9*u}+VFeNp8r1jo?c-YnsM0C5k1r*nAKy_^$GY5z^!-=F6=Kr>KC3JOn!;Sj- zB2!aSTa01E#9~KY!Figfj-UB%;CWq-G`3U;@`-!a4&CTsMhJ+niIe9ecTUlBCRCwW1dr4_IlwGX^nlsMk zLT2_kA|N8>c}wd(Six}u&oygbuk-cm*tBKa9sFG%kqizEQN}H1W@ZZ*0pMUyZz_?- zXJ9r^bg`I0N?InI$v6w)dk;WjN-9H8QB?yE9=3s_v+E9jL7*&9yhY6yZUS#!00f2X zxQA=wlu3z9eu`qU3e%f8bLQf-%I4QPqt^HuI1{MchBUq{Ep(SZnE_%2>$=j2LAG_>)n$mqja zr&2SRvd~NfM`EQQkw^wKwfuBj=yng3XH<1fZQNT;X?{E*F`r~hza@3$7hY(rsZ~_r zngwn8MiQS;!Uj)1lg`v!dMy5xP$-FkTd>@~XTuF+dG7$kmDwUS%>+4U_`SAF}+uM5$mG0V&dZst9c}dQ#xHeD6 zz`$VM5lMVAG1E(?_duE8>4TV4e|YGHhldA}OsO&Nq6nJqG!t1JuFa(l--hhm-6t=v z7(ajMGUVnLGWz%9`-kZ2>Q2^mDReX5&$ zN~KbfL6T7-K~pjNlBaucJ*A?c;1@SsFlIKf#Nw+rzuj*m~$?Q8rjI1)kPX zlZjzNLj&CZ_W{*;98Iw!Au+j0JNO7%JJ|(6EEaoGmaGJ4IJvkLtX<~=8~g)R3S=Nv zP&O#P{ukhwQ{+fEE=#|nL79M_QLSU2zzp-{&<(5`!-i&Of!njHjKWpv9Z1D zDsCT|7;yjm3(&+m&@Hc5R@dGqlOqcu2PL1vjs`3zV;h~19@Cw{*n0EbR#MQYkB^Td zYZKa6a{;2v`#BPZ(p(CyOP*nhX*#Tl2S-X3gY%Ul;!YA6#GD&N3^{ P00000NkvXXu0mjfLDl2u diff --git a/browser/themes/winstripe/browser/sync-notification-24.png b/browser/themes/winstripe/browser/sync-notification-24.png new file mode 100644 index 0000000000000000000000000000000000000000..fc9a4e63d2e6ad2078163ddd52498c360250b33e GIT binary patch literal 1119 zcmV-l1fctgP)W@N3Al7qBB}T`pS{;{Ht>My1Zw{moqyZTcqjwM6 zJ^a=BXmmOeAeqL!P{sPzm^z0F;lxo@tM3#DcaiS@34l7rm#4E1+RP6l-(fTfi0B7o zvNe{0O>MnTMZhu0oi}y_OJt1eOqJFy{3n5|*_(|t1mXQRC{Mv?5q&=bnnNRnUL0WBDrI59z_j$q1$EY8R^zq2CQT=PEam)E5 zpBZvXDO&!jSX3(IRyQ^r9U?i4t}2Dn1rQa%z!AOGFQO=E;qjLs26IYxHxQ}Rx_6QjWGiV^@JWDW z6>9q~WsC0|QgRxp+J}!&0d)qgZ2lTYVW(;h-b3U7e-LNw>)4oQUzTtyE7ja~L{xx} z$_l)rmi)=!!}AxRX%zjZ+T8!H!PK{f^!WsHkqC$=hV Date: Mon, 4 Jul 2011 16:06:18 +0200 Subject: [PATCH 09/10] Bug 659267 - Subtle grey text for Sync notification on pinstripe. r=dolske --- browser/themes/pinstripe/browser/browser.css | 1 + 1 file changed, 1 insertion(+) diff --git a/browser/themes/pinstripe/browser/browser.css b/browser/themes/pinstripe/browser/browser.css index 04a7602a8139..d1627aa7f8f8 100644 --- a/browser/themes/pinstripe/browser/browser.css +++ b/browser/themes/pinstripe/browser/browser.css @@ -1412,6 +1412,7 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action- border-bottom-left-radius: 6px; border-bottom-right-radius: 6px; box-shadow: 0 1px 1px hsla(0,0%,0%,.25) inset; + color: hsl(0,0%,60%); } .panel-promo-message > .text-link { From 2f27b1192a8bba272f74b5fa52ad46e125d08906 Mon Sep 17 00:00:00 2001 From: Benoit Girard Date: Mon, 4 Jul 2011 09:51:37 -0400 Subject: [PATCH 10/10] Bug 636707 - Check for null MacIOSurfaceImageOGL. r=mattwoodrow --- gfx/layers/opengl/ImageLayerOGL.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gfx/layers/opengl/ImageLayerOGL.cpp b/gfx/layers/opengl/ImageLayerOGL.cpp index 694eb1903fe1..ff3e7860076d 100644 --- a/gfx/layers/opengl/ImageLayerOGL.cpp +++ b/gfx/layers/opengl/ImageLayerOGL.cpp @@ -579,6 +579,10 @@ ImageLayerOGL::RenderLayer(int, gl()->MakeCurrent(); ioImage = static_cast(image.get()); } + + if (!ioImage) { + return; + } gl()->fActiveTexture(LOCAL_GL_TEXTURE0); gl()->fBindTexture(LOCAL_GL_TEXTURE_RECTANGLE_ARB, ioImage->mTexture.GetTextureID());