blob: b4843ff7803439da136d6fc63e5415f9ab734e66 [file] [log] [blame]
Greg Daniel6be35232017-03-01 17:01:09 -05001/*
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
13class GrGpu;
14
15class GrSemaphore : public SkRefCnt {
Brian Osmanfe3b5162017-03-02 15:09:20 -050016private:
Greg Daniel6be35232017-03-01 17:01:09 -050017 // 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
23protected:
24 explicit GrSemaphore(const GrGpu* gpu) : fGpu(gpu) {}
25
Greg Danield85f97d2017-03-07 13:37:21 -050026 friend class GrResourceProvider; // resetGpu
Brian Osmanfe3b5162017-03-02 15:09:20 -050027
Greg Daniel6be35232017-03-01 17:01:09 -050028 const GrGpu* fGpu;
29};
30
31#endif