1 /* 2 * Copyright 2017 Google Inc. 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8 #include "src/gpu/gl/GrGLSemaphore.h" 9 10 #include "src/gpu/gl/GrGLGpu.h" 11 GrGLSemaphore(GrGLGpu * gpu,bool isOwned)12GrGLSemaphore::GrGLSemaphore(GrGLGpu* gpu, bool isOwned) 13 : INHERITED(gpu), fSync(0), fIsOwned(isOwned) { 14 isOwned ? this->registerWithCache(SkBudgeted::kNo) 15 : this->registerWithCacheWrapped(GrWrapCacheable::kNo); 16 } 17 onRelease()18void GrGLSemaphore::onRelease() { 19 if (fSync && fIsOwned) { 20 static_cast<const GrGLGpu*>(this->getGpu())->deleteSync(fSync); 21 } 22 fSync = 0; 23 INHERITED::onRelease(); 24 } 25 onAbandon()26void GrGLSemaphore::onAbandon() { 27 fSync = 0; 28 INHERITED::onAbandon(); 29 } 30