|
|
DescriptionAndroid: Make netlog available in startup traces.
Netlog events are made available to trace events through
TraceNetLogObserver. On Android, it is created after tracing has
started, yet only listens for tracing state changes. Before listening
for tracing state changes, first check whether tracing is already
enabled.
TEST=
$ adb shell 'echo "_ --trace-startup=*,netlog" > /data/local/tmp/chrome-command-line'
$ adb shell 'am force-stop com.google.android.apps.chrome' &&
adb shell am start -a 'android.intent.action.VIEW' -n com.google.android.apps.chrome/.Main -d 'https://android.com'"
This was busted before, works with this patch.
BUG=668195
Committed: https://crrev.com/9da0f1a6adf25390c93d0ddd384defcedda25f89
Cr-Commit-Position: refs/heads/master@{#435895}
Patch Set 1 #Patch Set 2 : Tests. #
Total comments: 2
Patch Set 3 : Address comment. #
Messages
Total messages: 29 (18 generated)
[email protected] changed reviewers: + [email protected]
The CQ bit was checked by [email protected] to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by [email protected]
Dry run: Try jobs failed on following builders: ios-simulator on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios-simulator/bui...)
[email protected] changed reviewers: + [email protected]
+Helen who is more familiar with the tracing integration. (1) How does this relate to the existing test TraceNetLogObserverTest.CreateObserverAfterTracingStarts ? Looks like that test explicitly was not handling this case, would like to understand from Helen if there is a concern with changing this policy. (2) A consequence of this change is that we will end up calling a virtual function within the constructor, of the object being constructed (i.e. while inside ChromeNetLog::ChromeNetLog we will now indireclty call this->DeprecatedAddObserver()). This is generally a bad pattern as it breaks on base classes. It *should* work in this case since nothing extends ChromeNetLog... Can you structure the code differently to avoid this?
On 2016/11/23 20:36:01, eroman (slow) wrote: > +Helen who is more familiar with the tracing integration. > > (1) How does this relate to the existing test > TraceNetLogObserverTest.CreateObserverAfterTracingStarts ? Looks like that test > explicitly was not handling this case, would like to understand from Helen if > there is a concern with changing this policy. I think it is fine to change the policy here. Could you add an explicit check to make sure NetLog category is selected in startup tracing? I commented in the bug. My main concern is that NetLog trace events can take up a lot of space. Since we don't have the trace viewer UI and the prompt, I think we should disable it by default. > > (2) A consequence of this change is that we will end up calling a virtual > function within the constructor, of the object being constructed (i.e. while > inside ChromeNetLog::ChromeNetLog we will now indireclty call > this->DeprecatedAddObserver()). This is generally a bad pattern as it breaks on > base classes. It *should* work in this case since nothing extends > ChromeNetLog... Can you structure the code differently to avoid this?
On 2016/11/29 14:45:44, xunjieli wrote: > On 2016/11/23 20:36:01, eroman (slow) wrote: > > +Helen who is more familiar with the tracing integration. > > > > (1) How does this relate to the existing test > > TraceNetLogObserverTest.CreateObserverAfterTracingStarts ? Looks like that > test > > explicitly was not handling this case, would like to understand from Helen if > > there is a concern with changing this policy. > > I think it is fine to change the policy here. Could you add an explicit check to > make sure NetLog category is selected in startup tracing? I commented in the > bug. My main concern is that NetLog trace events can take up a lot of space. > Since we don't have the trace viewer UI and the prompt, I think we should > disable it by default. > > > > > (2) A consequence of this change is that we will end up calling a virtual > > function within the constructor, of the object being constructed (i.e. while > > inside ChromeNetLog::ChromeNetLog we will now indireclty call > > this->DeprecatedAddObserver()). This is generally a bad pattern as it breaks > on > > base classes. It *should* work in this case since nothing extends > > ChromeNetLog... Can you structure the code differently to avoid this? Per the discussion in the bug: - netlog is enabled as usual, no special casing for startup tracing. - Added a test to check that if the category is disabled, nothing gets recorded. This one may not be necessary, as this is no different from anything else in tracing. Note that a trace configuration can be provided for startup tracing, either through command-line flags or through the trace config file. Since changing the flags is necessary to enable startup tracing anyway, then the control does exist for users. About the virtual function call: NetLog::DeprecatedAddObserver() is not virtual, and NetLog has no virtual member function (aside from the destructor). So it should be fine, right?
The CQ bit was checked by [email protected] to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by [email protected]
Dry run: This issue passed the CQ dry run.
Acknowledged. LGTM. Please wait for eroman@ to sign off. https://codereview.chromium.org/2524043002/diff/20001/net/log/trace_net_log_o... File net/log/trace_net_log_observer_unittest.cc (right): https://codereview.chromium.org/2524043002/diff/20001/net/log/trace_net_log_o... net/log/trace_net_log_observer_unittest.cc:327: set_trace_net_log_observer(NULL); nit: use nullptr instead of NULL in new code.
Thanks! eroman@: PTAL, thank you. https://codereview.chromium.org/2524043002/diff/20001/net/log/trace_net_log_o... File net/log/trace_net_log_observer_unittest.cc (right): https://codereview.chromium.org/2524043002/diff/20001/net/log/trace_net_log_o... net/log/trace_net_log_observer_unittest.cc:327: set_trace_net_log_observer(NULL); On 2016/11/30 18:12:32, xunjieli wrote: > nit: use nullptr instead of NULL in new code. Done.
The CQ bit was checked by [email protected] to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by [email protected]
Dry run: This issue passed the CQ dry run.
lgtm
The CQ bit was checked by [email protected]
The patchset sent to the CQ was uploaded after l-g-t-m from [email protected] Link to the patchset: https://codereview.chromium.org/2524043002/#ps40001 (title: "Address comment.")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
CQ is committing da patch. Bot data: {"patchset_id": 40001, "attempt_start_ts": 1480670536264580, "parent_rev": "8d92448b226699e67088c17ece7660bf71d9f7e0", "commit_rev": "69520e245db98ef4a719e20018ce29ea6844fb1c"}
Message was sent while issue was closed.
Committed patchset #3 (id:40001)
Message was sent while issue was closed.
Description was changed from ========== Android: Make netlog available in startup traces. Netlog events are made available to trace events through TraceNetLogObserver. On Android, it is created after tracing has started, yet only listens for tracing state changes. Before listening for tracing state changes, first check whether tracing is already enabled. TEST= $ adb shell 'echo "_ --trace-startup=*,netlog" > /data/local/tmp/chrome-command-line' $ adb shell 'am force-stop com.google.android.apps.chrome' && adb shell am start -a 'android.intent.action.VIEW' -n com.google.android.apps.chrome/.Main -d 'https://android.com'" This was busted before, works with this patch. BUG=668195 ========== to ========== Android: Make netlog available in startup traces. Netlog events are made available to trace events through TraceNetLogObserver. On Android, it is created after tracing has started, yet only listens for tracing state changes. Before listening for tracing state changes, first check whether tracing is already enabled. TEST= $ adb shell 'echo "_ --trace-startup=*,netlog" > /data/local/tmp/chrome-command-line' $ adb shell 'am force-stop com.google.android.apps.chrome' && adb shell am start -a 'android.intent.action.VIEW' -n com.google.android.apps.chrome/.Main -d 'https://android.com'" This was busted before, works with this patch. BUG=668195 Committed: https://crrev.com/9da0f1a6adf25390c93d0ddd384defcedda25f89 Cr-Commit-Position: refs/heads/master@{#435895} ==========
Message was sent while issue was closed.
Patchset 3 (id:??) landed as https://crrev.com/9da0f1a6adf25390c93d0ddd384defcedda25f89 Cr-Commit-Position: refs/heads/master@{#435895} |