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

Side by Side Diff: sky/engine/tonic/dart_state.h

Issue 1175053002: Fix shutdown crash in Sky (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: more idiot-proof Created 5 years, 6 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"
(...skipping 30 matching lines...) Expand all
41 41
42 DartState(); 42 DartState();
43 virtual ~DartState(); 43 virtual ~DartState();
44 44
45 static DartState* From(Dart_Isolate isolate); 45 static DartState* From(Dart_Isolate isolate);
46 static DartState* Current(); 46 static DartState* Current();
47 47
48 base::WeakPtr<DartState> GetWeakPtr(); 48 base::WeakPtr<DartState> GetWeakPtr();
49 49
50 Dart_Isolate isolate() { return isolate_; } 50 Dart_Isolate isolate() { return isolate_; }
51 void set_isolate(Dart_Isolate isolate) { 51 void SetIsolate(Dart_Isolate isolate);
52 CHECK(!isolate_);
53 isolate_ = isolate;
54 DidSetIsolateInternal();
55 }
56 52
57 DartClassLibrary& class_library() { return *class_library_; } 53 DartClassLibrary& class_library() { return *class_library_; }
58 DartStringCache& string_cache() { return *string_cache_; } 54 DartStringCache& string_cache() { return *string_cache_; }
59 DartExceptionFactory& exception_factory() { return *exception_factory_; } 55 DartExceptionFactory& exception_factory() { return *exception_factory_; }
60 DartTimerHeap& timer_heap() { return *timer_heap_; } 56 DartTimerHeap& timer_heap() { return *timer_heap_; }
61 57
62 Dart_Handle index_handle() { return index_handle_.value(); } 58 Dart_Handle index_handle() { return index_handle_.value(); }
63 59
64 virtual void DidSetIsolate() {} 60 virtual void DidSetIsolate() {}
65 61
66 private: 62 private:
67 void DidSetIsolateInternal();
68
69 Dart_Isolate isolate_; 63 Dart_Isolate isolate_;
70 OwnPtr<DartClassLibrary> class_library_; 64 OwnPtr<DartClassLibrary> class_library_;
71 OwnPtr<DartStringCache> string_cache_; 65 OwnPtr<DartStringCache> string_cache_;
72 OwnPtr<DartExceptionFactory> exception_factory_; 66 OwnPtr<DartExceptionFactory> exception_factory_;
73 OwnPtr<DartTimerHeap> timer_heap_; 67 OwnPtr<DartTimerHeap> timer_heap_;
68 DartPersistentValue index_handle_;
74 69
70 protected:
75 base::WeakPtrFactory<DartState> weak_factory_; 71 base::WeakPtrFactory<DartState> weak_factory_;
76 DartPersistentValue index_handle_;
77 72
78 DISALLOW_COPY_AND_ASSIGN(DartState); 73 DISALLOW_COPY_AND_ASSIGN(DartState);
79 }; 74 };
80 75
81 } // namespace blink 76 } // namespace blink
82 77
83 #endif // SKY_ENGINE_TONIC_DART_STATE_H_ 78 #endif // SKY_ENGINE_TONIC_DART_STATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698