blob: b54738d9a2fe683157b81119045aee3a2d25e225 [file] [log] [blame]
// Copyright 2019 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef MSD_IMG_CONTEXT_H
#define MSD_IMG_CONTEXT_H
#include "magma_util/macros.h"
#include "msd.h"
class MsdImgConnection;
class MsdImgContext : public msd_context_t
{
public:
MsdImgContext(MsdImgConnection* connection) : connection_(connection) { magic_ = kMagic; }
~MsdImgContext() { magic_ = 0; }
static MsdImgContext* cast(msd_context_t* buf)
{
DASSERT(buf);
DASSERT(buf->magic_ == kMagic);
return static_cast<MsdImgContext*>(buf);
}
MsdImgConnection* connection() const
{
connection_->AssertValid();
return connection_;
}
private:
static const uint32_t kMagic = 'ictx';
// Connection should always outlive the context.
MsdImgConnection* connection_;
};
#endif // MSD_IMG_CONTEXT_H