Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 86 bool isEmpty() const | 86 bool isEmpty() const |
| 87 { | 87 { |
| 88 return m_promise.isEmpty(); | 88 return m_promise.isEmpty(); |
| 89 } | 89 } |
| 90 | 90 |
| 91 void clear() | 91 void clear() |
| 92 { | 92 { |
| 93 m_promise.clear(); | 93 m_promise.clear(); |
| 94 } | 94 } |
| 95 | 95 |
| 96 bool operator==(const ScriptPromise& value) const | |
| 97 { | |
| 98 return m_promise == value.m_promise; | |
| 99 } | |
| 100 | |
| 101 bool operator!=(const ScriptPromise& value) const | |
| 102 { | |
| 103 return !operator==(value); | |
|
yhirano
2014/07/01 04:38:14
No need for the parentheses?
dominicc (has gone to gerrit)
2014/07/01 05:32:16
I think they're needed for the explicit invocation
| |
| 104 } | |
| 105 | |
| 96 // Constructs and returns a ScriptPromise from |value|. | 106 // Constructs and returns a ScriptPromise from |value|. |
| 97 // if |value| is not a Promise object, returns a Promise object | 107 // if |value| is not a Promise object, returns a Promise object |
| 98 // resolved with |value|. | 108 // resolved with |value|. |
| 99 // Returns |value| itself if it is a Promise. | 109 // Returns |value| itself if it is a Promise. |
| 100 static ScriptPromise cast(ScriptState*, const ScriptValue& /*value*/); | 110 static ScriptPromise cast(ScriptState*, const ScriptValue& /*value*/); |
| 101 static ScriptPromise cast(ScriptState*, v8::Handle<v8::Value> /*value*/); | 111 static ScriptPromise cast(ScriptState*, v8::Handle<v8::Value> /*value*/); |
| 102 | 112 |
| 103 static ScriptPromise reject(ScriptState*, const ScriptValue&); | 113 static ScriptPromise reject(ScriptState*, const ScriptValue&); |
| 104 static ScriptPromise reject(ScriptState*, v8::Handle<v8::Value>); | 114 static ScriptPromise reject(ScriptState*, v8::Handle<v8::Value>); |
| 105 | 115 |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 122 | 132 |
| 123 private: | 133 private: |
| 124 RefPtr<ScriptState> m_scriptState; | 134 RefPtr<ScriptState> m_scriptState; |
| 125 ScriptValue m_promise; | 135 ScriptValue m_promise; |
| 126 }; | 136 }; |
| 127 | 137 |
| 128 } // namespace WebCore | 138 } // namespace WebCore |
| 129 | 139 |
| 130 | 140 |
| 131 #endif // ScriptPromise_h | 141 #endif // ScriptPromise_h |
| OLD | NEW |