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

Issue 1220473002: Introduce a SetRegValueWorkItem overload that accepts a callback instead (...) (Closed)

Created:
5 years, 6 months ago by gab
Modified:
5 years, 5 months ago
Reviewers:
grt (UTC plus 2)
CC:
chromium-reviews, grt+watch_chromium.org, wfh+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Introduce a SetRegValueWorkItem overload that accepts a callback instead of a fixed value. The callback is used to determine the desired value after inspecting the existing value. Also modified the existing test's paradigm to bring it up to modern days (from initial.commit!) and added some more tests to cover this new use case. Bypassing the wstring usage presubmit warnings because we will likely want to merge this, will consider fixing the API on trunk after. BUG=488247, 502363 NOPRESUBMIT=true Committed: https://crrev.com/69821f190e784c132d598e07433165c934ee3087 Cr-Commit-Position: refs/heads/master@{#337164}

Patch Set 1 : #

Total comments: 18

Patch Set 2 : review:grt #

Total comments: 7

Patch Set 3 : review:grt 2 #

Patch Set 4 : adopt grt's suggestion #

Unified diffs Side-by-side diffs Delta from patch set Stats (+362 lines, -152 lines) Patch
M chrome/installer/util/set_reg_value_work_item.h View 3 chunks +12 lines, -0 lines 0 comments Download
M chrome/installer/util/set_reg_value_work_item.cc View 1 2 3 4 chunks +71 lines, -2 lines 0 comments Download
M chrome/installer/util/set_reg_value_work_item_unittest.cc View 1 2 1 chunk +225 lines, -150 lines 0 comments Download
M chrome/installer/util/work_item.h View 2 chunks +16 lines, -0 lines 0 comments Download
M chrome/installer/util/work_item.cc View 1 chunk +13 lines, -0 lines 0 comments Download
M chrome/installer/util/work_item_list.h View 1 chunk +10 lines, -0 lines 0 comments Download
M chrome/installer/util/work_item_list.cc View 1 chunk +15 lines, -0 lines 0 comments Download

Messages

