Commit a50a34bc authored by tzik's avatar tzik Committed by Commit Bot

Avoid implicit first reference retention around AwQuotaManager

GetOriginsTask is ref counted, and its first reference is implicitly
retained by base::Bind() in GetOriginsTask::Run().
Though this case is safe, an upcoming base::Bind change rejects this
pattern of the first reference retention.

After this CL, the caller of GetOriginsTask::Run() keeps the first
reference to the GetOriginsTask instance to avoid the check failure.

Bug: 866456
Change-Id: Ia011ccc3b815a626200403b22c63b8133c83fbb0
Reviewed-on: https://chromium-review.googlesource.com/1158664
Commit-Queue: Taiju Tsuiki <tzik@chromium.org>
Reviewed-by: default avatarTao Bai <michaelbai@chromium.org>
Cr-Commit-Position: refs/heads/master@{#579873}
parent e297cf60
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "android_webview/browser/aw_content_browser_client.h" #include "android_webview/browser/aw_content_browser_client.h"
#include "base/android/jni_array.h" #include "base/android/jni_array.h"
#include "base/android/jni_string.h" #include "base/android/jni_string.h"
#include "base/memory/scoped_refptr.h"
#include "base/synchronization/waitable_event.h" #include "base/synchronization/waitable_event.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
#include "content/public/browser/storage_partition.h" #include "content/public/browser/storage_partition.h"
...@@ -251,8 +252,9 @@ void AwQuotaManagerBridge::GetOriginsOnUiThread(jint callback_id) { ...@@ -251,8 +252,9 @@ void AwQuotaManagerBridge::GetOriginsOnUiThread(jint callback_id) {
GetOriginsCallback ui_callback = GetOriginsCallback ui_callback =
base::BindOnce(&AwQuotaManagerBridge::GetOriginsCallbackImpl, base::BindOnce(&AwQuotaManagerBridge::GetOriginsCallbackImpl,
weak_factory_.GetWeakPtr(), callback_id); weak_factory_.GetWeakPtr(), callback_id);
base::MakeRefCounted<GetOriginsTask>(std::move(ui_callback),
(new GetOriginsTask(std::move(ui_callback), GetQuotaManager()))->Run(); GetQuotaManager())
->Run();
} }
void AwQuotaManagerBridge::GetOriginsCallbackImpl( void AwQuotaManagerBridge::GetOriginsCallbackImpl(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment