OLD | NEW |
| (Empty) |
1 // Copyright 2016 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 CHROME_BROWSER_ANDROID_BLIMP_CHROME_COMPOSITOR_DEPENDENCIES_H_ | |
6 #define CHROME_BROWSER_ANDROID_BLIMP_CHROME_COMPOSITOR_DEPENDENCIES_H_ | |
7 | |
8 #include "base/macros.h" | |
9 #include "base/memory/weak_ptr.h" | |
10 #include "blimp/client/public/compositor/compositor_dependencies.h" | |
11 #include "ui/android/context_provider_factory.h" | |
12 | |
13 // A wrapper for the Blimp compositor dependencies that passes through to the | |
14 // ui::ContextProviderFactory. The ContextProviderFactory must outlive this | |
15 // class. | |
16 class ChromeCompositorDependencies | |
17 : public blimp::client::CompositorDependencies { | |
18 public: | |
19 ChromeCompositorDependencies( | |
20 ui::ContextProviderFactory* context_provider_factory); | |
21 ~ChromeCompositorDependencies() override; | |
22 | |
23 // CompositorDependencies implementation. | |
24 gpu::GpuMemoryBufferManager* GetGpuMemoryBufferManager() override; | |
25 cc::SurfaceManager* GetSurfaceManager() override; | |
26 cc::FrameSinkId AllocateFrameSinkId() override; | |
27 void GetContextProviders(const ContextProviderCallback& callback) override; | |
28 | |
29 private: | |
30 void OnGpuChannelEstablished( | |
31 const ContextProviderCallback& callback, | |
32 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host, | |
33 ui::ContextProviderFactory::GpuChannelHostResult result); | |
34 | |
35 void HandlePendingRequests(gpu::GpuChannelHost* gpu_channel_host); | |
36 | |
37 ui::ContextProviderFactory* context_provider_factory_; | |
38 | |
39 // Worker context shared across all Blimp Compositors. | |
40 scoped_refptr<cc::ContextProvider> shared_main_thread_worker_context_; | |
41 | |
42 base::WeakPtrFactory<ChromeCompositorDependencies> weak_factory_; | |
43 | |
44 DISALLOW_COPY_AND_ASSIGN(ChromeCompositorDependencies); | |
45 }; | |
46 | |
47 #endif // CHROME_BROWSER_ANDROID_BLIMP_CHROME_COMPOSITOR_DEPENDENCIES_H_ | |
OLD | NEW |