Index: src/gpu/GrContext.cpp |
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp |
index b361b671c3b3080b9373ee30a76daf9ce91d7b7a..c9342a5e6a75aa564c2ef4bfe53eac573bce8bd0 100755 |
--- a/src/gpu/GrContext.cpp |
+++ b/src/gpu/GrContext.cpp |
@@ -92,7 +92,16 @@ GrContext* GrContext::Create(GrBackend backend, GrBackendContext backendContext, |
} |
} |
-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; |