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

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

Issue 2701993002: DO NOT COMMIT: Results of running new (proposed) clang-format on Blink (Closed)
Patch Set: 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
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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 static ScriptPromise CreateRejectedPromiseNotCallable( 128 static ScriptPromise CreateRejectedPromiseNotCallable(
129 ScriptState* scriptState) { 129 ScriptState* scriptState) {
130 return ScriptPromise::rejectWithDOMException( 130 return ScriptPromise::rejectWithDOMException(
131 scriptState, 131 scriptState,
132 DOMException::create(InvalidStateError, "The session is not callable.")); 132 DOMException::create(InvalidStateError, "The session is not callable."));
133 } 133 }
134 134
135 static ScriptPromise CreateRejectedPromiseAlreadyClosed( 135 static ScriptPromise CreateRejectedPromiseAlreadyClosed(
136 ScriptState* scriptState) { 136 ScriptState* scriptState) {
137 return ScriptPromise::rejectWithDOMException( 137 return ScriptPromise::rejectWithDOMException(
138 scriptState, DOMException::create(InvalidStateError, 138 scriptState,
139 "The session is already closed.")); 139 DOMException::create(InvalidStateError,
140 "The session is already closed."));
140 } 141 }
141 142
142 static ScriptPromise CreateRejectedPromiseAlreadyInitialized( 143 static ScriptPromise CreateRejectedPromiseAlreadyInitialized(
143 ScriptState* scriptState) { 144 ScriptState* scriptState) {
144 return ScriptPromise::rejectWithDOMException( 145 return ScriptPromise::rejectWithDOMException(
145 scriptState, DOMException::create(InvalidStateError, 146 scriptState,
146 "The session is already initialized.")); 147 DOMException::create(InvalidStateError,
148 "The session is already initialized."));
147 } 149 }
148 150
149 // A class holding a pending action. 151 // A class holding a pending action.
150 class MediaKeySession::PendingAction 152 class MediaKeySession::PendingAction
151 : public GarbageCollectedFinalized<MediaKeySession::PendingAction> { 153 : public GarbageCollectedFinalized<MediaKeySession::PendingAction> {
152 public: 154 public:
153 enum Type { GenerateRequest, Load, Update, Close, Remove }; 155 enum Type { GenerateRequest, Load, Update, Close, Remove };
154 156
155 Type getType() const { return m_type; } 157 Type getType() const { return m_type; }
156 158
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 return m_closedPromise->promise(scriptState->world()); 441 return m_closedPromise->promise(scriptState->world());
440 } 442 }
441 443
442 MediaKeyStatusMap* MediaKeySession::keyStatuses() { 444 MediaKeyStatusMap* MediaKeySession::keyStatuses() {
443 return m_keyStatusesMap; 445 return m_keyStatusesMap;
444 } 446 }
445 447
446 ScriptPromise MediaKeySession::generateRequest(ScriptState* scriptState, 448 ScriptPromise MediaKeySession::generateRequest(ScriptState* scriptState,
447 const String& initDataTypeString, 449 const String& initDataTypeString,
448 const DOMArrayPiece& initData) { 450 const DOMArrayPiece& initData) {
449 DVLOG(MEDIA_KEY_SESSION_LOG_LEVEL) << __func__ << "(" << this << ") " 451 DVLOG(MEDIA_KEY_SESSION_LOG_LEVEL)
450 << initDataTypeString; 452 << __func__ << "(" << this << ") " << initDataTypeString;
451 453
452 // From https://w3c.github.io/encrypted-media/#generateRequest: 454 // From https://w3c.github.io/encrypted-media/#generateRequest:
453 // Generates a request based on the initData. When this method is invoked, 455 // Generates a request based on the initData. When this method is invoked,
454 // the user agent must run the following steps: 456 // the user agent must run the following steps:
455 457
456 // 1. If this object is closed, return a promise rejected with an 458 // 1. If this object is closed, return a promise rejected with an
457 // InvalidStateError. 459 // InvalidStateError.
458 if (m_isClosed) 460 if (m_isClosed)
459 return CreateRejectedPromiseAlreadyClosed(scriptState); 461 return CreateRejectedPromiseAlreadyClosed(scriptState);
460 462
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 557
556 // 10.10.4 Run the Queue a "message" Event algorithm on the session, 558 // 10.10.4 Run the Queue a "message" Event algorithm on the session,
557 // providing message type and message. 559 // providing message type and message.
558 // (Done by the CDM.) 560 // (Done by the CDM.)
559 // 10.10.5 Resolve promise. 561 // 10.10.5 Resolve promise.
560 // (Done by NewSessionResultPromise.) 562 // (Done by NewSessionResultPromise.)
561 } 563 }
562 564
563 ScriptPromise MediaKeySession::load(ScriptState* scriptState, 565 ScriptPromise MediaKeySession::load(ScriptState* scriptState,
564 const String& sessionId) { 566 const String& sessionId) {
565 DVLOG(MEDIA_KEY_SESSION_LOG_LEVEL) << __func__ << "(" << this << ") " 567 DVLOG(MEDIA_KEY_SESSION_LOG_LEVEL)
566 << sessionId; 568 << __func__ << "(" << this << ") " << sessionId;
567 569
568 // From https://w3c.github.io/encrypted-media/#load: 570 // From https://w3c.github.io/encrypted-media/#load:
569 // Loads the data stored for the specified session into this object. When 571 // Loads the data stored for the specified session into this object. When
570 // this method is invoked, the user agent must run the following steps: 572 // this method is invoked, the user agent must run the following steps:
571 573
572 // 1. If this object is closed, return a promise rejected with an 574 // 1. If this object is closed, return a promise rejected with an
573 // InvalidStateError. 575 // InvalidStateError.
574 if (m_isClosed) 576 if (m_isClosed)
575 return CreateRejectedPromiseAlreadyClosed(scriptState); 577 return CreateRejectedPromiseAlreadyClosed(scriptState);
576 578
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
941 m_closedPromise->resolve(ToV8UndefinedGenerator()); 943 m_closedPromise->resolve(ToV8UndefinedGenerator());
942 944
943 // After this algorithm has run, event handlers for the events queued by 945 // After this algorithm has run, event handlers for the events queued by
944 // this algorithm will be executed, but no further events can be queued. 946 // this algorithm will be executed, but no further events can be queued.
945 // As a result, no messages can be sent by the CDM as a result of closing 947 // As a result, no messages can be sent by the CDM as a result of closing
946 // the session. 948 // the session.
947 m_isClosed = true; 949 m_isClosed = true;
948 } 950 }
949 951
950 void MediaKeySession::expirationChanged(double updatedExpiryTimeInMS) { 952 void MediaKeySession::expirationChanged(double updatedExpiryTimeInMS) {
951 DVLOG(MEDIA_KEY_SESSION_LOG_LEVEL) << __func__ << "(" << this << ") " 953 DVLOG(MEDIA_KEY_SESSION_LOG_LEVEL)
952 << updatedExpiryTimeInMS; 954 << __func__ << "(" << this << ") " << updatedExpiryTimeInMS;
953 955
954 // From https://w3c.github.io/encrypted-media/#update-expiration: 956 // From https://w3c.github.io/encrypted-media/#update-expiration:
955 // The following steps are run: 957 // The following steps are run:
956 // 1. Let the session be the associated MediaKeySession object. 958 // 1. Let the session be the associated MediaKeySession object.
957 // 2. Let expiration time be NaN. 959 // 2. Let expiration time be NaN.
958 double expirationTime = std::numeric_limits<double>::quiet_NaN(); 960 double expirationTime = std::numeric_limits<double>::quiet_NaN();
959 961
960 // 3. If the new expiration time is not NaN, let expiration time be the 962 // 3. If the new expiration time is not NaN, let expiration time be the
961 // new expiration time in milliseconds since 01 January 1970 UTC. 963 // new expiration time in milliseconds since 01 January 1970 UTC.
962 if (!std::isnan(updatedExpiryTimeInMS)) 964 if (!std::isnan(updatedExpiryTimeInMS))
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
1045 visitor->trace(m_asyncEventQueue); 1047 visitor->trace(m_asyncEventQueue);
1046 visitor->trace(m_pendingActions); 1048 visitor->trace(m_pendingActions);
1047 visitor->trace(m_mediaKeys); 1049 visitor->trace(m_mediaKeys);
1048 visitor->trace(m_keyStatusesMap); 1050 visitor->trace(m_keyStatusesMap);
1049 visitor->trace(m_closedPromise); 1051 visitor->trace(m_closedPromise);
1050 EventTargetWithInlineData::trace(visitor); 1052 EventTargetWithInlineData::trace(visitor);
1051 ContextLifecycleObserver::trace(visitor); 1053 ContextLifecycleObserver::trace(visitor);
1052 } 1054 }
1053 1055
1054 } // namespace blink 1056 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698