OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 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 ASH_SURFACES_SURFACE_CONTROLLER_H_ |
| 6 #define ASH_SURFACES_SURFACE_CONTROLLER_H_ |
| 7 |
| 8 #include "base/basictypes.h" |
| 9 #include "base/callback.h" |
| 10 #include "base/containers/scoped_ptr_hash_map.h" |
| 11 #include "base/files/scoped_file.h" |
| 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/memory/weak_ptr.h" |
| 15 #include "base/observer_list.h" |
| 16 #include "ui/gfx/geometry/size.h" |
| 17 #include "ui/gfx/gpu_memory_buffer.h" |
| 18 |
| 19 namespace cc { |
| 20 class ContextProvider; |
| 21 } |
| 22 |
| 23 namespace ui { |
| 24 class Layer; |
| 25 } |
| 26 |
| 27 namespace ash { |
| 28 |
| 29 class SurfaceController { |
| 30 public: |
| 31 using GraphicsBufferCreatedCallback = base::Callback<void(bool)>; |
| 32 |
| 33 SurfaceController(); |
| 34 ~SurfaceController(); |
| 35 |
| 36 void CreateGraphicsBufferFromGpuMemoryBufferHandle( |
| 37 uint32 id, |
| 38 const gfx::GpuMemoryBufferHandle& handle, |
| 39 const gfx::Size& size, |
| 40 gfx::BufferFormat format, |
| 41 const GraphicsBufferCreatedCallback& callback); |
| 42 void DestroyGraphicsBuffer(uint32 id); |
| 43 void AttachGraphicsBufferToTestShellSurface( |
| 44 uint32 buffer_id, |
| 45 const base::Closure& released_callback); |
| 46 |
| 47 ui::Layer* test_shell_surface_layer() { |
| 48 return test_shell_surface_layer_.get(); |
| 49 } |
| 50 |
| 51 private: |
| 52 void TextureReleased(scoped_refptr<cc::ContextProvider> context_provider, |
| 53 unsigned texture_id, |
| 54 unsigned image_id, |
| 55 const base::Closure& released_callback, |
| 56 uint32 sync_point, |
| 57 bool is_lost); |
| 58 |
| 59 base::ScopedPtrHashMap<int32, scoped_ptr<gfx::GpuMemoryBuffer>> |
| 60 gpu_memory_buffers_; |
| 61 scoped_ptr<ui::Layer> test_shell_surface_layer_; |
| 62 base::WeakPtrFactory<SurfaceController> weak_ptr_factory_; |
| 63 |
| 64 DISALLOW_COPY_AND_ASSIGN(SurfaceController); |
| 65 }; |
| 66 |
| 67 } // namespace ash |
| 68 |
| 69 #endif // ASH_SURFACES_SURFACE_CONTROLLER_H_ |
OLD | NEW |