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

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

Issue 1773813007: blink: Rename modules/ method to prefix with get when they collide. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: clash-modules: rebase-fixes 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 // 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 "bindings/core/v8/ScriptPromiseResolver.h" 5 #include "bindings/core/v8/ScriptPromiseResolver.h"
6 6
7 namespace blink { 7 namespace blink {
8 8
9 ScriptPromiseResolver::ScriptPromiseResolver(ScriptState* scriptState) 9 ScriptPromiseResolver::ScriptPromiseResolver(ScriptState* scriptState)
10 : ActiveDOMObject(scriptState->executionContext()) 10 : ActiveDOMObject(scriptState->getExecutionContext())
11 , m_state(Pending) 11 , m_state(Pending)
12 , m_scriptState(scriptState) 12 , m_scriptState(scriptState)
13 , m_timer(this, &ScriptPromiseResolver::onTimerFired) 13 , m_timer(this, &ScriptPromiseResolver::onTimerFired)
14 , m_resolver(scriptState) 14 , m_resolver(scriptState)
15 #if ENABLE(ASSERT) 15 #if ENABLE(ASSERT)
16 , m_isPromiseCalled(false) 16 , m_isPromiseCalled(false)
17 #endif 17 #endif
18 { 18 {
19 if (executionContext()->activeDOMObjectsAreStopped()) { 19 if (getExecutionContext()->activeDOMObjectsAreStopped()) {
20 m_state = Detached; 20 m_state = Detached;
21 m_resolver.clear(); 21 m_resolver.clear();
22 } 22 }
23 } 23 }
24 24
25 void ScriptPromiseResolver::suspend() 25 void ScriptPromiseResolver::suspend()
26 { 26 {
27 m_timer.stop(); 27 m_timer.stop();
28 } 28 }
29 29
(...skipping 23 matching lines...) Expand all
53 return; 53 return;
54 54
55 // Keep |this| around while the promise is Pending; 55 // Keep |this| around while the promise is Pending;
56 // see detach() for the dual operation. 56 // see detach() for the dual operation.
57 m_keepAlive = this; 57 m_keepAlive = this;
58 } 58 }
59 59
60 void ScriptPromiseResolver::onTimerFired(Timer<ScriptPromiseResolver>*) 60 void ScriptPromiseResolver::onTimerFired(Timer<ScriptPromiseResolver>*)
61 { 61 {
62 ASSERT(m_state == Resolving || m_state == Rejecting); 62 ASSERT(m_state == Resolving || m_state == Rejecting);
63 if (!scriptState()->contextIsValid()) { 63 if (!getScriptState()->contextIsValid()) {
64 detach(); 64 detach();
65 return; 65 return;
66 } 66 }
67 67
68 ScriptState::Scope scope(m_scriptState.get()); 68 ScriptState::Scope scope(m_scriptState.get());
69 resolveOrRejectImmediately(); 69 resolveOrRejectImmediately();
70 } 70 }
71 71
72 void ScriptPromiseResolver::resolveOrRejectImmediately() 72 void ScriptPromiseResolver::resolveOrRejectImmediately()
73 { 73 {
74 ASSERT(!executionContext()->activeDOMObjectsAreStopped()); 74 ASSERT(!getExecutionContext()->activeDOMObjectsAreStopped());
75 ASSERT(!executionContext()->activeDOMObjectsAreSuspended()); 75 ASSERT(!getExecutionContext()->activeDOMObjectsAreSuspended());
76 { 76 {
77 if (m_state == Resolving) { 77 if (m_state == Resolving) {
78 m_resolver.resolve(m_value.newLocal(m_scriptState->isolate())); 78 m_resolver.resolve(m_value.newLocal(m_scriptState->isolate()));
79 } else { 79 } else {
80 ASSERT(m_state == Rejecting); 80 ASSERT(m_state == Rejecting);
81 m_resolver.reject(m_value.newLocal(m_scriptState->isolate())); 81 m_resolver.reject(m_value.newLocal(m_scriptState->isolate()));
82 } 82 }
83 } 83 }
84 detach(); 84 detach();
85 } 85 }
86 86
87 DEFINE_TRACE(ScriptPromiseResolver) 87 DEFINE_TRACE(ScriptPromiseResolver)
88 { 88 {
89 ActiveDOMObject::trace(visitor); 89 ActiveDOMObject::trace(visitor);
90 } 90 }
91 91
92 } // namespace blink 92 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698