aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrContextThreadSafeProxyPriv.h
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2018-05-10 12:57:17 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-05-10 19:14:16 +0000
commit52aacd602f792a01218ca903759f6b9d4ec28450 (patch)
treeec5a18a5f4493fcbfe785777d02bbe8d7149ca2d /src/gpu/GrContextThreadSafeProxyPriv.h
parentce4cf72e3487f661e53f6d0c3416c9b58da4fd00 (diff)
Add GrContextThreadSafeProxy and remove most friends of GrContextThreadSafeProxy
A step towards removing GrCaps from GrContext.h Also adds operator== to GrContextThreadSafeProxy. Change-Id: Ic0bae12299dfb0ac8817d9f1c56a1219d6df97d9 Reviewed-on: https://skia-review.googlesource.com/127329 Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/gpu/GrContextThreadSafeProxyPriv.h')
-rw-r--r--src/gpu/GrContextThreadSafeProxyPriv.h49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/gpu/GrContextThreadSafeProxyPriv.h b/src/gpu/GrContextThreadSafeProxyPriv.h
new file mode 100644
index 0000000000..8e299c8180
--- /dev/null
+++ b/src/gpu/GrContextThreadSafeProxyPriv.h
@@ -0,0 +1,49 @@
+/*
+ * 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 "GrContext.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:
+ const GrContextOptions& contextOptions() { return fProxy->fOptions; }
+
+ const GrCaps* caps() const { return fProxy->fCaps.get(); }
+ sk_sp<const GrCaps> refCaps() const { return fProxy->fCaps; }
+ uint32_t contextUniqueID() const { return fProxy->fContextUniqueID; }
+ GrBackend backend() const { return fProxy->fBackend; }
+
+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<GrContextThreadSafeProxy*>(this));
+}
+
+#endif