|
|
Descriptionmedia: Fix expiry time convertion from base::Time to JS time
This is broken by https://codereview.chromium.org/2593073002/ where the
behavior of converting a null base::Time to JS time (double) has been
changed. We are discussing how to fix the base::Time API more properly.
For now, this check should work.
BUG=679079
TEST=Manually tested. I'll add auto tests later.
Review-Url: https://codereview.chromium.org/2650033007
Cr-Commit-Position: refs/heads/master@{#446246}
Committed: https://chromium.googlesource.com/chromium/src/+/d81adccb0dd24dd7c47ad0d3400dd745150e76db
Patch Set 1 #
Total comments: 2
Patch Set 2 : media: Fix expiry time convertion from base::Time to JS time #
Total comments: 7
Messages
Total messages: 23 (11 generated)
xhwang@chromium.org changed reviewers: + jrummell@chromium.org, majidvp@chromium.org
PTAL!
Description was changed from ========== media: Fix expiry time convertion from base::Time to JS time This is broken by https://codereview.chromium.org/2593073002/ where the behavior of converting a null base::Time to JS time (double) has been changed. We are discussing how to fix the base::Time API more properly. For now, this check should work. BUG=679079 TEST=Manually tested. I'll add auto tests later. ========== to ========== media: Fix expiry time convertion from base::Time to JS time This is broken by https://codereview.chromium.org/2593073002/ where the behavior of converting a null base::Time to JS time (double) has been changed. We are discussing how to fix the base::Time API more properly. For now, this check should work. BUG=679079 TEST=Manually tested. I'll add auto tests later. ==========
miu: FYI
The CQ bit was checked by xhwang@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...
https://codereview.chromium.org/2650033007/diff/1/media/blink/webcontentdecry... File media/blink/webcontentdecryptionmodulesession_impl.cc (right): https://codereview.chromium.org/2650033007/diff/1/media/blink/webcontentdecry... media/blink/webcontentdecryptionmodulesession_impl.cc:501: : new_expiry_time.ToJsTime()); This seems to duplicate some of the functionality in [1]. Can you to just pass in base::Time to |expirationChanged| function and then check for null there. I think eventually |is_null| check should be replace with opationl<Time> but this seems a good approach in the interim. [1] https://codesearch.chromium.org/chromium/src/third_party/WebKit/Source/module...
The CQ bit was checked by xhwang@chromium.org to run a CQ dry run
PTAL again! https://codereview.chromium.org/2650033007/diff/1/media/blink/webcontentdecry... File media/blink/webcontentdecryptionmodulesession_impl.cc (right): https://codereview.chromium.org/2650033007/diff/1/media/blink/webcontentdecry... media/blink/webcontentdecryptionmodulesession_impl.cc:501: : new_expiry_time.ToJsTime()); On 2017/01/25 18:53:28, majidvp wrote: > This seems to duplicate some of the functionality in [1]. > Can you to just pass in base::Time to > |expirationChanged| function and then check for null there. Previously base::Time wasn't allowed in Blink. Now I checked again, it seems base/time is not allowed by DEPS https://cs.chromium.org/chromium/src/third_party/WebKit/public/platform/DEPS?... Also, since I need to merge this into M57, I'd like to keep this CL small. That said, I fixed the FIXME at [1]. > I think eventually |is_null| check should be replace with opationl<Time> > but this seems a good approach in the interim. Actually, the Blink time also has the concept of isNull(). I still think a null time (corresponding to NaN double) makes sense :) > [1] > https://codesearch.chromium.org/chromium/src/third_party/WebKit/Source/module... >
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.
lgtm with nits. :) > https://codereview.chromium.org/2650033007/diff/1/media/blink/webcontentdecry... > media/blink/webcontentdecryptionmodulesession_impl.cc:501: : > new_expiry_time.ToJsTime()); > On 2017/01/25 18:53:28, majidvp wrote: > > This seems to duplicate some of the functionality in [1]. > > Can you to just pass in base::Time to > > |expirationChanged| function and then check for null there. > > Previously base::Time wasn't allowed in Blink. Now I checked again, it seems > base/time is not allowed by DEPS > https://cs.chromium.org/chromium/src/third_party/WebKit/public/platform/DEPS?... There is WTF::Time see wtf/Time.h (But that may not work given that I am removing isNull from it) > > I think eventually |is_null| check should be replace with opationl<Time> > > but this seems a good approach in the interim. > > Actually, the Blink time also has the concept of isNull(). I still think a null > time (corresponding to NaN double) makes sense :) I am removing that here. https://codereview.chromium.org/2656843003/
https://codereview.chromium.org/2650033007/diff/20001/third_party/WebKit/Sour... File third_party/WebKit/Source/modules/encryptedmedia/MediaKeySession.cpp (right): https://codereview.chromium.org/2650033007/diff/20001/third_party/WebKit/Sour... third_party/WebKit/Source/modules/encryptedmedia/MediaKeySession.cpp:946: void MediaKeySession::expirationChanged(double updatedExpiryTimeInMS) { nit: Please update the function comment for WebContentDecryptionModuleSession::expirationChange to call out NaN as a valid input and its meaning. (Perhaps even s/updatedExpiryTimeInMS/updatedExpiryTimeInMSOrNaN/) https://codereview.chromium.org/2650033007/diff/20001/third_party/WebKit/Sour... third_party/WebKit/Source/modules/encryptedmedia/MediaKeySession.cpp:954: double expirationTime = std::numeric_limits<double>::quiet_NaN(); nit: how about turning this quient_NaN() value into a constant e.g., |NeverExpire| or something like that? This should help with readability.
https://codereview.chromium.org/2650033007/diff/20001/third_party/WebKit/Sour... File third_party/WebKit/Source/modules/encryptedmedia/MediaKeySession.cpp (right): https://codereview.chromium.org/2650033007/diff/20001/third_party/WebKit/Sour... third_party/WebKit/Source/modules/encryptedmedia/MediaKeySession.cpp:946: void MediaKeySession::expirationChanged(double updatedExpiryTimeInMS) { On 2017/01/25 22:29:02, majidvp wrote: > nit: Please update the function comment for > WebContentDecryptionModuleSession::expirationChange to call out NaN as a > valid input and its meaning. > > (Perhaps even s/updatedExpiryTimeInMS/updatedExpiryTimeInMSOrNaN/) I looked at quiet_NaN() and isnan() call sites and I didn't see anywhere use the pattern FooOrNan... I suppose NaN is just a part of double. Like you don't pass in a number as NumOrZero... https://codereview.chromium.org/2650033007/diff/20001/third_party/WebKit/Sour... third_party/WebKit/Source/modules/encryptedmedia/MediaKeySession.cpp:954: double expirationTime = std::numeric_limits<double>::quiet_NaN(); On 2017/01/25 22:29:02, majidvp wrote: > nit: how about turning this quient_NaN() value into a constant e.g., > |NeverExpire| or something like that? > This should help with readability. Well, if you read the spec language on line 953, it's explicit that this should be NaN. Then it's in the spec text that NaN means "never expire"...
lgtm
https://codereview.chromium.org/2650033007/diff/20001/third_party/WebKit/Sour... File third_party/WebKit/Source/modules/encryptedmedia/MediaKeySession.cpp (right): https://codereview.chromium.org/2650033007/diff/20001/third_party/WebKit/Sour... third_party/WebKit/Source/modules/encryptedmedia/MediaKeySession.cpp:946: void MediaKeySession::expirationChanged(double updatedExpiryTimeInMS) { On 2017/01/25 22:34:06, xhwang_slow wrote: > On 2017/01/25 22:29:02, majidvp wrote: > > nit: Please update the function comment for > > WebContentDecryptionModuleSession::expirationChange to call out NaN as a > > valid input and its meaning. > > > > (Perhaps even s/updatedExpiryTimeInMS/updatedExpiryTimeInMSOrNaN/) > > I looked at quiet_NaN() and isnan() call sites and I didn't see anywhere use the > pattern FooOrNan... I suppose NaN is just a part of double. Like you don't pass > in a number as NumOrZero... fair enough. https://codereview.chromium.org/2650033007/diff/20001/third_party/WebKit/Sour... third_party/WebKit/Source/modules/encryptedmedia/MediaKeySession.cpp:954: double expirationTime = std::numeric_limits<double>::quiet_NaN(); On 2017/01/25 22:34:06, xhwang_slow wrote: > On 2017/01/25 22:29:02, majidvp wrote: > > nit: how about turning this quient_NaN() value into a constant e.g., > > |NeverExpire| or something like that? > > This should help with readability. > > Well, if you read the spec language on line 953, it's explicit that this should > be NaN. Then it's in the spec text that NaN means "never expire"... I am not suggesting to change it from NaN. Rather have a named constant with that value. In fact, I think this matches the style guide [1] https://google.github.io/styleguide/cppguide.html "If the argument is a literal constant, and the same constant is used in multiple function calls in a way that tacitly assumes they're the same, you should use a named constant to make that constraint explicit, and to guarantee that it holds."
https://codereview.chromium.org/2650033007/diff/20001/third_party/WebKit/Sour... File third_party/WebKit/Source/modules/encryptedmedia/MediaKeySession.cpp (right): https://codereview.chromium.org/2650033007/diff/20001/third_party/WebKit/Sour... third_party/WebKit/Source/modules/encryptedmedia/MediaKeySession.cpp:954: double expirationTime = std::numeric_limits<double>::quiet_NaN(); On 2017/01/25 22:49:02, majidvp wrote: > On 2017/01/25 22:34:06, xhwang_slow wrote: > > On 2017/01/25 22:29:02, majidvp wrote: > > > nit: how about turning this quient_NaN() value into a constant e.g., > > > |NeverExpire| or something like that? > > > This should help with readability. > > > > Well, if you read the spec language on line 953, it's explicit that this > should > > be NaN. Then it's in the spec text that NaN means "never expire"... > > I am not suggesting to change it from NaN. Rather have a named > constant with that value. In fact, I think this matches the style > guide > > [1] https://google.github.io/styleguide/cppguide.html > > "If the argument is a literal constant, and the same constant is used in > multiple function calls in a way that tacitly assumes they're the same, you > should use a named constant to make that constraint explicit, and to guarantee > that it holds." Well... quiet_Nan() is already such a constant name... Do you mean I should have a const double kDoubleNaN = quiet_NaN()?
The CQ bit was checked by xhwang@chromium.org
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": 20001, "attempt_start_ts": 1485410428910760, "parent_rev": "b71beb8843deac62f26c8a0753fa5e8b16e63248", "commit_rev": "d81adccb0dd24dd7c47ad0d3400dd745150e76db"}
Message was sent while issue was closed.
Description was changed from ========== media: Fix expiry time convertion from base::Time to JS time This is broken by https://codereview.chromium.org/2593073002/ where the behavior of converting a null base::Time to JS time (double) has been changed. We are discussing how to fix the base::Time API more properly. For now, this check should work. BUG=679079 TEST=Manually tested. I'll add auto tests later. ========== to ========== media: Fix expiry time convertion from base::Time to JS time This is broken by https://codereview.chromium.org/2593073002/ where the behavior of converting a null base::Time to JS time (double) has been changed. We are discussing how to fix the base::Time API more properly. For now, this check should work. BUG=679079 TEST=Manually tested. I'll add auto tests later. Review-Url: https://codereview.chromium.org/2650033007 Cr-Commit-Position: refs/heads/master@{#446246} Committed: https://chromium.googlesource.com/chromium/src/+/d81adccb0dd24dd7c47ad0d3400d... ==========
Message was sent while issue was closed.
Committed patchset #2 (id:20001) as https://chromium.googlesource.com/chromium/src/+/d81adccb0dd24dd7c47ad0d3400d... |