1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "cc/output/context_provider.h"
6 #include "mojo/public/gles2/gles2.h"
7 #include "mojo/public/system/core_cpp.h"
12 class MojoContextProvider : public cc::ContextProvider {
14 explicit MojoContextProvider(ScopedMessagePipeHandle gl_pipe);
16 // cc::ContextProvider implementation.
17 virtual bool BindToCurrentThread() OVERRIDE;
18 virtual gpu::gles2::GLES2Interface* ContextGL() OVERRIDE;
19 virtual gpu::ContextSupport* ContextSupport() OVERRIDE;
20 virtual class GrContext* GrContext() OVERRIDE;
21 virtual Capabilities ContextCapabilities() OVERRIDE;
22 virtual bool IsContextLost() OVERRIDE;
23 virtual void VerifyContexts() OVERRIDE {}
24 virtual bool DestroyedOnMainThread() OVERRIDE;
25 virtual void SetLostContextCallback(
26 const LostContextCallback& lost_context_callback) OVERRIDE {}
27 virtual void SetMemoryPolicyChangedCallback(
28 const MemoryPolicyChangedCallback& memory_policy_changed_callback)
32 friend class base::RefCountedThreadSafe<MojoContextProvider>;
33 virtual ~MojoContextProvider();
36 static void ContextLostThunk(void* closure) {
37 static_cast<MojoContextProvider*>(closure)->ContextLost();
41 cc::ContextProvider::Capabilities capabilities_;
42 ScopedMessagePipeHandle gl_pipe_;
43 MojoGLES2Context context_;
46 } // namespace examples