aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-05-29 20:13:22 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-05-29 20:13:22 +0000
commit97de357270e54be53acb17e1cb4b4d5e25bacc01 (patch)
treef66e2395aa435070d3c6bb4bffa3e16dfa096356 /include
parentf9bd04faffb936602f7f957413a8cd5b7fc44add (diff)
SkLazyPtr, mk. 2
SK_DECLARE_STATIC_LAZY_PTR and SK_DECLARE_STATIC_LAZY_PTR_ARRAY let you declare a single or array of static pointers that are lazily initialized. You can think of this as a restricted, lighter-weight version of SkOnce. There's no guarantee that Create will be called exactly once, but we do guarantee all threads will agree on the resulting pointer. We'll clean up any other extra pointers we Create()ed by calling Destroy(), which defaults to SkDELETE. In debug mode, we also clean up the winning pointer at process exit, so we can make sure we didn't leak it or free it early. I've ported SkData (singleton) and SkXfermode (array) as examples. Once this lands I'll port most other users of SkOnce. BUG=skia: R=bungeman@google.com, mtklein@google.com, reed@google.com Author: mtklein@chromium.org Review URL: https://codereview.chromium.org/306943003 git-svn-id: http://skia.googlecode.com/svn/trunk@14976 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include')
-rw-r--r--include/core/SkData.h3
-rw-r--r--include/core/SkXfermode.h3
2 files changed, 2 insertions, 4 deletions
diff --git a/include/core/SkData.h b/include/core/SkData.h
index bee0fcdfa2..fba2846c70 100644
--- a/include/core/SkData.h
+++ b/include/core/SkData.h
@@ -137,7 +137,8 @@ private:
virtual ~SkData();
// Called the first time someone calls NewEmpty to initialize the singleton.
- static void NewEmptyImpl(int/*unused*/);
+ static SkData* NewEmptyImpl();
+ static void DeleteEmpty(SkData*);
typedef SkRefCnt INHERITED;
};
diff --git a/include/core/SkXfermode.h b/include/core/SkXfermode.h
index 13749fd51b..c0a6572ec7 100644
--- a/include/core/SkXfermode.h
+++ b/include/core/SkXfermode.h
@@ -234,9 +234,6 @@ private:
kModeCount = kLastMode + 1
};
- friend class SkGraphics;
- static void Term();
-
typedef SkFlattenable INHERITED;
};