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 GrGLSemaphore_DEFINED
9 #define GrGLSemaphore_DEFINED
10 
11 #include "GrSemaphore.h"
12 
13 #include "GrGLGpu.h"
14 
15 class GrGLSemaphore : public GrSemaphore {
16 public:
Make(const GrGLGpu * gpu)17     static sk_sp<GrGLSemaphore> Make(const GrGLGpu* gpu) {
18         return sk_sp<GrGLSemaphore>(new GrGLSemaphore(gpu));
19     }
20 
~GrGLSemaphore()21     ~GrGLSemaphore() override {
22         if (fGpu) {
23             static_cast<const GrGLGpu*>(fGpu)->deleteSync(fSync);
24         }
25     }
26 
sync()27     GrGLsync sync() const { return fSync; }
setSync(const GrGLsync & sync)28     void setSync(const GrGLsync& sync) { fSync = sync; }
29 
30 private:
GrGLSemaphore(const GrGLGpu * gpu)31     GrGLSemaphore(const GrGLGpu* gpu) : INHERITED(gpu), fSync(0) {}
32 
33     GrGLsync fSync;
34 
35     typedef GrSemaphore INHERITED;
36 };
37 
38 #endif
39