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

Side by Side Diff: Source/bindings/v8/ScriptPromiseResolverWithContext.h

Issue 236713003: [ServiceWorker, PushMessaging] Use ScriptPromiseResolverWithContext. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 8 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 #ifndef ScriptPromiseResolverWithContext_h 5 #ifndef ScriptPromiseResolverWithContext_h
6 #define ScriptPromiseResolverWithContext_h 6 #define ScriptPromiseResolverWithContext_h
7 7
8 #include "bindings/v8/NewScriptState.h" 8 #include "bindings/v8/NewScriptState.h"
9 #include "bindings/v8/ScopedPersistent.h" 9 #include "bindings/v8/ScopedPersistent.h"
10 #include "bindings/v8/ScriptPromise.h" 10 #include "bindings/v8/ScriptPromise.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 { 55 {
56 if (m_state != Pending || !executionContext() || executionContext()->act iveDOMObjectsAreStopped()) 56 if (m_state != Pending || !executionContext() || executionContext()->act iveDOMObjectsAreStopped())
57 return; 57 return;
58 m_state = Rejecting; 58 m_state = Rejecting;
59 NewScriptState::Scope scope(m_scriptState.get()); 59 NewScriptState::Scope scope(m_scriptState.get());
60 m_value.set(m_scriptState->isolate(), toV8(value)); 60 m_value.set(m_scriptState->isolate(), toV8(value));
61 if (!executionContext()->activeDOMObjectsAreSuspended()) 61 if (!executionContext()->activeDOMObjectsAreSuspended())
62 resolveOrRejectImmediately(&m_timer); 62 resolveOrRejectImmediately(&m_timer);
63 } 63 }
64 64
65 // The returned pointer can be null.
haraken 2014/04/14 12:13:17 (I should have pointed this out in the previous co
yhirano 2014/04/15 01:02:17 Done.
66 NewScriptState* scriptState() { return m_scriptState.get(); }
67
65 // Note that an empty ScriptPromise will be returned after resolve or 68 // Note that an empty ScriptPromise will be returned after resolve or
66 // reject is called. 69 // reject is called.
67 ScriptPromise promise() 70 ScriptPromise promise()
68 { 71 {
69 return m_resolver ? m_resolver->promise() : ScriptPromise(); 72 return m_resolver ? m_resolver->promise() : ScriptPromise();
70 } 73 }
71 74
72 // ActiveDOMObject implementation. 75 // ActiveDOMObject implementation.
73 virtual void suspend() OVERRIDE; 76 virtual void suspend() OVERRIDE;
74 virtual void resume() OVERRIDE; 77 virtual void resume() OVERRIDE;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 ResolutionState m_state; 113 ResolutionState m_state;
111 RefPtr<NewScriptState> m_scriptState; 114 RefPtr<NewScriptState> m_scriptState;
112 Timer<ScriptPromiseResolverWithContext> m_timer; 115 Timer<ScriptPromiseResolverWithContext> m_timer;
113 RefPtr<ScriptPromiseResolver> m_resolver; 116 RefPtr<ScriptPromiseResolver> m_resolver;
114 ScopedPersistent<v8::Value> m_value; 117 ScopedPersistent<v8::Value> m_value;
115 }; 118 };
116 119
117 } // namespace WebCore 120 } // namespace WebCore
118 121
119 #endif // #ifndef ScriptPromiseResolverWithContext_h 122 #endif // #ifndef ScriptPromiseResolverWithContext_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698