| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 SKY_ENGINE_TONIC_DART_VALUE_H_ | 5 #ifndef SKY_ENGINE_TONIC_DART_VALUE_H_ |
| 6 #define SKY_ENGINE_TONIC_DART_VALUE_H_ | 6 #define SKY_ENGINE_TONIC_DART_VALUE_H_ |
| 7 | 7 |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "dart/runtime/include/dart_api.h" | 9 #include "dart/runtime/include/dart_api.h" |
| 10 #include "sky/engine/tonic/dart_persistent_value.h" | 10 #include "sky/engine/tonic/dart_persistent_value.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 static PassRefPtr<DartValue> Create(DartState* dart_state, | 23 static PassRefPtr<DartValue> Create(DartState* dart_state, |
| 24 Dart_Handle value) { | 24 Dart_Handle value) { |
| 25 return adoptRef(new DartValue(dart_state, value)); | 25 return adoptRef(new DartValue(dart_state, value)); |
| 26 } | 26 } |
| 27 | 27 |
| 28 static PassRefPtr<DartValue> Create() { return adoptRef(new DartValue()); } | 28 static PassRefPtr<DartValue> Create() { return adoptRef(new DartValue()); } |
| 29 | 29 |
| 30 ~DartValue(); | 30 ~DartValue(); |
| 31 | 31 |
| 32 Dart_Handle dart_value() const { return dart_value_.value(); } | 32 Dart_Handle dart_value() const { return dart_value_.value(); } |
| 33 const base::WeakPtr<DartState>& dart_state() const { |
| 34 return dart_value_.dart_state(); |
| 35 } |
| 36 |
| 33 bool is_empty() const { return !dart_value(); } | 37 bool is_empty() const { return !dart_value(); } |
| 34 | 38 |
| 35 bool is_null() const { | 39 bool is_null() const { |
| 36 DCHECK(!is_empty()); | 40 DCHECK(!is_empty()); |
| 37 return Dart_IsNull(dart_value()); | 41 return Dart_IsNull(dart_value()); |
| 38 } | 42 } |
| 39 | 43 |
| 40 bool is_function() const { | 44 bool is_function() const { |
| 41 DCHECK(!is_empty()); | 45 DCHECK(!is_empty()); |
| 42 return Dart_IsClosure(dart_value()); | 46 return Dart_IsClosure(dart_value()); |
| 43 } | 47 } |
| 44 | 48 |
| 45 bool Equals(DartValue* other) const; | 49 bool Equals(DartValue* other) const; |
| 46 void Clear(); | 50 void Clear(); |
| 47 | 51 |
| 48 private: | 52 private: |
| 49 DartValue(); | 53 DartValue(); |
| 50 DartValue(DartState* dart_state, Dart_Handle value); | 54 DartValue(DartState* dart_state, Dart_Handle value); |
| 51 | 55 |
| 52 DartPersistentValue dart_value_; | 56 DartPersistentValue dart_value_; |
| 53 | 57 |
| 54 DISALLOW_COPY_AND_ASSIGN(DartValue); | 58 DISALLOW_COPY_AND_ASSIGN(DartValue); |
| 55 }; | 59 }; |
| 56 | 60 |
| 57 } // namespace blink | 61 } // namespace blink |
| 58 | 62 |
| 59 #endif // SKY_ENGINE_TONIC_DART_VALUE_H_ | 63 #endif // SKY_ENGINE_TONIC_DART_VALUE_H_ |
| OLD | NEW |