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

Issue 2054623002: Refactor HostContentSettingsMap::SetWebsiteSettingDefaultScope to take a std::unique_ptr. (Closed)

Created:
4 years, 6 months ago by dominickn
Modified:
3 years, 10 months ago
Reviewers:
raymes
CC:
chromium-reviews, mlamouri+watch-permissions_chromium.org, markusheintz_, msramek+watch_chromium.org, raymes+watch_chromium.org, chrome-apps-syd-reviews_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Refactor HostContentSettingsMap::SetWebsiteSettingDefaultScope to take a std::unique_ptr. Currently, HostContentSettingsMap::SetWebsiteSettingDefaultScope takes a raw base::Value*, and its clients typically release() a std::unique_ptr<base::Value> when calling it. However, this method returns without doing anything if provided with an invalid primary or secondary URL pattern (e.g. the view source page). When this happens, the base::Value is leaked, as it has been released() by its previous owner without being taken into a unique_ptr in SetWebsiteSettingsDefaultScope. This CL eliminates the leak by making the method take a std::unique_ptr, and adjusting its call sites to use either std::move or base::WrapUnique. BUG=618529 TBR=felt@chromium.org,mkwst@chromium.org,benwells@chromium.org Committed: https://crrev.com/d7e7fc45f0d5f84430707280a18dfe7d6217aed8 Cr-Commit-Position: refs/heads/master@{#398806}

Patch Set 1 #

Total comments: 4

Patch Set 2 : Addressing reviewer comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+43 lines, -23 lines) Patch
M chrome/browser/banners/app_banner_settings_helper.cc View 2 chunks +6 lines, -6 lines 0 comments Download
M chrome/browser/browsing_data/browsing_data_remover_unittest.cc View 2 chunks +7 lines, -7 lines 0 comments Download
M chrome/browser/content_settings/host_content_settings_map_unittest.cc View 1 3 chunks +21 lines, -1 line 0 comments Download
M chrome/browser/engagement/site_engagement_score.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/permissions/chooser_context_base.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/ssl/chrome_ssl_host_state_delegate.cc View 3 chunks +3 lines, -3 lines 0 comments Download
M chrome/browser/ssl/ssl_browser_tests.cc View 1 chunk +1 line, -1 line 0 comments Download
M components/content_settings/core/browser/host_content_settings_map.h View 1 chunk +1 line, -1 line 0 comments Download
M components/content_settings/core/browser/host_content_settings_map.cc View 2 chunks +2 lines, -2 lines 0 comments Download

Messages

Total messages: 16 (10 generated)
dominickn
raymes: PTAL, thanks!
4 years, 6 months ago (2016-06-09 03:05:49 UTC) #4
raymes
lgtm thanks Dom! https://codereview.chromium.org/2054623002/diff/1/chrome/browser/browsing_data/browsing_data_remover_unittest.cc File chrome/browser/browsing_data/browsing_data_remover_unittest.cc (right): https://codereview.chromium.org/2054623002/diff/1/chrome/browser/browsing_data/browsing_data_remover_unittest.cc#newcode29 chrome/browser/browsing_data/browsing_data_remover_unittest.cc:29: #include "build/build_config.h" Should probably include ptr_util.h ...
4 years, 6 months ago (2016-06-09 05:59:21 UTC) #8
dominickn
Thanks! https://codereview.chromium.org/2054623002/diff/1/chrome/browser/browsing_data/browsing_data_remover_unittest.cc File chrome/browser/browsing_data/browsing_data_remover_unittest.cc (right): https://codereview.chromium.org/2054623002/diff/1/chrome/browser/browsing_data/browsing_data_remover_unittest.cc#newcode29 chrome/browser/browsing_data/browsing_data_remover_unittest.cc:29: #include "build/build_config.h" On 2016/06/09 05:59:21, raymes wrote: > ...
4 years, 6 months ago (2016-06-09 06:09:44 UTC) #9
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2054623002/20001
4 years, 6 months ago (2016-06-09 07:17:34 UTC) #12
commit-bot: I haz the power
Committed patchset #2 (id:20001)
4 years, 6 months ago (2016-06-09 07:30:46 UTC) #14
commit-bot: I haz the power
4 years, 6 months ago (2016-06-09 07:32:23 UTC) #16
Message was sent while issue was closed.
Patchset 2 (id:??) landed as
https://crrev.com/d7e7fc45f0d5f84430707280a18dfe7d6217aed8
Cr-Commit-Position: refs/heads/master@{#398806}

Powered by Google App Engine
This is Rietveld 408576698