summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorjochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-11 08:15:33 +0000
committerjochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-11 08:15:33 +0000
commit42f9c700fff0a8c5089f4120908de48951ec957a (patch)
treeb3911deb25d310f6897cdf416b789309e7a3dac6 /chrome
parentb5ba4480dc52bbb92b04753aa6dce073a74438bf (diff)
downloadchromium_src-42f9c700fff0a8c5089f4120908de48951ec957a.zip
chromium_src-42f9c700fff0a8c5089f4120908de48951ec957a.tar.gz
chromium_src-42f9c700fff0a8c5089f4120908de48951ec957a.tar.bz2
Delete callbacks after use in canned browsing data helpers.
BUG=49750 TEST=Canned*.* Review URL: http://codereview.chromium.org/3178001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@55688 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/browsing_data_appcache_helper.cc1
-rw-r--r--chrome/browser/browsing_data_appcache_helper_unittest.cc11
-rw-r--r--chrome/browser/browsing_data_database_helper.cc1
-rw-r--r--chrome/browser/browsing_data_database_helper_unittest.cc17
-rw-r--r--chrome/browser/browsing_data_local_storage_helper.cc1
-rw-r--r--chrome/browser/browsing_data_local_storage_helper_unittest.cc17
6 files changed, 26 insertions, 22 deletions
diff --git a/chrome/browser/browsing_data_appcache_helper.cc b/chrome/browser/browsing_data_appcache_helper.cc
index 2e58c6b..66f9b79 100644
--- a/chrome/browser/browsing_data_appcache_helper.cc
+++ b/chrome/browser/browsing_data_appcache_helper.cc
@@ -130,4 +130,5 @@ void CannedBrowsingDataAppCacheHelper::Reset() {
void CannedBrowsingDataAppCacheHelper::StartFetching(
Callback0::Type* completion_callback) {
completion_callback->Run();
+ delete completion_callback;
}
diff --git a/chrome/browser/browsing_data_appcache_helper_unittest.cc b/chrome/browser/browsing_data_appcache_helper_unittest.cc
index e5631b1..f66e8d3 100644
--- a/chrome/browser/browsing_data_appcache_helper_unittest.cc
+++ b/chrome/browser/browsing_data_appcache_helper_unittest.cc
@@ -9,7 +9,7 @@
#include "testing/gtest/include/gtest/gtest.h"
namespace {
-class TestCompletionCallback : public CallbackRunner<Tuple0> {
+class TestCompletionCallback {
public:
TestCompletionCallback()
: have_result_(false) {
@@ -17,9 +17,10 @@ class TestCompletionCallback : public CallbackRunner<Tuple0> {
bool have_result() const { return have_result_; }
- virtual void RunWithParams(const Tuple0& params) {
+ void callback() {
have_result_ = true;
}
+
private:
bool have_result_;
};
@@ -40,7 +41,8 @@ TEST(CannedBrowsingDataAppCacheHelperTest, SetInfo) {
helper->AddAppCache(manifest3);
TestCompletionCallback callback;
- helper->StartFetching(&callback);
+ helper->StartFetching(
+ NewCallback(&callback, &TestCompletionCallback::callback));
ASSERT_TRUE(callback.have_result());
std::map<GURL, appcache::AppCacheInfoVector>& collection =
@@ -71,7 +73,8 @@ TEST(CannedBrowsingDataAppCacheHelperTest, Unique) {
helper->AddAppCache(manifest);
TestCompletionCallback callback;
- helper->StartFetching(&callback);
+ helper->StartFetching(
+ NewCallback(&callback, &TestCompletionCallback::callback));
ASSERT_TRUE(callback.have_result());
std::map<GURL, appcache::AppCacheInfoVector>& collection =
diff --git a/chrome/browser/browsing_data_database_helper.cc b/chrome/browser/browsing_data_database_helper.cc
index 11e5e6b..fee1e0f 100644
--- a/chrome/browser/browsing_data_database_helper.cc
+++ b/chrome/browser/browsing_data_database_helper.cc
@@ -150,4 +150,5 @@ void CannedBrowsingDataDatabaseHelper::Reset() {
void CannedBrowsingDataDatabaseHelper::StartFetching(
Callback1<const std::vector<DatabaseInfo>& >::Type* callback) {
callback->Run(database_info_);
+ delete callback;
}
diff --git a/chrome/browser/browsing_data_database_helper_unittest.cc b/chrome/browser/browsing_data_database_helper_unittest.cc
index b5368c4..051738a 100644
--- a/chrome/browser/browsing_data_database_helper_unittest.cc
+++ b/chrome/browser/browsing_data_database_helper_unittest.cc
@@ -8,9 +8,7 @@
#include "testing/gtest/include/gtest/gtest.h"
namespace {
-class TestCompletionCallback
- : public CallbackRunner<Tuple1<
- const std::vector<BrowsingDataDatabaseHelper::DatabaseInfo>& > > {
+class TestCompletionCallback {
public:
TestCompletionCallback()
: have_result_(false) {
@@ -22,11 +20,10 @@ class TestCompletionCallback
return result_;
}
- virtual void RunWithParams(
- const Tuple1<const std::vector<
- BrowsingDataDatabaseHelper::DatabaseInfo>& >& params) {
+ void callback(const std::vector<
+ BrowsingDataDatabaseHelper::DatabaseInfo>& info) {
have_result_ = true;
- result_ = params.a;
+ result_ = info;
}
private:
@@ -55,7 +52,8 @@ TEST(CannedBrowsingDataDatabaseTest, AddDatabase) {
helper->AddDatabase(origin2, db3, "");
TestCompletionCallback callback;
- helper->StartFetching(&callback);
+ helper->StartFetching(
+ NewCallback(&callback, &TestCompletionCallback::callback));
ASSERT_TRUE(callback.have_result());
std::vector<BrowsingDataDatabaseHelper::DatabaseInfo> result =
@@ -83,7 +81,8 @@ TEST(CannedBrowsingDataDatabaseTest, Unique) {
helper->AddDatabase(origin, db, "");
TestCompletionCallback callback;
- helper->StartFetching(&callback);
+ helper->StartFetching(
+ NewCallback(&callback, &TestCompletionCallback::callback));
ASSERT_TRUE(callback.have_result());
std::vector<BrowsingDataDatabaseHelper::DatabaseInfo> result =
diff --git a/chrome/browser/browsing_data_local_storage_helper.cc b/chrome/browser/browsing_data_local_storage_helper.cc
index 2193305..71c038c 100644
--- a/chrome/browser/browsing_data_local_storage_helper.cc
+++ b/chrome/browser/browsing_data_local_storage_helper.cc
@@ -155,4 +155,5 @@ void CannedBrowsingDataLocalStorageHelper::Reset() {
void CannedBrowsingDataLocalStorageHelper::StartFetching(
Callback1<const std::vector<LocalStorageInfo>& >::Type* callback) {
callback->Run(local_storage_info_);
+ delete callback;
}
diff --git a/chrome/browser/browsing_data_local_storage_helper_unittest.cc b/chrome/browser/browsing_data_local_storage_helper_unittest.cc
index 37c3555..8f3a9c6 100644
--- a/chrome/browser/browsing_data_local_storage_helper_unittest.cc
+++ b/chrome/browser/browsing_data_local_storage_helper_unittest.cc
@@ -8,9 +8,7 @@
#include "testing/gtest/include/gtest/gtest.h"
namespace {
-class TestCompletionCallback
- : public CallbackRunner<Tuple1<const std::vector<
- BrowsingDataLocalStorageHelper::LocalStorageInfo>& > > {
+class TestCompletionCallback {
public:
TestCompletionCallback()
: have_result_(false) {
@@ -23,11 +21,10 @@ class TestCompletionCallback
return result_;
}
- virtual void RunWithParams(
- const Tuple1<const std::vector<
- BrowsingDataLocalStorageHelper::LocalStorageInfo>& >& params) {
+ void callback(const std::vector<
+ BrowsingDataLocalStorageHelper::LocalStorageInfo>& info) {
have_result_ = true;
- result_ = params.a;
+ result_ = info;
}
private:
@@ -54,7 +51,8 @@ TEST(CannedBrowsingDataLocalStorageTest, AddLocalStorage) {
helper->AddLocalStorage(origin2);
TestCompletionCallback callback;
- helper->StartFetching(&callback);
+ helper->StartFetching(
+ NewCallback(&callback, &TestCompletionCallback::callback));
ASSERT_TRUE(callback.have_result());
std::vector<BrowsingDataLocalStorageHelper::LocalStorageInfo> result =
@@ -78,7 +76,8 @@ TEST(CannedBrowsingDataLocalStorageTest, Unique) {
helper->AddLocalStorage(origin);
TestCompletionCallback callback;
- helper->StartFetching(&callback);
+ helper->StartFetching(
+ NewCallback(&callback, &TestCompletionCallback::callback));
ASSERT_TRUE(callback.have_result());
std::vector<BrowsingDataLocalStorageHelper::LocalStorageInfo> result =