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#ifndef GrSemaphore_DEFINED 9#define GrSemaphore_DEFINED 10 11#include "include/gpu/GrBackendSemaphore.h" 12 13/** 14 * Represents a semaphore-like GPU synchronization object. 15 */ 16class GrSemaphore { 17public: 18 virtual ~GrSemaphore() {} 19 20 // The derived class can return its GrBackendSemaphore. This is used when flushing with signal 21 // semaphores so we can set the client's GrBackendSemaphore object after we've created the 22 // internal semaphore. 23 virtual GrBackendSemaphore backendSemaphore() const = 0; 24 25private: 26 friend class GrGpu; // for setIsOwned 27 // This is only used in GrGpu to handle the case where we created a semaphore that was meant to 28 // be borrowed, but we failed to submit it. So we must go back and switch the semaphore to owned 29 // so that it gets deleted. 30 virtual void setIsOwned() = 0; 31}; 32 33#endif 34