Index: gpu/command_buffer/service/context_group.cc |
diff --git a/gpu/command_buffer/service/context_group.cc b/gpu/command_buffer/service/context_group.cc |
index b34f992d77b9ed553d55ce0a1fc42ae952ca8318..4f61b8546afa26de253d79fbe30a2d3e75ea9c12 100644 |
--- a/gpu/command_buffer/service/context_group.cc |
+++ b/gpu/command_buffer/service/context_group.cc |
@@ -242,6 +242,19 @@ bool IsNull(const base::WeakPtr<gles2::GLES2Decoder>& decoder) { |
return !decoder.get(); |
} |
+template <typename T> |
+class WeakPtrEquals { |
+ public: |
+ explicit WeakPtrEquals(T* t) : t_(t) {} |
+ |
+ bool operator()(const base::WeakPtr<T>& t) { |
+ return t.get() == t_; |
+ } |
+ |
+ private: |
+ T* const t_; |
+}; |
+ |
} // namespace anonymous |
bool ContextGroup::HaveContexts() { |
@@ -251,8 +264,8 @@ bool ContextGroup::HaveContexts() { |
} |
void ContextGroup::Destroy(GLES2Decoder* decoder, bool have_context) { |
- decoders_.erase(std::remove(decoders_.begin(), decoders_.end(), |
- decoder->AsWeakPtr()), |
+ decoders_.erase(std::remove_if(decoders_.begin(), decoders_.end(), |
+ WeakPtrEquals<gles2::GLES2Decoder>(decoder)), |
decoders_.end()); |
// If we still have contexts do nothing. |
if (HaveContexts()) { |