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

Issue 2256733004: Re-write many calls to WrapUnique() with MakeUnique() (Closed)

Created:
4 years, 4 months ago by Adam Rice
Modified:
4 years, 4 months ago
Reviewers:
maxbogue
CC:
chromium-reviews, albertb+watch_chromium.org, sync-reviews_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Re-write many calls to WrapUnique() with MakeUnique() A mostly-automated change to convert instances of WrapUnique(new Foo(...)) to MakeUnique<Foo>(...). See the thread at https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/iQgMedVA8-k for background. To avoid requiring too many manual fixups, the change skips some cases that are frequently problematic. In particular, in methods named Foo::Method() it will not try to change WrapUnique(new Foo()) to MakeUnique<Foo>(). This is because Foo::Method() may be accessing an internal constructor of Foo. Cases where MakeUnique<NestedClass>(...) is called within a method of OuterClass are common but hard to detect automatically, so have been fixed-up manually. The only types of manual fix ups applied are: 1) Revert MakeUnique back to WrapUnique 2) Change NULL to nullptr in argument list (MakeUnique cannot forward NULL correctly) 3) Add base:: namespace qualifier where missing. WrapUnique(new Foo) has not been converted to MakeUnique<Foo>() as this might change behaviour if Foo does not have a user-defined constructor. For example, WrapUnique(new int) creates an unitialised integer, but MakeUnique<int>() creates an integer initialised to 0. git cl format has been been run over the CL. Spot-checking has uncovered no cases of mis-formatting. BUG=637812 Committed: https://crrev.com/08e66e6f17755de8d0082593183f7d67ce13cb57 Cr-Commit-Position: refs/heads/master@{#413404}

Patch Set 1 #

Total comments: 2

Patch Set 2 : Change braced construction to assignment construction #

Patch Set 3 : Rebase #

Unified diffs Side-by-side diffs Delta from patch set Stats (+62 lines, -67 lines) Patch
M components/sync/api/model_type_service_unittest.cc View 1 chunk +2 lines, -3 lines 0 comments Download
M components/sync/core/model_type_store_impl.cc View 1 chunk +1 line, -1 line 0 comments Download
M components/sync/core/processor_entity_tracker_unittest.cc View 1 chunk +1 line, -1 line 0 comments Download
M components/sync/core/shared_model_type_processor.cc View 1 chunk +4 lines, -3 lines 0 comments Download
M components/sync/core/shared_model_type_processor_unittest.cc View 1 chunk +1 line, -1 line 0 comments Download
M components/sync/core_impl/attachments/attachment_service_impl_unittest.cc View 3 chunks +6 lines, -6 lines 0 comments Download
M components/sync/core_impl/model_type_connector_proxy_unittest.cc View 1 chunk +1 line, -1 line 0 comments Download
M components/sync/core_impl/sync_manager_impl.cc View 1 2 1 chunk +2 lines, -2 lines 0 comments Download
M components/sync/core_impl/test/fake_sync_manager.cc View 1 chunk +1 line, -1 line 0 comments Download
M components/sync/device_info/device_info_service.cc View 1 6 chunks +8 lines, -8 lines 0 comments Download
M components/sync/device_info/device_info_service_unittest.cc View 1 chunk +1 line, -1 line 0 comments Download
M components/sync/driver/fake_sync_client.cc View 2 chunks +2 lines, -3 lines 0 comments Download
M components/sync/driver/fake_sync_service.cc View 1 2 1 chunk +1 line, -1 line 0 comments Download
M components/sync/driver/generic_change_processor_factory.cc View 1 chunk +2 lines, -2 lines 0 comments Download
M components/sync/driver/non_ui_model_type_controller_unittest.cc View 3 chunks +3 lines, -5 lines 0 comments Download
M components/sync/driver/sync_policy_handler_unittest.cc View 2 chunks +2 lines, -2 lines 0 comments Download
M components/sync/driver/ui_model_type_controller_unittest.cc View 3 chunks +3 lines, -5 lines 0 comments Download
M components/sync/engine_impl/cycle/nudge_tracker.cc View 1 2 1 chunk +1 line, -1 line 0 comments Download
M components/sync/engine_impl/directory_update_handler_unittest.cc View 1 2 1 chunk +6 lines, -6 lines 0 comments Download
M components/sync/engine_impl/model_type_registry.cc View 1 2 1 chunk +1 line, -1 line 0 comments Download
M components/sync/engine_impl/model_type_registry_unittest.cc View 3 chunks +4 lines, -4 lines 0 comments Download
M components/sync/engine_impl/model_type_worker.cc View 1 2 1 chunk +1 line, -1 line 0 comments Download
M components/sync/engine_impl/model_type_worker_unittest.cc View 1 2 2 chunks +2 lines, -2 lines 0 comments Download
M components/sync/protocol/proto_value_conversions.cc View 3 chunks +4 lines, -4 lines 0 comments Download
M components/sync/tools/sync_client.cc View 1 chunk +1 line, -1 line 0 comments Download
M components/sync/tools/sync_listen_notifications.cc View 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 19 (11 generated)
Adam Rice
4 years, 4 months ago (2016-08-19 07:04:53 UTC) #6
maxbogue
lgtm w/ tiny request https://codereview.chromium.org/2256733004/diff/1/components/sync/device_info/device_info_service.cc File components/sync/device_info/device_info_service.cc (right): https://codereview.chromium.org/2256733004/diff/1/components/sync/device_info/device_info_service.cc#newcode345 components/sync/device_info/device_info_service.cc:345: std::unique_ptr<DeviceInfoSpecifics> specifics( nit: while you're ...
4 years, 4 months ago (2016-08-19 16:50:07 UTC) #7
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/2256733004/20001
4 years, 4 months ago (2016-08-22 01:51:03 UTC) #10
Adam Rice
https://codereview.chromium.org/2256733004/diff/1/components/sync/device_info/device_info_service.cc File components/sync/device_info/device_info_service.cc (right): https://codereview.chromium.org/2256733004/diff/1/components/sync/device_info/device_info_service.cc#newcode345 components/sync/device_info/device_info_service.cc:345: std::unique_ptr<DeviceInfoSpecifics> specifics( On 2016/08/19 16:50:07, maxbogue wrote: > nit: ...
4 years, 4 months ago (2016-08-22 01:51:15 UTC) #11
commit-bot: I haz the power
Try jobs failed on following builders: mac_chromium_compile_dbg_ng on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_compile_dbg_ng/builds/255045)
4 years, 4 months ago (2016-08-22 01:53:42 UTC) #13
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/2256733004/40001
4 years, 4 months ago (2016-08-22 02:24:18 UTC) #16
commit-bot: I haz the power
Committed patchset #3 (id:40001)
4 years, 4 months ago (2016-08-22 04:25:28 UTC) #17
commit-bot: I haz the power
4 years, 4 months ago (2016-08-22 04:27:58 UTC) #19
Message was sent while issue was closed.
Patchset 3 (id:??) landed as
https://crrev.com/08e66e6f17755de8d0082593183f7d67ce13cb57
Cr-Commit-Position: refs/heads/master@{#413404}

Powered by Google App Engine
This is Rietveld 408576698