/* * Copyright 2018 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef GrContextThreadSafeProxyPriv_DEFINED #define GrContextThreadSafeProxyPriv_DEFINED #include "include/gpu/GrContextThreadSafeProxy.h" #include "src/gpu/GrCaps.h" /** * Class that adds methods to GrContextThreadSafeProxy that are only intended for use internal to * Skia. This class is purely a privileged window into GrContextThreadSafeProxy. It should never * have additional data members or virtual methods. */ class GrContextThreadSafeProxyPriv { public: // from GrContext_Base uint32_t contextID() const { return fProxy->contextID(); } bool matches(GrContext_Base* candidate) const { return fProxy->matches(candidate); } const GrContextOptions& options() const { return fProxy->options(); } const GrCaps* caps() const { return fProxy->caps(); } sk_sp refCaps() const { return fProxy->refCaps(); } sk_sp fpFactoryCache(); // GrContextThreadSafeProxyPriv static sk_sp Make(GrBackendApi, const GrContextOptions&, uint32_t contextID, sk_sp, sk_sp); private: explicit GrContextThreadSafeProxyPriv(GrContextThreadSafeProxy* proxy) : fProxy(proxy) {} GrContextThreadSafeProxyPriv(const GrContextThreadSafeProxy&) = delete; GrContextThreadSafeProxyPriv& operator=(const GrContextThreadSafeProxyPriv&) = delete; // No taking addresses of this type. const GrContextThreadSafeProxyPriv* operator&() const = delete; GrContextThreadSafeProxyPriv* operator&() = delete; GrContextThreadSafeProxy* fProxy; friend class GrContextThreadSafeProxy; // to construct/copy this type. }; inline GrContextThreadSafeProxyPriv GrContextThreadSafeProxy::priv() { return GrContextThreadSafeProxyPriv(this); } inline const GrContextThreadSafeProxyPriv GrContextThreadSafeProxy::priv() const { return GrContextThreadSafeProxyPriv(const_cast(this)); } #endif