|
|
DescriptionWe can change the key value to std::string in child_process_stats_buffer so that
conversion is not required while accessing value from map.
BUG=544002
Committed: https://crrev.com/2f7efbfc902e719648fa3b0f58cb66c3d1fede58
Cr-Commit-Position: refs/heads/master@{#355492}
Patch Set 1 #Patch Set 2 : #
Total comments: 5
Patch Set 3 : #Patch Set 4 : #Messages
Total messages: 16 (3 generated)
deepak.m1@samsung.com changed reviewers: + ajith.v@chromium.org
PTAL
peer review looks good to me!
deepak.m1@samsung.com changed reviewers: + isherman@chromium.org
PTAL
https://codereview.chromium.org/1407203002/diff/20001/chrome/browser/metrics/... File chrome/browser/metrics/plugin_metrics_provider.cc (right): https://codereview.chromium.org/1407203002/diff/20001/chrome/browser/metrics/... chrome/browser/metrics/plugin_metrics_provider.cc:265: for (std::map<std::string, ChildProcessStats>::iterator cache_iter = nit: Please update this type to be "auto" https://codereview.chromium.org/1407203002/diff/20001/chrome/browser/metrics/... chrome/browser/metrics/plugin_metrics_provider.cc:336: PluginMetricsProvider::GetChildProcessStats( This method is fairly frequently called, so I'm not sure that it helps to trade string conversions in a different place for string conversions here. Best would be to simply not have string conversions.
@Ilya PTAL https://codereview.chromium.org/1407203002/diff/20001/chrome/browser/metrics/... File chrome/browser/metrics/plugin_metrics_provider.cc (right): https://codereview.chromium.org/1407203002/diff/20001/chrome/browser/metrics/... chrome/browser/metrics/plugin_metrics_provider.cc:265: for (std::map<std::string, ChildProcessStats>::iterator cache_iter = On 2015/10/16 22:09:33, Ilya Sherman wrote: > nit: Please update this type to be "auto" Done. https://codereview.chromium.org/1407203002/diff/20001/chrome/browser/metrics/... chrome/browser/metrics/plugin_metrics_provider.cc:336: PluginMetricsProvider::GetChildProcessStats( On 2015/10/16 22:09:33, Ilya Sherman wrote: > This method is fairly frequently called, so I'm not sure that it helps to trade > string conversions in a different place for string conversions here. Best would > be to simply not have string conversions. I understand, It is best if we can avoid all string conversions. But as kStabilityPluginName i.e plugin name should be stored in the dictionary as std::string. and plugin name in ChildProcessStats and in WebPluginInfo is base:string16. So we have to do string conversion. PluginMetricsProvider::RecordCurrentState() is also called frequently and here we are doing conversion for every plugin in the map in 2 "for loops". that we tried to avoid. But again I completely agree with you,that it is trade off. Please correct me if I misunderstood something.
https://codereview.chromium.org/1407203002/diff/20001/chrome/browser/metrics/... File chrome/browser/metrics/plugin_metrics_provider.cc (right): https://codereview.chromium.org/1407203002/diff/20001/chrome/browser/metrics/... chrome/browser/metrics/plugin_metrics_provider.cc:336: PluginMetricsProvider::GetChildProcessStats( On 2015/10/18 05:59:41, Deepak wrote: > On 2015/10/16 22:09:33, Ilya Sherman wrote: > > This method is fairly frequently called, so I'm not sure that it helps to > trade > > string conversions in a different place for string conversions here. Best > would > > be to simply not have string conversions. > > I understand, It is best if we can avoid all string conversions. > But as kStabilityPluginName i.e plugin name should be stored in the dictionary > as std::string. > and plugin name in ChildProcessStats and in WebPluginInfo is base:string16. > So we have to do string conversion. > > PluginMetricsProvider::RecordCurrentState() is also called frequently and here > we are doing conversion for every plugin in the map in 2 "for loops". that we > tried to avoid. > But again I completely agree with you,that it is trade off. > Please correct me if I misunderstood something. What makes you say that PluginMetricsProvider::RecordCurrentState() is frequently called? Regardless, I think the point of this TODO was to avoid all string conversions, not just to trade some for others. If I had to guess, I'd guess that the idea was to unify the representation to consistently be either UTF-8 or UTF-16.
On 2015/10/20 06:24:32, Ilya Sherman wrote: > https://codereview.chromium.org/1407203002/diff/20001/chrome/browser/metrics/... > File chrome/browser/metrics/plugin_metrics_provider.cc (right): > > https://codereview.chromium.org/1407203002/diff/20001/chrome/browser/metrics/... > chrome/browser/metrics/plugin_metrics_provider.cc:336: > PluginMetricsProvider::GetChildProcessStats( > On 2015/10/18 05:59:41, Deepak wrote: > > On 2015/10/16 22:09:33, Ilya Sherman wrote: > > > This method is fairly frequently called, so I'm not sure that it helps to > > trade > > > string conversions in a different place for string conversions here. Best > > would > > > be to simply not have string conversions. > > > > I understand, It is best if we can avoid all string conversions. > > But as kStabilityPluginName i.e plugin name should be stored in the dictionary > > as std::string. > > and plugin name in ChildProcessStats and in WebPluginInfo is base:string16. > > So we have to do string conversion. > > > > PluginMetricsProvider::RecordCurrentState() is also called frequently and here > > we are doing conversion for every plugin in the map in 2 "for loops". that we > > tried to avoid. > > But again I completely agree with you,that it is trade off. > > Please correct me if I misunderstood something. > > What makes you say that PluginMetricsProvider::RecordCurrentState() is > frequently called? The number of times GetChildProcessStats() is getting called, same number of times PluginMetricsProvider::RecordCurrentState() will get called via RecordCurrentStateWithDelay(). > Regardless, I think the point of this TODO was to avoid all string conversions, > not just to trade some for others. If I had to guess, I'd guess that the idea > was to unify the representation to consistently be either UTF-8 or UTF-16. I agree with your opinion. As plugin_dict->GetString() gives us value based on the out parameter passed in the call. if we are passing std::string as out parameter then we get data in std::string format. Similarly when we pass base::string16 then we get data in the base::string16 format. plugin_dict->SetString() will store the data in the UTF8 format only. I am made changes for this. PTAL
On 2015/10/20 09:39:39, Deepak wrote: > On 2015/10/20 06:24:32, Ilya Sherman wrote: > > > https://codereview.chromium.org/1407203002/diff/20001/chrome/browser/metrics/... > > File chrome/browser/metrics/plugin_metrics_provider.cc (right): > > > > > https://codereview.chromium.org/1407203002/diff/20001/chrome/browser/metrics/... > > chrome/browser/metrics/plugin_metrics_provider.cc:336: > > PluginMetricsProvider::GetChildProcessStats( > > On 2015/10/18 05:59:41, Deepak wrote: > > > On 2015/10/16 22:09:33, Ilya Sherman wrote: > > > > This method is fairly frequently called, so I'm not sure that it helps to > > > trade > > > > string conversions in a different place for string conversions here. Best > > > would > > > > be to simply not have string conversions. > > > > > > I understand, It is best if we can avoid all string conversions. > > > But as kStabilityPluginName i.e plugin name should be stored in the > dictionary > > > as std::string. > > > and plugin name in ChildProcessStats and in WebPluginInfo is base:string16. > > > So we have to do string conversion. > > > > > > PluginMetricsProvider::RecordCurrentState() is also called frequently and > here > > > we are doing conversion for every plugin in the map in 2 "for loops". that > we > > > tried to avoid. > > > But again I completely agree with you,that it is trade off. > > > Please correct me if I misunderstood something. > > > > What makes you say that PluginMetricsProvider::RecordCurrentState() is > > frequently called? > > The number of times GetChildProcessStats() is getting called, same number of > times > PluginMetricsProvider::RecordCurrentState() will get called via > RecordCurrentStateWithDelay(). > > > Regardless, I think the point of this TODO was to avoid all string > conversions, > > not just to trade some for others. If I had to guess, I'd guess that the idea > > was to unify the representation to consistently be either UTF-8 or UTF-16. > > I agree with your opinion. > As plugin_dict->GetString() gives us value based on the out parameter passed in > the call. > if we are passing std::string as out parameter then we get data in std::string > format. > Similarly when we pass base::string16 then we get data in the base::string16 > format. > > plugin_dict->SetString() will store the data in the UTF8 format only. > > I am made changes for this. > PTAL ping :)
LGTM, thanks.
The CQ bit was checked by isherman@chromium.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1407203002/60001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1407203002/60001
On 2015/10/22 04:27:45, Ilya Sherman wrote: > LGTM, thanks. Thankyou Ilya.
Message was sent while issue was closed.
Committed patchset #4 (id:60001)
Message was sent while issue was closed.
Patchset 4 (id:??) landed as https://crrev.com/2f7efbfc902e719648fa3b0f58cb66c3d1fede58 Cr-Commit-Position: refs/heads/master@{#355492} |