skia2/include/gpu
commit-bot@chromium.org 50a3043194 We want to give SkPixelRef a way to signal over to GrResourceCache that it's become pointless to keep around textures based on that SkPixelRef when its pixels change, so that it can be a good citizen and free those textures.
This adds an invalidation listener mechanism to SkPixelRef to let it send this message while still staying ignorant of who's listening.

These messages are tricky to deliver.  The SkPixelRefs they originates from and the GrResourceCaches they ultimately end up at may be on different threads; neither class is threadsafe; their object lifetimes are totally independent; it's a many-senders-to-many-receivers relation; and neither codebase should really know about the other.

So I've added a per-message-type global message bus to broadcast messages to threadsafe inboxes.  Anyone can post() a message, which will show up in all the inboxes of that type, read whenever the inbox's owner calls poll().  The implementation is _dumb_; it can be improved in several dimensions (inbox size limits, lock-free message delivery) if we find the need.

I took some care to make sure not to send the invalidation message for any SkPixelRef that's sharing a generation ID with another SkPixelRef.

BUG=
R=bsalomon@google.com, scroggo@google.com, reed@google.com

Author: mtklein@google.com

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

git-svn-id: http://skia.googlecode.com/svn/trunk@11949 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-10-24 17:44:27 +00:00
..
gl Add swapBuffer call to SkGLContextHelper. 2013-10-09 18:25:38 +00:00
GrBackendEffectFactory.h Make GPU coord transforms automatic 2013-10-02 13:04:56 +00:00
GrBitmapTextContext.h Split out GrBitmapTextContext from GrTextContext. 2013-10-16 18:15:34 +00:00
GrClipData.h Replace all instances of GrRect with SkRect. 2013-07-17 21:39:42 +00:00
GrColor.h Replace uses of GrAssert by SkASSERT. 2013-08-17 00:02:59 +00:00
GrConfig.h Replace GR_*_BUILD by their SK_BUILD_FOR_* equivalents. 2013-09-25 20:57:51 +00:00
GrContext.h We want to give SkPixelRef a way to signal over to GrResourceCache that it's become pointless to keep around textures based on that SkPixelRef when its pixels change, so that it can be a good citizen and free those textures. 2013-10-24 17:44:27 +00:00
GrContextFactory.h Replace uses of GrNoncopyable by SkNoncopyable. 2013-09-18 13:00:55 +00:00
GrCoordTransform.h Allow gradient optimization with perspective 2013-10-04 01:20:09 +00:00
GrDrawEffect.h Make GPU coord transforms automatic 2013-10-02 13:04:56 +00:00
GrEffect.h Implement SkColorFilter as a GrGLEffect 2013-10-23 05:42:03 +00:00
GrEffectStage.h Replace uses of GR_DEBUGCODE by SkDEBUGCODE. 2013-09-06 23:13:05 +00:00
GrEffectUnitTest.h Replace uses of GrNoncopyable by SkNoncopyable. 2013-09-18 13:00:55 +00:00
GrFontScaler.h Remove GrRefCnt.h in favor of SkRefCnt.h 2013-09-09 13:38:37 +00:00
GrGlyph.h GrAtlas cleanup: Split out GrPlot and GrAtlas 2013-09-27 19:39:38 +00:00
GrKey.h Remove GrRefCnt.h in favor of SkRefCnt.h 2013-09-09 13:38:37 +00:00
GrPaint.h Implement SkColorFilter as a GrGLEffect 2013-10-23 05:42:03 +00:00
GrPathRendererChain.h Remove GrRefCnt.h in favor of SkRefCnt.h 2013-09-09 13:38:37 +00:00
GrPoint.h Sanitizing source files in Skia_Periodic_House_Keeping 2013-01-26 07:06:02 +00:00
GrRect.h Replace all instances of GrRect with SkRect. 2013-07-17 21:39:42 +00:00
GrRenderTarget.h Replace uses of GrAssert by SkASSERT. 2013-08-17 00:02:59 +00:00
GrResource.h Minor changes 2013-10-24 14:03:01 +00:00
GrSurface.h Add GrSurface::savePixels(). 2013-09-30 18:05:43 +00:00
GrTBackendEffectFactory.h Repurpose GrGLCoordTransform as GrGLProgramEffects 2013-10-03 15:17:58 +00:00
GrTextContext.h Split out GrBitmapTextContext from GrTextContext. 2013-10-16 18:15:34 +00:00
GrTexture.h Make it explicit that some validate methods are debug only 2013-10-02 16:42:21 +00:00
GrTextureAccess.h Replace uses of GrNoncopyable by SkNoncopyable. 2013-09-18 13:00:55 +00:00
GrTypes.h Implement filling a path with nv_path_rendering cover 2013-10-09 14:11:33 +00:00
GrTypesPriv.h Replace uses of GrAssert by SkASSERT. 2013-08-17 00:02:59 +00:00
GrUserConfig.h Replace uses of GR_DEBUG by SK_DEBUG. 2013-08-28 14:17:03 +00:00
SkGpuDevice.h Apply matrix early in draw bitmap 2013-10-24 01:46:11 +00:00
SkGr.h Remove uses of GR_RELEASE. 2013-09-03 23:32:08 +00:00
SkGrPixelRef.h Change undefined SkGpuRenderTarget and SkGpuTexture forward declares to GrRenderTarget and GrTexture. 2013-06-26 19:18:23 +00:00
SkGrTexturePixelRef.h Sanitizing source files in Skia_Periodic_House_Keeping 2013-01-26 07:06:02 +00:00