SkOnce: let f be any functor, update comments

BUG=
R=bungeman@google.com

Author: mtklein@google.com

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

git-svn-id: http://skia.googlecode.com/svn/trunk@12518 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tests/OnceTest.cpp b/tests/OnceTest.cpp
index 31c6a85..d3a0a00 100644
--- a/tests/OnceTest.cpp
+++ b/tests/OnceTest.cpp
@@ -28,6 +28,20 @@
     REPORTER_ASSERT(r, 5 == x);
 }
 
+struct AddFour { void operator()(int* x) { *x += 4; } };
+
+DEF_TEST(SkOnce_MiscFeatures, r) {
+    // Tests that we support functors and explicit SkOnceFlags.
+    int x = 0;
+
+    SkOnceFlag once = SK_ONCE_INIT;
+    SkOnce(&once, AddFour(), &x);
+    SkOnce(&once, AddFour(), &x);
+    SkOnce(&once, AddFour(), &x);
+
+    REPORTER_ASSERT(r, 4 == x);
+}
+
 static void add_six(int* x) {
     *x += 6;
 }