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

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

Issue 2049003002: Wrap GCed raw pointer parameters of WTF::bind with Persistent (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 5 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/ContentDecryptionModuleResultPromise.h" 5 #include "modules/encryptedmedia/ContentDecryptionModuleResultPromise.h"
6 6
7 #include "bindings/core/v8/ScriptPromise.h" 7 #include "bindings/core/v8/ScriptPromise.h"
8 #include "bindings/core/v8/ScriptState.h" 8 #include "bindings/core/v8/ScriptState.h"
9 #include "core/dom/DOMException.h" 9 #include "core/dom/DOMException.h"
10 #include "core/dom/ExecutionContext.h" 10 #include "core/dom/ExecutionContext.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 } 86 }
87 87
88 void ContentDecryptionModuleResultPromise::reject(ExceptionCode code, const Stri ng& errorMessage) 88 void ContentDecryptionModuleResultPromise::reject(ExceptionCode code, const Stri ng& errorMessage)
89 { 89 {
90 // Reject the promise asynchronously. This avoids problems when gc is 90 // Reject the promise asynchronously. This avoids problems when gc is
91 // destroying objects that result in unfulfilled promises being rejected. 91 // destroying objects that result in unfulfilled promises being rejected.
92 // (Resolving promises is still done synchronously as there may be events 92 // (Resolving promises is still done synchronously as there may be events
93 // already posted that need to happen only after the promise is resolved.) 93 // already posted that need to happen only after the promise is resolved.)
94 // TODO(jrummell): Make resolving a promise asynchronous as well (including 94 // TODO(jrummell): Make resolving a promise asynchronous as well (including
95 // making sure events still happen after the promise is resolved). 95 // making sure events still happen after the promise is resolved).
96 getExecutionContext()->postTask(BLINK_FROM_HERE, 96 getExecutionContext()->postTask(BLINK_FROM_HERE, createSameThreadTask(&Conte ntDecryptionModuleResultPromise::rejectInternal, wrapPersistent(this), code, err orMessage));
97 createSameThreadTask(&ContentDecryptionModuleResultPromise::rejectIntern al, this, code, errorMessage));
98 } 97 }
99 98
100 void ContentDecryptionModuleResultPromise::rejectInternal(ExceptionCode code, co nst String& errorMessage) 99 void ContentDecryptionModuleResultPromise::rejectInternal(ExceptionCode code, co nst String& errorMessage)
101 { 100 {
102 m_resolver->reject(DOMException::create(code, errorMessage)); 101 m_resolver->reject(DOMException::create(code, errorMessage));
103 m_resolver.clear(); 102 m_resolver.clear();
104 } 103 }
105 104
106 ExecutionContext* ContentDecryptionModuleResultPromise::getExecutionContext() co nst 105 ExecutionContext* ContentDecryptionModuleResultPromise::getExecutionContext() co nst
107 { 106 {
108 return m_resolver->getExecutionContext(); 107 return m_resolver->getExecutionContext();
109 } 108 }
110 109
111 DEFINE_TRACE(ContentDecryptionModuleResultPromise) 110 DEFINE_TRACE(ContentDecryptionModuleResultPromise)
112 { 111 {
113 visitor->trace(m_resolver); 112 visitor->trace(m_resolver);
114 ContentDecryptionModuleResult::trace(visitor); 113 ContentDecryptionModuleResult::trace(visitor);
115 } 114 }
116 115
117 } // namespace blink 116 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698