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 "SkRefCnt.h" 12 13 class GrGpu; 14 15 class GrSemaphore : public SkRefCnt { 16 private: 17 // This function should only be used in the case of exporting and importing a GrSemaphore object 18 // from one GrContext to another. When exporting, the GrSemaphore should be set to a null GrGpu, 19 // and when importing it should be set to the GrGpu of the current context. Once exported, a 20 // GrSemaphore should not be used with its old context. 21 void resetGpu(const GrGpu* gpu) { fGpu = gpu; } 22 23 protected: 24 explicit GrSemaphore(const GrGpu* gpu) : fGpu(gpu) {} 25 26 friend class GrResourceProvider; // resetGpu 27 28 const GrGpu* fGpu; 29 }; 30 31 #endif 32