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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « include/gpu/GrContext.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "GrContext.h" 9 #include "GrContext.h"
10 10
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 } 85 }
86 86
87 if (context->init(backend, backendContext)) { 87 if (context->init(backend, backendContext)) {
88 return context; 88 return context;
89 } else { 89 } else {
90 context->unref(); 90 context->unref();
91 return NULL; 91 return NULL;
92 } 92 }
93 } 93 }
94 94
95 GrContext::GrContext(const Options& opts) : fOptions(opts) { 95 static int32_t gNextID = 1;
96 static int32_t next_id() {
97 int32_t id;
98 do {
99 id = sk_atomic_inc(&gNextID);
100 } while (id == SK_InvalidGenID);
101 return id;
102 }
103
104 GrContext::GrContext(const Options& opts) : fOptions(opts), fUniqueID(next_id()) {
96 fGpu = NULL; 105 fGpu = NULL;
97 fResourceCache = NULL; 106 fResourceCache = NULL;
98 fResourceProvider = NULL; 107 fResourceProvider = NULL;
99 fPathRendererChain = NULL; 108 fPathRendererChain = NULL;
100 fSoftwarePathRenderer = NULL; 109 fSoftwarePathRenderer = NULL;
101 fBatchFontCache = NULL; 110 fBatchFontCache = NULL;
102 fDrawBuffer = NULL; 111 fDrawBuffer = NULL;
103 fDrawBufferVBAllocPool = NULL; 112 fDrawBufferVBAllocPool = NULL;
104 fDrawBufferIBAllocPool = NULL; 113 fDrawBufferIBAllocPool = NULL;
105 fFlushToReduceCacheSize = false; 114 fFlushToReduceCacheSize = false;
(...skipping 1786 matching lines...) Expand 10 before | Expand all | Expand 10 after
1892 fDrawBuffer->addGpuTraceMarker(marker); 1901 fDrawBuffer->addGpuTraceMarker(marker);
1893 } 1902 }
1894 } 1903 }
1895 1904
1896 void GrContext::removeGpuTraceMarker(const GrGpuTraceMarker* marker) { 1905 void GrContext::removeGpuTraceMarker(const GrGpuTraceMarker* marker) {
1897 fGpu->removeGpuTraceMarker(marker); 1906 fGpu->removeGpuTraceMarker(marker);
1898 if (fDrawBuffer) { 1907 if (fDrawBuffer) {
1899 fDrawBuffer->removeGpuTraceMarker(marker); 1908 fDrawBuffer->removeGpuTraceMarker(marker);
1900 } 1909 }
1901 } 1910 }
OLDNEW
« 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