| OLD | NEW |
| (Empty) | |
| 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. |
| 4 |
| 5 #ifndef SERVICES_SURFACES_CONTEXT_PROVIDER_MOJO_H_ |
| 6 #define SERVICES_SURFACES_CONTEXT_PROVIDER_MOJO_H_ |
| 7 |
| 8 #include <MGL/mgl.h> |
| 9 |
| 10 #include "base/macros.h" |
| 11 #include "base/synchronization/lock.h" |
| 12 #include "cc/output/context_provider.h" |
| 13 #include "gpu/command_buffer/client/gles2_interface.h" |
| 14 #include "mojo/gpu/mojo_context_support.h" |
| 15 #include "mojo/public/cpp/system/core.h" |
| 16 |
| 17 namespace mojo { |
| 18 |
| 19 class MojoContextSupport; |
| 20 class MojoGLES2Impl; |
| 21 |
| 22 class ContextProviderMojo : public cc::ContextProvider { |
| 23 public: |
| 24 explicit ContextProviderMojo(ScopedMessagePipeHandle command_buffer_handle); |
| 25 |
| 26 // cc::ContextProvider implementation. |
| 27 bool BindToCurrentThread() override; |
| 28 gpu::gles2::GLES2Interface* ContextGL() override; |
| 29 gpu::ContextSupport* ContextSupport() override; |
| 30 class GrContext* GrContext() override; |
| 31 Capabilities ContextCapabilities() override; |
| 32 bool IsContextLost() override; |
| 33 void VerifyContexts() override {} |
| 34 void DeleteCachedResources() override {} |
| 35 bool DestroyedOnMainThread() override; |
| 36 void SetLostContextCallback( |
| 37 const LostContextCallback& lost_context_callback) override; |
| 38 void SetMemoryPolicyChangedCallback( |
| 39 const MemoryPolicyChangedCallback& memory_policy_changed_callback) |
| 40 override {} |
| 41 void SetupLock() override; |
| 42 base::Lock* GetLock() override; |
| 43 |
| 44 protected: |
| 45 friend class base::RefCountedThreadSafe<ContextProviderMojo>; |
| 46 ~ContextProviderMojo() override; |
| 47 |
| 48 private: |
| 49 static void ContextLostThunk(void* closure) { |
| 50 static_cast<ContextProviderMojo*>(closure)->ContextLost(); |
| 51 } |
| 52 void ContextLost(); |
| 53 |
| 54 cc::ContextProvider::Capabilities capabilities_; |
| 55 ScopedMessagePipeHandle command_buffer_handle_; |
| 56 MGLContext context_; |
| 57 scoped_ptr<MojoGLES2Impl> gles2_impl_; |
| 58 scoped_ptr<MojoContextSupport> context_support_; |
| 59 bool context_lost_; |
| 60 LostContextCallback lost_context_callback_; |
| 61 |
| 62 base::Lock context_lock_; |
| 63 |
| 64 DISALLOW_COPY_AND_ASSIGN(ContextProviderMojo); |
| 65 }; |
| 66 |
| 67 } // namespace mojo |
| 68 |
| 69 #endif // SERVICES_SURFACES_CONTEXT_PROVIDER_MOJO_H_ |
| OLD | NEW |