OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 11 matching lines...) Expand all Loading... |
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 #include "config.h" | 26 #include "config.h" |
27 #include "bindings/core/v8/ArrayValue.h" | 27 #include "bindings/core/v8/ArrayValue.h" |
28 | 28 |
29 #include "bindings/core/v8/Dictionary.h" | 29 #include "bindings/core/v8/Dictionary.h" |
30 #include "bindings/core/v8/V8Binding.h" | 30 #include "bindings/core/v8/V8Binding.h" |
31 | 31 |
32 namespace WebCore { | 32 namespace blink { |
33 | 33 |
34 ArrayValue& ArrayValue::operator=(const ArrayValue& other) | 34 ArrayValue& ArrayValue::operator=(const ArrayValue& other) |
35 { | 35 { |
36 m_array = other.m_array; | 36 m_array = other.m_array; |
37 m_isolate = other.m_isolate; | 37 m_isolate = other.m_isolate; |
38 return *this; | 38 return *this; |
39 } | 39 } |
40 | 40 |
41 bool ArrayValue::isUndefinedOrNull() const | 41 bool ArrayValue::isUndefinedOrNull() const |
42 { | 42 { |
43 return m_array.IsEmpty() || WebCore::isUndefinedOrNull(m_array); | 43 return m_array.IsEmpty() || blink::isUndefinedOrNull(m_array); |
44 } | 44 } |
45 | 45 |
46 bool ArrayValue::length(size_t& length) const | 46 bool ArrayValue::length(size_t& length) const |
47 { | 47 { |
48 if (isUndefinedOrNull()) | 48 if (isUndefinedOrNull()) |
49 return false; | 49 return false; |
50 | 50 |
51 length = m_array->Length(); | 51 length = m_array->Length(); |
52 return true; | 52 return true; |
53 } | 53 } |
54 | 54 |
55 bool ArrayValue::get(size_t index, Dictionary& value) const | 55 bool ArrayValue::get(size_t index, Dictionary& value) const |
56 { | 56 { |
57 if (isUndefinedOrNull()) | 57 if (isUndefinedOrNull()) |
58 return false; | 58 return false; |
59 | 59 |
60 if (index >= m_array->Length()) | 60 if (index >= m_array->Length()) |
61 return false; | 61 return false; |
62 | 62 |
63 ASSERT(m_isolate); | 63 ASSERT(m_isolate); |
64 ASSERT(m_isolate == v8::Isolate::GetCurrent()); | 64 ASSERT(m_isolate == v8::Isolate::GetCurrent()); |
65 v8::Local<v8::Value> indexedValue = m_array->Get(v8::Integer::NewFromUnsigne
d(m_isolate, index)); | 65 v8::Local<v8::Value> indexedValue = m_array->Get(v8::Integer::NewFromUnsigne
d(m_isolate, index)); |
66 if (indexedValue.IsEmpty() || !indexedValue->IsObject()) | 66 if (indexedValue.IsEmpty() || !indexedValue->IsObject()) |
67 return false; | 67 return false; |
68 | 68 |
69 value = Dictionary(indexedValue, m_isolate); | 69 value = Dictionary(indexedValue, m_isolate); |
70 return true; | 70 return true; |
71 } | 71 } |
72 | 72 |
73 } // namespace WebCore | 73 } // namespace blink |
OLD | NEW |