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

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

Issue 2433773006: Remove ExecutionContext::activeDOMObjectsAreStopped()
Patch Set: Created 4 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "modules/encryptedmedia/NavigatorRequestMediaKeySystemAccess.h" 5 #include "modules/encryptedmedia/NavigatorRequestMediaKeySystemAccess.h"
6 6
7 #include "bindings/core/v8/ScriptPromise.h" 7 #include "bindings/core/v8/ScriptPromise.h"
8 #include "bindings/core/v8/ScriptPromiseResolver.h" 8 #include "bindings/core/v8/ScriptPromiseResolver.h"
9 #include "bindings/core/v8/ScriptState.h" 9 #include "bindings/core/v8/ScriptState.h"
10 #include "bindings/core/v8/V8ThrowException.h" 10 #include "bindings/core/v8/V8ThrowException.h"
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 void MediaKeySystemAccessInitializer::requestNotSupported( 217 void MediaKeySystemAccessInitializer::requestNotSupported(
218 const WebString& errorMessage) { 218 const WebString& errorMessage) {
219 if (!isExecutionContextValid()) 219 if (!isExecutionContextValid())
220 return; 220 return;
221 221
222 m_resolver->reject(DOMException::create(NotSupportedError, errorMessage)); 222 m_resolver->reject(DOMException::create(NotSupportedError, errorMessage));
223 m_resolver.clear(); 223 m_resolver.clear();
224 } 224 }
225 225
226 bool MediaKeySystemAccessInitializer::isExecutionContextValid() const { 226 bool MediaKeySystemAccessInitializer::isExecutionContextValid() const {
227 // activeDOMObjectsAreStopped() is called to see if the context is in the 227 return m_resolver->getExecutionContext();
228 // process of being destroyed. If it is true, assume the context is no
229 // longer valid as it is about to be destroyed anyway.
230 ExecutionContext* context = m_resolver->getExecutionContext();
231 return context && !context->activeDOMObjectsAreStopped();
232 } 228 }
233 229
234 void MediaKeySystemAccessInitializer::checkVideoCapabilityRobustness() const { 230 void MediaKeySystemAccessInitializer::checkVideoCapabilityRobustness() const {
235 // Only check for widevine key system. 231 // Only check for widevine key system.
236 if (keySystem() != "com.widevine.alpha") 232 if (keySystem() != "com.widevine.alpha")
237 return; 233 return;
238 234
239 bool hasVideoCapabilities = false; 235 bool hasVideoCapabilities = false;
240 bool hasEmptyRobustness = false; 236 bool hasEmptyRobustness = false;
241 237
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 WebEncryptedMediaClient* mediaClient = 389 WebEncryptedMediaClient* mediaClient =
394 controller->encryptedMediaClient(executionContext); 390 controller->encryptedMediaClient(executionContext);
395 mediaClient->requestMediaKeySystemAccess( 391 mediaClient->requestMediaKeySystemAccess(
396 WebEncryptedMediaRequest(initializer)); 392 WebEncryptedMediaRequest(initializer));
397 393
398 // 7. Return promise. 394 // 7. Return promise.
399 return promise; 395 return promise;
400 } 396 }
401 397
402 } // namespace blink 398 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698