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

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

Issue 934863002: ParentNode#appendChild(null) shouldn't crash (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: git cl format 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
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 "sky/engine/wtf/OwnPtr.h" 12 #include "sky/engine/wtf/OwnPtr.h"
13 #include "sky/engine/wtf/PassRefPtr.h" 13 #include "sky/engine/wtf/PassRefPtr.h"
14 #include "sky/engine/wtf/RefCounted.h" 14 #include "sky/engine/wtf/RefCounted.h"
15 15
16 namespace blink { 16 namespace blink {
17 class DartStringCache; 17 class DartStringCache;
18 class DartClassLibrary; 18 class DartClassLibrary;
19 class DartExceptionFactory;
19 20
20 // DartState represents the state associated with a given Dart isolate. The 21 // 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 // 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 // reference to a DartState instance, please hold a base::WeakPtr<DartState>.
23 // 24 //
24 // DartState is analogous to gin::PerIsolateData and JSC::ExecState. 25 // DartState is analogous to gin::PerIsolateData and JSC::ExecState.
25 class DartState : public base::SupportsUserData { 26 class DartState : public base::SupportsUserData {
26 public: 27 public:
27 class Scope { 28 class Scope {
28 public: 29 public:
(...skipping 10 matching lines...) Expand all
39 base::WeakPtr<DartState> GetWeakPtr(); 40 base::WeakPtr<DartState> GetWeakPtr();
40 41
41 Dart_Isolate isolate() { return isolate_; } 42 Dart_Isolate isolate() { return isolate_; }
42 void set_isolate(Dart_Isolate isolate) { 43 void set_isolate(Dart_Isolate isolate) {
43 CHECK(!isolate_); 44 CHECK(!isolate_);
44 isolate_ = isolate; 45 isolate_ = isolate;
45 } 46 }
46 47
47 DartClassLibrary& class_library() { return *class_library_; } 48 DartClassLibrary& class_library() { return *class_library_; }
48 DartStringCache& string_cache() { return *string_cache_; } 49 DartStringCache& string_cache() { return *string_cache_; }
50 DartExceptionFactory& exception_factory() { return *exception_factory_; }
49 51
50 private: 52 private:
51 Dart_Isolate isolate_; 53 Dart_Isolate isolate_;
52 OwnPtr<DartClassLibrary> class_library_; 54 OwnPtr<DartClassLibrary> class_library_;
53 OwnPtr<DartStringCache> string_cache_; 55 OwnPtr<DartStringCache> string_cache_;
56 OwnPtr<DartExceptionFactory> exception_factory_;
54 57
55 base::WeakPtrFactory<DartState> weak_factory_; 58 base::WeakPtrFactory<DartState> weak_factory_;
56 59
57 DISALLOW_COPY_AND_ASSIGN(DartState); 60 DISALLOW_COPY_AND_ASSIGN(DartState);
58 }; 61 };
59 62
60 } // namespace blink 63 } // namespace blink
61 64
62 #endif // SKY_ENGINE_TONIC_DART_STATE_H_ 65 #endif // SKY_ENGINE_TONIC_DART_STATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698