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

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

Issue 273683006: ScriptPromise should understand the ScriptState from which the ScriptPromise is generated (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « Source/bindings/tests/results/V8TestObject.cpp ('k') | Source/bindings/v8/ScriptPromise.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 // So holding a ScriptPromise as a member variable in DOM object causes 45 // So holding a ScriptPromise as a member variable in DOM object causes
46 // memory leaks since it has a reference from C++ to V8. 46 // memory leaks since it has a reference from C++ to V8.
47 // 47 //
48 class ScriptPromise { 48 class ScriptPromise {
49 public: 49 public:
50 // Constructs an empty promise. 50 // Constructs an empty promise.
51 ScriptPromise() { } 51 ScriptPromise() { }
52 52
53 // Constructs a ScriptPromise from |promise|. 53 // Constructs a ScriptPromise from |promise|.
54 // If |promise| is not a Promise object, throws a v8 TypeError. 54 // If |promise| is not a Promise object, throws a v8 TypeError.
55 ScriptPromise(v8::Handle<v8::Value> promise, v8::Isolate*); 55 ScriptPromise(ScriptState*, v8::Handle<v8::Value> promise);
56 56
57 ScriptPromise then(PassOwnPtr<ScriptFunction> onFulfilled, PassOwnPtr<Script Function> onRejected = PassOwnPtr<ScriptFunction>()); 57 ScriptPromise then(PassOwnPtr<ScriptFunction> onFulfilled, PassOwnPtr<Script Function> onRejected = PassOwnPtr<ScriptFunction>());
58 58
59 bool isObject() const 59 bool isObject() const
60 { 60 {
61 return m_promise.isObject(); 61 return m_promise.isObject();
62 } 62 }
63 63
64 bool isNull() const 64 bool isNull() const
65 { 65 {
(...skipping 24 matching lines...) Expand all
90 { 90 {
91 m_promise.clear(); 91 m_promise.clear();
92 } 92 }
93 93
94 // Constructs and returns a ScriptPromise from |value|. 94 // Constructs and returns a ScriptPromise from |value|.
95 // if |value| is not a Promise object, returns a Promise object 95 // if |value| is not a Promise object, returns a Promise object
96 // resolved with |value|. 96 // resolved with |value|.
97 static ScriptPromise cast(const ScriptValue& /*value*/); 97 static ScriptPromise cast(const ScriptValue& /*value*/);
98 98
99 private: 99 private:
100 RefPtr<ScriptState> m_scriptState;
100 ScriptValue m_promise; 101 ScriptValue m_promise;
101 }; 102 };
102 103
103 } // namespace WebCore 104 } // namespace WebCore
104 105
105 106
106 #endif // ScriptPromise_h 107 #endif // ScriptPromise_h
OLDNEW
« no previous file with comments | « Source/bindings/tests/results/V8TestObject.cpp ('k') | Source/bindings/v8/ScriptPromise.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698