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

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

Issue 42883002: Ship DOM/Promises (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@websocket-inspector-ipc
Patch Set: rebase Created 7 years, 1 month 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 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 13 matching lines...) Expand all
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "config.h" 31 #include "config.h"
32 #include "bindings/v8/ScriptPromiseResolver.h" 32 #include "bindings/v8/ScriptPromiseResolver.h"
33 33
34 #include "RuntimeEnabledFeatures.h"
35 #include "bindings/v8/ScriptState.h" 34 #include "bindings/v8/ScriptState.h"
36 #include "bindings/v8/ScriptValue.h" 35 #include "bindings/v8/ScriptValue.h"
37 #include "bindings/v8/V8Binding.h" 36 #include "bindings/v8/V8Binding.h"
38 #include "bindings/v8/V8DOMWrapper.h" 37 #include "bindings/v8/V8DOMWrapper.h"
39 #include "bindings/v8/custom/V8PromiseCustom.h" 38 #include "bindings/v8/custom/V8PromiseCustom.h"
40 39
41 #include <v8.h> 40 #include <v8.h>
42 41
43 namespace WebCore { 42 namespace WebCore {
44 43
45 ScriptPromiseResolver::ScriptPromiseResolver(ScriptPromise promise, v8::Isolate* isolate) 44 ScriptPromiseResolver::ScriptPromiseResolver(ScriptPromise promise, v8::Isolate* isolate)
46 : m_isolate(isolate) 45 : m_isolate(isolate)
47 , m_promise(promise) 46 , m_promise(promise)
48 { 47 {
49 ASSERT(RuntimeEnabledFeatures::promiseEnabled());
50 } 48 }
51 49
52 ScriptPromiseResolver::~ScriptPromiseResolver() 50 ScriptPromiseResolver::~ScriptPromiseResolver()
53 { 51 {
54 // We don't call "reject" here because it requires a caller 52 // We don't call "reject" here because it requires a caller
55 // to be in a v8 context. 53 // to be in a v8 context.
56 54
57 m_promise.clear(); 55 m_promise.clear();
58 } 56 }
59 57
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 resolve(value.v8Value()); 104 resolve(value.v8Value());
107 } 105 }
108 106
109 void ScriptPromiseResolver::reject(ScriptValue value) 107 void ScriptPromiseResolver::reject(ScriptValue value)
110 { 108 {
111 ASSERT(v8::Context::InContext()); 109 ASSERT(v8::Context::InContext());
112 reject(value.v8Value()); 110 reject(value.v8Value());
113 } 111 }
114 112
115 } // namespace WebCore 113 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698