1cb93a386Sopenharmony_ci// Copyright 2019 Google LLC. 2cb93a386Sopenharmony_ci// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. 3cb93a386Sopenharmony_ci#ifndef GrContextHolder_DEFINED 4cb93a386Sopenharmony_ci#define GrContextHolder_DEFINED 5cb93a386Sopenharmony_ci 6cb93a386Sopenharmony_ci#include <memory> 7cb93a386Sopenharmony_ci 8cb93a386Sopenharmony_ciclass GrDirectContext; 9cb93a386Sopenharmony_ci 10cb93a386Sopenharmony_ci// A struct to take ownership of a GrDirectContext. 11cb93a386Sopenharmony_cistruct GrContextRelease { void operator()(GrDirectContext*); }; 12cb93a386Sopenharmony_ciusing GrContextHolder = std::unique_ptr<GrDirectContext, GrContextRelease>; 13cb93a386Sopenharmony_ci 14cb93a386Sopenharmony_ci// Wrapper around GrDirectContext::MakeGL 15cb93a386Sopenharmony_ciGrContextHolder SkMakeGLContext(); 16cb93a386Sopenharmony_ci 17cb93a386Sopenharmony_ci#endif // GrContextHolder_DEFINED 18