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

Issue 2686463003: [Extensions] Fix a data race in ChromeExtensionMessageFilter. (Closed)

Created:
3 years, 10 months ago by atuchin
Modified:
3 years, 10 months ago
Reviewers:
Devlin
CC:
chromium-reviews, chromium-apps-reviews_chromium.org, extensions-reviews_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

[Extensions] Fix a data race in ChromeExtensionMessageFilter. There is a data race in OnGetExtMessageBundleOnBlockingPool method. It calls InfoMap::extensions() on a blocking pool, but all InfoMap methods must be called on the IO thread. This CL does the following: 1. Add DCHECK_CURRENTRY_ON(..) in extensions::InfoMap. With those DCHECKs browser_tests.ExtensionApiTest.SharedModuleLocale starts crashing (because of a wrong thread). 2. Remove calls to IO-only methods from LoadMessageBundleSubstitutionMapWithImport and rename that function. 3. Use OnGetExtMessageBundle to collect all necessary information before posting a task to a blocking pool. 4. Remove NOTREACHED(), because an extension might be removed before OnGetExtMessageBundle message was received. TEST=browser_tests.ExtensionApiTest.SharedModuleLocale BUG= Review-Url: https://codereview.chromium.org/2686463003 Cr-Commit-Position: refs/heads/master@{#451339} Committed: https://chromium.googlesource.com/chromium/src/+/54e8d335c0e4bebe49fbb2cacc5e49c06f29dc6e

Patch Set 1 #

Patch Set 2 : [Extensions] Fix a data race in ChromeExtensionMessageFilter. #

Total comments: 7

Patch Set 3 : [Extensions] Fix a data race in ChromeExtensionMessageFilter. #

Total comments: 8

Patch Set 4 : [Extensions] Fix a data race in ChromeExtensionMessageFilter. #

Total comments: 4

Patch Set 5 : [Extensions] Fix a data race in ChromeExtensionMessageFilter. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+95 lines, -73 lines) Patch
M chrome/browser/renderer_host/chrome_extension_message_filter.h View 2 chunks +4 lines, -1 line 0 comments Download
M chrome/browser/renderer_host/chrome_extension_message_filter.cc View 1 2 3 4 2 chunks +51 lines, -7 lines 0 comments Download
M extensions/browser/info_map.h View 1 chunk +2 lines, -4 lines 0 comments Download
M extensions/browser/info_map.cc View 1 2 3 4 1 chunk +10 lines, -0 lines 0 comments Download
M extensions/common/file_util.h View 1 2 3 2 chunks +11 lines, -6 lines 0 comments Download
M extensions/common/file_util.cc View 1 2 3 2 chunks +17 lines, -55 lines 0 comments Download

Messages

Total messages: 20 (8 generated)
atuchin
https://codereview.chromium.org/2686463003/diff/20001/extensions/common/file_util.cc File extensions/common/file_util.cc (right): https://codereview.chromium.org/2686463003/diff/20001/extensions/common/file_util.cc#newcode536 extensions/common/file_util.cc:536: MessageBundle::SubstitutionMap* LoadMessageBundleSubstitutionMapFromPaths( In addition: What do you think about ...
3 years, 10 months ago (2017-02-08 05:51:42 UTC) #3
atuchin
On 2017/02/08 05:51:42, atuchin wrote: > https://codereview.chromium.org/2686463003/diff/20001/extensions/common/file_util.cc > File extensions/common/file_util.cc (right): > > https://codereview.chromium.org/2686463003/diff/20001/extensions/common/file_util.cc#newcode536 > ...
3 years, 10 months ago (2017-02-10 06:29:57 UTC) #5
Finnur
Devlin is a better candidate, I think.
3 years, 10 months ago (2017-02-10 15:00:08 UTC) #7
atuchin
On 2017/02/10 15:00:08, Finnur wrote: > Devlin is a better candidate, I think. Ping.
3 years, 10 months ago (2017-02-14 05:22:55 UTC) #8
Devlin
Mostly good, with one suggestion for an optimization. Thanks for the patch! :) https://codereview.chromium.org/2686463003/diff/20001/chrome/browser/renderer_host/chrome_extension_message_filter.cc File ...
3 years, 10 months ago (2017-02-14 17:45:49 UTC) #9
atuchin
Thanks for comments. PTAL! https://codereview.chromium.org/2686463003/diff/20001/chrome/browser/renderer_host/chrome_extension_message_filter.cc File chrome/browser/renderer_host/chrome_extension_message_filter.cc (right): https://codereview.chromium.org/2686463003/diff/20001/chrome/browser/renderer_host/chrome_extension_message_filter.cc#newcode239 chrome/browser/renderer_host/chrome_extension_message_filter.cc:239: extensions::LocaleInfo::GetDefaultLocale(extension), reply_msg)); On 2017/02/14 17:45:49, ...
3 years, 10 months ago (2017-02-15 08:17:29 UTC) #10
Devlin
Nice! Just a few last nits. https://codereview.chromium.org/2686463003/diff/40001/chrome/browser/renderer_host/chrome_extension_message_filter.cc File chrome/browser/renderer_host/chrome_extension_message_filter.cc (right): https://codereview.chromium.org/2686463003/diff/40001/chrome/browser/renderer_host/chrome_extension_message_filter.cc#newcode234 chrome/browser/renderer_host/chrome_extension_message_filter.cc:234: const std::string default_locale ...
3 years, 10 months ago (2017-02-16 16:20:56 UTC) #11
atuchin
Ок, all nits have fixed. Take a look. https://codereview.chromium.org/2686463003/diff/40001/chrome/browser/renderer_host/chrome_extension_message_filter.cc File chrome/browser/renderer_host/chrome_extension_message_filter.cc (right): https://codereview.chromium.org/2686463003/diff/40001/chrome/browser/renderer_host/chrome_extension_message_filter.cc#newcode234 chrome/browser/renderer_host/chrome_extension_message_filter.cc:234: const ...
3 years, 10 months ago (2017-02-17 06:22:02 UTC) #12
Devlin
lgtm; thanks for your work here! :) https://codereview.chromium.org/2686463003/diff/60001/chrome/browser/renderer_host/chrome_extension_message_filter.cc File chrome/browser/renderer_host/chrome_extension_message_filter.cc (right): https://codereview.chromium.org/2686463003/diff/60001/chrome/browser/renderer_host/chrome_extension_message_filter.cc#newcode236 chrome/browser/renderer_host/chrome_extension_message_filter.cc:236: if (default_locale.empty()) ...
3 years, 10 months ago (2017-02-17 15:57:39 UTC) #13
atuchin
Thanks for the review. https://codereview.chromium.org/2686463003/diff/60001/chrome/browser/renderer_host/chrome_extension_message_filter.cc File chrome/browser/renderer_host/chrome_extension_message_filter.cc (right): https://codereview.chromium.org/2686463003/diff/60001/chrome/browser/renderer_host/chrome_extension_message_filter.cc#newcode236 chrome/browser/renderer_host/chrome_extension_message_filter.cc:236: if (default_locale.empty()) { On 2017/02/17 ...
3 years, 10 months ago (2017-02-17 16:22:47 UTC) #14
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/2686463003/80001
3 years, 10 months ago (2017-02-17 16:23:23 UTC) #17
commit-bot: I haz the power
3 years, 10 months ago (2017-02-17 18:13:07 UTC) #20
Message was sent while issue was closed.
Committed patchset #5 (id:80001) as
https://chromium.googlesource.com/chromium/src/+/54e8d335c0e4bebe49fbb2cacc5e...

Powered by Google App Engine
This is Rietveld 408576698