| 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_STATE_H_ | 5 #ifndef SKY_ENGINE_TONIC_DART_STATE_H_ |
| 6 #define SKY_ENGINE_TONIC_DART_STATE_H_ | 6 #define SKY_ENGINE_TONIC_DART_STATE_H_ |
| 7 | 7 |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "base/supports_user_data.h" | 10 #include "base/supports_user_data.h" |
| 11 #include "dart/runtime/include/dart_api.h" | 11 #include "dart/runtime/include/dart_api.h" |
| 12 #include "sky/engine/tonic/dart_api_scope.h" | 12 #include "sky/engine/tonic/dart_api_scope.h" |
| 13 #include "sky/engine/tonic/dart_isolate_scope.h" | 13 #include "sky/engine/tonic/dart_isolate_scope.h" |
| 14 #include "sky/engine/tonic/dart_persistent_value.h" | 14 #include "sky/engine/tonic/dart_persistent_value.h" |
| 15 #include "sky/engine/wtf/OwnPtr.h" | |
| 16 | 15 |
| 17 namespace blink { | 16 namespace blink { |
| 18 class DartClassLibrary; | 17 class DartClassLibrary; |
| 19 class DartExceptionFactory; | 18 class DartExceptionFactory; |
| 20 class DartLibraryLoader; | 19 class DartLibraryLoader; |
| 21 class DartStringCache; | 20 class DartStringCache; |
| 22 class DartTimerHeap; | 21 class DartTimerHeap; |
| 23 | 22 |
| 24 // DartState represents the state associated with a given Dart isolate. The | 23 // DartState represents the state associated with a given Dart isolate. The |
| 25 // lifetime of this object is controlled by the DartVM. If you want to hold a | 24 // lifetime of this object is controlled by the DartVM. If you want to hold a |
| (...skipping 28 matching lines...) Expand all Loading... |
| 54 DartLibraryLoader& library_loader() { return *library_loader_; } | 53 DartLibraryLoader& library_loader() { return *library_loader_; } |
| 55 DartStringCache& string_cache() { return *string_cache_; } | 54 DartStringCache& string_cache() { return *string_cache_; } |
| 56 DartTimerHeap& timer_heap() { return *timer_heap_; } | 55 DartTimerHeap& timer_heap() { return *timer_heap_; } |
| 57 | 56 |
| 58 Dart_Handle index_handle() { return index_handle_.value(); } | 57 Dart_Handle index_handle() { return index_handle_.value(); } |
| 59 | 58 |
| 60 virtual void DidSetIsolate() {} | 59 virtual void DidSetIsolate() {} |
| 61 | 60 |
| 62 private: | 61 private: |
| 63 Dart_Isolate isolate_; | 62 Dart_Isolate isolate_; |
| 64 OwnPtr<DartClassLibrary> class_library_; | 63 std::unique_ptr<DartClassLibrary> class_library_; |
| 65 OwnPtr<DartExceptionFactory> exception_factory_; | 64 std::unique_ptr<DartExceptionFactory> exception_factory_; |
| 66 OwnPtr<DartLibraryLoader> library_loader_; | 65 std::unique_ptr<DartLibraryLoader> library_loader_; |
| 67 OwnPtr<DartStringCache> string_cache_; | 66 std::unique_ptr<DartStringCache> string_cache_; |
| 68 OwnPtr<DartTimerHeap> timer_heap_; | 67 std::unique_ptr<DartTimerHeap> timer_heap_; |
| 69 DartPersistentValue index_handle_; | 68 DartPersistentValue index_handle_; |
| 70 | 69 |
| 71 protected: | 70 protected: |
| 72 base::WeakPtrFactory<DartState> weak_factory_; | 71 base::WeakPtrFactory<DartState> weak_factory_; |
| 73 | 72 |
| 74 DISALLOW_COPY_AND_ASSIGN(DartState); | 73 DISALLOW_COPY_AND_ASSIGN(DartState); |
| 75 }; | 74 }; |
| 76 | 75 |
| 77 } // namespace blink | 76 } // namespace blink |
| 78 | 77 |
| 79 #endif // SKY_ENGINE_TONIC_DART_STATE_H_ | 78 #endif // SKY_ENGINE_TONIC_DART_STATE_H_ |
| OLD | NEW |