blob: 80e7a80c247d881e0d3962e06e88a94186944061 [file] [log] [blame]
Robert Phillips4217ea72019-01-30 13:08:28 -05001/*
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
10static 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
19GrContext_Base::GrContext_Base(GrBackendApi backend,
20 uint32_t uniqueID)
21 : fBackend(backend)
22 , fUniqueID(SK_InvalidGenID == uniqueID ? next_id() : uniqueID) {
23}
24
25GrContext_Base::~GrContext_Base() {
26}
27
28