blob: d594dc8df652582aa578d7c643d47a0dc5e43bdf [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) {
Brian Salomonaa6ca0a2019-01-24 16:03:07 -050014 isOwned ? this->registerWithCache(SkBudgeted::kNo)
15 : this->registerWithCacheWrapped(GrWrapCacheable::kNo);
Greg Daniel6ecc9112017-06-16 16:17:03 +000016}
17
Brian Salomon62db8d52018-08-30 10:37:47 -040018void GrGLSemaphore::onRelease() {
19 if (fSync && fIsOwned) {
20 static_cast<const GrGLGpu*>(this->getGpu())->deleteSync(fSync);
Greg Daniel6ecc9112017-06-16 16:17:03 +000021 }
Brian Salomon62db8d52018-08-30 10:37:47 -040022 fSync = 0;
23 INHERITED::onRelease();
24}
25
26void GrGLSemaphore::onAbandon() {
27 fSync = 0;
28 INHERITED::onAbandon();
Greg Daniel6ecc9112017-06-16 16:17:03 +000029}