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

Side by Side Diff: tonic/dart_state.h

Issue 1244983003: Make mojo dart controller depend on tonic and get building without wtf (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 5 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 unified diff | Download patch
OLDNEW
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 "tonic/dart_api_scope.h" 12 #include "tonic/dart_api_scope.h"
13 #include "tonic/dart_isolate_scope.h" 13 #include "tonic/dart_isolate_scope.h"
14 #include "tonic/dart_persistent_value.h" 14 #include "tonic/dart_persistent_value.h"
15 15
16 namespace blink { 16 namespace blink {
17 class DartClassLibrary; 17 class DartClassLibrary;
18 class DartExceptionFactory; 18 class DartExceptionFactory;
19 class DartLibraryLoader; 19 class DartLibraryLoader;
20 class DartStringCache;
21 class DartTimerHeap; 20 class DartTimerHeap;
22 21
23 // DartState represents the state associated with a given Dart isolate. The 22 // DartState represents the state associated with a given Dart isolate. The
24 // lifetime of this object is controlled by the DartVM. If you want to hold a 23 // lifetime of this object is controlled by the DartVM. If you want to hold a
25 // reference to a DartState instance, please hold a base::WeakPtr<DartState>. 24 // reference to a DartState instance, please hold a base::WeakPtr<DartState>.
26 // 25 //
27 // DartState is analogous to gin::PerIsolateData and JSC::ExecState. 26 // DartState is analogous to gin::PerIsolateData and JSC::ExecState.
28 class DartState : public base::SupportsUserData { 27 class DartState : public base::SupportsUserData {
29 public: 28 public:
30 class Scope { 29 class Scope {
(...skipping 13 matching lines...) Expand all
44 static DartState* Current(); 43 static DartState* Current();
45 44
46 base::WeakPtr<DartState> GetWeakPtr(); 45 base::WeakPtr<DartState> GetWeakPtr();
47 46
48 Dart_Isolate isolate() { return isolate_; } 47 Dart_Isolate isolate() { return isolate_; }
49 void SetIsolate(Dart_Isolate isolate); 48 void SetIsolate(Dart_Isolate isolate);
50 49
51 DartClassLibrary& class_library() { return *class_library_; } 50 DartClassLibrary& class_library() { return *class_library_; }
52 DartExceptionFactory& exception_factory() { return *exception_factory_; } 51 DartExceptionFactory& exception_factory() { return *exception_factory_; }
53 DartLibraryLoader& library_loader() { return *library_loader_; } 52 DartLibraryLoader& library_loader() { return *library_loader_; }
54 DartStringCache& string_cache() { return *string_cache_; }
55 DartTimerHeap& timer_heap() { return *timer_heap_; } 53 DartTimerHeap& timer_heap() { return *timer_heap_; }
56 54
57 Dart_Handle index_handle() { return index_handle_.value(); } 55 Dart_Handle index_handle() { return index_handle_.value(); }
58 56
59 virtual void DidSetIsolate() {} 57 virtual void DidSetIsolate() {}
60 58
61 private: 59 private:
62 Dart_Isolate isolate_; 60 Dart_Isolate isolate_;
63 std::unique_ptr<DartClassLibrary> class_library_; 61 std::unique_ptr<DartClassLibrary> class_library_;
64 std::unique_ptr<DartExceptionFactory> exception_factory_; 62 std::unique_ptr<DartExceptionFactory> exception_factory_;
65 std::unique_ptr<DartLibraryLoader> library_loader_; 63 std::unique_ptr<DartLibraryLoader> library_loader_;
66 std::unique_ptr<DartStringCache> string_cache_;
67 std::unique_ptr<DartTimerHeap> timer_heap_; 64 std::unique_ptr<DartTimerHeap> timer_heap_;
68 DartPersistentValue index_handle_; 65 DartPersistentValue index_handle_;
69 66
70 protected: 67 protected:
71 base::WeakPtrFactory<DartState> weak_factory_; 68 base::WeakPtrFactory<DartState> weak_factory_;
72 69
73 DISALLOW_COPY_AND_ASSIGN(DartState); 70 DISALLOW_COPY_AND_ASSIGN(DartState);
74 }; 71 };
75 72
76 } // namespace blink 73 } // namespace blink
77 74
78 #endif // SKY_ENGINE_TONIC_DART_STATE_H_ 75 #endif // SKY_ENGINE_TONIC_DART_STATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698