Hi Brett,
TL;DR -- it seems to me like the mid-step with unique_ptr, while adding a little overhead, might allow us to paralellise the migration to value semantics more.
More details:
I though about skipping the unique_ptr, but that would mean blocking the change until the new API is ready.
There still seems to be value(*) in doing the mid-step with unique_ptr in that it makes the intermediate steps smaller. Consider the following patter which I saw frequently in the code:
DictionaryValue* value = new DictionaryValue(...);
...
FunctionTakingOwnership(value);
...
value->Set(...);
To convert this directly to the value semantics API, one needs to both fix the all the lines touching |value| and also fix the order so that the third line comes before the second one. So the one-step change introduces significant churn.
Compared to that, converting to unique_ptr first still creates most of that churn (some changes on lines touching |value| and the change in the order), but because of the current co-existence of raw-pointer and unique_ptr APIs, these conversions can be better separated into smaller chunks. Once converted to unique_ptr, the code would look something like:
auto value = MakeUnique<DictionaryValue>();
...
value->Set(...);
FunctionTakingOwnership(std::move(value));
Changing that to value semantics API is a fairly minimal change: only changes the |value| declaration and all "->" into ".". Also, bugs in the code caused by the the raw pointer ownership being unclear are unlikely to still be present during the conversion to value semantics, making that conversion smoother and smaller in scope.
So while you and Jan are progressing towards the value semantics, I thought I would prepare the code in advance for a smoother transition, instead of the whole project being a long sequence of strongly dependent tasks. (I also still hope to root out the potentially multiple causes of
https://crbug.com/697817 ASAP.)
Does that make sense?
Cheers,
Václav
(*) Apologies for using "value" with at least 3 different meanings in this e-mail!