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

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

Issue 26004002: Decouple ScriptPromise creation from ScriptPromiseResolver. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase Created 7 years, 2 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 /* 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 27 matching lines...) Expand all
38 38
39 namespace WebCore { 39 namespace WebCore {
40 40
41 // ScriptPromise is the class for representing Promise values in C++ world. 41 // ScriptPromise is the class for representing Promise values in C++ world.
42 // ScriptPromise holds a Promise. 42 // ScriptPromise holds a Promise.
43 // So holding a ScriptPromise as a member variable in DOM object causes 43 // So holding a ScriptPromise as a member variable in DOM object causes
44 // memory leaks since it has a reference from C++ to V8. 44 // memory leaks since it has a reference from C++ to V8.
45 // 45 //
46 class ScriptPromise { 46 class ScriptPromise {
47 public: 47 public:
48 // Constructs an empty promise.
48 ScriptPromise() 49 ScriptPromise()
49 : m_promise() 50 : m_promise()
50 { 51 {
51 } 52 }
52 53
53 explicit ScriptPromise(const ScriptValue& promise) 54 explicit ScriptPromise(const ScriptValue& promise)
54 : m_promise(promise) 55 : m_promise(promise)
55 { 56 {
56 ASSERT(!m_promise.hasNoValue()); 57 ASSERT(!m_promise.hasNoValue());
57 } 58 }
(...skipping 27 matching lines...) Expand all
85 bool hasNoValue() const 86 bool hasNoValue() const
86 { 87 {
87 return m_promise.hasNoValue(); 88 return m_promise.hasNoValue();
88 } 89 }
89 90
90 void clear() 91 void clear()
91 { 92 {
92 m_promise.clear(); 93 m_promise.clear();
93 } 94 }
94 95
96 // Creates a pending promise.
97 static ScriptPromise create();
98 // Creates a pending promise.
99 static ScriptPromise create(ScriptExecutionContext*);
abarth-chromium 2013/10/11 18:18:02 Rather than write comments like these, we prefer i
yhirano 2013/10/14 02:49:53 Done.
100
95 private: 101 private:
96 ScriptValue m_promise; 102 ScriptValue m_promise;
97 }; 103 };
98 104
99 } // namespace WebCore 105 } // namespace WebCore
100 106
101 107
102 #endif // ScriptPromise_h 108 #endif // ScriptPromise_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698