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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 { | 120 { |
121 if (m_isSettled) | 121 if (m_isSettled) |
122 return; | 122 return; |
123 | 123 |
124 ASSERT(index < m_values.size()); | 124 ASSERT(index < m_values.size()); |
125 m_values[index] = value; | 125 m_values[index] = value; |
126 if (--m_numberOfPendingPromises > 0) | 126 if (--m_numberOfPendingPromises > 0) |
127 return; | 127 return; |
128 | 128 |
129 v8::Local<v8::Array> values = v8::Array::New(value.isolate(), m_values.s
ize()); | 129 v8::Local<v8::Array> values = v8::Array::New(value.isolate(), m_values.s
ize()); |
130 for (size_t i = 0; i < m_values.size(); ++i) | 130 for (size_t i = 0; i < m_values.size(); ++i) { |
131 values->Set(i, m_values[i].v8Value()); | 131 if (!v8CallBoolean(values->CreateDataProperty(value.context(), i, m_
values[i].v8Value()))) |
| 132 return; |
| 133 } |
132 | 134 |
133 markPromiseSettled(); | 135 markPromiseSettled(); |
134 m_resolver.resolve(values); | 136 m_resolver.resolve(values); |
135 } | 137 } |
136 | 138 |
137 void onRejected(const ScriptValue& value) | 139 void onRejected(const ScriptValue& value) |
138 { | 140 { |
139 if (m_isSettled) | 141 if (m_isSettled) |
140 return; | 142 return; |
141 markPromiseSettled(); | 143 markPromiseSettled(); |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 InstanceCounters::incrementCounter(InstanceCounters::ScriptPromiseCounte
r); | 323 InstanceCounters::incrementCounter(InstanceCounters::ScriptPromiseCounte
r); |
322 } | 324 } |
323 | 325 |
324 void ScriptPromise::decreaseInstanceCount() | 326 void ScriptPromise::decreaseInstanceCount() |
325 { | 327 { |
326 if (isMainThread()) | 328 if (isMainThread()) |
327 InstanceCounters::decrementCounter(InstanceCounters::ScriptPromiseCounte
r); | 329 InstanceCounters::decrementCounter(InstanceCounters::ScriptPromiseCounte
r); |
328 } | 330 } |
329 | 331 |
330 } // namespace blink | 332 } // namespace blink |
OLD | NEW |