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

Unified Diff: gpu/command_buffer/service/fence_manager.h

Issue 2383753002: gpu: Add GpuFence framework.
Patch Set: rebase Created 4 years, 1 month 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: gpu/command_buffer/service/fence_manager.h
diff --git a/gpu/command_buffer/service/fence_manager.h b/gpu/command_buffer/service/fence_manager.h
new file mode 100644
index 0000000000000000000000000000000000000000..13c711b942bae63d58d47270ea720e9ab09e5f5c
--- /dev/null
+++ b/gpu/command_buffer/service/fence_manager.h
@@ -0,0 +1,43 @@
+// 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 GPU_COMMAND_BUFFER_SERVICE_FENCE_MANAGER_H_
+#define GPU_COMMAND_BUFFER_SERVICE_FENCE_MANAGER_H_
+
+#include <stdint.h>
+
+#include "base/containers/hash_tables.h"
+#include "base/macros.h"
+#include "base/memory/ref_counted.h"
+#include "gpu/gpu_export.h"
+
+namespace gl {
+class GLFence;
+}
+
+namespace gpu {
+namespace gles2 {
+
+// This class keeps track of the fences and their state.
+class GPU_EXPORT FenceManager {
+ public:
+ FenceManager();
+ ~FenceManager();
+
+ void Destroy(bool have_context);
+ void AddFence(std::unique_ptr<gl::GLFence> fence, int32_t service_id);
+ void RemoveFence(int32_t service_id);
+ gl::GLFence* LookupFence(int32_t service_id);
+
+ private:
+ typedef base::hash_map<int32_t, std::unique_ptr<gl::GLFence>> GLFenceMap;
+ GLFenceMap fences_;
+
+ DISALLOW_COPY_AND_ASSIGN(FenceManager);
+};
+
+} // namespage gles2
+} // namespace gpu
+
+#endif // GPU_COMMAND_BUFFER_SERVICE_FENCE_MANAGER_H_

Powered by Google App Engine
This is Rietveld 408576698