#ifndef CC_OUTPUT_CONTEXT_PROVIDER_H_
#define CC_OUTPUT_CONTEXT_PROVIDER_H_
#include "base/callback.h"
#include "base/memory/ref_counted.h"
#include "cc/base/cc_export.h"
#include "gpu/command_buffer/common/capabilities.h"
class GrContext;
namespace gpu {
class ContextSupport;
namespace gles2 { class GLES2Interface; }
}
namespace cc {
struct ManagedMemoryPolicy;
class ContextProvider : public base::RefCountedThreadSafe<ContextProvider> {
public:
virtual bool BindToCurrentThread() = 0;
virtual gpu::gles2::GLES2Interface* ContextGL() = 0;
virtual gpu::ContextSupport* ContextSupport() = 0;
virtual class GrContext* GrContext() = 0;
struct Capabilities {
gpu::Capabilities gpu;
size_t max_transfer_buffer_usage_bytes;
CC_EXPORT Capabilities();
};
virtual Capabilities ContextCapabilities() = 0;
virtual bool IsContextLost() = 0;
virtual void VerifyContexts() = 0;
virtual bool DestroyedOnMainThread() = 0;
typedef base::Closure LostContextCallback;
virtual void SetLostContextCallback(
const LostContextCallback& lost_context_callback) = 0;
typedef base::Callback<void(const ManagedMemoryPolicy& policy)>
MemoryPolicyChangedCallback;
virtual void SetMemoryPolicyChangedCallback(
const MemoryPolicyChangedCallback& memory_policy_changed_callback) = 0;
protected:
friend class base::RefCountedThreadSafe<ContextProvider>;
virtual ~ContextProvider() {}
};
}
#endif