Commit efa950d0 authored by gman@chromium.org's avatar gman@chromium.org

Adjust Query code to handle context lost

BUG=140116


Review URL: https://chromiumcodereview.appspot.com/10837105

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@149978 0039d316-1c4b-4281-b951-d872f2087c98
parent 293fa3c6
...@@ -3059,7 +3059,7 @@ void GLES2Implementation::DeleteQueriesEXTHelper( ...@@ -3059,7 +3059,7 @@ void GLES2Implementation::DeleteQueriesEXTHelper(
MustBeContextLost(); MustBeContextLost();
} }
} }
query_tracker_->RemoveQuery(queries[ii]); query_tracker_->RemoveQuery(queries[ii], context_lost_);
} }
helper_->DeleteQueriesEXTImmediate(n, queries); helper_->DeleteQueriesEXTImmediate(n, queries);
} }
......
...@@ -151,11 +151,12 @@ QueryTracker::Query* QueryTracker::GetQuery( ...@@ -151,11 +151,12 @@ QueryTracker::Query* QueryTracker::GetQuery(
return it != queries_.end() ? it->second : NULL; return it != queries_.end() ? it->second : NULL;
} }
void QueryTracker::RemoveQuery(GLuint client_id) { void QueryTracker::RemoveQuery(GLuint client_id, bool context_lost) {
(void)context_lost; // stop unused warning
QueryMap::iterator it = queries_.find(client_id); QueryMap::iterator it = queries_.find(client_id);
if (it != queries_.end()) { if (it != queries_.end()) {
Query* query = it->second; Query* query = it->second;
GPU_DCHECK(!query->Pending()); GPU_DCHECK(context_lost || !query->Pending());
query_sync_manager_.Free(query->info_); query_sync_manager_.Free(query->info_);
queries_.erase(it); queries_.erase(it);
delete query; delete query;
......
...@@ -150,7 +150,7 @@ class GLES2_IMPL_EXPORT QueryTracker { ...@@ -150,7 +150,7 @@ class GLES2_IMPL_EXPORT QueryTracker {
Query* CreateQuery(GLuint id, GLenum target); Query* CreateQuery(GLuint id, GLenum target);
Query* GetQuery(GLuint id); Query* GetQuery(GLuint id);
void RemoveQuery(GLuint id); void RemoveQuery(GLuint id, bool context_lost);
private: private:
typedef gpu::hash_map<GLuint, Query*> QueryMap; typedef gpu::hash_map<GLuint, Query*> QueryMap;
......
...@@ -115,7 +115,7 @@ TEST_F(QueryTrackerTest, Basic) { ...@@ -115,7 +115,7 @@ TEST_F(QueryTrackerTest, Basic) {
// Check we get nothing for a non-existent query. // Check we get nothing for a non-existent query.
EXPECT_TRUE(query_tracker_->GetQuery(kId2) == NULL); EXPECT_TRUE(query_tracker_->GetQuery(kId2) == NULL);
// Check we can delete the query. // Check we can delete the query.
query_tracker_->RemoveQuery(kId1); query_tracker_->RemoveQuery(kId1, false);
// Check we get nothing for a non-existent query. // Check we get nothing for a non-existent query.
EXPECT_TRUE(query_tracker_->GetQuery(kId1) == NULL); EXPECT_TRUE(query_tracker_->GetQuery(kId1) == NULL);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment