| Index: services/surfaces/context_provider_mojo.h
|
| diff --git a/services/surfaces/context_provider_mojo.h b/services/surfaces/context_provider_mojo.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..c7d7f5831969a045d64ad28cf96a2dd2873bf42b
|
| --- /dev/null
|
| +++ b/services/surfaces/context_provider_mojo.h
|
| @@ -0,0 +1,69 @@
|
| +// Copyright 2014 The Chromium 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 SERVICES_SURFACES_CONTEXT_PROVIDER_MOJO_H_
|
| +#define SERVICES_SURFACES_CONTEXT_PROVIDER_MOJO_H_
|
| +
|
| +#include <MGL/mgl.h>
|
| +
|
| +#include "base/macros.h"
|
| +#include "base/synchronization/lock.h"
|
| +#include "cc/output/context_provider.h"
|
| +#include "gpu/command_buffer/client/gles2_interface.h"
|
| +#include "mojo/gpu/mojo_context_support.h"
|
| +#include "mojo/public/cpp/system/core.h"
|
| +
|
| +namespace mojo {
|
| +
|
| +class MojoContextSupport;
|
| +class MojoGLES2Impl;
|
| +
|
| +class ContextProviderMojo : public cc::ContextProvider {
|
| + public:
|
| + explicit ContextProviderMojo(ScopedMessagePipeHandle command_buffer_handle);
|
| +
|
| + // cc::ContextProvider implementation.
|
| + bool BindToCurrentThread() override;
|
| + gpu::gles2::GLES2Interface* ContextGL() override;
|
| + gpu::ContextSupport* ContextSupport() override;
|
| + class GrContext* GrContext() override;
|
| + Capabilities ContextCapabilities() override;
|
| + bool IsContextLost() override;
|
| + void VerifyContexts() override {}
|
| + void DeleteCachedResources() override {}
|
| + bool DestroyedOnMainThread() override;
|
| + void SetLostContextCallback(
|
| + const LostContextCallback& lost_context_callback) override;
|
| + void SetMemoryPolicyChangedCallback(
|
| + const MemoryPolicyChangedCallback& memory_policy_changed_callback)
|
| + override {}
|
| + void SetupLock() override;
|
| + base::Lock* GetLock() override;
|
| +
|
| + protected:
|
| + friend class base::RefCountedThreadSafe<ContextProviderMojo>;
|
| + ~ContextProviderMojo() override;
|
| +
|
| + private:
|
| + static void ContextLostThunk(void* closure) {
|
| + static_cast<ContextProviderMojo*>(closure)->ContextLost();
|
| + }
|
| + void ContextLost();
|
| +
|
| + cc::ContextProvider::Capabilities capabilities_;
|
| + ScopedMessagePipeHandle command_buffer_handle_;
|
| + MGLContext context_;
|
| + scoped_ptr<MojoGLES2Impl> gles2_impl_;
|
| + scoped_ptr<MojoContextSupport> context_support_;
|
| + bool context_lost_;
|
| + LostContextCallback lost_context_callback_;
|
| +
|
| + base::Lock context_lock_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(ContextProviderMojo);
|
| +};
|
| +
|
| +} // namespace mojo
|
| +
|
| +#endif // SERVICES_SURFACES_CONTEXT_PROVIDER_MOJO_H_
|
|
|