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

Side by Side Diff: Source/bindings/core/v8/ScriptPromiseResolver.cpp

Issue 780793002: Make CryptoResultImpl not to use WeakPtr. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years 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 "config.h" 5 #include "config.h"
6 #include "bindings/core/v8/ScriptPromiseResolver.h" 6 #include "bindings/core/v8/ScriptPromiseResolver.h"
7 7
8 #include "bindings/core/v8/V8RecursionScope.h" 8 #include "bindings/core/v8/V8RecursionScope.h"
9 9
10 namespace blink { 10 namespace blink {
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 m_resolver.reject(m_value.newLocal(m_scriptState->isolate())); 73 m_resolver.reject(m_value.newLocal(m_scriptState->isolate()));
74 } 74 }
75 } 75 }
76 clear(); 76 clear();
77 } 77 }
78 78
79 void ScriptPromiseResolver::clear() 79 void ScriptPromiseResolver::clear()
80 { 80 {
81 if (m_state == ResolvedOrRejected) 81 if (m_state == ResolvedOrRejected)
82 return; 82 return;
83
83 ResolutionState state = m_state; 84 ResolutionState state = m_state;
84 m_state = ResolvedOrRejected; 85 m_state = ResolvedOrRejected;
86 resolverCleared();
85 m_resolver.clear(); 87 m_resolver.clear();
86 m_value.clear(); 88 m_value.clear();
87 if (m_mode == KeepAliveWhilePending) { 89 if (m_mode == KeepAliveWhilePending) {
88 // |ref| was called in |keepAliveWhilePending|. 90 // |ref| was called in |keepAliveWhilePending|.
89 deref(); 91 deref();
90 } 92 }
91 // |this| may be deleted here, but it is safe to check |state| because 93 // |this| may be deleted here, but it is safe to check |state| because
92 // it doesn't depend on |this|. When |this| is deleted, |state| can't be 94 // it doesn't depend on |this|. When |this| is deleted, |state| can't be
93 // |Resolving| nor |Rejecting| and hence |this->deref()| can't be executed. 95 // |Resolving| nor |Rejecting| and hence |this->deref()| can't be executed.
94 if (state == Resolving || state == Rejecting) { 96 if (state == Resolving || state == Rejecting) {
95 // |ref| was called in |resolveOrReject|. 97 // |ref| was called in |resolveOrReject|.
96 deref(); 98 deref();
97 } 99 }
98 } 100 }
99 101
100 } // namespace blink 102 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698