• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "GrGLSemaphore.h"
9 
10 #include "GrGLGpu.h"
11 
GrGLSemaphore(GrGLGpu * gpu,bool isOwned)12 GrGLSemaphore::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()18 void 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()26 void GrGLSemaphore::onAbandon() {
27     fSync = 0;
28     INHERITED::onAbandon();
29 }
30