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, |