diff options
author | akalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-04 20:54:20 +0000 |
---|---|---|
committer | akalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-04 20:54:20 +0000 |
commit | eab9d01a2f673428cf1b8633e0a88697ae688408 (patch) | |
tree | c3796aad7c4ef9dcd559b759e7ca9386ca3554c7 /gpu | |
parent | 35e10e96455d71f04bf4756872290cc3563e74e7 (diff) | |
download | chromium_src-eab9d01a2f673428cf1b8633e0a88697ae688408.zip chromium_src-eab9d01a2f673428cf1b8633e0a88697ae688408.tar.gz chromium_src-eab9d01a2f673428cf1b8633e0a88697ae688408.tar.bz2 |
Fix even more remaining uses of WeakPtr<T>'s operator T* conversion
These cases weren't caught by the automated pass and/or needed to be
solved in another way than using .get().
BUG=245942
TBR=darin@chromium.org
Review URL: https://codereview.chromium.org/16226028
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@204036 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
-rw-r--r-- | gpu/command_buffer/service/context_group.cc | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/gpu/command_buffer/service/context_group.cc b/gpu/command_buffer/service/context_group.cc index b34f992..4f61b85 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()) { |