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

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

Issue 621903003: Add MediaKeySession.expiration attribute. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase Created 6 years, 2 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
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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 #include "platform/Logging.h" 42 #include "platform/Logging.h"
43 #include "platform/MIMETypeRegistry.h" 43 #include "platform/MIMETypeRegistry.h"
44 #include "platform/Timer.h" 44 #include "platform/Timer.h"
45 #include "public/platform/WebContentDecryptionModule.h" 45 #include "public/platform/WebContentDecryptionModule.h"
46 #include "public/platform/WebContentDecryptionModuleException.h" 46 #include "public/platform/WebContentDecryptionModuleException.h"
47 #include "public/platform/WebContentDecryptionModuleSession.h" 47 #include "public/platform/WebContentDecryptionModuleSession.h"
48 #include "public/platform/WebString.h" 48 #include "public/platform/WebString.h"
49 #include "public/platform/WebURL.h" 49 #include "public/platform/WebURL.h"
50 #include "wtf/ArrayBuffer.h" 50 #include "wtf/ArrayBuffer.h"
51 #include "wtf/ArrayBufferView.h" 51 #include "wtf/ArrayBufferView.h"
52 #include <cmath>
53 #include <limits>
52 54
53 namespace blink { 55 namespace blink {
54 56
55 static bool isKeySystemSupportedWithInitDataType(const String& keySystem, const String& initDataType) 57 static bool isKeySystemSupportedWithInitDataType(const String& keySystem, const String& initDataType)
56 { 58 {
57 ASSERT(!keySystem.isEmpty()); 59 ASSERT(!keySystem.isEmpty());
58 60
59 // FIXME: initDataType != contentType. Implement this properly. 61 // FIXME: initDataType != contentType. Implement this properly.
60 // http://crbug.com/385874. 62 // http://crbug.com/385874.
61 String contentType = initDataType; 63 String contentType = initDataType;
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 session->suspendIfNeeded(); 213 session->suspendIfNeeded();
212 return session.get(); 214 return session.get();
213 } 215 }
214 216
215 MediaKeySession::MediaKeySession(ScriptState* scriptState, MediaKeys* mediaKeys, const String& sessionType) 217 MediaKeySession::MediaKeySession(ScriptState* scriptState, MediaKeys* mediaKeys, const String& sessionType)
216 : ActiveDOMObject(scriptState->executionContext()) 218 : ActiveDOMObject(scriptState->executionContext())
217 , m_keySystem(mediaKeys->keySystem()) 219 , m_keySystem(mediaKeys->keySystem())
218 , m_asyncEventQueue(GenericEventQueue::create(this)) 220 , m_asyncEventQueue(GenericEventQueue::create(this))
219 , m_mediaKeys(mediaKeys) 221 , m_mediaKeys(mediaKeys)
220 , m_sessionType(sessionType) 222 , m_sessionType(sessionType)
223 , m_expiration(std::numeric_limits<double>::quiet_NaN())
221 , m_isUninitialized(true) 224 , m_isUninitialized(true)
222 , m_isCallable(false) 225 , m_isCallable(false)
223 , m_isClosed(false) 226 , m_isClosed(false)
224 , m_closedPromise(new ClosedPromise(scriptState->executionContext(), this, C losedPromise::Closed)) 227 , m_closedPromise(new ClosedPromise(scriptState->executionContext(), this, C losedPromise::Closed))
225 , m_actionTimer(this, &MediaKeySession::actionTimerFired) 228 , m_actionTimer(this, &MediaKeySession::actionTimerFired)
226 { 229 {
227 WTF_LOG(Media, "MediaKeySession(%p)::MediaKeySession", this); 230 WTF_LOG(Media, "MediaKeySession(%p)::MediaKeySession", this);
228 231
229 // Create the matching Chromium object. It will not be usable until 232 // Create the matching Chromium object. It will not be usable until
230 // initializeNewSession() is called in response to the user calling 233 // initializeNewSession() is called in response to the user calling
231 // generateRequest(). 234 // generateRequest().
232 WebContentDecryptionModule* cdm = mediaKeys->contentDecryptionModule(); 235 WebContentDecryptionModule* cdm = mediaKeys->contentDecryptionModule();
233 m_session = adoptPtr(cdm->createSession()); 236 m_session = adoptPtr(cdm->createSession());
234 m_session->setClientInterface(this); 237 m_session->setClientInterface(this);
235 238
236 // MediaKeys::createSession(), step 2. 239 // MediaKeys::createSession(), step 2.
237 // 2.1 Let the sessionId attribute be the empty string. 240 // 2.1 Let the sessionId attribute be the empty string.
238 ASSERT(sessionId().isEmpty()); 241 ASSERT(sessionId().isEmpty());
239 242
240 // 2.2 Let the expiration attribute be NaN. 243 // 2.2 Let the expiration attribute be NaN.
241 // FIXME: Add expiration property. 244 ASSERT(std::isnan(m_expiration));
242 245
243 // 2.3 Let the closed attribute be a new promise. 246 // 2.3 Let the closed attribute be a new promise.
244 ASSERT(!closed(scriptState).isUndefinedOrNull()); 247 ASSERT(!closed(scriptState).isUndefinedOrNull());
245 248
246 // 2.4 Let the session type be sessionType. 249 // 2.4 Let the session type be sessionType.
247 ASSERT(sessionType == m_sessionType); 250 ASSERT(sessionType == m_sessionType);
248 251
249 // 2.5 Let uninitialized be true. 252 // 2.5 Let uninitialized be true.
250 ASSERT(m_isUninitialized); 253 ASSERT(m_isUninitialized);
251 254
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 default: 603 default:
601 // All other exceptions get converted into Unknown. 604 // All other exceptions get converted into Unknown.
602 errorCode = MediaKeyErrorCodeUnknown; 605 errorCode = MediaKeyErrorCodeUnknown;
603 break; 606 break;
604 } 607 }
605 error(errorCode, systemCode); 608 error(errorCode, systemCode);
606 } 609 }
607 610
608 void MediaKeySession::expirationChanged(double updatedExpiryTimeInMS) 611 void MediaKeySession::expirationChanged(double updatedExpiryTimeInMS)
609 { 612 {
610 // FIXME: Implement expiration attribute. 613 m_expiration = updatedExpiryTimeInMS;
611 } 614 }
612 615
613 const AtomicString& MediaKeySession::interfaceName() const 616 const AtomicString& MediaKeySession::interfaceName() const
614 { 617 {
615 return EventTargetNames::MediaKeySession; 618 return EventTargetNames::MediaKeySession;
616 } 619 }
617 620
618 ExecutionContext* MediaKeySession::executionContext() const 621 ExecutionContext* MediaKeySession::executionContext() const
619 { 622 {
620 return ActiveDOMObject::executionContext(); 623 return ActiveDOMObject::executionContext();
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 { 655 {
653 visitor->trace(m_error); 656 visitor->trace(m_error);
654 visitor->trace(m_asyncEventQueue); 657 visitor->trace(m_asyncEventQueue);
655 visitor->trace(m_pendingActions); 658 visitor->trace(m_pendingActions);
656 visitor->trace(m_mediaKeys); 659 visitor->trace(m_mediaKeys);
657 visitor->trace(m_closedPromise); 660 visitor->trace(m_closedPromise);
658 EventTargetWithInlineData::trace(visitor); 661 EventTargetWithInlineData::trace(visitor);
659 } 662 }
660 663
661 } // namespace blink 664 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/encryptedmedia/MediaKeySession.h ('k') | Source/modules/encryptedmedia/MediaKeySession.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698