Index: ash/surfaces/surface_controller.h |
diff --git a/ash/surfaces/surface_controller.h b/ash/surfaces/surface_controller.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..53f90858e08d43471eec9510bdd092e315c424ee |
--- /dev/null |
+++ b/ash/surfaces/surface_controller.h |
@@ -0,0 +1,69 @@ |
+// Copyright 2015 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 ASH_SURFACES_SURFACE_CONTROLLER_H_ |
+#define ASH_SURFACES_SURFACE_CONTROLLER_H_ |
+ |
+#include "base/basictypes.h" |
+#include "base/callback.h" |
+#include "base/containers/scoped_ptr_hash_map.h" |
+#include "base/files/scoped_file.h" |
+#include "base/memory/ref_counted.h" |
+#include "base/memory/scoped_ptr.h" |
+#include "base/memory/weak_ptr.h" |
+#include "base/observer_list.h" |
+#include "ui/gfx/geometry/size.h" |
+#include "ui/gfx/gpu_memory_buffer.h" |
+ |
+namespace cc { |
+class ContextProvider; |
+} |
+ |
+namespace ui { |
+class Layer; |
+} |
+ |
+namespace ash { |
+ |
+class SurfaceController { |
+ public: |
+ using GraphicsBufferCreatedCallback = base::Callback<void(bool)>; |
+ |
+ SurfaceController(); |
+ ~SurfaceController(); |
+ |
+ void CreateGraphicsBufferFromGpuMemoryBufferHandle( |
+ uint32 id, |
+ const gfx::GpuMemoryBufferHandle& handle, |
+ const gfx::Size& size, |
+ gfx::BufferFormat format, |
+ const GraphicsBufferCreatedCallback& callback); |
+ void DestroyGraphicsBuffer(uint32 id); |
+ void AttachGraphicsBufferToTestShellSurface( |
+ uint32 buffer_id, |
+ const base::Closure& released_callback); |
+ |
+ ui::Layer* test_shell_surface_layer() { |
+ return test_shell_surface_layer_.get(); |
+ } |
+ |
+ private: |
+ void TextureReleased(scoped_refptr<cc::ContextProvider> context_provider, |
+ unsigned texture_id, |
+ unsigned image_id, |
+ const base::Closure& released_callback, |
+ uint32 sync_point, |
+ bool is_lost); |
+ |
+ base::ScopedPtrHashMap<int32, scoped_ptr<gfx::GpuMemoryBuffer>> |
+ gpu_memory_buffers_; |
+ scoped_ptr<ui::Layer> test_shell_surface_layer_; |
+ base::WeakPtrFactory<SurfaceController> weak_ptr_factory_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(SurfaceController); |
+}; |
+ |
+} // namespace ash |
+ |
+#endif // ASH_SURFACES_SURFACE_CONTROLLER_H_ |