Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(194)

Unified Diff: src/gpu/GrContext.cpp

Issue 1128873009: adding uniqueID to GrContext (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: tweak Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/gpu/GrContext.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « include/gpu/GrContext.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698