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 #ifndef MOJO_CC_CONTEXT_PROVIDER_MOJO_H_
6 #define MOJO_CC_CONTEXT_PROVIDER_MOJO_H_
8 #include "base/macros.h"
9 #include "cc/output/context_provider.h"
10 #include "mojo/public/c/gles2/gles2.h"
11 #include "mojo/public/cpp/system/core.h"
15 class ContextProviderMojo
: public cc::ContextProvider
{
17 explicit ContextProviderMojo(ScopedMessagePipeHandle command_buffer_handle
);
19 // cc::ContextProvider implementation.
20 bool BindToCurrentThread() override
;
21 gpu::gles2::GLES2Interface
* ContextGL() override
;
22 gpu::ContextSupport
* ContextSupport() override
;
23 class GrContext
* GrContext() override
;
24 Capabilities
ContextCapabilities() override
;
25 bool IsContextLost() override
;
26 void VerifyContexts() override
{}
27 void DeleteCachedResources() override
{}
28 bool DestroyedOnMainThread() override
;
29 void SetLostContextCallback(
30 const LostContextCallback
& lost_context_callback
) override
{}
31 void SetMemoryPolicyChangedCallback(
32 const MemoryPolicyChangedCallback
& memory_policy_changed_callback
)
36 friend class base::RefCountedThreadSafe
<ContextProviderMojo
>;
37 ~ContextProviderMojo() override
;
40 static void ContextLostThunk(void* closure
) {
41 static_cast<ContextProviderMojo
*>(closure
)->ContextLost();
45 cc::ContextProvider::Capabilities capabilities_
;
46 ScopedMessagePipeHandle command_buffer_handle_
;
47 MojoGLES2Context context_
;
50 DISALLOW_COPY_AND_ASSIGN(ContextProviderMojo
);
55 #endif // MOJO_CC_CONTEXT_PROVIDER_MOJO_H_