diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-20 23:16:26 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-20 23:16:26 +0000 |
commit | 5be7da24155466bf0e9bf2e5fda1a581e549df8d (patch) | |
tree | e14153b1254d3eacaaa65a9997d7edf9775d4036 /chrome/plugin/plugin_channel_base.cc | |
parent | 8a92555e667090d8c6592ebe670628ca33b86ef0 (diff) | |
download | chromium_src-5be7da24155466bf0e9bf2e5fda1a581e549df8d.zip chromium_src-5be7da24155466bf0e9bf2e5fda1a581e549df8d.tar.gz chromium_src-5be7da24155466bf0e9bf2e5fda1a581e549df8d.tar.bz2 |
Use AutoReset (formerly ScopedBool) where possible.
This frequently saves a tiny bit of code, but even when it doesn't I think it's more future-proof (less error-prone).
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/399096
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32708 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/plugin/plugin_channel_base.cc')
-rw-r--r-- | chrome/plugin/plugin_channel_base.cc | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/chrome/plugin/plugin_channel_base.cc b/chrome/plugin/plugin_channel_base.cc index 7da4560..026b9e5 100644 --- a/chrome/plugin/plugin_channel_base.cc +++ b/chrome/plugin/plugin_channel_base.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -6,6 +6,7 @@ #include <stack> +#include "base/auto_reset.h" #include "base/hash_tables.h" #include "base/lazy_instance.h" #include "chrome/common/child_process.h" @@ -186,17 +187,15 @@ void PluginChannelBase::RemoveRoute(int route_id) { DCHECK(plugin_count_ >= 0); if (!plugin_count_) { - ListenerMap::iterator npobj_iter = npobject_listeners_.begin(); - in_remove_route_ = true; - while (npobj_iter != npobject_listeners_.end()) { + AutoReset auto_reset_in_remove_route(&in_remove_route_, true); + for (ListenerMap::iterator npobj_iter = npobject_listeners_.begin(); + npobj_iter != npobject_listeners_.end(); ++npobj_iter) { if (npobj_iter->second) npobj_iter->second->OnChannelError(); - npobj_iter++; } - in_remove_route_ = false; - PluginChannelMap::iterator iter = g_plugin_channels_.begin(); - while (iter != g_plugin_channels_.end()) { + for (PluginChannelMap::iterator iter = g_plugin_channels_.begin(); + iter != g_plugin_channels_.end(); ++iter) { if (iter->second == this) { #if defined(OS_POSIX) if (channel_valid()) { @@ -206,8 +205,6 @@ void PluginChannelBase::RemoveRoute(int route_id) { g_plugin_channels_.erase(iter); return; } - - iter++; } NOTREACHED(); |