Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(338)

Unified Diff: sky/engine/bindings-dart/common/ArrayValue.h

Issue 875013003: Import Dart bindings as of Blink r188698. This merely copies the files over and does not attach any… (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sky/engine/bindings-dart/common/ArrayValue.h
diff --git a/sky/engine/bindings/core/v8/ArrayValue.h b/sky/engine/bindings-dart/common/ArrayValue.h
similarity index 62%
copy from sky/engine/bindings/core/v8/ArrayValue.h
copy to sky/engine/bindings-dart/common/ArrayValue.h
index e020c5ac4245b8cc5d82a6127fadb8fc3e5c4de7..eba1b57e0f9a975d26812df8e0754d9ff0dcd3c4 100644
--- a/sky/engine/bindings/core/v8/ArrayValue.h
+++ b/sky/engine/bindings-dart/common/ArrayValue.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Google Inc. All rights reserved.
+ * Copyright (C) 2014 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -23,11 +23,12 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SKY_ENGINE_BINDINGS_CORE_V8_ARRAYVALUE_H_
-#define SKY_ENGINE_BINDINGS_CORE_V8_ARRAYVALUE_H_
+#ifndef ArrayValue_h
+#define ArrayValue_h
-#include "sky/engine/wtf/Assertions.h"
-#include "v8/include/v8.h"
+#include "bindings/common/AbstractArrayValue.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefPtr.h"
namespace blink {
@@ -35,32 +36,37 @@ class Dictionary;
class ArrayValue {
public:
- ArrayValue() : m_isolate(0) { }
- explicit ArrayValue(const v8::Local<v8::Array>& array, v8::Isolate* isolate)
- : m_array(array)
- , m_isolate(isolate)
+ ArrayValue() : m_arrayValueImpl() { }
+ explicit ArrayValue(PassRefPtr<AbstractArrayValue> impl) : m_arrayValueImpl(impl) { }
+
+ bool isUndefinedOrNull() const
{
- ASSERT(m_isolate);
+ return !m_arrayValueImpl || m_arrayValueImpl->isUndefinedOrNull();
}
- ~ArrayValue() { }
-
- ArrayValue& operator=(const ArrayValue&);
- bool isUndefinedOrNull() const;
+ bool length(size_t& length) const
+ {
+ if (!m_arrayValueImpl)
+ return false;
+ return m_arrayValueImpl->length(length);
+ }
- bool length(size_t&) const;
- bool get(size_t index, Dictionary&) const;
+ bool get(size_t index, Dictionary& value) const
+ {
+ if (!m_arrayValueImpl)
+ return false;
+ return m_arrayValueImpl->get(index, value);
+ }
private:
- // This object can only be used safely when stack allocated because of v8::Local.
+ RefPtr<AbstractArrayValue> m_arrayValueImpl;
+
+ // Disallow heap allocation. Only valid to use this object within a handle scope.
static void* operator new(size_t);
static void* operator new[](size_t);
static void operator delete(void *);
-
- v8::Local<v8::Array> m_array;
- v8::Isolate* m_isolate;
};
}
-#endif // SKY_ENGINE_BINDINGS_CORE_V8_ARRAYVALUE_H_
+#endif // ArrayValue_h
« no previous file with comments | « sky/engine/bindings-dart/common/AbstractScriptValue.h ('k') | sky/engine/bindings-dart/common/BindingSecurity.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698