|
|
Created:
4 years, 3 months ago by Not at Google. Contact bengr Modified:
4 years, 2 months ago CC:
chromium-reviews, cbentzel+watch_chromium.org Target Ref:
refs/pending/heads/master Project:
chromium Visibility:
Public. |
DescriptionPropagate network delegate events to ChromeDataUseAscriber.
ChromeDataUseAscriber ascribes all data use to logical entities
such as page loads. Propagating pertinent network events to
the ascriber provides it with the hooks to track data usage.
The actual tracking will be done in a future cl.
BUG=645188
Committed: https://crrev.com/c6135966d9e76c2f69f21f1f6a24be7609309b0d
Cr-Commit-Position: refs/heads/master@{#420926}
Patch Set 1 #Patch Set 2 : Set up in profile_io_data #Patch Set 3 : fix missing include #Patch Set 4 : Variable name #Patch Set 5 : Fix tests #Patch Set 6 : Use LayeredNetworkDelegate #Patch Set 7 : Added comments #
Total comments: 4
Patch Set 8 : Move delegate creation to ascriber. #
Total comments: 6
Patch Set 9 : new lines #
Messages
Total messages: 49 (33 generated)
The CQ bit was checked by kundaji@chromium.org to run a CQ dry run
Description was changed from ========== Propagate network delegate events to ChromeDataUseAscriber. ChromeDataUseAscriber ascribes all data use to logical entities such as page loads. Propagating pertinent network events to the ascriber provides it with the hooks to track data usage. The actual tracking will be done in a future cl. BUG=645188 ========== to ========== Propagate network delegate events to ChromeDataUseAscriber. ChromeDataUseAscriber ascribes all data use to logical entities such as page loads. Propagating pertinent network events to the ascriber provides it with the hooks to track data usage. The actual tracking will be done in a future cl. BUG=645188 ==========
kundaji@chromium.org changed reviewers: + bengr@chromium.org, mmenke@chromium.org
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
bengr: components/data_use_measurement/* mmenke: chrome/browser/*
The CQ bit was checked by kundaji@chromium.org 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 checked by kundaji@chromium.org 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 checked by kundaji@chromium.org 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 commit-bot@chromium.org
Dry run: Try jobs failed on following builders: android_n5x_swarming_rel on master.tryserver.chromium.android (JOB_FAILED, https://build.chromium.org/p/tryserver.chromium.android/builders/android_n5x_...) chromeos_x86-generic_chromium_compile_only_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromeos_x86-ge...) linux_chromium_compile_dbg_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_...)
On 2016/09/21 16:19:14, kundaji wrote: > bengr: > components/data_use_measurement/* > > mmenke: > chrome/browser/* Should we use a LayeredNetworkDelegate for this instead?
The CQ bit was checked by kundaji@chromium.org 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...
On 2016/09/21 17:57:27, mmenke wrote: > On 2016/09/21 16:19:14, kundaji wrote: > > bengr: > > components/data_use_measurement/* > > > > mmenke: > > chrome/browser/* > > Should we use a LayeredNetworkDelegate for this instead? Using LayeredNetworkDelegate was my first instinct. It is doable, but is a little more complicated. Specifically, will need an extra class that will subclass LayeredNetworkDelegate and propagate the events to ChromeDataUseAscriber. This is because there should be only one instance of ChromeDataUseAscriber, whereas there are multiple NetworkDelegates. What do you think?
On 2016/09/21 19:04:26, kundaji wrote: > On 2016/09/21 17:57:27, mmenke wrote: > > On 2016/09/21 16:19:14, kundaji wrote: > > > bengr: > > > components/data_use_measurement/* > > > > > > mmenke: > > > chrome/browser/* > > > > Should we use a LayeredNetworkDelegate for this instead? > > Using LayeredNetworkDelegate was my first instinct. It is doable, but is a > little more complicated. > > Specifically, will need an extra class that will subclass LayeredNetworkDelegate > and propagate the events to ChromeDataUseAscriber. This is because there should > be only one instance of ChromeDataUseAscriber, whereas there are multiple > NetworkDelegates. > > What do you think? I'm fine with that - I think the layering is much simpler, and it's much more easily pluggable into the network stack. I'm fine with the extra class, seems worth it.
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
On 2016/09/21 19:06:05, mmenke wrote: > On 2016/09/21 19:04:26, kundaji wrote: > > On 2016/09/21 17:57:27, mmenke wrote: > > > On 2016/09/21 16:19:14, kundaji wrote: > > > > bengr: > > > > components/data_use_measurement/* > > > > > > > > mmenke: > > > > chrome/browser/* > > > > > > Should we use a LayeredNetworkDelegate for this instead? > > > > Using LayeredNetworkDelegate was my first instinct. It is doable, but is a > > little more complicated. > > > > Specifically, will need an extra class that will subclass > LayeredNetworkDelegate > > and propagate the events to ChromeDataUseAscriber. This is because there > should > > be only one instance of ChromeDataUseAscriber, whereas there are multiple > > NetworkDelegates. > > > > What do you think? > > I'm fine with that - I think the layering is much simpler, and it's much more > easily pluggable into the network stack. I'm fine with the extra class, seems > worth it. Sounds good. I am changing the cl to use a LayeredNetworkDelegate. I have 2 questions: 1) If a delegate changes new_url in OnBeforeURLRequest(): a) is OnBeforeURLRequest() called again with the new URL for all the delegates? b) is OnBeforeRedirect() called for all the delegates with the new URL? 2) If a delegate returns anything other than a OK or ERR_IO_PENDING in OnBeforeURLRequest() will the OnCompleted() method still be called for the URLRequest? Thanks!
On 2016/09/21 20:32:13, kundaji wrote: > On 2016/09/21 19:06:05, mmenke wrote: > > On 2016/09/21 19:04:26, kundaji wrote: > > > On 2016/09/21 17:57:27, mmenke wrote: > > > > On 2016/09/21 16:19:14, kundaji wrote: > > > > > bengr: > > > > > components/data_use_measurement/* > > > > > > > > > > mmenke: > > > > > chrome/browser/* > > > > > > > > Should we use a LayeredNetworkDelegate for this instead? > > > > > > Using LayeredNetworkDelegate was my first instinct. It is doable, but is a > > > little more complicated. > > > > > > Specifically, will need an extra class that will subclass > > LayeredNetworkDelegate > > > and propagate the events to ChromeDataUseAscriber. This is because there > > should > > > be only one instance of ChromeDataUseAscriber, whereas there are multiple > > > NetworkDelegates. > > > > > > What do you think? > > > > I'm fine with that - I think the layering is much simpler, and it's much more > > easily pluggable into the network stack. I'm fine with the extra class, seems > > worth it. > > Sounds good. I am changing the cl to use a LayeredNetworkDelegate. I have 2 > questions: > > 1) If a delegate changes new_url in OnBeforeURLRequest(): > a) is OnBeforeURLRequest() called again with the new URL for all the > delegates? No. > b) is OnBeforeRedirect() called for all the delegates with the new URL? Yes, it looks just like a normal redirect (Well, mostly like a normal redirect). > 2) If a delegate returns anything other than a OK or ERR_IO_PENDING in > OnBeforeURLRequest() will the OnCompleted() method still be called for the > URLRequest? Yes. > Thanks!
The CQ bit was checked by kundaji@chromium.org 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...
On 2016/09/21 20:34:51, mmenke wrote: > On 2016/09/21 20:32:13, kundaji wrote: > > On 2016/09/21 19:06:05, mmenke wrote: > > > On 2016/09/21 19:04:26, kundaji wrote: > > > > On 2016/09/21 17:57:27, mmenke wrote: > > > > > On 2016/09/21 16:19:14, kundaji wrote: > > > > > > bengr: > > > > > > components/data_use_measurement/* > > > > > > > > > > > > mmenke: > > > > > > chrome/browser/* > > > > > > > > > > Should we use a LayeredNetworkDelegate for this instead? > > > > > > > > Using LayeredNetworkDelegate was my first instinct. It is doable, but is a > > > > little more complicated. > > > > > > > > Specifically, will need an extra class that will subclass > > > LayeredNetworkDelegate > > > > and propagate the events to ChromeDataUseAscriber. This is because there > > > should > > > > be only one instance of ChromeDataUseAscriber, whereas there are multiple > > > > NetworkDelegates. > > > > > > > > What do you think? > > > > > > I'm fine with that - I think the layering is much simpler, and it's much > more > > > easily pluggable into the network stack. I'm fine with the extra class, > seems > > > worth it. > > > > Sounds good. I am changing the cl to use a LayeredNetworkDelegate. I have 2 > > questions: > > > > 1) If a delegate changes new_url in OnBeforeURLRequest(): > > a) is OnBeforeURLRequest() called again with the new URL for all the > > delegates? > > No. > > > b) is OnBeforeRedirect() called for all the delegates with the new URL? > > Yes, it looks just like a normal redirect (Well, mostly like a normal redirect). > > > 2) If a delegate returns anything other than a OK or ERR_IO_PENDING in > > OnBeforeURLRequest() will the OnCompleted() method still be called for the > > URLRequest? > > Yes. > > > Thanks! Switched to using a LayeredNetworkDelegate. PTAL.
The CQ bit was checked by kundaji@chromium.org 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 commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
ProfileImpIOData, IOData LGTM. I assume it's deliberate that you're not hooking up incognito mode. https://codereview.chromium.org/2354323002/diff/120001/chrome/browser/io_thre... File chrome/browser/io_thread.cc (right): https://codereview.chromium.org/2354323002/diff/120001/chrome/browser/io_thre... chrome/browser/io_thread.cc:52: #include "components/data_use_measurement/core/data_use_ascriber.h" Not needed, since you never derefernce one of these, see other comment, though. Both comments apply to both files. https://codereview.chromium.org/2354323002/diff/120001/chrome/browser/io_thre... chrome/browser/io_thread.cc:536: globals_->data_use_ascriber.get()); optional: I'd suggest making this method: globals_->data_use_ascriber->CreateNetworkDelegate( std::move(chrome_network_delegate)); Instead. Then we only have to know about one DataUse class, and the ascriber will (hopefully) be responsible for any changes in the API. I only have a weak preference for this, so if you prefer this approach, that's fine.
The CQ bit was checked by kundaji@chromium.org 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...
Yes, deliberately not hooking up incognito. Thanks for confirming. https://codereview.chromium.org/2354323002/diff/120001/chrome/browser/io_thre... File chrome/browser/io_thread.cc (right): https://codereview.chromium.org/2354323002/diff/120001/chrome/browser/io_thre... chrome/browser/io_thread.cc:52: #include "components/data_use_measurement/core/data_use_ascriber.h" On 2016/09/22 14:36:45, mmenke wrote: > Not needed, since you never derefernce one of these, see other comment, though. > Both comments apply to both files. Done. https://codereview.chromium.org/2354323002/diff/120001/chrome/browser/io_thre... chrome/browser/io_thread.cc:536: globals_->data_use_ascriber.get()); On 2016/09/22 14:36:45, mmenke wrote: > optional: I'd suggest making this method: > > globals_->data_use_ascriber->CreateNetworkDelegate( > std::move(chrome_network_delegate)); > > Instead. Then we only have to know about one DataUse class, and the ascriber > will (hopefully) be responsible for any changes in the API. I only have a weak > preference for this, so if you prefer this approach, that's fine. Done. I like this suggestion since it makes the interface of the data_use_measurement component cleaner as well.
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: linux_android_rel_ng on master.tryserver.chromium.android (JOB_FAILED, https://build.chromium.org/p/tryserver.chromium.android/builders/linux_androi...)
kundaji@chromium.org changed reviewers: + rajendrant@chromium.org
lgtm
kundaji@chromium.org changed reviewers: - bengr@chromium.org
kundaji@chromium.org changed reviewers: + bengr@chromium.org
lgtm with nits. https://codereview.chromium.org/2354323002/diff/140001/components/data_use_me... File components/data_use_measurement/core/data_use_ascriber.cc (right): https://codereview.chromium.org/2354323002/diff/140001/components/data_use_me... components/data_use_measurement/core/data_use_ascriber.cc:20: void DataUseAscriber::OnBeforeUrlRequest(net::URLRequest* request) {} It's hard to tell if theses are the right prototypes without implementations. I'm ok with you landing as is if you're ok with me pushing back on this API once you have code. https://codereview.chromium.org/2354323002/diff/140001/components/data_use_me... File components/data_use_measurement/core/data_use_ascriber.h (right): https://codereview.chromium.org/2354323002/diff/140001/components/data_use_me... components/data_use_measurement/core/data_use_ascriber.h:9: #include <memory> Add a blank line above. https://codereview.chromium.org/2354323002/diff/140001/components/data_use_me... File components/data_use_measurement/core/data_use_network_delegate.h (right): https://codereview.chromium.org/2354323002/diff/140001/components/data_use_me... components/data_use_measurement/core/data_use_network_delegate.h:9: #include <memory> Insert blank line above.
https://codereview.chromium.org/2354323002/diff/140001/components/data_use_me... File components/data_use_measurement/core/data_use_ascriber.cc (right): https://codereview.chromium.org/2354323002/diff/140001/components/data_use_me... components/data_use_measurement/core/data_use_ascriber.cc:20: void DataUseAscriber::OnBeforeUrlRequest(net::URLRequest* request) {} On 2016/09/23 21:21:13, bengr wrote: > It's hard to tell if theses are the right prototypes without implementations. > I'm ok with you landing as is if you're ok with me pushing back on this API once > you have code. These calls come from the network delegate, so not sure what you mean by changing this API. Do you have any alternative hooks to get network events in mind? On a separate note, I just realized that since only DataUseNetworkDelegate calls these methods, they could be made protected with DataUseNetworkDelegate being made a friend class.
https://codereview.chromium.org/2354323002/diff/140001/components/data_use_me... File components/data_use_measurement/core/data_use_ascriber.h (right): https://codereview.chromium.org/2354323002/diff/140001/components/data_use_me... components/data_use_measurement/core/data_use_ascriber.h:9: #include <memory> On 2016/09/23 21:21:13, bengr wrote: > Add a blank line above. Done. https://codereview.chromium.org/2354323002/diff/140001/components/data_use_me... File components/data_use_measurement/core/data_use_network_delegate.h (right): https://codereview.chromium.org/2354323002/diff/140001/components/data_use_me... components/data_use_measurement/core/data_use_network_delegate.h:9: #include <memory> On 2016/09/23 21:21:13, bengr wrote: > Insert blank line above. Done.
The CQ bit was checked by kundaji@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from mmenke@chromium.org, bengr@chromium.org, rajendrant@chromium.org Link to the patchset: https://codereview.chromium.org/2354323002/#ps160001 (title: "new lines")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Message was sent while issue was closed.
Description was changed from ========== Propagate network delegate events to ChromeDataUseAscriber. ChromeDataUseAscriber ascribes all data use to logical entities such as page loads. Propagating pertinent network events to the ascriber provides it with the hooks to track data usage. The actual tracking will be done in a future cl. BUG=645188 ========== to ========== Propagate network delegate events to ChromeDataUseAscriber. ChromeDataUseAscriber ascribes all data use to logical entities such as page loads. Propagating pertinent network events to the ascriber provides it with the hooks to track data usage. The actual tracking will be done in a future cl. BUG=645188 ==========
Message was sent while issue was closed.
Committed patchset #9 (id:160001)
Message was sent while issue was closed.
Description was changed from ========== Propagate network delegate events to ChromeDataUseAscriber. ChromeDataUseAscriber ascribes all data use to logical entities such as page loads. Propagating pertinent network events to the ascriber provides it with the hooks to track data usage. The actual tracking will be done in a future cl. BUG=645188 ========== to ========== Propagate network delegate events to ChromeDataUseAscriber. ChromeDataUseAscriber ascribes all data use to logical entities such as page loads. Propagating pertinent network events to the ascriber provides it with the hooks to track data usage. The actual tracking will be done in a future cl. BUG=645188 Committed: https://crrev.com/c6135966d9e76c2f69f21f1f6a24be7609309b0d Cr-Commit-Position: refs/heads/master@{#420926} ==========
Message was sent while issue was closed.
Patchset 9 (id:??) landed as https://crrev.com/c6135966d9e76c2f69f21f1f6a24be7609309b0d Cr-Commit-Position: refs/heads/master@{#420926} |