Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5546)

Unified Diff: chrome/browser/android/cookies/cookies_fetcher.cc

Issue 2282153002: android: Remove CleanupReference from CookiesFetcher (Closed)
Patch Set: fix double delete Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/android/cookies/cookies_fetcher.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/cookies/cookies_fetcher.cc
diff --git a/chrome/browser/android/cookies/cookies_fetcher.cc b/chrome/browser/android/cookies/cookies_fetcher.cc
index 1711d7901beb9db11faec23da22f3ad06a171f88..6443c14b5c69c24b6d70e8d77d19ae2ef75baa38 100644
--- a/chrome/browser/android/cookies/cookies_fetcher.cc
+++ b/chrome/browser/android/cookies/cookies_fetcher.cc
@@ -24,10 +24,6 @@ CookiesFetcher::CookiesFetcher(JNIEnv* env, jobject obj, Profile* profile) {
CookiesFetcher::~CookiesFetcher() {
}
-void CookiesFetcher::Destroy(JNIEnv* env, const JavaParamRef<jobject>& obj) {
- delete this;
-}
-
void CookiesFetcher::PersistCookies(JNIEnv* env,
const JavaParamRef<jobject>& obj) {
Profile* profile = ProfileManager::GetPrimaryUserProfile();
@@ -62,12 +58,12 @@ void CookiesFetcher::PersistCookiesInternal(
// Nullable sometimes according to docs. There is no work need to be done
// but we can consider calling the Java callback with empty output.
if (!store) {
- jobject_.Reset();
+ delete this;
return;
}
- store->GetAllCookiesAsync(base::Bind(
- &CookiesFetcher::OnCookiesFetchFinished, base::Unretained(this)));
+ store->GetAllCookiesAsync(
+ base::Bind(&CookiesFetcher::OnCookiesFetchFinished, base::Owned(this)));
gone 2016/08/29 18:07:53 What destroys the object on this path? It seems t
boliu 2016/08/29 18:53:45 It's owned and so deleted by the callback. Look up
gone 2016/08/29 18:55:01 Sorry, I don't do many native code reviews :P
}
void CookiesFetcher::OnCookiesFetchFinished(const net::CookieList& cookies) {
@@ -94,9 +90,6 @@ void CookiesFetcher::OnCookiesFetchFinished(const net::CookieList& cookies) {
}
Java_CookiesFetcher_onCookieFetchFinished(env, jobject_, joa);
-
- // Give up the reference.
- jobject_.Reset();
}
static void RestoreToCookieJarInternal(net::URLRequestContextGetter* getter,
« no previous file with comments | « chrome/browser/android/cookies/cookies_fetcher.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698