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

Issue 2898723003: [Sync] Migrate SyncInternalsMessageHandler off CallJavascriptFunctionUnsafe. (Closed)

Created:
3 years, 7 months ago by skym
Modified:
3 years, 7 months ago
CC:
chromium-reviews, ios-reviews+chrome_chromium.org, ios-reviews_chromium.org, pkl (ping after 24h if needed), noyau+watch_chromium.org, marq+watch_chromium.org, sync-reviews_chromium.org
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

[Sync] Migrate SyncInternalsMessageHandler off CallJavascriptFunctionUnsafe. This CL is a result of comments in https://codereview.chromium.org/2872023002/ that became too large to be included in the original code review. These changes should make SyncInternalsMessageHandler behave more safely in regards to when javascript methods are invoked, as well as increasing test coverage. * Replaced CallJavascriptFunctionUnsafe with CallJavascriptFunction. This mostly worked by adding AllowJavascript to all callbacks from javascript, and unregistering from model callbacks/observations in OnJavascriptDisallowed(). However, this didn't work for OnReceivedAllNodes, which is called asycronously. Instead we need to manually verify IsJavascriptAllowed() is still true. * Moved SigninManagerBase accessor from ProfileSyncService to SyncService[Base]. This allowed us to remove the SyncManagerBase param from the ConstructAboutInformation function. In general we want to move things out of ProfileSyncService that don't have a reason to be there. * Reworked how SyncInternalsMessageHandler accesses a SyncService to facilitate unit tests. * Replaced extractor with callback to be more similar to SyncService injection pattern. * Added test coverage for registration/unregistration. BUG=719044 Review-Url: https://codereview.chromium.org/2898723003 Cr-Commit-Position: refs/heads/master@{#474755} Committed: https://chromium.googlesource.com/chromium/src/+/b522e5fd22c3454dff23fc48b43bafebd160a543

Patch Set 1 #

Patch Set 2 : Self review. #

Patch Set 3 : Removed unused browser_state. #

Patch Set 4 : Fix Android compile. #

Total comments: 6

Patch Set 5 : Updates for dbeam and fixing windows browser test. #

Total comments: 8

Patch Set 6 : More updates for dbeam. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+401 lines, -184 lines) Patch
M chrome/browser/feedback/system_logs/log_sources/chrome_internal_log_source.cc View 2 chunks +5 lines, -2 lines 0 comments Download
M chrome/browser/sync/profile_sync_service_android.cc View 1 2 3 1 chunk +2 lines, -2 lines 0 comments Download
M chrome/browser/sync/test/integration/profile_sync_service_harness.cc View 1 chunk +2 lines, -2 lines 0 comments Download
M chrome/browser/ui/webui/sync_internals_message_handler.h View 6 chunks +30 lines, -20 lines 0 comments Download
M chrome/browser/ui/webui/sync_internals_message_handler.cc View 1 2 3 4 5 8 chunks +103 lines, -83 lines 0 comments Download
M chrome/browser/ui/webui/sync_internals_message_handler_unittest.cc View 1 2 3 4 5 4 chunks +226 lines, -41 lines 0 comments Download
M components/browser_sync/profile_sync_service.h View 1 1 chunk +0 lines, -2 lines 0 comments Download
M components/browser_sync/profile_sync_service.cc View 1 chunk +0 lines, -7 lines 0 comments Download
M components/sync/driver/about_sync_util.h View 2 chunks +0 lines, -3 lines 0 comments Download
M components/sync/driver/about_sync_util.cc View 2 chunks +2 lines, -3 lines 0 comments Download
M components/sync/driver/about_sync_util_unittest.cc View 1 chunk +2 lines, -2 lines 0 comments Download
M components/sync/driver/fake_sync_service.h View 1 chunk +1 line, -0 lines 0 comments Download
M components/sync/driver/fake_sync_service.cc View 1 chunk +4 lines, -0 lines 0 comments Download
M components/sync/driver/sync_service.h View 1 2 chunks +5 lines, -0 lines 0 comments Download
M components/sync/driver/sync_service_base.h View 1 chunk +1 line, -0 lines 0 comments Download
M components/sync/driver/sync_service_base.cc View 2 chunks +10 lines, -5 lines 0 comments Download
M components/sync/engine/events/protocol_event.cc View 2 chunks +6 lines, -4 lines 0 comments Download
M ios/chrome/browser/ui/webui/sync_internals/sync_internals_message_handler.cc View 1 2 3 chunks +2 lines, -8 lines 0 comments Download

