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

Side by Side Diff: gpu/command_buffer/service/fence_manager.h

Issue 2447533002: ui: Add ref-counting to GLFence class.
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 unified diff | Download patch
« no previous file with comments | « no previous file | gpu/command_buffer/service/fence_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_
OLDNEW
« no previous file with comments | « no previous file | gpu/command_buffer/service/fence_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698