Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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> | |
|
sandersd (OOO until July 31)
2014/10/01 22:57:52
These should be between the two exiting #include b
jrummell
2014/10/03 00:36:10
Blink style guide says this is correct (and the pr
| |
| 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 Loading... | |
| 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 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 598 errorCode = MediaKeyErrorCodeClient; | 601 errorCode = MediaKeyErrorCodeClient; |
| 599 break; | 602 break; |
| 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 |
| 611 void MediaKeySession::expirationChanged(double updatedExpiryTimeInMS) | |
| 612 { | |
| 613 m_expiration = updatedExpiryTimeInMS; | |
| 614 } | |
| 615 | |
| 608 const AtomicString& MediaKeySession::interfaceName() const | 616 const AtomicString& MediaKeySession::interfaceName() const |
| 609 { | 617 { |
| 610 return EventTargetNames::MediaKeySession; | 618 return EventTargetNames::MediaKeySession; |
| 611 } | 619 } |
| 612 | 620 |
| 613 ExecutionContext* MediaKeySession::executionContext() const | 621 ExecutionContext* MediaKeySession::executionContext() const |
| 614 { | 622 { |
| 615 return ActiveDOMObject::executionContext(); | 623 return ActiveDOMObject::executionContext(); |
| 616 } | 624 } |
| 617 | 625 |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 647 { | 655 { |
| 648 visitor->trace(m_error); | 656 visitor->trace(m_error); |
| 649 visitor->trace(m_asyncEventQueue); | 657 visitor->trace(m_asyncEventQueue); |
| 650 visitor->trace(m_pendingActions); | 658 visitor->trace(m_pendingActions); |
| 651 visitor->trace(m_mediaKeys); | 659 visitor->trace(m_mediaKeys); |
| 652 visitor->trace(m_closedPromise); | 660 visitor->trace(m_closedPromise); |
| 653 EventTargetWithInlineData::trace(visitor); | 661 EventTargetWithInlineData::trace(visitor); |
| 654 } | 662 } |
| 655 | 663 |
| 656 } // namespace blink | 664 } // namespace blink |
| OLD | NEW |