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

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

Issue 1805843002: [v8 gc] Introduce a base class for all objects that can have pending activity (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updates Created 4 years, 9 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 }; 82 };
83 83
84 MediaKeys* MediaKeys::create(ExecutionContext* context, const WebVector<WebEncry ptedMediaSessionType>& supportedSessionTypes, PassOwnPtr<WebContentDecryptionMod ule> cdm) 84 MediaKeys* MediaKeys::create(ExecutionContext* context, const WebVector<WebEncry ptedMediaSessionType>& supportedSessionTypes, PassOwnPtr<WebContentDecryptionMod ule> cdm)
85 { 85 {
86 MediaKeys* mediaKeys = new MediaKeys(context, supportedSessionTypes, cdm); 86 MediaKeys* mediaKeys = new MediaKeys(context, supportedSessionTypes, cdm);
87 mediaKeys->suspendIfNeeded(); 87 mediaKeys->suspendIfNeeded();
88 return mediaKeys; 88 return mediaKeys;
89 } 89 }
90 90
91 MediaKeys::MediaKeys(ExecutionContext* context, const WebVector<WebEncryptedMedi aSessionType>& supportedSessionTypes, PassOwnPtr<WebContentDecryptionModule> cdm ) 91 MediaKeys::MediaKeys(ExecutionContext* context, const WebVector<WebEncryptedMedi aSessionType>& supportedSessionTypes, PassOwnPtr<WebContentDecryptionModule> cdm )
92 : ActiveDOMObject(context) 92 : ActiveScriptWrappable(this)
93 , ActiveDOMObject(context)
93 , m_supportedSessionTypes(supportedSessionTypes) 94 , m_supportedSessionTypes(supportedSessionTypes)
94 , m_cdm(cdm) 95 , m_cdm(cdm)
95 , m_mediaElement(nullptr) 96 , m_mediaElement(nullptr)
96 , m_reservedForMediaElement(false) 97 , m_reservedForMediaElement(false)
97 , m_timer(this, &MediaKeys::timerFired) 98 , m_timer(this, &MediaKeys::timerFired)
98 { 99 {
99 WTF_LOG(Media, "MediaKeys(%p)::MediaKeys", this); 100 WTF_LOG(Media, "MediaKeys(%p)::MediaKeys", this);
100 } 101 }
101 102
102 MediaKeys::~MediaKeys() 103 MediaKeys::~MediaKeys()
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 ActiveDOMObject::contextDestroyed(); 248 ActiveDOMObject::contextDestroyed();
248 249
249 // We don't need the CDM anymore. Only destroyed after all related 250 // We don't need the CDM anymore. Only destroyed after all related
250 // ActiveDOMObjects have been stopped. 251 // ActiveDOMObjects have been stopped.
251 m_cdm.clear(); 252 m_cdm.clear();
252 } 253 }
253 254
254 bool MediaKeys::hasPendingActivity() const 255 bool MediaKeys::hasPendingActivity() const
255 { 256 {
256 // Remain around if there are pending events. 257 // Remain around if there are pending events.
257 WTF_LOG(Media, "MediaKeys(%p)::hasPendingActivity %s%s%s", this, 258 WTF_LOG(Media, "MediaKeys(%p)::hasPendingActivity %s%s", this,
258 ScriptWrappable::hasPendingActivity() ? " ScriptWrappable::hasPendingAct ivity()" : "",
259 !m_pendingActions.isEmpty() ? " !m_pendingActions.isEmpty()" : "", 259 !m_pendingActions.isEmpty() ? " !m_pendingActions.isEmpty()" : "",
260 m_reservedForMediaElement ? " m_reservedForMediaElement" : ""); 260 m_reservedForMediaElement ? " m_reservedForMediaElement" : "");
261 261
262 return ScriptWrappable::hasPendingActivity() || !m_pendingActions.isEmpty() || m_reservedForMediaElement; 262 return !m_pendingActions.isEmpty() || m_reservedForMediaElement;
263 } 263 }
264 264
265 void MediaKeys::stop() 265 void MediaKeys::stop()
266 { 266 {
267 ActiveDOMObject::stop(); 267 ActiveDOMObject::stop();
268 268
269 if (m_timer.isActive()) 269 if (m_timer.isActive())
270 m_timer.stop(); 270 m_timer.stop();
271 m_pendingActions.clear(); 271 m_pendingActions.clear();
272 } 272 }
273 273
274 } // namespace blink 274 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698