| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_FENCE_MANAGER_H_ | 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_FENCE_MANAGER_H_ |
| 6 #define GPU_COMMAND_BUFFER_SERVICE_FENCE_MANAGER_H_ | 6 #define GPU_COMMAND_BUFFER_SERVICE_FENCE_MANAGER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "gpu/gpu_export.h" | 13 #include "gpu/gpu_export.h" |
| 14 | 14 |
| 15 namespace gl { | 15 namespace gl { |
| 16 class GLFence; | 16 class GLFence; |
| 17 } | 17 } |
| 18 | 18 |
| 19 namespace gpu { | 19 namespace gpu { |
| 20 namespace gles2 { | 20 namespace gles2 { |
| 21 | 21 |
| 22 // This class keeps track of the fences and their state. | 22 // This class keeps track of the fences and their state. |
| 23 class GPU_EXPORT FenceManager { | 23 class GPU_EXPORT FenceManager { |
| 24 public: | 24 public: |
| 25 FenceManager(); | 25 FenceManager(); |
| 26 ~FenceManager(); | 26 ~FenceManager(); |
| 27 | 27 |
| 28 void Destroy(bool have_context); | 28 void Destroy(bool have_context); |
| 29 void AddFence(std::unique_ptr<gl::GLFence> fence, int32_t service_id); | 29 void AddFence(gl::GLFence* fence, int32_t service_id); |
| 30 void RemoveFence(int32_t service_id); | 30 void RemoveFence(int32_t service_id); |
| 31 gl::GLFence* LookupFence(int32_t service_id); | 31 gl::GLFence* LookupFence(int32_t service_id); |
| 32 | 32 |
| 33 private: | 33 private: |
| 34 typedef base::hash_map<int32_t, std::unique_ptr<gl::GLFence>> GLFenceMap; | 34 typedef base::hash_map<int32_t, scoped_refptr<gl::GLFence>> GLFenceMap; |
| 35 GLFenceMap fences_; | 35 GLFenceMap fences_; |
| 36 | 36 |
| 37 DISALLOW_COPY_AND_ASSIGN(FenceManager); | 37 DISALLOW_COPY_AND_ASSIGN(FenceManager); |
| 38 }; | 38 }; |
| 39 | 39 |
| 40 } // namespage gles2 | 40 } // namespage gles2 |
| 41 } // namespace gpu | 41 } // namespace gpu |
| 42 | 42 |
| 43 #endif // GPU_COMMAND_BUFFER_SERVICE_FENCE_MANAGER_H_ | 43 #endif // GPU_COMMAND_BUFFER_SERVICE_FENCE_MANAGER_H_ |
| OLD | NEW |