| Index: gpu/command_buffer/service/gles2_cmd_decoder.cc | 
| diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc | 
| index 25509d8d7ee346ae696b01c6302758a7ad86447d..12909356d94a48cf7137a5edbe338c0a3a836978 100644 | 
| --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc | 
| +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc | 
| @@ -9349,8 +9349,9 @@ void GLES2DecoderImpl::DeleteQueriesEXTHelper( | 
| for (GLsizei ii = 0; ii < n; ++ii) { | 
| QueryManager::Query* query = query_manager_->GetQuery(client_ids[ii]); | 
| if (query && !query->IsDeleted()) { | 
| -      ContextState::QueryMap::iterator it = | 
| -          state_.current_queries.find(query->target()); | 
| +      bool internal = query->serial() != 0; | 
| +      ContextState::QueryMap::iterator it = state_.current_queries.find( | 
| +          std::make_pair(query->target(), internal)); | 
| if (it != state_.current_queries.end()) | 
| state_.current_queries.erase(it); | 
|  | 
| @@ -9411,6 +9412,9 @@ error::Error GLES2DecoderImpl::HandleBeginQueryEXT( | 
| GLuint client_id = static_cast<GLuint>(c.id); | 
| int32 sync_shm_id = static_cast<int32>(c.sync_data_shm_id); | 
| uint32 sync_shm_offset = static_cast<uint32>(c.sync_data_shm_offset); | 
| +  uint32 serial = static_cast<uint32>(c.serial); | 
| +  bool internal = serial != 0; | 
| +  ContextState::QueryKey key = std::make_pair(target, internal); | 
|  | 
| switch (target) { | 
| case GL_COMMANDS_ISSUED_CHROMIUM: | 
| @@ -9429,7 +9433,7 @@ error::Error GLES2DecoderImpl::HandleBeginQueryEXT( | 
| break; | 
| } | 
|  | 
| -  if (state_.current_queries.find(target) != state_.current_queries.end()) { | 
| +  if (state_.current_queries.find(key) != state_.current_queries.end()) { | 
| LOCAL_SET_GL_ERROR( | 
| GL_INVALID_OPERATION, "glBeginQueryEXT", "query already in progress"); | 
| return error::kNoError; | 
| @@ -9462,6 +9466,7 @@ error::Error GLES2DecoderImpl::HandleBeginQueryEXT( | 
| // } | 
| query = query_manager_->CreateQuery( | 
| target, client_id, sync_shm_id, sync_shm_offset); | 
| +    query->set_serial(serial); | 
| } | 
|  | 
| if (query->target() != target) { | 
| @@ -9478,7 +9483,7 @@ error::Error GLES2DecoderImpl::HandleBeginQueryEXT( | 
| return error::kOutOfBounds; | 
| } | 
|  | 
| -  state_.current_queries[target] = query; | 
| +  state_.current_queries[key] = query; | 
| return error::kNoError; | 
| } | 
|  | 
| @@ -9486,7 +9491,10 @@ error::Error GLES2DecoderImpl::HandleEndQueryEXT( | 
| uint32 immediate_data_size, const cmds::EndQueryEXT& c) { | 
| GLenum target = static_cast<GLenum>(c.target); | 
| uint32 submit_count = static_cast<GLuint>(c.submit_count); | 
| -  ContextState::QueryMap::iterator it = state_.current_queries.find(target); | 
| +  uint32 serial = static_cast<uint32>(c.serial); | 
| +  bool internal = serial != 0; | 
| +  ContextState::QueryKey key = std::make_pair(target, internal); | 
| +  ContextState::QueryMap::iterator it = state_.current_queries.find(key); | 
|  | 
| if (it == state_.current_queries.end()) { | 
| LOCAL_SET_GL_ERROR( | 
|  |