Greg Daniel | 6be3523 | 2017-03-01 17:01:09 -0500 | [diff] [blame] | 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 { |
Brian Osman | fe3b516 | 2017-03-02 15:09:20 -0500 | [diff] [blame] | 16 | private: |
Greg Daniel | 6be3523 | 2017-03-01 17:01:09 -0500 | [diff] [blame] | 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 | |
Greg Daniel | d85f97d | 2017-03-07 13:37:21 -0500 | [diff] [blame] | 26 | friend class GrResourceProvider; // resetGpu |
Brian Osman | fe3b516 | 2017-03-02 15:09:20 -0500 | [diff] [blame] | 27 | |
Greg Daniel | 6be3523 | 2017-03-01 17:01:09 -0500 | [diff] [blame] | 28 | const GrGpu* fGpu; |
| 29 | }; |
| 30 | |
| 31 | #endif |