Dependent Patchsets:

Messages

Total messages: 31 (22 generated)
skym
PTAL afakhry@ for chrome/browser/feedback/system_logs/log_sources/chrome_internal_log_source.cc dbeam@ for chrome/browser/ui/webui/sync_internals_message_handler.* pnoland@ for everything else.
3 years, 7 months ago (2017-05-22 21:55:44 UTC) #9
afakhry
feedback lgtm.
3 years, 7 months ago (2017-05-22 23:31:39 UTC) #14
Dan Beam
https://codereview.chromium.org/2898723003/diff/60001/chrome/browser/ui/webui/sync_internals_message_handler.cc File chrome/browser/ui/webui/sync_internals_message_handler.cc (right): https://codereview.chromium.org/2898723003/diff/60001/chrome/browser/ui/webui/sync_internals_message_handler.cc#newcode58 chrome/browser/ui/webui/sync_internals_message_handler.cc:58: UnregisterModelNotifications(); can we just call weak_ptr_factory_.InvalidateWeakPtrs() here to sever ...
3 years, 7 months ago (2017-05-22 23:31:43 UTC) #15
skym
Updates for dbeam and fixing windows browser test. https://codereview.chromium.org/2898723003/diff/60001/chrome/browser/ui/webui/sync_internals_message_handler.cc File chrome/browser/ui/webui/sync_internals_message_handler.cc (right): https://codereview.chromium.org/2898723003/diff/60001/chrome/browser/ui/webui/sync_internals_message_handler.cc#newcode58 chrome/browser/ui/webui/sync_internals_message_handler.cc:58: UnregisterModelNotifications(); ...
3 years, 7 months ago (2017-05-24 00:20:16 UTC) #20
Patrick Noland
lgtm
3 years, 7 months ago (2017-05-25 00:13:41 UTC) #23
Dan Beam
lgtm! https://codereview.chromium.org/2898723003/diff/80001/chrome/browser/ui/webui/sync_internals_message_handler.cc File chrome/browser/ui/webui/sync_internals_message_handler.cc (right): https://codereview.chromium.org/2898723003/diff/80001/chrome/browser/ui/webui/sync_internals_message_handler.cc#newcode121 chrome/browser/ui/webui/sync_internals_message_handler.cc:121: } nit: no curlies https://codereview.chromium.org/2898723003/diff/80001/chrome/browser/ui/webui/sync_internals_message_handler.cc#newcode249 chrome/browser/ui/webui/sync_internals_message_handler.cc:249: if (!service) ...
3 years, 7 months ago (2017-05-25 00:28:21 UTC) #24
skym
https://codereview.chromium.org/2898723003/diff/80001/chrome/browser/ui/webui/sync_internals_message_handler.cc File chrome/browser/ui/webui/sync_internals_message_handler.cc (right): https://codereview.chromium.org/2898723003/diff/80001/chrome/browser/ui/webui/sync_internals_message_handler.cc#newcode121 chrome/browser/ui/webui/sync_internals_message_handler.cc:121: } On 2017/05/25 00:28:20, Dan Beam wrote: > nit: ...
3 years, 7 months ago (2017-05-25 17:38:12 UTC) #25
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/2898723003/100001
3 years, 7 months ago (2017-05-25 17:38:48 UTC) #28
commit-bot: I haz the power
3 years, 7 months ago (2017-05-25 19:36:36 UTC) #31
Message was sent while issue was closed.
Committed patchset #6 (id:100001) as
https://chromium.googlesource.com/chromium/src/+/b522e5fd22c3454dff23fc48b43b...

Powered by Google App Engine
This is Rietveld 408576698