blob: b557efb1278452a3ebd89bbd0aab09479bb05028 [file] [log] [blame]
Greg Daniel6ecc9112017-06-16 16:17:03 +00001/*
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
Brian Salomon62db8d52018-08-30 10:37:47 -040012GrGLSemaphore::GrGLSemaphore(GrGLGpu* gpu, bool isOwned)
13 : INHERITED(gpu), fSync(0), fIsOwned(isOwned) {
14 isOwned ? this->registerWithCache(SkBudgeted::kNo) : this->registerWithCacheWrapped();
Greg Daniel6ecc9112017-06-16 16:17:03 +000015}
16
Brian Salomon62db8d52018-08-30 10:37:47 -040017void GrGLSemaphore::onRelease() {
18 if (fSync && fIsOwned) {
19 static_cast<const GrGLGpu*>(this->getGpu())->deleteSync(fSync);
Greg Daniel6ecc9112017-06-16 16:17:03 +000020 }
Brian Salomon62db8d52018-08-30 10:37:47 -040021 fSync = 0;
22 INHERITED::onRelease();
23}
24
25void GrGLSemaphore::onAbandon() {
26 fSync = 0;
27 INHERITED::onAbandon();
Greg Daniel6ecc9112017-06-16 16:17:03 +000028}