Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(263)

Side by Side Diff: third_party/WebKit/Source/modules/encryptedmedia/MediaKeySession.cpp

Issue 2650033007: media: Fix expiry time convertion from base::Time to JS time (Closed)
Patch Set: media: Fix expiry time convertion from base::Time to JS time Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/blink/webcontentdecryptionmodulesession_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Apple Inc. All rights reserved. 2 * Copyright (C) 2013 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 925 matching lines...) Expand 10 before | Expand all | Expand 10 after
936 // 6. Resolve promise. 936 // 6. Resolve promise.
937 m_closedPromise->resolve(ToV8UndefinedGenerator()); 937 m_closedPromise->resolve(ToV8UndefinedGenerator());
938 938
939 // After this algorithm has run, event handlers for the events queued by 939 // After this algorithm has run, event handlers for the events queued by
940 // this algorithm will be executed, but no further events can be queued. 940 // this algorithm will be executed, but no further events can be queued.
941 // As a result, no messages can be sent by the CDM as a result of closing 941 // As a result, no messages can be sent by the CDM as a result of closing
942 // the session. 942 // the session.
943 m_isClosed = true; 943 m_isClosed = true;
944 } 944 }
945 945
946 void MediaKeySession::expirationChanged(double updatedExpiryTimeInMS) { 946 void MediaKeySession::expirationChanged(double updatedExpiryTimeInMS) {
majidvp 2017/01/25 22:29:02 nit: Please update the function comment for WebCo
xhwang 2017/01/25 22:34:06 I looked at quiet_NaN() and isnan() call sites and
majidvp 2017/01/25 22:49:01 fair enough.
947 DVLOG(MEDIA_KEY_SESSION_LOG_LEVEL) << __func__ << "(" << this << ") " 947 DVLOG(MEDIA_KEY_SESSION_LOG_LEVEL) << __func__ << "(" << this << ") "
948 << updatedExpiryTimeInMS; 948 << updatedExpiryTimeInMS;
949 949
950 // From https://w3c.github.io/encrypted-media/#update-expiration: 950 // From https://w3c.github.io/encrypted-media/#update-expiration:
951 // The following steps are run: 951 // The following steps are run:
952 // 1. Let the session be the associated MediaKeySession object. 952 // 1. Let the session be the associated MediaKeySession object.
953 // 2. Let expiration time be NaN. 953 // 2. Let expiration time be NaN.
954 double expirationTime = std::numeric_limits<double>::quiet_NaN(); 954 double expirationTime = std::numeric_limits<double>::quiet_NaN();
majidvp 2017/01/25 22:29:02 nit: how about turning this quient_NaN() value int
xhwang 2017/01/25 22:34:06 Well, if you read the spec language on line 953, i
majidvp 2017/01/25 22:49:02 I am not suggesting to change it from NaN. Rather
xhwang 2017/01/25 23:22:39 Well... quiet_Nan() is already such a constant nam
955 955
956 // 3. If the new expiration time is not NaN, let expiration time be the 956 // 3. If the new expiration time is not NaN, let expiration time be the
957 // new expiration time in milliseconds since 01 January 1970 UTC. 957 // new expiration time in milliseconds since 01 January 1970 UTC.
958 // (Note that Chromium actually passes 0 to indicate no expiry.) 958 if (!std::isnan(updatedExpiryTimeInMS))
959 // FIXME: Get Chromium to pass NaN.
960 if (!std::isnan(updatedExpiryTimeInMS) && updatedExpiryTimeInMS != 0.0)
961 expirationTime = updatedExpiryTimeInMS; 959 expirationTime = updatedExpiryTimeInMS;
962 960
963 // 4. Set the session's expiration attribute to expiration time. 961 // 4. Set the session's expiration attribute to expiration time.
964 m_expiration = expirationTime; 962 m_expiration = expirationTime;
965 } 963 }
966 964
967 void MediaKeySession::keysStatusesChange( 965 void MediaKeySession::keysStatusesChange(
968 const WebVector<WebEncryptedMediaKeyInformation>& keys, 966 const WebVector<WebEncryptedMediaKeyInformation>& keys,
969 bool hasAdditionalUsableKey) { 967 bool hasAdditionalUsableKey) {
970 DVLOG(MEDIA_KEY_SESSION_LOG_LEVEL) 968 DVLOG(MEDIA_KEY_SESSION_LOG_LEVEL)
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
1043 visitor->trace(m_asyncEventQueue); 1041 visitor->trace(m_asyncEventQueue);
1044 visitor->trace(m_pendingActions); 1042 visitor->trace(m_pendingActions);
1045 visitor->trace(m_mediaKeys); 1043 visitor->trace(m_mediaKeys);
1046 visitor->trace(m_keyStatusesMap); 1044 visitor->trace(m_keyStatusesMap);
1047 visitor->trace(m_closedPromise); 1045 visitor->trace(m_closedPromise);
1048 EventTargetWithInlineData::trace(visitor); 1046 EventTargetWithInlineData::trace(visitor);
1049 ContextLifecycleObserver::trace(visitor); 1047 ContextLifecycleObserver::trace(visitor);
1050 } 1048 }
1051 1049
1052 } // namespace blink 1050 } // namespace blink
OLDNEW
« no previous file with comments | « media/blink/webcontentdecryptionmodulesession_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698