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

Issue 2691943010: Fix a data race on the ref count of AddToHomescreenDataFetcher (Closed)

Created:
3 years, 10 months ago by tzik
Modified:
3 years, 10 months ago
Reviewers:
dominickn, pkotwicz, gone
CC:
chromium-reviews, dominickn+watch_chromium.org, pkotwicz+watch_chromium.org, zpeng+watch_chromium.org, agrieve+watch_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Fix a data race on the ref count of AddToHomescreenDataFetcher AddToHomescreenDataFetcher has a non-thread-safe ref count. It posts itself to background threads, and posts itself back to the original thread. In the post-back phase of the previous code, the ref count is manipulated without any protection, and that causes a data race. This CL replaces the PostTask round trip with PostTaskAndReply, so that we touch the ref count only on the original thread. BUG=688072 Review-Url: https://codereview.chromium.org/2691943010 Cr-Commit-Position: refs/heads/master@{#451241} Committed: https://chromium.googlesource.com/chromium/src/+/99f46d6b1a2e559bf0f4f60fe59c2c0690e94ba8

Patch Set 1 #

Patch Set 2 : fix #

Total comments: 4

Patch Set 3 : +#include. +RetainedRef #

Unified diffs Side-by-side diffs Delta from patch set Stats (+29 lines, -18 lines) Patch
M chrome/browser/android/webapps/add_to_homescreen_data_fetcher.h View 2 chunks +8 lines, -2 lines 0 comments Download
M chrome/browser/android/webapps/add_to_homescreen_data_fetcher.cc View 1 2 5 chunks +21 lines, -16 lines 0 comments Download

Messages

Total messages: 27 (18 generated)
tzik
PTAL
3 years, 10 months ago (2017-02-16 13:22:51 UTC) #7
pkotwicz
I am not a reviewer. Your CL looks good to me though Can you include ...
3 years, 10 months ago (2017-02-16 14:27:49 UTC) #10
tzik
On 2017/02/16 14:27:49, pkotwicz wrote: > I am not a reviewer. Your CL looks good ...
3 years, 10 months ago (2017-02-16 17:49:51 UTC) #14
gone
Sending to dominickn@ because he's more familiar with it.
3 years, 10 months ago (2017-02-16 18:49:49 UTC) #16
dominickn
https://codereview.chromium.org/2691943010/diff/20001/chrome/browser/android/webapps/add_to_homescreen_data_fetcher.cc File chrome/browser/android/webapps/add_to_homescreen_data_fetcher.cc (right): https://codereview.chromium.org/2691943010/diff/20001/chrome/browser/android/webapps/add_to_homescreen_data_fetcher.cc#newcode11 chrome/browser/android/webapps/add_to_homescreen_data_fetcher.cc:11: #include "base/location.h" Nit: #include "base/task_runner_util.h" for base::PostTaskAndReplyWithResult https://codereview.chromium.org/2691943010/diff/20001/chrome/browser/android/webapps/add_to_homescreen_data_fetcher.cc#newcode297 chrome/browser/android/webapps/add_to_homescreen_data_fetcher.cc:297: ...
3 years, 10 months ago (2017-02-16 23:24:45 UTC) #17
tzik
https://codereview.chromium.org/2691943010/diff/20001/chrome/browser/android/webapps/add_to_homescreen_data_fetcher.cc File chrome/browser/android/webapps/add_to_homescreen_data_fetcher.cc (right): https://codereview.chromium.org/2691943010/diff/20001/chrome/browser/android/webapps/add_to_homescreen_data_fetcher.cc#newcode11 chrome/browser/android/webapps/add_to_homescreen_data_fetcher.cc:11: #include "base/location.h" On 2017/02/16 23:24:45, dominickn wrote: > Nit: ...
3 years, 10 months ago (2017-02-17 04:58:20 UTC) #19
dominickn
Thanks. lgtm
3 years, 10 months ago (2017-02-17 05:00:37 UTC) #21
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2691943010/40001
3 years, 10 months ago (2017-02-17 05:38:56 UTC) #24
commit-bot: I haz the power
3 years, 10 months ago (2017-02-17 06:17:37 UTC) #27
Message was sent while issue was closed.
Committed patchset #3 (id:40001) as
https://chromium.googlesource.com/chromium/src/+/99f46d6b1a2e559bf0f4f60fe59c...

Powered by Google App Engine
This is Rietveld 408576698