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

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

Issue 2293633003: Skip spinlock overhead on Android (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add comments Created 4 years, 3 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 | « no previous file | 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 static SkSpinlock gProcessorSpinlock; 84 static SkSpinlock gProcessorSpinlock;
85 class MemoryPoolAccessor { 85 class MemoryPoolAccessor {
86 public: 86 public:
87
88 // We know in the Android framework there is only one GrContext.
89 #if defined(SK_BUILD_FOR_ANDROID_FRAMEWORK)
90 MemoryPoolAccessor() {}
91 ~MemoryPoolAccessor() {}
92 #else
87 MemoryPoolAccessor() { gProcessorSpinlock.acquire(); } 93 MemoryPoolAccessor() { gProcessorSpinlock.acquire(); }
88
89 ~MemoryPoolAccessor() { gProcessorSpinlock.release(); } 94 ~MemoryPoolAccessor() { gProcessorSpinlock.release(); }
95 #endif
90 96
91 GrMemoryPool* pool() const { 97 GrMemoryPool* pool() const {
92 static GrMemoryPool gPool(4096, 4096); 98 static GrMemoryPool gPool(4096, 4096);
93 return &gPool; 99 return &gPool;
94 } 100 }
95 }; 101 };
96 } 102 }
97 103
98 int32_t GrProcessor::gCurrProcessorClassID = GrProcessor::kIllegalProcessorClass ID; 104 int32_t GrProcessor::gCurrProcessorClassID = GrProcessor::kIllegalProcessorClass ID;
99 105
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 } 140 }
135 } 141 }
136 return true; 142 return true;
137 } 143 }
138 144
139 //////////////////////////////////////////////////////////////////////////////// /////////////////// 145 //////////////////////////////////////////////////////////////////////////////// ///////////////////
140 146
141 // Initial static variable from GrXPFactory 147 // Initial static variable from GrXPFactory
142 int32_t GrXPFactory::gCurrXPFClassID = 148 int32_t GrXPFactory::gCurrXPFClassID =
143 GrXPFactory::kIllegalXPFClassID; 149 GrXPFactory::kIllegalXPFClassID;
OLDNEW
« no previous file with comments | « no previous file | src/gpu/batches/GrBatch.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698