Chromium Code Reviews| 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 21 matching lines...) Expand all Loading... | |
| 32 | 32 |
| 33 ArrayValue& ArrayValue::operator=(const ArrayValue& other) | 33 ArrayValue& ArrayValue::operator=(const ArrayValue& other) |
| 34 { | 34 { |
| 35 m_array = other.m_array; | 35 m_array = other.m_array; |
| 36 m_isolate = other.m_isolate; | 36 m_isolate = other.m_isolate; |
| 37 return *this; | 37 return *this; |
| 38 } | 38 } |
| 39 | 39 |
| 40 bool ArrayValue::isUndefinedOrNull() const | 40 bool ArrayValue::isUndefinedOrNull() const |
| 41 { | 41 { |
| 42 return m_array.IsEmpty() || blink::isUndefinedOrNull(m_array); | 42 return blink::isUndefinedOrNull(m_array); |
|
peria
2016/08/25 15:31:18
We don't need 'blink::' here.
Yuki
2016/08/30 06:09:07
We do need it because ArrayValue::isUndefinedOrNul
| |
| 43 } | 43 } |
| 44 | 44 |
| 45 bool ArrayValue::length(size_t& length) const | 45 bool ArrayValue::length(size_t& length) const |
| 46 { | 46 { |
| 47 if (isUndefinedOrNull()) | 47 if (isUndefinedOrNull()) |
| 48 return false; | 48 return false; |
| 49 | 49 |
| 50 length = m_array->Length(); | 50 length = m_array->Length(); |
| 51 return true; | 51 return true; |
| 52 } | 52 } |
| 53 | 53 |
| 54 bool ArrayValue::get(size_t index, Dictionary& value) const | 54 bool ArrayValue::get(size_t index, Dictionary& value) const |
| 55 { | 55 { |
| 56 if (isUndefinedOrNull()) | 56 if (isUndefinedOrNull()) |
| 57 return false; | 57 return false; |
| 58 | 58 |
| 59 if (index >= m_array->Length()) | 59 if (index >= m_array->Length()) |
| 60 return false; | 60 return false; |
| 61 | 61 |
| 62 ASSERT(m_isolate); | 62 DCHECK(m_isolate); |
| 63 ASSERT(m_isolate == v8::Isolate::GetCurrent()); | 63 DCHECK_EQ(m_isolate, v8::Isolate::GetCurrent()); |
| 64 v8::Local<v8::Value> indexedValue; | 64 v8::Local<v8::Value> indexedValue; |
| 65 if (!m_array->Get(m_isolate->GetCurrentContext(), index).ToLocal(&indexedVal ue) || !indexedValue->IsObject()) | 65 if (!m_array->Get(m_isolate->GetCurrentContext(), index).ToLocal(&indexedVal ue) || !indexedValue->IsObject()) |
| 66 return false; | 66 return false; |
| 67 | 67 |
| 68 value = Dictionary(indexedValue, m_isolate, m_exceptionState); | 68 value = Dictionary(m_isolate, indexedValue); |
| 69 return true; | 69 return true; |
| 70 } | 70 } |
| 71 | 71 |
| 72 } // namespace blink | 72 } // namespace blink |
| OLD | NEW |