Robert Phillips | 4217ea7 | 2019-01-30 13:08:28 -0500 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 2019 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 | #include "GrContext_Base.h" |
| 9 | |
| 10 | static int32_t next_id() { |
| 11 | static std::atomic<int32_t> nextID{1}; |
| 12 | int32_t id; |
| 13 | do { |
| 14 | id = nextID++; |
| 15 | } while (id == SK_InvalidGenID); |
| 16 | return id; |
| 17 | } |
| 18 | |
| 19 | GrContext_Base::GrContext_Base(GrBackendApi backend, |
| 20 | uint32_t uniqueID) |
| 21 | : fBackend(backend) |
| 22 | , fUniqueID(SK_InvalidGenID == uniqueID ? next_id() : uniqueID) { |
| 23 | } |
| 24 | |
| 25 | GrContext_Base::~GrContext_Base() { |
| 26 | } |
| 27 | |
| 28 | |