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 #include "tonic/dart_state.h" | 5 #include "tonic/dart_state.h" |
6 | 6 |
7 #include "tonic/dart_class_library.h" | 7 #include "tonic/dart_class_library.h" |
8 #include "tonic/dart_converter.h" | 8 #include "tonic/dart_converter.h" |
9 #include "tonic/dart_exception_factory.h" | 9 #include "tonic/dart_exception_factory.h" |
10 #include "tonic/dart_library_loader.h" | 10 #include "tonic/dart_library_loader.h" |
11 #include "tonic/dart_string_cache.h" | |
12 #include "tonic/dart_timer_heap.h" | 11 #include "tonic/dart_timer_heap.h" |
13 | 12 |
14 namespace blink { | 13 namespace blink { |
15 | 14 |
16 DartState::Scope::Scope(DartState* dart_state) : scope_(dart_state->isolate()) { | 15 DartState::Scope::Scope(DartState* dart_state) : scope_(dart_state->isolate()) { |
17 } | 16 } |
18 | 17 |
19 DartState::Scope::~Scope() { | 18 DartState::Scope::~Scope() { |
20 } | 19 } |
21 | 20 |
22 DartState::DartState() | 21 DartState::DartState() |
23 : isolate_(NULL), | 22 : isolate_(NULL), |
24 class_library_(std::unique_ptr<DartClassLibrary>(new DartClassLibrary)), | 23 class_library_(std::unique_ptr<DartClassLibrary>(new DartClassLibrary)), |
25 exception_factory_(std::unique_ptr<DartExceptionFactory>( | 24 exception_factory_(std::unique_ptr<DartExceptionFactory>( |
26 new DartExceptionFactory(this))), | 25 new DartExceptionFactory(this))), |
27 library_loader_(std::unique_ptr<DartLibraryLoader>( | 26 library_loader_(std::unique_ptr<DartLibraryLoader>( |
28 new DartLibraryLoader(this))), | 27 new DartLibraryLoader(this))), |
29 string_cache_(std::unique_ptr<DartStringCache>( | |
30 new DartStringCache)), | |
31 timer_heap_(std::unique_ptr<DartTimerHeap>( | 28 timer_heap_(std::unique_ptr<DartTimerHeap>( |
32 new DartTimerHeap())), | 29 new DartTimerHeap())), |
33 weak_factory_(this) { | 30 weak_factory_(this) { |
34 } | 31 } |
35 | 32 |
36 DartState::~DartState() { | 33 DartState::~DartState() { |
37 } | 34 } |
38 | 35 |
39 void DartState::SetIsolate(Dart_Isolate isolate) { | 36 void DartState::SetIsolate(Dart_Isolate isolate) { |
40 isolate_ = isolate; | 37 isolate_ = isolate; |
(...skipping 14 matching lines...) Expand all Loading... |
55 | 52 |
56 DartState* DartState::Current() { | 53 DartState* DartState::Current() { |
57 return static_cast<DartState*>(Dart_CurrentIsolateData()); | 54 return static_cast<DartState*>(Dart_CurrentIsolateData()); |
58 } | 55 } |
59 | 56 |
60 base::WeakPtr<DartState> DartState::GetWeakPtr() { | 57 base::WeakPtr<DartState> DartState::GetWeakPtr() { |
61 return weak_factory_.GetWeakPtr(); | 58 return weak_factory_.GetWeakPtr(); |
62 } | 59 } |
63 | 60 |
64 } // namespace blink | 61 } // namespace blink |
OLD | NEW |