blob: 19b81712e1abf226f0e7f08e85d3a32595a1bfe4 [file] [log] [blame]
Robert Phillips757914d2017-01-25 15:48:30 -05001/*
2 * Copyright 2017 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#ifndef GrSurfaceProxyPriv_DEFINED
9#define GrSurfaceProxyPriv_DEFINED
10
11#include "GrSurfaceProxy.h"
12
13/** Class that adds methods to GrSurfaceProxy that are only intended for use internal to Skia.
14 This class is purely a privileged window into GrSurfaceProxy. It should never have additional
15 data members or virtual methods. */
16class GrSurfaceProxyPriv {
17public:
18 // Beware! This call is only guaranteed to tell you if the proxy in question has
19 // any pending IO in its current state. It won't tell you about the IO state in the
20 // future when the proxy is actually used/instantiated.
21 bool hasPendingIO() const { return fProxy->hasPendingIO(); }
22
23private:
24 explicit GrSurfaceProxyPriv(GrSurfaceProxy* proxy) : fProxy(proxy) {}
25 GrSurfaceProxyPriv(const GrSurfaceProxyPriv&) {} // unimpl
26 GrSurfaceProxyPriv& operator=(const GrSurfaceProxyPriv&); // unimpl
27
28 // No taking addresses of this type.
29 const GrSurfaceProxyPriv* operator&() const;
30 GrSurfaceProxyPriv* operator&();
31
32 GrSurfaceProxy* fProxy;
33
34 friend class GrSurfaceProxy; // to construct/copy this type.
35};
36
37inline GrSurfaceProxyPriv GrSurfaceProxy::priv() { return GrSurfaceProxyPriv(this); }
38
39inline const GrSurfaceProxyPriv GrSurfaceProxy::priv () const {
40 return GrSurfaceProxyPriv(const_cast<GrSurfaceProxy*>(this));
41}
42
43#endif