summaryrefslogtreecommitdiffstats
path: root/chrome/browser/history
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 /chrome/browser/history
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
Diffstat (limited to 'chrome/browser/history')
-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
5 files changed, 16 insertions, 14 deletions
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_++;
}