Total messages: 23 (8 generated)
gab
Greg PTAL (I stand before you honored to finally get back to some good ol' ...
5 years, 6 months ago (2015-06-26 19:19:48 UTC) #4
grt (UTC plus 2)
looks good. some small comments. https://codereview.chromium.org/1220473002/diff/40001/chrome/installer/util/set_reg_value_work_item.cc File chrome/installer/util/set_reg_value_work_item.cc (right): https://codereview.chromium.org/1220473002/diff/40001/chrome/installer/util/set_reg_value_work_item.cc#newcode14 chrome/installer/util/set_reg_value_work_item.cc:14: void StringToBinaryData(const std::wstring& str_value, ...
5 years, 5 months ago (2015-06-29 15:37:48 UTC) #5
gab
Thanks, PTAL. Cheers, Gab https://codereview.chromium.org/1220473002/diff/40001/chrome/installer/util/set_reg_value_work_item.cc File chrome/installer/util/set_reg_value_work_item.cc (right): https://codereview.chromium.org/1220473002/diff/40001/chrome/installer/util/set_reg_value_work_item.cc#newcode14 chrome/installer/util/set_reg_value_work_item.cc:14: void StringToBinaryData(const std::wstring& str_value, On ...
5 years, 5 months ago (2015-06-29 20:11:01 UTC) #7
grt (UTC plus 2)
https://codereview.chromium.org/1220473002/diff/40001/chrome/installer/util/set_reg_value_work_item.cc File chrome/installer/util/set_reg_value_work_item.cc (right): https://codereview.chromium.org/1220473002/diff/40001/chrome/installer/util/set_reg_value_work_item.cc#newcode154 chrome/installer/util/set_reg_value_work_item.cc:154: DCHECK(type_ == REG_SZ); On 2015/06/29 20:11:01, gab wrote: > ...
5 years, 5 months ago (2015-06-30 20:26:43 UTC) #8
gab
Thanks, PTAL https://codereview.chromium.org/1220473002/diff/40001/chrome/installer/util/set_reg_value_work_item.cc File chrome/installer/util/set_reg_value_work_item.cc (right): https://codereview.chromium.org/1220473002/diff/40001/chrome/installer/util/set_reg_value_work_item.cc#newcode154 chrome/installer/util/set_reg_value_work_item.cc:154: DCHECK(type_ == REG_SZ); On 2015/06/30 20:26:42, grt ...
5 years, 5 months ago (2015-07-01 02:55:19 UTC) #9
grt (UTC plus 2)
lgtm https://codereview.chromium.org/1220473002/diff/80001/chrome/installer/util/set_reg_value_work_item.cc File chrome/installer/util/set_reg_value_work_item.cc (right): https://codereview.chromium.org/1220473002/diff/80001/chrome/installer/util/set_reg_value_work_item.cc#newcode43 chrome/installer/util/set_reg_value_work_item.cc:43: if ((*str_value)[str_len_maybe_with_null - 1] == L'\0') On 2015/07/01 ...
5 years, 5 months ago (2015-07-01 15:37:17 UTC) #10
gab
Thanks, adopted suggestion :-). https://codereview.chromium.org/1220473002/diff/80001/chrome/installer/util/set_reg_value_work_item.cc File chrome/installer/util/set_reg_value_work_item.cc (right): https://codereview.chromium.org/1220473002/diff/80001/chrome/installer/util/set_reg_value_work_item.cc#newcode43 chrome/installer/util/set_reg_value_work_item.cc:43: if ((*str_value)[str_len_maybe_with_null - 1] == ...
5 years, 5 months ago (2015-07-02 01:59:06 UTC) #11
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1220473002/120001
5 years, 5 months ago (2015-07-02 01:59:50 UTC) #14
commit-bot: I haz the power
Try jobs failed on following builders: chromium_presubmit on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromium_presubmit/builds/75562)
5 years, 5 months ago (2015-07-02 02:11:36 UTC) #16
gab
On 2015/07/02 02:11:36, commit-bot: I haz the power wrote: > Try jobs failed on following ...
5 years, 5 months ago (2015-07-02 02:15:10 UTC) #17
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1220473002/120001
5 years, 5 months ago (2015-07-02 02:15:56 UTC) #19
commit-bot: I haz the power
Committed patchset #4 (id:120001)
5 years, 5 months ago (2015-07-02 02:59:50 UTC) #20
commit-bot: I haz the power
Patchset 4 (id:??) landed as https://crrev.com/69821f190e784c132d598e07433165c934ee3087 Cr-Commit-Position: refs/heads/master@{#337164}
5 years, 5 months ago (2015-07-02 03:00:56 UTC) #21
gab
Post-commit note below. https://codereview.chromium.org/1220473002/diff/40001/chrome/installer/util/set_reg_value_work_item.cc File chrome/installer/util/set_reg_value_work_item.cc (right): https://codereview.chromium.org/1220473002/diff/40001/chrome/installer/util/set_reg_value_work_item.cc#newcode158 chrome/installer/util/set_reg_value_work_item.cc:158: ? reinterpret_cast<wchar_t*>(&previous_value_[0]) On 2015/06/29 15:37:48, grt ...
5 years, 5 months ago (2015-07-06 20:56:03 UTC) #22
grt (UTC plus 2)
5 years, 5 months ago (2015-07-10 19:10:52 UTC) #23
Message was sent while issue was closed.
https://codereview.chromium.org/1220473002/diff/40001/chrome/installer/util/s...
File chrome/installer/util/set_reg_value_work_item.cc (right):

https://codereview.chromium.org/1220473002/diff/40001/chrome/installer/util/s...
chrome/installer/util/set_reg_value_work_item.cc:158: ?
reinterpret_cast<wchar_t*>(&previous_value_[0])
On 2015/07/06 20:56:02, gab wrote:
> On 2015/06/29 15:37:48, grt wrote:
> > there is no guarantee that previous_value_ is null terminated
> 
> Actually registry.cc's ReadValue() [1] does assume it's null terminated.

That's a bug. The one in mini_installer.cc does something close to the right
thing.

> It
> appears [2] that REG_SZ is indeed the type of a null-terminated string

It is the "type" of a null-terminated string, but there's nothing in Windows
that makes sure it is null-terminated. You're welcome to write a ten-byte REG_SZ
containing UTF16 "hello" (no terminator). Windows is perfectly happy with this,
but you will fall over when you read it if you expect to read twelve bytes, the
last two of which are "\0\0".

>, shall we
> go back to this simpler version?

No, we should fix base::win::RegKey!

Powered by Google App Engine
This is Rietveld 408576698