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

Issue 2228743002: Rework some UserScriptLoader logic in preparation to removing UserScript copy. (Closed)

Created:
4 years, 4 months ago by lazyboy
Modified:
4 years, 4 months ago
Reviewers:
Devlin
CC:
chromium-reviews, chromium-apps-reviews_chromium.org, extensions-reviews_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Rework some UserScriptLoader logic in preparation to removing UserScript copy. Script removal does not need to store and operate on whole UserScript object, only the scripts' id and host_id are enough. Make UserScriptLoader::RemoveScript(s) take those ids (called UserScriptIDPair). WebViewContentScriptManager also doesn't need the list of entire UserScript, make them use UserScriptIDPair as well. All the places that adds scripts usign UserScriptLoader::AddScripts, we already have scripts with unique IDs generated. So turn those std::set of scripts to std::vectors. Also add a dcheck that they are indeed unique. BUG=622464 Committed: https://crrev.com/4884705e76ea2cda9dc7a5f189ecbba23ae5fb98 Cr-Commit-Position: refs/heads/master@{#411804}

Patch Set 1 #

Total comments: 22

Patch Set 2 : sync @tott #

Patch Set 3 : address comments #

Patch Set 4 : change UserScriptIDPair to set from map #

Patch Set 5 : fix DCHECK #

Total comments: 10

Patch Set 6 : address comments from Devlin #

Patch Set 7 : remove DCHECK as it is wrong #

Total comments: 4

Patch Set 8 : address comments #

Patch Set 9 : sync @tott #

Unified diffs Side-by-side diffs Delta from patch set Stats (+134 lines, -94 lines) Patch
M chrome/browser/extensions/shared_user_script_master.h View 1 2 3 4 5 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/extensions/shared_user_script_master.cc View 1 2 1 chunk +13 lines, -10 lines 0 comments Download
M extensions/browser/api/guest_view/web_view/web_view_internal_api.cc View 1 2 3 4 5 6 7 8 3 chunks +3 lines, -4 lines 0 comments Download
M extensions/browser/declarative_user_script_master.h View 1 2 3 4 5 6 7 8 3 chunks +4 lines, -2 lines 0 comments Download
M extensions/browser/declarative_user_script_master.cc View 1 2 3 4 5 6 7 8 1 chunk +8 lines, -11 lines 0 comments Download
M extensions/browser/guest_view/web_view/web_view_content_script_manager.h View 1 2 3 4 5 6 7 8 2 chunks +2 lines, -2 lines 0 comments Download
M extensions/browser/guest_view/web_view/web_view_content_script_manager.cc View 1 2 3 4 5 6 7 8 6 chunks +15 lines, -16 lines 0 comments Download
M extensions/browser/user_script_loader.h View 1 2 3 4 5 6 7 8 4 chunks +13 lines, -9 lines 0 comments Download
M extensions/browser/user_script_loader.cc View 1 2 3 4 5 6 7 8 4 chunks +53 lines, -37 lines 0 comments Download
M extensions/browser/web_ui_user_script_loader.h View 1 2 3 4 5 6 7 8 1 chunk +1 line, -1 line 0 comments Download
M extensions/browser/web_ui_user_script_loader.cc View 1 2 3 4 5 6 7 8 1 chunk +1 line, -1 line 0 comments Download
M extensions/common/user_script.h View 1 2 3 1 chunk +11 lines, -0 lines 0 comments Download
M extensions/common/user_script.cc View 1 2 3 1 chunk +9 lines, -0 lines 0 comments Download

Messages

