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

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

Issue 2161193003: Use __func__ instead of __FUNCTION__. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Resync Created 4 years, 4 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 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 , m_mediaKeys(mediaKeys) 318 , m_mediaKeys(mediaKeys)
319 , m_sessionType(sessionType) 319 , m_sessionType(sessionType)
320 , m_expiration(std::numeric_limits<double>::quiet_NaN()) 320 , m_expiration(std::numeric_limits<double>::quiet_NaN())
321 , m_keyStatusesMap(new MediaKeyStatusMap()) 321 , m_keyStatusesMap(new MediaKeyStatusMap())
322 , m_isUninitialized(true) 322 , m_isUninitialized(true)
323 , m_isCallable(false) 323 , m_isCallable(false)
324 , m_isClosed(false) 324 , m_isClosed(false)
325 , m_closedPromise(new ClosedPromise(scriptState->getExecutionContext(), this , ClosedPromise::Closed)) 325 , m_closedPromise(new ClosedPromise(scriptState->getExecutionContext(), this , ClosedPromise::Closed))
326 , m_actionTimer(this, &MediaKeySession::actionTimerFired) 326 , m_actionTimer(this, &MediaKeySession::actionTimerFired)
327 { 327 {
328 DVLOG(MEDIA_KEY_SESSION_LOG_LEVEL) << __FUNCTION__ << "(" << this << ")"; 328 DVLOG(MEDIA_KEY_SESSION_LOG_LEVEL) << __func__ << "(" << this << ")";
329 ThreadState::current()->registerPreFinalizer(this); 329 ThreadState::current()->registerPreFinalizer(this);
330 330
331 // Create the matching Chromium object. It will not be usable until 331 // Create the matching Chromium object. It will not be usable until
332 // initializeNewSession() is called in response to the user calling 332 // initializeNewSession() is called in response to the user calling
333 // generateRequest(). 333 // generateRequest().
334 WebContentDecryptionModule* cdm = mediaKeys->contentDecryptionModule(); 334 WebContentDecryptionModule* cdm = mediaKeys->contentDecryptionModule();
335 m_session = wrapUnique(cdm->createSession()); 335 m_session = wrapUnique(cdm->createSession());
336 m_session->setClientInterface(this); 336 m_session->setClientInterface(this);
337 337
338 // From https://w3c.github.io/encrypted-media/#createSession: 338 // From https://w3c.github.io/encrypted-media/#createSession:
(...skipping 22 matching lines...) Expand all
361 // 3.8 Let the use distinctive identifier value be this object's 361 // 3.8 Let the use distinctive identifier value be this object's
362 // use distinctive identifier. 362 // use distinctive identifier.
363 // FIXME: Implement this (http://crbug.com/448922). 363 // FIXME: Implement this (http://crbug.com/448922).
364 364
365 // 3.9 Let the cdm implementation value be this object's cdm implementation. 365 // 3.9 Let the cdm implementation value be this object's cdm implementation.
366 // 3.10 Let the cdm instance value be this object's cdm instance. 366 // 3.10 Let the cdm instance value be this object's cdm instance.
367 } 367 }
368 368
369 MediaKeySession::~MediaKeySession() 369 MediaKeySession::~MediaKeySession()
370 { 370 {
371 DVLOG(MEDIA_KEY_SESSION_LOG_LEVEL) << __FUNCTION__ << "(" << this << ")"; 371 DVLOG(MEDIA_KEY_SESSION_LOG_LEVEL) << __func__ << "(" << this << ")";
372 } 372 }
373 373
374 void MediaKeySession::dispose() 374 void MediaKeySession::dispose()
375 { 375 {
376 // Promptly clears a raw reference from content/ to an on-heap object 376 // Promptly clears a raw reference from content/ to an on-heap object
377 // so that content/ doesn't access it in a lazy sweeping phase. 377 // so that content/ doesn't access it in a lazy sweeping phase.
378 m_session.reset(); 378 m_session.reset();
379 } 379 }
380 380
381 String MediaKeySession::sessionId() const 381 String MediaKeySession::sessionId() const
382 { 382 {
383 return m_session->sessionId(); 383 return m_session->sessionId();
384 } 384 }
385 385
386 ScriptPromise MediaKeySession::closed(ScriptState* scriptState) 386 ScriptPromise MediaKeySession::closed(ScriptState* scriptState)
387 { 387 {
388 return m_closedPromise->promise(scriptState->world()); 388 return m_closedPromise->promise(scriptState->world());
389 } 389 }
390 390
391 MediaKeyStatusMap* MediaKeySession::keyStatuses() 391 MediaKeyStatusMap* MediaKeySession::keyStatuses()
392 { 392 {
393 return m_keyStatusesMap; 393 return m_keyStatusesMap;
394 } 394 }
395 395
396 ScriptPromise MediaKeySession::generateRequest(ScriptState* scriptState, const S tring& initDataTypeString, const DOMArrayPiece& initData) 396 ScriptPromise MediaKeySession::generateRequest(ScriptState* scriptState, const S tring& initDataTypeString, const DOMArrayPiece& initData)
397 { 397 {
398 DVLOG(MEDIA_KEY_SESSION_LOG_LEVEL) << __FUNCTION__ << "(" << this << ") " << initDataTypeString; 398 DVLOG(MEDIA_KEY_SESSION_LOG_LEVEL) << __func__ << "(" << this << ") " << ini tDataTypeString;
399 399
400 // From https://w3c.github.io/encrypted-media/#generateRequest: 400 // From https://w3c.github.io/encrypted-media/#generateRequest:
401 // Generates a request based on the initData. When this method is invoked, 401 // Generates a request based on the initData. When this method is invoked,
402 // the user agent must run the following steps: 402 // the user agent must run the following steps:
403 403
404 // 1. If this object's uninitialized value is false, return a promise 404 // 1. If this object's uninitialized value is false, return a promise
405 // rejected with a new DOMException whose name is "InvalidStateError". 405 // rejected with a new DOMException whose name is "InvalidStateError".
406 if (!m_isUninitialized) 406 if (!m_isUninitialized)
407 return CreateRejectedPromiseAlreadyInitialized(scriptState); 407 return CreateRejectedPromiseAlreadyInitialized(scriptState);
408 408
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 m_pendingActions.append(PendingAction::CreatePendingGenerateRequest(result, initDataType, initDataBuffer)); 452 m_pendingActions.append(PendingAction::CreatePendingGenerateRequest(result, initDataType, initDataBuffer));
453 DCHECK(!m_actionTimer.isActive()); 453 DCHECK(!m_actionTimer.isActive());
454 m_actionTimer.startOneShot(0, BLINK_FROM_HERE); 454 m_actionTimer.startOneShot(0, BLINK_FROM_HERE);
455 455
456 // 10. Return promise. 456 // 10. Return promise.
457 return promise; 457 return promise;
458 } 458 }
459 459
460 ScriptPromise MediaKeySession::load(ScriptState* scriptState, const String& sess ionId) 460 ScriptPromise MediaKeySession::load(ScriptState* scriptState, const String& sess ionId)
461 { 461 {
462 DVLOG(MEDIA_KEY_SESSION_LOG_LEVEL) << __FUNCTION__ << "(" << this << ") " << sessionId; 462 DVLOG(MEDIA_KEY_SESSION_LOG_LEVEL) << __func__ << "(" << this << ") " << ses sionId;
463 463
464 // From https://w3c.github.io/encrypted-media/#load: 464 // From https://w3c.github.io/encrypted-media/#load:
465 // Loads the data stored for the specified session into this object. When 465 // Loads the data stored for the specified session into this object. When
466 // this method is invoked, the user agent must run the following steps: 466 // this method is invoked, the user agent must run the following steps:
467 467
468 // 1. If this object's uninitialized value is false, return a promise 468 // 1. If this object's uninitialized value is false, return a promise
469 // rejected with a new DOMException whose name is "InvalidStateError". 469 // rejected with a new DOMException whose name is "InvalidStateError".
470 if (!m_isUninitialized) 470 if (!m_isUninitialized)
471 return CreateRejectedPromiseAlreadyInitialized(scriptState); 471 return CreateRejectedPromiseAlreadyInitialized(scriptState);
472 472
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 m_pendingActions.append(PendingAction::CreatePendingLoadRequest(result, sess ionId)); 506 m_pendingActions.append(PendingAction::CreatePendingLoadRequest(result, sess ionId));
507 DCHECK(!m_actionTimer.isActive()); 507 DCHECK(!m_actionTimer.isActive());
508 m_actionTimer.startOneShot(0, BLINK_FROM_HERE); 508 m_actionTimer.startOneShot(0, BLINK_FROM_HERE);
509 509
510 // 9. Return promise. 510 // 9. Return promise.
511 return promise; 511 return promise;
512 } 512 }
513 513
514 ScriptPromise MediaKeySession::update(ScriptState* scriptState, const DOMArrayPi ece& response) 514 ScriptPromise MediaKeySession::update(ScriptState* scriptState, const DOMArrayPi ece& response)
515 { 515 {
516 DVLOG(MEDIA_KEY_SESSION_LOG_LEVEL) << __FUNCTION__ << "(" << this << ")"; 516 DVLOG(MEDIA_KEY_SESSION_LOG_LEVEL) << __func__ << "(" << this << ")";
517 DCHECK(!m_isClosed); 517 DCHECK(!m_isClosed);
518 518
519 // From https://w3c.github.io/encrypted-media/#update: 519 // From https://w3c.github.io/encrypted-media/#update:
520 // Provides messages, including licenses, to the CDM. When this method is 520 // Provides messages, including licenses, to the CDM. When this method is
521 // invoked, the user agent must run the following steps: 521 // invoked, the user agent must run the following steps:
522 522
523 // 1. If this object's callable value is false, return a promise rejected 523 // 1. If this object's callable value is false, return a promise rejected
524 // with a new DOMException whose name is InvalidStateError. 524 // with a new DOMException whose name is InvalidStateError.
525 if (!m_isCallable) 525 if (!m_isCallable)
526 return CreateRejectedPromiseNotCallable(scriptState); 526 return CreateRejectedPromiseNotCallable(scriptState);
(...skipping 17 matching lines...) Expand all
544 m_pendingActions.append(PendingAction::CreatePendingUpdate(result, responseC opy)); 544 m_pendingActions.append(PendingAction::CreatePendingUpdate(result, responseC opy));
545 if (!m_actionTimer.isActive()) 545 if (!m_actionTimer.isActive())
546 m_actionTimer.startOneShot(0, BLINK_FROM_HERE); 546 m_actionTimer.startOneShot(0, BLINK_FROM_HERE);
547 547
548 // 6. Return promise. 548 // 6. Return promise.
549 return promise; 549 return promise;
550 } 550 }
551 551
552 ScriptPromise MediaKeySession::close(ScriptState* scriptState) 552 ScriptPromise MediaKeySession::close(ScriptState* scriptState)
553 { 553 {
554 DVLOG(MEDIA_KEY_SESSION_LOG_LEVEL) << __FUNCTION__ << "(" << this << ")"; 554 DVLOG(MEDIA_KEY_SESSION_LOG_LEVEL) << __func__ << "(" << this << ")";
555 555
556 // From https://w3c.github.io/encrypted-media/#close: 556 // From https://w3c.github.io/encrypted-media/#close:
557 // Indicates that the application no longer needs the session and the CDM 557 // Indicates that the application no longer needs the session and the CDM
558 // should release any resources associated with this object and close it. 558 // should release any resources associated with this object and close it.
559 // When this method is invoked, the user agent must run the following steps: 559 // When this method is invoked, the user agent must run the following steps:
560 560
561 // 1. If this object's callable value is false, return a promise rejected 561 // 1. If this object's callable value is false, return a promise rejected
562 // with a new DOMException whose name is "InvalidStateError". 562 // with a new DOMException whose name is "InvalidStateError".
563 if (!m_isCallable) 563 if (!m_isCallable)
564 return CreateRejectedPromiseNotCallable(scriptState); 564 return CreateRejectedPromiseNotCallable(scriptState);
(...skipping 12 matching lines...) Expand all
577 m_pendingActions.append(PendingAction::CreatePendingClose(result)); 577 m_pendingActions.append(PendingAction::CreatePendingClose(result));
578 if (!m_actionTimer.isActive()) 578 if (!m_actionTimer.isActive())
579 m_actionTimer.startOneShot(0, BLINK_FROM_HERE); 579 m_actionTimer.startOneShot(0, BLINK_FROM_HERE);
580 580
581 // 5. Return promise. 581 // 5. Return promise.
582 return promise; 582 return promise;
583 } 583 }
584 584
585 ScriptPromise MediaKeySession::remove(ScriptState* scriptState) 585 ScriptPromise MediaKeySession::remove(ScriptState* scriptState)
586 { 586 {
587 DVLOG(MEDIA_KEY_SESSION_LOG_LEVEL) << __FUNCTION__ << "(" << this << ")"; 587 DVLOG(MEDIA_KEY_SESSION_LOG_LEVEL) << __func__ << "(" << this << ")";
588 588
589 // From https://w3c.github.io/encrypted-media/#remove: 589 // From https://w3c.github.io/encrypted-media/#remove:
590 // Removes stored session data associated with this object. When this 590 // Removes stored session data associated with this object. When this
591 // method is invoked, the user agent must run the following steps: 591 // method is invoked, the user agent must run the following steps:
592 592
593 // 1. If this object's callable value is false, return a promise rejected 593 // 1. If this object's callable value is false, return a promise rejected
594 // with a new DOMException whose name is "InvalidStateError". 594 // with a new DOMException whose name is "InvalidStateError".
595 if (!m_isCallable) 595 if (!m_isCallable)
596 return CreateRejectedPromiseNotCallable(scriptState); 596 return CreateRejectedPromiseNotCallable(scriptState);
597 597
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 // a local copy to avoid problems if this happens. 634 // a local copy to avoid problems if this happens.
635 HeapDeque<Member<PendingAction>> pendingActions; 635 HeapDeque<Member<PendingAction>> pendingActions;
636 pendingActions.swap(m_pendingActions); 636 pendingActions.swap(m_pendingActions);
637 637
638 while (!pendingActions.isEmpty()) { 638 while (!pendingActions.isEmpty()) {
639 PendingAction* action = pendingActions.takeFirst(); 639 PendingAction* action = pendingActions.takeFirst();
640 640
641 switch (action->getType()) { 641 switch (action->getType()) {
642 case PendingAction::GenerateRequest: 642 case PendingAction::GenerateRequest:
643 // NOTE: Continue step 9 of MediaKeySession::generateRequest(). 643 // NOTE: Continue step 9 of MediaKeySession::generateRequest().
644 DVLOG(MEDIA_KEY_SESSION_LOG_LEVEL) << __FUNCTION__ << "(" << this << ") GenerateRequest"; 644 DVLOG(MEDIA_KEY_SESSION_LOG_LEVEL) << __func__ << "(" << this << ") GenerateRequest";
645 645
646 // initializeNewSession() in Chromium will execute steps 9.1 to 9.7. 646 // initializeNewSession() in Chromium will execute steps 9.1 to 9.7.
647 m_session->initializeNewSession(action->initDataType(), static_cast< unsigned char*>(action->data()->data()), action->data()->byteLength(), m_session Type, action->result()->result()); 647 m_session->initializeNewSession(action->initDataType(), static_cast< unsigned char*>(action->data()->data()), action->data()->byteLength(), m_session Type, action->result()->result());
648 648
649 // Remaining steps (from 9.8) executed in finishGenerateRequest(), 649 // Remaining steps (from 9.8) executed in finishGenerateRequest(),
650 // called when |result| is resolved. 650 // called when |result| is resolved.
651 break; 651 break;
652 652
653 case PendingAction::Load: 653 case PendingAction::Load:
654 // NOTE: Continue step 8 of MediaKeySession::load(). 654 // NOTE: Continue step 8 of MediaKeySession::load().
655 DVLOG(MEDIA_KEY_SESSION_LOG_LEVEL) << __FUNCTION__ << "(" << this << ") Load"; 655 DVLOG(MEDIA_KEY_SESSION_LOG_LEVEL) << __func__ << "(" << this << ") Load";
656 656
657 // 8.1 Let sanitized session ID be a validated and/or sanitized 657 // 8.1 Let sanitized session ID be a validated and/or sanitized
658 // version of sessionId. The user agent should thoroughly 658 // version of sessionId. The user agent should thoroughly
659 // validate the sessionId value before passing it to the CDM. 659 // validate the sessionId value before passing it to the CDM.
660 // At a minimum, this should include checking that the length 660 // At a minimum, this should include checking that the length
661 // and value (e.g. alphanumeric) are reasonable. 661 // and value (e.g. alphanumeric) are reasonable.
662 // 8.2 If the previous step failed, reject promise with a new 662 // 8.2 If the previous step failed, reject promise with a new
663 // DOMException whose name is "InvalidAccessError". 663 // DOMException whose name is "InvalidAccessError".
664 if (!isValidSessionId(action->sessionId())) { 664 if (!isValidSessionId(action->sessionId())) {
665 action->result()->completeWithError(WebContentDecryptionModuleEx ceptionInvalidAccessError, 0, "Invalid sessionId"); 665 action->result()->completeWithError(WebContentDecryptionModuleEx ceptionInvalidAccessError, 0, "Invalid sessionId");
(...skipping 14 matching lines...) Expand all
680 680
681 // load() in Chromium will execute steps 8.5 through 8.8. 681 // load() in Chromium will execute steps 8.5 through 8.8.
682 m_session->load(action->sessionId(), action->result()->result()); 682 m_session->load(action->sessionId(), action->result()->result());
683 683
684 // Remaining steps (from 8.9) executed in finishLoad(), called 684 // Remaining steps (from 8.9) executed in finishLoad(), called
685 // when |result| is resolved. 685 // when |result| is resolved.
686 break; 686 break;
687 687
688 case PendingAction::Update: 688 case PendingAction::Update:
689 // NOTE: Continue step 5 of MediaKeySession::update(). 689 // NOTE: Continue step 5 of MediaKeySession::update().
690 DVLOG(MEDIA_KEY_SESSION_LOG_LEVEL) << __FUNCTION__ << "(" << this << ") Update"; 690 DVLOG(MEDIA_KEY_SESSION_LOG_LEVEL) << __func__ << "(" << this << ") Update";
691 691
692 // update() in Chromium will execute steps 5.1 through 5.8. 692 // update() in Chromium will execute steps 5.1 through 5.8.
693 m_session->update(static_cast<unsigned char*>(action->data()->data() ), action->data()->byteLength(), action->result()->result()); 693 m_session->update(static_cast<unsigned char*>(action->data()->data() ), action->data()->byteLength(), action->result()->result());
694 694
695 // Last step (5.9 Resolve promise) will be done when |result| is 695 // Last step (5.9 Resolve promise) will be done when |result| is
696 // resolved. 696 // resolved.
697 break; 697 break;
698 698
699 case PendingAction::Close: 699 case PendingAction::Close:
700 // NOTE: Continue step 4 of MediaKeySession::close(). 700 // NOTE: Continue step 4 of MediaKeySession::close().
701 DVLOG(MEDIA_KEY_SESSION_LOG_LEVEL) << __FUNCTION__ << "(" << this << ") Close"; 701 DVLOG(MEDIA_KEY_SESSION_LOG_LEVEL) << __func__ << "(" << this << ") Close";
702 702
703 // close() in Chromium will execute steps 4.1 through 4.2. 703 // close() in Chromium will execute steps 4.1 through 4.2.
704 m_session->close(action->result()->result()); 704 m_session->close(action->result()->result());
705 705
706 // Last step (4.3 Resolve promise) will be done when |result| is 706 // Last step (4.3 Resolve promise) will be done when |result| is
707 // resolved. 707 // resolved.
708 break; 708 break;
709 709
710 case PendingAction::Remove: 710 case PendingAction::Remove:
711 // NOTE: Continue step 5 of MediaKeySession::remove(). 711 // NOTE: Continue step 5 of MediaKeySession::remove().
712 DVLOG(MEDIA_KEY_SESSION_LOG_LEVEL) << __FUNCTION__ << "(" << this << ") Remove"; 712 DVLOG(MEDIA_KEY_SESSION_LOG_LEVEL) << __func__ << "(" << this << ") Remove";
713 713
714 // remove() in Chromium will execute steps 5.1 through 5.3. 714 // remove() in Chromium will execute steps 5.1 through 5.3.
715 m_session->remove(action->result()->result()); 715 m_session->remove(action->result()->result());
716 716
717 // Last step (5.3.3 Resolve promise) will be done when |result| is 717 // Last step (5.3.3 Resolve promise) will be done when |result| is
718 // resolved. 718 // resolved.
719 break; 719 break;
720 } 720 }
721 } 721 }
722 } 722 }
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
772 // on the session, providing message type and message. 772 // on the session, providing message type and message.
773 // (Done by the CDM.) 773 // (Done by the CDM.)
774 774
775 // 8.15 Resolve promise with true. 775 // 8.15 Resolve promise with true.
776 // (Done by LoadSessionResultPromise.) 776 // (Done by LoadSessionResultPromise.)
777 } 777 }
778 778
779 // Queue a task to fire a simple event named keymessage at the new object. 779 // Queue a task to fire a simple event named keymessage at the new object.
780 void MediaKeySession::message(MessageType messageType, const unsigned char* mess age, size_t messageLength) 780 void MediaKeySession::message(MessageType messageType, const unsigned char* mess age, size_t messageLength)
781 { 781 {
782 DVLOG(MEDIA_KEY_SESSION_LOG_LEVEL) << __FUNCTION__ << "(" << this << ")"; 782 DVLOG(MEDIA_KEY_SESSION_LOG_LEVEL) << __func__ << "(" << this << ")";
783 783
784 // Verify that 'message' not fired before session initialization is complete . 784 // Verify that 'message' not fired before session initialization is complete .
785 DCHECK(m_isCallable); 785 DCHECK(m_isCallable);
786 786
787 // From https://w3c.github.io/encrypted-media/#queue-message: 787 // From https://w3c.github.io/encrypted-media/#queue-message:
788 // The following steps are run: 788 // The following steps are run:
789 // 1. Let the session be the specified MediaKeySession object. 789 // 1. Let the session be the specified MediaKeySession object.
790 // 2. Queue a task to fire a simple event named message at the session. 790 // 2. Queue a task to fire a simple event named message at the session.
791 // The event is of type MediaKeyMessageEvent and has: 791 // The event is of type MediaKeyMessageEvent and has:
792 // -> messageType = the specified message type 792 // -> messageType = the specified message type
(...skipping 13 matching lines...) Expand all
806 } 806 }
807 init.setMessage(DOMArrayBuffer::create(static_cast<const void*>(message), me ssageLength)); 807 init.setMessage(DOMArrayBuffer::create(static_cast<const void*>(message), me ssageLength));
808 808
809 MediaKeyMessageEvent* event = MediaKeyMessageEvent::create(EventTypeNames::m essage, init); 809 MediaKeyMessageEvent* event = MediaKeyMessageEvent::create(EventTypeNames::m essage, init);
810 event->setTarget(this); 810 event->setTarget(this);
811 m_asyncEventQueue->enqueueEvent(event); 811 m_asyncEventQueue->enqueueEvent(event);
812 } 812 }
813 813
814 void MediaKeySession::close() 814 void MediaKeySession::close()
815 { 815 {
816 DVLOG(MEDIA_KEY_SESSION_LOG_LEVEL) << __FUNCTION__ << "(" << this << ")"; 816 DVLOG(MEDIA_KEY_SESSION_LOG_LEVEL) << __func__ << "(" << this << ")";
817 817
818 // From https://w3c.github.io/encrypted-media/#session-close: 818 // From https://w3c.github.io/encrypted-media/#session-close:
819 // The following steps are run: 819 // The following steps are run:
820 // 1. Let the session be the associated MediaKeySession object. 820 // 1. Let the session be the associated MediaKeySession object.
821 // 2. Let promise be the closed attribute of the session. 821 // 2. Let promise be the closed attribute of the session.
822 // 3. Resolve promise. 822 // 3. Resolve promise.
823 m_closedPromise->resolve(ToV8UndefinedGenerator()); 823 m_closedPromise->resolve(ToV8UndefinedGenerator());
824 824
825 // Once closed, the session can no longer be the target of events from 825 // Once closed, the session can no longer be the target of events from
826 // the CDM so this object can be garbage collected. 826 // the CDM so this object can be garbage collected.
827 m_isClosed = true; 827 m_isClosed = true;
828 } 828 }
829 829
830 void MediaKeySession::expirationChanged(double updatedExpiryTimeInMS) 830 void MediaKeySession::expirationChanged(double updatedExpiryTimeInMS)
831 { 831 {
832 DVLOG(MEDIA_KEY_SESSION_LOG_LEVEL) << __FUNCTION__ << "(" << this << ") " << updatedExpiryTimeInMS; 832 DVLOG(MEDIA_KEY_SESSION_LOG_LEVEL) << __func__ << "(" << this << ") " << upd atedExpiryTimeInMS;
833 833
834 // From https://w3c.github.io/encrypted-media/#update-expiration: 834 // From https://w3c.github.io/encrypted-media/#update-expiration:
835 // The following steps are run: 835 // The following steps are run:
836 // 1. Let the session be the associated MediaKeySession object. 836 // 1. Let the session be the associated MediaKeySession object.
837 // 2. Let expiration time be NaN. 837 // 2. Let expiration time be NaN.
838 double expirationTime = std::numeric_limits<double>::quiet_NaN(); 838 double expirationTime = std::numeric_limits<double>::quiet_NaN();
839 839
840 // 3. If the new expiration time is not NaN, let expiration time be the 840 // 3. If the new expiration time is not NaN, let expiration time be the
841 // new expiration time in milliseconds since 01 January 1970 UTC. 841 // new expiration time in milliseconds since 01 January 1970 UTC.
842 // (Note that Chromium actually passes 0 to indicate no expiry.) 842 // (Note that Chromium actually passes 0 to indicate no expiry.)
843 // FIXME: Get Chromium to pass NaN. 843 // FIXME: Get Chromium to pass NaN.
844 if (!std::isnan(updatedExpiryTimeInMS) && updatedExpiryTimeInMS != 0.0) 844 if (!std::isnan(updatedExpiryTimeInMS) && updatedExpiryTimeInMS != 0.0)
845 expirationTime = updatedExpiryTimeInMS; 845 expirationTime = updatedExpiryTimeInMS;
846 846
847 // 4. Set the session's expiration attribute to expiration time. 847 // 4. Set the session's expiration attribute to expiration time.
848 m_expiration = expirationTime; 848 m_expiration = expirationTime;
849 } 849 }
850 850
851 void MediaKeySession::keysStatusesChange(const WebVector<WebEncryptedMediaKeyInf ormation>& keys, bool hasAdditionalUsableKey) 851 void MediaKeySession::keysStatusesChange(const WebVector<WebEncryptedMediaKeyInf ormation>& keys, bool hasAdditionalUsableKey)
852 { 852 {
853 DVLOG(MEDIA_KEY_SESSION_LOG_LEVEL) << __FUNCTION__ << "(" << this << ") with " << keys.size() << " keys and hasAdditionalUsableKey is " << (hasAdditionalUsa bleKey ? "true" : "false"); 853 DVLOG(MEDIA_KEY_SESSION_LOG_LEVEL) << __func__ << "(" << this << ") with " < < keys.size() << " keys and hasAdditionalUsableKey is " << (hasAdditionalUsableK ey ? "true" : "false");
854 854
855 // From https://w3c.github.io/encrypted-media/#update-key-statuses: 855 // From https://w3c.github.io/encrypted-media/#update-key-statuses:
856 // The following steps are run: 856 // The following steps are run:
857 // 1. Let the session be the associated MediaKeySession object. 857 // 1. Let the session be the associated MediaKeySession object.
858 // 2. Let the input statuses be the sequence of pairs key ID and 858 // 2. Let the input statuses be the sequence of pairs key ID and
859 // associated MediaKeyStatus pairs. 859 // associated MediaKeyStatus pairs.
860 // 3. Let the statuses be session's keyStatuses attribute. 860 // 3. Let the statuses be session's keyStatuses attribute.
861 861
862 // 4. Run the following steps to replace the contents of statuses: 862 // 4. Run the following steps to replace the contents of statuses:
863 // 4.1 Empty statuses. 863 // 4.1 Empty statuses.
(...skipping 29 matching lines...) Expand all
893 893
894 ExecutionContext* MediaKeySession::getExecutionContext() const 894 ExecutionContext* MediaKeySession::getExecutionContext() const
895 { 895 {
896 return ActiveDOMObject::getExecutionContext(); 896 return ActiveDOMObject::getExecutionContext();
897 } 897 }
898 898
899 bool MediaKeySession::hasPendingActivity() const 899 bool MediaKeySession::hasPendingActivity() const
900 { 900 {
901 // Remain around if there are pending events or MediaKeys is still around 901 // Remain around if there are pending events or MediaKeys is still around
902 // and we're not closed. 902 // and we're not closed.
903 DVLOG(MEDIA_KEY_SESSION_LOG_LEVEL) << __FUNCTION__ << "(" << this << ")" 903 DVLOG(MEDIA_KEY_SESSION_LOG_LEVEL) << __func__ << "(" << this << ")"
904 << (!m_pendingActions.isEmpty() ? " !m_pendingActions.isEmpty()" : "") 904 << (!m_pendingActions.isEmpty() ? " !m_pendingActions.isEmpty()" : "")
905 << (m_asyncEventQueue->hasPendingEvents() ? " m_asyncEventQueue->hasPend ingEvents()" : "") 905 << (m_asyncEventQueue->hasPendingEvents() ? " m_asyncEventQueue->hasPend ingEvents()" : "")
906 << ((m_mediaKeys && !m_isClosed) ? " m_mediaKeys && !m_isClosed" : ""); 906 << ((m_mediaKeys && !m_isClosed) ? " m_mediaKeys && !m_isClosed" : "");
907 907
908 return !m_pendingActions.isEmpty() 908 return !m_pendingActions.isEmpty()
909 || m_asyncEventQueue->hasPendingEvents() 909 || m_asyncEventQueue->hasPendingEvents()
910 || (m_mediaKeys && !m_isClosed); 910 || (m_mediaKeys && !m_isClosed);
911 } 911 }
912 912
913 void MediaKeySession::stop() 913 void MediaKeySession::stop()
(...skipping 13 matching lines...) Expand all
927 visitor->trace(m_asyncEventQueue); 927 visitor->trace(m_asyncEventQueue);
928 visitor->trace(m_pendingActions); 928 visitor->trace(m_pendingActions);
929 visitor->trace(m_mediaKeys); 929 visitor->trace(m_mediaKeys);
930 visitor->trace(m_keyStatusesMap); 930 visitor->trace(m_keyStatusesMap);
931 visitor->trace(m_closedPromise); 931 visitor->trace(m_closedPromise);
932 EventTargetWithInlineData::trace(visitor); 932 EventTargetWithInlineData::trace(visitor);
933 ActiveDOMObject::trace(visitor); 933 ActiveDOMObject::trace(visitor);
934 } 934 }
935 935
936 } // namespace blink 936 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698