summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-26 18:10:00 +0000
committerjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-26 18:10:00 +0000
commita3caa82f2d87ae876570d1fb9dd220c1e90104d4 (patch)
tree049c32974d5feb71d4e00e2031ddc3fc859da728
parentd5bdce9f860bb4d87b5d51d1d202c59ec8b851b4 (diff)
downloadchromium_src-a3caa82f2d87ae876570d1fb9dd220c1e90104d4.zip
chromium_src-a3caa82f2d87ae876570d1fb9dd220c1e90104d4.tar.gz
chromium_src-a3caa82f2d87ae876570d1fb9dd220c1e90104d4.tar.bz2
Coverity: Fix several pass-by-values.
CID=12543,12544,12758,12878,12879,12918,13252,13285,13301,13391 BUG=none TEST=none Review URL: http://codereview.chromium.org/4040003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@63910 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/autocomplete/autocomplete_popup_view_gtk.cc2
-rw-r--r--chrome/browser/automation/testing_automation_provider.cc10
-rw-r--r--chrome/browser/automation/testing_automation_provider.h4
-rw-r--r--chrome/browser/dom_ui/most_visited_handler.cc2
-rw-r--r--chrome/browser/dom_ui/most_visited_handler.h2
-rw-r--r--chrome/browser/history/in_memory_url_index.cc6
-rw-r--r--chrome/browser/history/in_memory_url_index.h2
-rw-r--r--chrome/browser/history/top_sites.cc9
-rw-r--r--chrome/browser/history/top_sites.h11
-rw-r--r--chrome/browser/history/top_sites_unittest.cc2
-rw-r--r--chrome/browser/renderer_host/resource_message_filter.cc10
-rw-r--r--chrome/browser/renderer_host/resource_message_filter.h2
-rw-r--r--chrome/browser/renderer_host/web_cache_manager.cc4
-rw-r--r--chrome/browser/renderer_host/web_cache_manager.h4
-rw-r--r--chrome/common/extensions/extension.cc2
-rw-r--r--chrome/common/extensions/extension.h2
16 files changed, 40 insertions, 34 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_popup_view_gtk.cc b/chrome/browser/autocomplete/autocomplete_popup_view_gtk.cc
index 3d3d4e8..9c8c1b8 100644
--- a/chrome/browser/autocomplete/autocomplete_popup_view_gtk.cc
+++ b/chrome/browser/autocomplete/autocomplete_popup_view_gtk.cc
@@ -111,7 +111,7 @@ size_t GetUTF8Offset(const std::wstring& wide_text, size_t wide_text_offset) {
void SetupLayoutForMatch(PangoLayout* layout,
const std::wstring& text,
- AutocompleteMatch::ACMatchClassifications classifications,
+ const AutocompleteMatch::ACMatchClassifications& classifications,
const GdkColor* base_color,
const GdkColor* dim_color,
const GdkColor* url_color,
diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc
index e4e1d53..75e064f 100644
--- a/chrome/browser/automation/testing_automation_provider.cc
+++ b/chrome/browser/automation/testing_automation_provider.cc
@@ -3815,14 +3815,15 @@ void TestingAutomationProvider::FillAutoFillProfile(
/* static */
ListValue* TestingAutomationProvider::GetListFromAutoFillProfiles(
- std::vector<AutoFillProfile*> autofill_profiles) {
+ const std::vector<AutoFillProfile*>& autofill_profiles) {
ListValue* profiles = new ListValue;
std::map<AutoFillFieldType, std::wstring> autofill_type_to_string
= GetAutoFillFieldToStringMap();
// For each AutoFillProfile, transform it to a dictionary object to return.
- for (std::vector<AutoFillProfile*>::iterator it = autofill_profiles.begin();
+ for (std::vector<AutoFillProfile*>::const_iterator it =
+ autofill_profiles.begin();
it != autofill_profiles.end(); ++it) {
AutoFillProfile* profile = *it;
DictionaryValue* profile_info = new DictionaryValue;
@@ -3842,14 +3843,15 @@ ListValue* TestingAutomationProvider::GetListFromAutoFillProfiles(
/* static */
ListValue* TestingAutomationProvider::GetListFromCreditCards(
- std::vector<CreditCard*> credit_cards) {
+ const std::vector<CreditCard*>& credit_cards) {
ListValue* cards = new ListValue;
std::map<AutoFillFieldType, std::wstring> credit_card_type_to_string =
GetCreditCardFieldToStringMap();
// For each AutoFillProfile, transform it to a dictionary object to return.
- for (std::vector<CreditCard*>::iterator it = credit_cards.begin();
+ for (std::vector<CreditCard*>::const_iterator it =
+ credit_cards.begin();
it != credit_cards.end(); ++it) {
CreditCard* card = *it;
DictionaryValue* card_info = new DictionaryValue;
diff --git a/chrome/browser/automation/testing_automation_provider.h b/chrome/browser/automation/testing_automation_provider.h
index 7f82ea5..9a0dec8 100644
--- a/chrome/browser/automation/testing_automation_provider.h
+++ b/chrome/browser/automation/testing_automation_provider.h
@@ -626,9 +626,9 @@ class TestingAutomationProvider : public AutomationProvider,
// for profiles and credit cards to a ListValue of DictionaryValues. The
// caller owns the returned object.
static ListValue* GetListFromAutoFillProfiles(
- std::vector<AutoFillProfile*> autofill_profiles);
+ const std::vector<AutoFillProfile*>& autofill_profiles);
static ListValue* GetListFromCreditCards(
- std::vector<CreditCard*> credit_cards);
+ const std::vector<CreditCard*>& credit_cards);
// Return the map from the internal data representation to the string value
// of auto fill fields and credit card fields.
diff --git a/chrome/browser/dom_ui/most_visited_handler.cc b/chrome/browser/dom_ui/most_visited_handler.cc
index bb10fe7..eac6702 100644
--- a/chrome/browser/dom_ui/most_visited_handler.cc
+++ b/chrome/browser/dom_ui/most_visited_handler.cc
@@ -449,7 +449,7 @@ void MostVisitedHandler::SetPagesValueFromTopSites(
}
void MostVisitedHandler::OnMostVisitedURLsAvailable(
- history::MostVisitedURLList data) {
+ const history::MostVisitedURLList& data) {
SetPagesValueFromTopSites(data);
if (got_first_most_visited_request_) {
SendPagesValue();
diff --git a/chrome/browser/dom_ui/most_visited_handler.h b/chrome/browser/dom_ui/most_visited_handler.h
index 92aaa2e..e589c66 100644
--- a/chrome/browser/dom_ui/most_visited_handler.h
+++ b/chrome/browser/dom_ui/most_visited_handler.h
@@ -80,7 +80,7 @@ class MostVisitedHandler : public DOMMessageHandler,
void SetPagesValueFromTopSites(const history::MostVisitedURLList& data);
// Callback for TopSites.
- void OnMostVisitedURLsAvailable(history::MostVisitedURLList data);
+ void OnMostVisitedURLsAvailable(const history::MostVisitedURLList& data);
// Puts the passed URL in the blacklist (so it does not show as a thumbnail).
void BlacklistURL(const GURL& url);
diff --git a/chrome/browser/history/in_memory_url_index.cc b/chrome/browser/history/in_memory_url_index.cc
index 654afdc..98c2acd 100644
--- a/chrome/browser/history/in_memory_url_index.cc
+++ b/chrome/browser/history/in_memory_url_index.cc
@@ -34,7 +34,9 @@ ScoredHistoryMatch::ScoredHistoryMatch(const URLRow& url_info,
}
struct InMemoryURLIndex::TermCharWordSet {
- TermCharWordSet(Char16Set char_set, WordIDSet word_id_set, bool used)
+ TermCharWordSet(const Char16Set& char_set,
+ const WordIDSet& word_id_set,
+ bool used)
: char_set_(char_set),
word_id_set_(word_id_set),
used_(used) {}
@@ -81,7 +83,7 @@ bool InMemoryURLIndex::Init(history::URLDatabase* history_db,
return true;
}
-bool InMemoryURLIndex::IndexRow(URLRow row) {
+bool InMemoryURLIndex::IndexRow(const URLRow& row) {
const GURL& gurl(row.url());
string16 url(net::FormatUrl(gurl, languages_,
net::kFormatUrlOmitUsernamePassword,
diff --git a/chrome/browser/history/in_memory_url_index.h b/chrome/browser/history/in_memory_url_index.h
index a2ac0f3..81336f1 100644
--- a/chrome/browser/history/in_memory_url_index.h
+++ b/chrome/browser/history/in_memory_url_index.h
@@ -159,7 +159,7 @@ class InMemoryURLIndex {
// URL History indexing support functions.
// Index one URL history item.
- bool IndexRow(URLRow row);
+ bool IndexRow(const URLRow& row);
// Break a string down into its individual characters.
// Note that this is temporarily intended to work on a single word, but
diff --git a/chrome/browser/history/top_sites.cc b/chrome/browser/history/top_sites.cc
index 31ce4ac..c314206 100644
--- a/chrome/browser/history/top_sites.cc
+++ b/chrome/browser/history/top_sites.cc
@@ -782,16 +782,15 @@ void TopSites::OnTopSitesAvailable(
}
// static
-void TopSites::ProcessPendingCallbacks(PendingCallbackSet pending_callbacks,
- const MostVisitedURLList& urls) {
- PendingCallbackSet::iterator i;
- for (i = pending_callbacks.begin();
+void TopSites::ProcessPendingCallbacks(
+ const PendingCallbackSet& pending_callbacks,
+ const MostVisitedURLList& urls) {
+ for (PendingCallbackSet::const_iterator i = pending_callbacks.begin();
i != pending_callbacks.end(); ++i) {
scoped_refptr<CancelableRequest<GetTopSitesCallback> > request = *i;
if (!request->canceled())
request->ForwardResult(GetTopSitesCallback::TupleType(urls));
}
- pending_callbacks.clear();
}
void TopSites::OnThumbnailAvailable(CancelableRequestProvider::Handle handle,
diff --git a/chrome/browser/history/top_sites.h b/chrome/browser/history/top_sites.h
index f080c05..c46ce927 100644
--- a/chrome/browser/history/top_sites.h
+++ b/chrome/browser/history/top_sites.h
@@ -48,8 +48,8 @@ typedef std::vector<MostVisitedURL> MostVisitedURLList;
// new tab page requests on the I/O thread without proxying to the UI thread is
// a nontrivial performance win, especially when the browser is starting and
// the UI thread is busy.
-class TopSites :
- public base::RefCountedThreadSafe<TopSites,
+class TopSites
+ : public base::RefCountedThreadSafe<TopSites,
BrowserThread::DeleteOnUIThread>,
public NotificationObserver,
public CancelableRequestProvider {
@@ -85,7 +85,7 @@ class TopSites :
const ThumbnailScore& score);
// Callback for GetMostVisitedURLs.
- typedef Callback1<MostVisitedURLList>::Type GetTopSitesCallback;
+ typedef Callback1<const MostVisitedURLList&>::Type GetTopSitesCallback;
typedef std::set<scoped_refptr<CancelableRequest<GetTopSitesCallback> > >
PendingCallbackSet;
@@ -188,8 +188,9 @@ class TopSites :
MostVisitedURLList data);
// Returns a list of urls to each pending callback.
- static void ProcessPendingCallbacks(PendingCallbackSet pending_callbacks,
- const MostVisitedURLList& urls);
+ static void ProcessPendingCallbacks(
+ const PendingCallbackSet& pending_callbacks,
+ const MostVisitedURLList& urls);
// Called when history service returns a thumbnail.
void OnThumbnailAvailable(CancelableRequestProvider::Handle handle,
diff --git a/chrome/browser/history/top_sites_unittest.cc b/chrome/browser/history/top_sites_unittest.cc
index 160b275..1439216 100644
--- a/chrome/browser/history/top_sites_unittest.cc
+++ b/chrome/browser/history/top_sites_unittest.cc
@@ -82,7 +82,7 @@ class TopSitesTest : public testing::Test {
}
// Callback for TopSites::GetMostVisitedURLs.
- void OnTopSitesAvailable(history::MostVisitedURLList data) {
+ void OnTopSitesAvailable(const history::MostVisitedURLList& data) {
urls_ = data;
number_of_callbacks_++;
}
diff --git a/chrome/browser/renderer_host/resource_message_filter.cc b/chrome/browser/renderer_host/resource_message_filter.cc
index c201a89..17b2d91 100644
--- a/chrome/browser/renderer_host/resource_message_filter.cc
+++ b/chrome/browser/renderer_host/resource_message_filter.cc
@@ -779,16 +779,18 @@ void ResourceMessageFilter::OnGetPluginInfoOnFileThread(
}
void ResourceMessageFilter::OnGotPluginInfo(bool found,
- WebPluginInfo info,
+ const WebPluginInfo& info,
const std::string& actual_mime_type,
const GURL& policy_url,
IPC::Message* reply_msg) {
ContentSetting setting = CONTENT_SETTING_DEFAULT;
if (found) {
- info.enabled = info.enabled &&
- plugin_service_->PrivatePluginAllowedForURL(info.path, policy_url);
+ WebPluginInfo info_copy = info;
+ info_copy.enabled = info_copy.enabled &&
+ plugin_service_->PrivatePluginAllowedForURL(info_copy.path, policy_url);
HostContentSettingsMap* map = profile_->GetHostContentSettingsMap();
- scoped_ptr<PluginGroup> group(PluginGroup::CopyOrCreatePluginGroup(info));
+ scoped_ptr<PluginGroup> group(
+ PluginGroup::CopyOrCreatePluginGroup(info_copy));
std::string resource = group->identifier();
setting = map->GetContentSetting(policy_url,
CONTENT_SETTINGS_TYPE_PLUGINS,
diff --git a/chrome/browser/renderer_host/resource_message_filter.h b/chrome/browser/renderer_host/resource_message_filter.h
index 399a122..15c97de 100644
--- a/chrome/browser/renderer_host/resource_message_filter.h
+++ b/chrome/browser/renderer_host/resource_message_filter.h
@@ -188,7 +188,7 @@ class ResourceMessageFilter : public IPC::ChannelProxy::MessageFilter,
const std::string& mime_type,
IPC::Message* reply_msg);
void OnGotPluginInfo(bool found,
- WebPluginInfo info,
+ const WebPluginInfo& info,
const std::string& actual_mime_type,
const GURL& policy_url,
IPC::Message* reply_msg);
diff --git a/chrome/browser/renderer_host/web_cache_manager.cc b/chrome/browser/renderer_host/web_cache_manager.cc
index 88baa7b..a9262ed 100644
--- a/chrome/browser/renderer_host/web_cache_manager.cc
+++ b/chrome/browser/renderer_host/web_cache_manager.cc
@@ -248,7 +248,7 @@ bool WebCacheManager::AttemptTactic(
return true;
}
-void WebCacheManager::AddToStrategy(std::set<int> renderers,
+void WebCacheManager::AddToStrategy(const std::set<int>& renderers,
AllocationTactic tactic,
size_t extra_bytes_to_allocate,
AllocationStrategy* strategy) {
@@ -304,7 +304,7 @@ void WebCacheManager::EnactStrategy(const AllocationStrategy& strategy) {
}
}
-void WebCacheManager::ClearRendederCache(std::set<int> renderers) {
+void WebCacheManager::ClearRendederCache(const std::set<int>& renderers) {
std::set<int>::const_iterator iter = renderers.begin();
for (; iter != renderers.end(); ++iter) {
RenderProcessHost* host = RenderProcessHost::FromID(*iter);
diff --git a/chrome/browser/renderer_host/web_cache_manager.h b/chrome/browser/renderer_host/web_cache_manager.h
index 248363e..1bd266b 100644
--- a/chrome/browser/renderer_host/web_cache_manager.h
+++ b/chrome/browser/renderer_host/web_cache_manager.h
@@ -162,7 +162,7 @@ class WebCacheManager {
// For each renderer in |renderers|, computes its allocation according to
// |tactic| and add the result to |strategy|. Any |extra_bytes_to_allocate|
// is divided evenly among the renderers.
- void AddToStrategy(std::set<int> renderers,
+ void AddToStrategy(const std::set<int>& renderers,
AllocationTactic tactic,
size_t extra_bytes_to_allocate,
AllocationStrategy* strategy);
@@ -172,7 +172,7 @@ class WebCacheManager {
void EnactStrategy(const AllocationStrategy& strategy);
// Inform all |renderers| to clear their cache.
- void ClearRendederCache(std::set<int> renderers);
+ void ClearRendederCache(const std::set<int>& renderers);
// Check to see if any active renderers have fallen inactive.
void FindInactiveRenderers();
diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc
index 74f6b22..e0cdc5d 100644
--- a/chrome/common/extensions/extension.cc
+++ b/chrome/common/extensions/extension.cc
@@ -2041,7 +2041,7 @@ GURL Extension::GetIconURL(int size, ExtensionIconSet::MatchType match_type) {
return GetResourceURL(path);
}
-bool Extension::CanSpecifyHostPermission(const URLPattern pattern) const {
+bool Extension::CanSpecifyHostPermission(const URLPattern& pattern) const {
if (!pattern.match_all_urls() &&
pattern.MatchesScheme(chrome::kChromeUIScheme)) {
// Only allow access to chrome://favicon to regular extensions. Component
diff --git a/chrome/common/extensions/extension.h b/chrome/common/extensions/extension.h
index 4aa662d..c073987 100644
--- a/chrome/common/extensions/extension.h
+++ b/chrome/common/extensions/extension.h
@@ -540,7 +540,7 @@ class Extension {
// the manifest. http, https, and chrome://favicon/ is allowed for all
// extensions, while component extensions are allowed access to
// chrome://resources.
- bool CanSpecifyHostPermission(const URLPattern pattern) const;
+ bool CanSpecifyHostPermission(const URLPattern& pattern) const;
// Whether the extension has access to the given URL.
bool HasHostPermission(const GURL& url) const;