skia2/include/utils
commit-bot@chromium.org 3f032156c8 DM: Push GPU-parent child tasks to the front of the queue.
Like yesterday's change to run CPU-parent child tasks serially in thread, this
reduces peak memory usage by improving the temporaly locality of the bitmaps we
create.

E.g. Let's say we start with tasks A B C and D
    Queue: [ A B C D ]
Running A creates A' and A", which depend on a bitmap created by A.
    Queue: [ B C D A' A" * ]
That bitmap now needs sit around in RAM while B C and D run pointlessly and can
only be destroyed at *.  If instead we do this and push dependent child tasks
to the front of the queue, the queue and bitmap lifetime looks like this:
    Queue: [ A' A" * B C D ]

This is much, much worse in practice because the queue is often several thousand
tasks long.  100s of megs of bitmaps can pile up for 10s of seconds pointlessly.

To make this work we add addNext() to SkThreadPool and its cousin DMTaskRunner.
I also took the opportunity to swap head and tail in the threadpool
implementation so it matches the comments and intuition better: we always pop
the head, add() puts it at the tail, addNext() at the head.


Before
  Debug:   49s, 1403352k peak
  Release: 16s, 2064008k peak

After
  Debug:   49s, 1234788k peak
  Release: 15s, 1903424k peak

BUG=skia:2478
R=bsalomon@google.com, borenet@google.com, mtklein@google.com

Author: mtklein@chromium.org

Review URL: https://codereview.chromium.org/263803003

git-svn-id: http://skia.googlecode.com/svn/trunk@14506 2bbb7eff-a529-9590-31e7-b0007b416f81
2014-05-01 17:41:32 +00:00
..
ios Drop executable flag from headers so that they can be packaged 2014-03-11 19:55:51 +00:00
mac expose CGImage -> SkBitmap 2014-04-22 20:24:33 +00:00
win Use lowercase windows.h in includes to fix Windows cross compilation using mingw. 2013-12-03 15:23:37 +00:00
SkBoundaryPatch.h Sanitizing source files in Skia_Periodic_House_Keeping 2013-01-26 07:06:02 +00:00
SkCamera.h remove SkScalarMul macro 2014-01-23 02:02:45 +00:00
SkCanvasStateUtils.h Create a semi-stable API for capturing the state of an SkCanvas and reconstructing that state across different versions of Skia. 2013-08-29 20:20:40 +00:00
SkCondVar.h Use lowercase windows.h in includes to fix Windows cross compilation using mingw. 2013-12-03 15:23:37 +00:00
SkCountdown.h Add SkThreadPool for managing threads. 2012-10-31 15:52:16 +00:00
SkCubicInterval.h Sanitizing source files in Skia_Periodic_House_Keeping 2013-01-26 07:06:02 +00:00
SkCullPoints.h Result of running tools/sanitize_source_files.py (which was added in https://codereview.appspot.com/6465078/) 2012-08-23 18:09:54 +00:00
SkDebugUtils.h Sanitizing source files in Skia_Periodic_House_Keeping 2013-02-15 07:16:57 +00:00
SkDeferredCanvas.h Make drawText calls non-virtual, to ease SkFont and TextBlob (https://codereview.chromium.org/243853006/)" 2014-04-23 04:00:17 +00:00
SkDumpCanvas.h Make drawText calls non-virtual, to ease SkFont and TextBlob (https://codereview.chromium.org/243853006/)" 2014-04-23 04:00:17 +00:00
SkEventTracer.h rename tracing parameter to be more consistent with other methods 2014-02-03 19:47:13 +00:00
SkFrontBufferedStream.h Hide implementation details: SkFrontBufferedStream 2013-11-12 20:53:05 +00:00
SkInterpolator.h Sanitizing source files in Skia_Periodic_House_Keeping 2013-01-26 07:06:02 +00:00
SkJSON.h Result of running tools/sanitize_source_files.py (which was added in https://codereview.appspot.com/6465078/) 2012-08-23 18:09:54 +00:00
SkJSONCPP.h Add JSON output option to bench. 2013-12-03 18:16:48 +00:00
SkLayer.h Extended Inst counting to find "unknown" leaked object (SkTMaskGamma) 2012-08-16 14:58:06 +00:00
SkLua.h add initial scraper for dashing 2014-03-17 23:09:47 +00:00
SkLuaCanvas.h Make drawText calls non-virtual, to ease SkFont and TextBlob (https://codereview.chromium.org/243853006/)" 2014-04-23 04:00:17 +00:00
SkMatrix44.h Revert "Revert "add SK_ATTR_DEPRECATED -- will need to disable for chrome, since it triggers a warning"" 2013-10-31 17:28:30 +00:00
SkMeshUtils.h Start cleaning up 64bit Win warnings 2013-10-14 21:53:24 +00:00
SkNinePatch.h Result of running tools/sanitize_source_files.py (which was added in https://codereview.appspot.com/6465078/) 2012-08-23 18:09:54 +00:00
SkNoSaveLayerCanvas.h Move SkNoSaveLayerCanvas.h to include/utils 2014-03-16 21:59:11 +00:00
SkNullCanvas.h Add SK_API to null canvas create method 2012-06-11 15:41:25 +00:00
SkNWayCanvas.h Make drawText calls non-virtual, to ease SkFont and TextBlob (https://codereview.chromium.org/243853006/)" 2014-04-23 04:00:17 +00:00
SkParse.h Sanitizing source files in Skia_Periodic_House_Keeping 2013-01-26 07:06:02 +00:00
SkParsePaint.h Sanitizing source files in Skia_Periodic_House_Keeping 2013-01-26 07:06:02 +00:00
SkParsePath.h Sanitizing source files in Skia_Periodic_House_Keeping 2013-01-26 07:06:02 +00:00
SkPathUtils.h Animated the PathUtils Sample to show path contours# Enter a description of the change. 2013-07-09 16:30:38 +00:00
SkPictureUtils.h Pull in Chromium's version of GatherPixelRefs 2014-01-13 13:33:26 +00:00
SkProxyCanvas.h Make drawText calls non-virtual, to ease SkFont and TextBlob (https://codereview.chromium.org/243853006/)" 2014-04-23 04:00:17 +00:00
SkRandom.h remove SkScalarMul macro 2014-01-23 02:02:45 +00:00
SkRTConf.h fix leaks in SkConf 2014-01-31 17:32:03 +00:00
SkRunnable.h DM: make GPU tasks multithreaded again. Big refactor. 2014-02-28 20:31:31 +00:00
SkThreadPool.h DM: Push GPU-parent child tasks to the front of the queue. 2014-05-01 17:41:32 +00:00
SkUnitMappers.h Refactor read and write buffers. 2014-01-30 18:58:24 +00:00
SkWGL.h Use lowercase windows.h in includes to fix Windows cross compilation using mingw. 2013-12-03 15:23:37 +00:00