Index: blimp/client/core/compositor/compositor_deps_provider.h |
diff --git a/blimp/client/core/compositor/compositor_deps_provider.h b/blimp/client/core/compositor/compositor_deps_provider.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..e8fd3849dfa56beb969acf901d4ff580f9fd0fe0 |
--- /dev/null |
+++ b/blimp/client/core/compositor/compositor_deps_provider.h |
@@ -0,0 +1,75 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef BLIMP_CLIENT_CORE_COMPOSITOR_COMPOSITOR_DEPS_PROVIDER_H_ |
+#define BLIMP_CLIENT_CORE_COMPOSITOR_COMPOSITOR_DEPS_PROVIDER_H_ |
+ |
+#include "base/macros.h" |
+#include "base/memory/ref_counted.h" |
+#include "ui/gfx/native_widget_types.h" |
+ |
+namespace base { |
+class SingleThreadTaskRunner; |
+class Thread; |
+} // namespace base |
+ |
+namespace cc { |
+class LayerTreeSettings; |
+class OutputSurface; |
+class TaskGraphRunner; |
+} // namespace cc |
+ |
+namespace gpu { |
+class GpuMemoryBufferManager; |
+} // namespace gpu |
+ |
+namespace blimp { |
+namespace client { |
+class BlimpGpuMemoryBufferManager; |
+ |
+// This class is not thread-safe and should only be used from the UI thread. |
+class CompositorDepsProvider { |
+ public: |
+ static void Initialize(bool use_internal_display); |
+ static void Terminate(); |
+ |
+ static CompositorDepsProvider* current(); |
+ |
+ bool use_internal_display() const { return use_internal_display_; } |
+ |
+ gpu::GpuMemoryBufferManager* GetGpuMemoryBufferManager(); |
+ |
+ scoped_refptr<base::SingleThreadTaskRunner> GetCompositorTaskRunner(); |
+ |
+ cc::LayerTreeSettings* GetLayerTreeSettings(); |
+ |
+ cc::TaskGraphRunner* GetTaskGraphRunner(); |
+ |
+ // Used only when we have an internal display. |
+ std::unique_ptr<cc::OutputSurface> CreateDelegatedOutputSurface( |
+ gfx::AcceleratedWidget widget); |
+ |
+ private: |
+ explicit CompositorDepsProvider(bool use_internal_display); |
+ ~CompositorDepsProvider(); |
+ |
+ void GenerateLayerTreeSettings(cc::LayerTreeSettings* settings); |
+ |
+ const bool use_internal_display_; |
+ |
+ std::unique_ptr<cc::LayerTreeSettings> settings_; |
+ std::unique_ptr<BlimpGpuMemoryBufferManager> gpu_memory_buffer_manager_; |
+ std::unique_ptr<cc::TaskGraphRunner> task_graph_runner_; |
+ |
+ // Lazily created thread that will run the compositor rendering tasks and will |
+ // be shared by all compositor instances. |
+ std::unique_ptr<base::Thread> compositor_thread_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(CompositorDepsProvider); |
+}; |
+ |
+} // namespace client |
+} // namespace blimp |
+ |
+#endif // BLIMP_CLIENT_CORE_COMPOSITOR_COMPOSITOR_DEPS_PROVIDER_H_ |