adding uniqueID to GrContext
BUG=skia:
Review URL: https://codereview.chromium.org/1128873009
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index b361b67..c9342a5 100755
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -92,7 +92,16 @@
}
}
-GrContext::GrContext(const Options& opts) : fOptions(opts) {
+static int32_t gNextID = 1;
+static int32_t next_id() {
+ int32_t id;
+ do {
+ id = sk_atomic_inc(&gNextID);
+ } while (id == SK_InvalidGenID);
+ return id;
+}
+
+GrContext::GrContext(const Options& opts) : fOptions(opts), fUniqueID(next_id()) {
fGpu = NULL;
fResourceCache = NULL;
fResourceProvider = NULL;