Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Unified Diff: ash/surfaces/surface_controller.h

Issue 1394573003: chromeos: Add SurfaceServiceProvider. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..b892cb7ec14e6de196ee57849b1e560df0e72983
--- /dev/null
+++ b/ash/surfaces/surface_controller.h
@@ -0,0 +1,57 @@
+// 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/containers/scoped_ptr_hash_map.h"
+#include "base/files/scoped_file.h"
+#include "base/observer_list.h"
+#include "ui/gfx/geometry/size.h"
+#include "ui/gfx/gpu_memory_buffer.h"
+
+namespace ash {
+
+class SurfaceController {
+ public:
+ class Observer {
+ public:
+ virtual void OnTestSurfaceGpuMemoryBufferChanged() = 0;
+
+ protected:
+ virtual ~Observer() {}
+ };
+
+ using GraphicsBufferCreatedCallback = base::Callback<void(int32 buffer)>;
+
+ SurfaceController();
+ ~SurfaceController();
+
+ void AddObserver(Observer* observer);
+ void RemoveObserver(Observer* observer);
+
+ void CreateGraphicsBufferFromGpuMemoryBufferHandle(
+ const gfx::GpuMemoryBufferHandle& handle,
+ const gfx::Size& size,
+ gfx::BufferFormat format,
+ const GraphicsBufferCreatedCallback& callback);
+ void DestroyGraphicsBuffer(int32 buffer);
+ void SetTestSurfaceContents(int32 buffer);
+
+ gfx::GpuMemoryBuffer* GetTestSurfaceGpuMemoryBuffer() const;
+
+ private:
+ base::ScopedPtrHashMap<int32, scoped_ptr<gfx::GpuMemoryBuffer>>
+ gpu_memory_buffers_;
+ base::ObserverList<Observer> observers_;
+ int32 next_buffer_;
+ int32 test_surface_buffer_;
+
+ DISALLOW_COPY_AND_ASSIGN(SurfaceController);
+};
+
+} // namespace ash
+
+#endif // ASH_SURFACES_SURFACE_CONTROLLER_H_

Powered by Google App Engine
This is Rietveld 408576698