Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8IteratorResultValue_h | 5 #ifndef V8IteratorResultValue_h |
| 6 #define V8IteratorResultValue_h | 6 #define V8IteratorResultValue_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/ScriptValue.h" | 8 #include "bindings/core/v8/ScriptValue.h" |
| 9 #include "bindings/core/v8/ToV8.h" | 9 #include "bindings/core/v8/ToV8.h" |
| 10 #include "core/CoreExport.h" | 10 #include "core/CoreExport.h" |
| 11 #include <v8.h> | 11 #include <v8.h> |
| 12 | 12 |
| 13 namespace blink { | 13 namespace blink { |
| 14 | 14 |
| 15 CORE_EXPORT v8::Local<v8::Object> v8IteratorResultValue(v8::Isolate*, bool done, v8::Local<v8::Value>); | 15 CORE_EXPORT v8::Local<v8::Object> v8IteratorResultValue(v8::Isolate*, bool done, v8::Local<v8::Value>); |
| 16 | 16 |
| 17 // Unpacks |item|, stores the value of "done" member to |done| and returns | |
| 18 // the value of "value" member. Returns an empty handle when errored. | |
| 19 CORE_EXPORT v8::MaybeLocal<v8::Value> v8IterationItemUnpack(ScriptState*, v8::Lo cal<v8::Object> item, bool* done); | |
|
haraken
2015/12/10 14:24:35
v8IterationItemUnpack => v8UnpackIteratorResultVal
yhirano
2015/12/11 03:27:18
Fixed.
Here "iterator result" means an object hav
yhirano
2015/12/11 03:42:56
correction:
- v8IteratorResult takes a value and
| |
| 20 | |
| 17 template<typename T> | 21 template<typename T> |
| 18 inline ScriptValue v8IteratorResult(ScriptState* scriptState, const T& value) | 22 inline ScriptValue v8IteratorResult(ScriptState* scriptState, const T& value) |
| 19 { | 23 { |
| 20 return ScriptValue( | 24 return ScriptValue( |
| 21 scriptState, | 25 scriptState, |
| 22 v8IteratorResultValue( | 26 v8IteratorResultValue( |
| 23 scriptState->isolate(), | 27 scriptState->isolate(), |
| 24 false, | 28 false, |
| 25 toV8(value, scriptState->context()->Global(), scriptState->isolate() ))); | 29 toV8(value, scriptState->context()->Global(), scriptState->isolate() ))); |
| 26 } | 30 } |
| 27 | 31 |
| 28 inline ScriptValue v8IteratorResultDone(ScriptState* scriptState) | 32 inline ScriptValue v8IteratorResultDone(ScriptState* scriptState) |
| 29 { | 33 { |
| 30 return ScriptValue( | 34 return ScriptValue( |
| 31 scriptState, | 35 scriptState, |
| 32 v8IteratorResultValue( | 36 v8IteratorResultValue( |
| 33 scriptState->isolate(), | 37 scriptState->isolate(), |
| 34 true, | 38 true, |
| 35 v8::Undefined(scriptState->isolate()))); | 39 v8::Undefined(scriptState->isolate()))); |
| 36 } | 40 } |
| 37 | 41 |
| 38 } // namespace blink | 42 } // namespace blink |
| 39 | 43 |
| 40 #endif // V8IteratorResultValue_h | 44 #endif // V8IteratorResultValue_h |
| OLD | NEW |