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

Unified Diff: gpu/command_buffer/client/query_tracker.h

Issue 12278025: Shrink QueryTracker when freeing everything (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Restore buckets Created 7 years, 10 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
« no previous file with comments | « gpu/command_buffer/client/gles2_implementation.cc ('k') | gpu/command_buffer/client/query_tracker.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/client/query_tracker.h
diff --git a/gpu/command_buffer/client/query_tracker.h b/gpu/command_buffer/client/query_tracker.h
index 9df8d18ccb7cccb525ff8084fe0b7c9b5a8ec9e3..5341ae9ddc84be11413da95242026497564f8aff 100644
--- a/gpu/command_buffer/client/query_tracker.h
+++ b/gpu/command_buffer/client/query_tracker.h
@@ -7,7 +7,7 @@
#include <GLES2/gl2.h>
-#include <queue>
+#include <deque>
#include "../client/hash_tables.h"
#include "../common/gles2_cmd_format.h"
#include "gles2_impl_export.h"
@@ -26,19 +26,30 @@ class GLES2_IMPL_EXPORT QuerySyncManager {
public:
static const size_t kSyncsPerBucket = 4096;
+ struct Bucket {
+ explicit Bucket(QuerySync* sync_mem)
+ : syncs(sync_mem),
+ used_query_count(0) {
+ }
+ QuerySync* syncs;
+ unsigned used_query_count;
+ };
struct QueryInfo {
- QueryInfo(int32 id, uint32 offset, QuerySync* sync_mem)
- : shm_id(id),
+ QueryInfo(Bucket* bucket, int32 id, uint32 offset, QuerySync* sync_mem)
+ : bucket(bucket),
+ shm_id(id),
shm_offset(offset),
sync(sync_mem) {
}
QueryInfo()
- : shm_id(0),
+ : bucket(NULL),
+ shm_id(0),
shm_offset(0),
sync(NULL) {
}
+ Bucket* bucket;
int32 shm_id;
uint32 shm_offset;
QuerySync* sync;
@@ -49,11 +60,12 @@ class GLES2_IMPL_EXPORT QuerySyncManager {
bool Alloc(QueryInfo* info);
void Free(const QueryInfo& sync);
+ void Shrink();
private:
MappedMemoryManager* mapped_memory_;
- std::queue<QuerySync*> buckets_;
- std::queue<QueryInfo> free_queries_;
+ std::deque<Bucket*> buckets_;
+ std::deque<QueryInfo> free_queries_;
DISALLOW_COPY_AND_ASSIGN(QuerySyncManager);
};
@@ -143,6 +155,7 @@ class GLES2_IMPL_EXPORT QueryTracker {
Query* CreateQuery(GLuint id, GLenum target);
Query* GetQuery(GLuint id);
void RemoveQuery(GLuint id, bool context_lost);
+ void Shrink();
private:
typedef gpu::hash_map<GLuint, Query*> QueryMap;
« no previous file with comments | « gpu/command_buffer/client/gles2_implementation.cc ('k') | gpu/command_buffer/client/query_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698