diff options
author | teravest@chromium.org <teravest@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-07 04:56:53 +0000 |
---|---|---|
committer | teravest@chromium.org <teravest@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-07 04:56:53 +0000 |
commit | 34163b29888fc51bb25f851e2aac826288197490 (patch) | |
tree | f00cf5601b8221833f8ef2cc8b0089851736148d | |
parent | 2dc33bb4b2d2a6ad9d08063b9ee3af30f86fe610 (diff) | |
download | chromium_src-34163b29888fc51bb25f851e2aac826288197490.zip chromium_src-34163b29888fc51bb25f851e2aac826288197490.tar.gz chromium_src-34163b29888fc51bb25f851e2aac826288197490.tar.bz2 |
Pepper: Fix iteration bug in PluginVarTracker.
An earlier change had bad code for iterating over the live_vars_ map inside
PluginVarTracker, which caused unnecessary allocations (and out of memory
bugs).
BUG=238288
Review URL: https://chromiumcodereview.appspot.com/14874008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@198631 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | ppapi/proxy/plugin_var_tracker.cc | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/ppapi/proxy/plugin_var_tracker.cc b/ppapi/proxy/plugin_var_tracker.cc index 4561ac5..0b583d6 100644 --- a/ppapi/proxy/plugin_var_tracker.cc +++ b/ppapi/proxy/plugin_var_tracker.cc @@ -189,10 +189,12 @@ void PluginVarTracker::DidDeleteInstance(PP_Instance instance) { } void PluginVarTracker::DidDeleteDispatcher(PluginDispatcher* dispatcher) { - for (size_t i = 0; i < live_vars_.size(); ++i) { - if (live_vars_[i].var.get() == NULL) + for (VarMap::iterator it = live_vars_.begin(); + it != live_vars_.end(); + ++it) { + if (it->second.var.get() == NULL) continue; - ProxyObjectVar* object = live_vars_[i].var->AsProxyObjectVar(); + ProxyObjectVar* object = it->second.var->AsProxyObjectVar(); if (object && object->dispatcher() == dispatcher) object->clear_dispatcher(); } |