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

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

Issue 924593002: Merge the tonic layer from skydart branch back to master (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: fix Created 5 years, 10 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
« no previous file with comments | « sky/engine/tonic/dart_persistent_value.cc ('k') | sky/engine/tonic/dart_state.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef SKY_ENGINE_TONIC_DART_STATE_H_
6 #define SKY_ENGINE_TONIC_DART_STATE_H_
7
8 #include "base/logging.h"
9 #include "base/memory/weak_ptr.h"
10 #include "base/supports_user_data.h"
11 #include "dart/runtime/include/dart_api.h"
12 #include "sky/engine/wtf/OwnPtr.h"
13 #include "sky/engine/wtf/PassRefPtr.h"
14 #include "sky/engine/wtf/RefCounted.h"
15
16 namespace blink {
17 class DartStringCache;
18 class DartClassLibrary;
19
20 // DartState represents the state associated with a given Dart isolate. The
21 // lifetime of this object is controlled by the DartVM. If you want to hold a
22 // reference to a DartState instance, please hold a base::WeakPtr<DartState>.
23 //
24 // DartState is analogous to gin::PerIsolateData and JSC::ExecState.
25 class DartState : public base::SupportsUserData {
26 public:
27 class Scope {
28 public:
29 Scope(DartState* dart_state);
30 ~Scope();
31 };
32
33 DartState();
34 virtual ~DartState();
35
36 static DartState* From(Dart_Isolate isolate);
37 static DartState* Current();
38
39 base::WeakPtr<DartState> GetWeakPtr();
40
41 Dart_Isolate isolate() { return isolate_; }
42 void set_isolate(Dart_Isolate isolate) {
43 CHECK(!isolate_);
44 isolate_ = isolate;
45 }
46
47 DartClassLibrary& class_library() { return *class_library_; }
48 DartStringCache& string_cache() { return *string_cache_; }
49
50 private:
51 Dart_Isolate isolate_;
52 OwnPtr<DartClassLibrary> class_library_;
53 OwnPtr<DartStringCache> string_cache_;
54
55 base::WeakPtrFactory<DartState> weak_factory_;
56
57 DISALLOW_COPY_AND_ASSIGN(DartState);
58 };
59
60 } // namespace blink
61
62 #endif // SKY_ENGINE_TONIC_DART_STATE_H_
OLDNEW
« no previous file with comments | « sky/engine/tonic/dart_persistent_value.cc ('k') | sky/engine/tonic/dart_state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698