Total messages: 27 (14 generated)
lazyboy
https://codereview.chromium.org/2228743002/diff/1/extensions/browser/user_script_loader.cc File extensions/browser/user_script_loader.cc (left): https://codereview.chromium.org/2228743002/diff/1/extensions/browser/user_script_loader.cc#oldcode251 extensions/browser/user_script_loader.cc:251: user_scripts_->insert( This is a major source of copy, because ...
4 years, 4 months ago (2016-08-09 00:48:51 UTC) #4
Devlin
https://codereview.chromium.org/2228743002/diff/1/chrome/browser/extensions/shared_user_script_master.cc File chrome/browser/extensions/shared_user_script_master.cc (right): https://codereview.chromium.org/2228743002/diff/1/chrome/browser/extensions/shared_user_script_master.cc#newcode53 chrome/browser/extensions/shared_user_script_master.cc:53: UserScript script_copy = script; This is actually two copies ...
4 years, 4 months ago (2016-08-09 23:28:55 UTC) #7
lazyboy
https://codereview.chromium.org/2228743002/diff/1/chrome/browser/extensions/shared_user_script_master.cc File chrome/browser/extensions/shared_user_script_master.cc (right): https://codereview.chromium.org/2228743002/diff/1/chrome/browser/extensions/shared_user_script_master.cc#newcode53 chrome/browser/extensions/shared_user_script_master.cc:53: UserScript script_copy = script; On 2016/08/09 23:28:54, Devlin wrote: ...
4 years, 4 months ago (2016-08-10 00:03:41 UTC) #8
Devlin
(just responding, will take another look later today) https://codereview.chromium.org/2228743002/diff/1/extensions/browser/user_script_loader.cc File extensions/browser/user_script_loader.cc (right): https://codereview.chromium.org/2228743002/diff/1/extensions/browser/user_script_loader.cc#newcode201 extensions/browser/user_script_loader.cc:201: removed_script_hosts_map_[id_pair.id] ...
4 years, 4 months ago (2016-08-10 16:22:40 UTC) #9
lazyboy
https://codereview.chromium.org/2228743002/diff/1/extensions/browser/user_script_loader.cc File extensions/browser/user_script_loader.cc (right): https://codereview.chromium.org/2228743002/diff/1/extensions/browser/user_script_loader.cc#newcode201 extensions/browser/user_script_loader.cc:201: removed_script_hosts_map_[id_pair.id] = id_pair.host_id; On 2016/08/10 16:22:40, Devlin wrote: > ...
4 years, 4 months ago (2016-08-10 22:39:54 UTC) #10
Devlin
nit: You also have a typo in the description with "usign" and capitalization in UserScriptIDPair. ...
4 years, 4 months ago (2016-08-11 01:09:27 UTC) #11
lazyboy
Fixed typos in the CL description. Kudos for reviewing on phone, you must have super ...
4 years, 4 months ago (2016-08-11 01:51:06 UTC) #13
lazyboy
https://codereview.chromium.org/2228743002/diff/80001/extensions/browser/user_script_loader.cc File extensions/browser/user_script_loader.cc (right): https://codereview.chromium.org/2228743002/diff/80001/extensions/browser/user_script_loader.cc#newcode205 extensions/browser/user_script_loader.cc:205: DCHECK(added_scripts_map_.count(id_pair.id) > 0u); On 2016/08/11 01:51:06, lazyboy wrote: > ...
4 years, 4 months ago (2016-08-11 02:00:22 UTC) #14
Devlin
lgtm https://codereview.chromium.org/2228743002/diff/120001/extensions/browser/user_script_loader.cc File extensions/browser/user_script_loader.cc (right): https://codereview.chromium.org/2228743002/diff/120001/extensions/browser/user_script_loader.cc#newcode279 extensions/browser/user_script_loader.cc:279: const UserScript& script = id_and_script.second; Apparently reviewing on ...
4 years, 4 months ago (2016-08-11 16:40:00 UTC) #15
lazyboy
https://codereview.chromium.org/2228743002/diff/120001/extensions/browser/user_script_loader.cc File extensions/browser/user_script_loader.cc (right): https://codereview.chromium.org/2228743002/diff/120001/extensions/browser/user_script_loader.cc#newcode279 extensions/browser/user_script_loader.cc:279: const UserScript& script = id_and_script.second; On 2016/08/11 16:40:00, Devlin ...
4 years, 4 months ago (2016-08-11 17:59:05 UTC) #16
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/2228743002/160001
4 years, 4 months ago (2016-08-12 22:18:39 UTC) #23
commit-bot: I haz the power
Committed patchset #9 (id:160001)
4 years, 4 months ago (2016-08-12 22:37:45 UTC) #25
commit-bot: I haz the power
4 years, 4 months ago (2016-08-12 22:45:10 UTC) #27
Message was sent while issue was closed.
Patchset 9 (id:??) landed as
https://crrev.com/4884705e76ea2cda9dc7a5f189ecbba23ae5fb98
Cr-Commit-Position: refs/heads/master@{#411804}

Powered by Google App Engine
This is Rietveld 408576698