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

Side by Side Diff: src/gpu/GrProcessor.cpp

Issue 1734383002: Modernize SkSpinlock. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: std::atomic<bool> Created 4 years, 9 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 | « src/core/SkSpinlock.cpp ('k') | src/gpu/batches/GrBatch.cpp » ('j') | 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 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "GrProcessor.h" 8 #include "GrProcessor.h"
9 #include "GrContext.h" 9 #include "GrContext.h"
10 #include "GrGeometryProcessor.h" 10 #include "GrGeometryProcessor.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 } 74 }
75 75
76 #endif 76 #endif
77 77
78 78
79 // We use a global pool protected by a mutex(spinlock). Chrome may use the same GrContext on 79 // We use a global pool protected by a mutex(spinlock). Chrome may use the same GrContext on
80 // different threads. The GrContext is not used concurrently on different thread s and there is a 80 // different threads. The GrContext is not used concurrently on different thread s and there is a
81 // memory barrier between accesses of a context on different threads. Also, ther e may be multiple 81 // memory barrier between accesses of a context on different threads. Also, ther e may be multiple
82 // GrContexts and those contexts may be in use concurrently on different threads . 82 // GrContexts and those contexts may be in use concurrently on different threads .
83 namespace { 83 namespace {
84 SK_DECLARE_STATIC_SPINLOCK(gProcessorSpinlock); 84 static SkSpinlock gProcessorSpinlock;
85 class MemoryPoolAccessor { 85 class MemoryPoolAccessor {
86 public: 86 public:
87 MemoryPoolAccessor() { gProcessorSpinlock.acquire(); } 87 MemoryPoolAccessor() { gProcessorSpinlock.acquire(); }
88 88
89 ~MemoryPoolAccessor() { gProcessorSpinlock.release(); } 89 ~MemoryPoolAccessor() { gProcessorSpinlock.release(); }
90 90
91 GrMemoryPool* pool() const { 91 GrMemoryPool* pool() const {
92 static GrMemoryPool gPool(4096, 4096); 92 static GrMemoryPool gPool(4096, 4096);
93 return &gPool; 93 return &gPool;
94 } 94 }
(...skipping 29 matching lines...) Expand all
124 } 124 }
125 } 125 }
126 return true; 126 return true;
127 } 127 }
128 128
129 //////////////////////////////////////////////////////////////////////////////// /////////////////// 129 //////////////////////////////////////////////////////////////////////////////// ///////////////////
130 130
131 // Initial static variable from GrXPFactory 131 // Initial static variable from GrXPFactory
132 int32_t GrXPFactory::gCurrXPFClassID = 132 int32_t GrXPFactory::gCurrXPFClassID =
133 GrXPFactory::kIllegalXPFClassID; 133 GrXPFactory::kIllegalXPFClassID;
OLDNEW
« no previous file with comments | « src/core/SkSpinlock.cpp ('k') | src/gpu/batches/GrBatch.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698