ozone: evdev: Sync caps lock LED state to evdev
[chromium-blink-merge.git] / mojo / cc / context_provider_mojo.h
blobefbdece3c8cb43da0a5e26d4dac1b7459a4c25aa
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 "base/synchronization/lock.h"
10 #include "cc/output/context_provider.h"
11 #include "third_party/mojo/src/mojo/public/c/gles2/gles2.h"
12 #include "third_party/mojo/src/mojo/public/cpp/system/core.h"
14 namespace mojo {
16 class ContextProviderMojo : public cc::ContextProvider {
17 public:
18 explicit ContextProviderMojo(ScopedMessagePipeHandle command_buffer_handle);
20 // cc::ContextProvider implementation.
21 bool BindToCurrentThread() override;
22 gpu::gles2::GLES2Interface* ContextGL() override;
23 gpu::ContextSupport* ContextSupport() override;
24 class GrContext* GrContext() override;
25 void SetupLock() override;
26 base::Lock* GetLock() override;
27 Capabilities ContextCapabilities() override;
28 bool IsContextLost() override;
29 void VerifyContexts() override {}
30 void DeleteCachedResources() override {}
31 bool DestroyedOnMainThread() override;
32 void SetLostContextCallback(
33 const LostContextCallback& lost_context_callback) override {}
34 void SetMemoryPolicyChangedCallback(
35 const MemoryPolicyChangedCallback& memory_policy_changed_callback)
36 override {}
38 protected:
39 friend class base::RefCountedThreadSafe<ContextProviderMojo>;
40 ~ContextProviderMojo() override;
42 private:
43 static void ContextLostThunk(void* closure) {
44 static_cast<ContextProviderMojo*>(closure)->ContextLost();
46 void ContextLost();
48 cc::ContextProvider::Capabilities capabilities_;
49 ScopedMessagePipeHandle command_buffer_handle_;
50 MojoGLES2Context context_;
51 bool context_lost_;
53 base::Lock context_lock_;
55 DISALLOW_COPY_AND_ASSIGN(ContextProviderMojo);
58 } // namespace mojo
60 #endif // MOJO_CC_CONTEXT_PROVIDER_MOJO_H_