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