OLD | NEW |
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 Loading... |
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 Loading... |
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; |
OLD | NEW |