Chromium Code Reviews| 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/config.h" | 5 #include "sky/engine/config.h" |
| 6 #include "sky/engine/tonic/dart_state.h" | 6 #include "sky/engine/tonic/dart_state.h" |
| 7 | 7 |
| 8 #include "sky/engine/tonic/dart_class_library.h" | 8 #include "sky/engine/tonic/dart_class_library.h" |
| 9 #include "sky/engine/tonic/dart_converter.h" | |
| 9 #include "sky/engine/tonic/dart_exception_factory.h" | 10 #include "sky/engine/tonic/dart_exception_factory.h" |
| 10 #include "sky/engine/tonic/dart_string_cache.h" | 11 #include "sky/engine/tonic/dart_string_cache.h" |
| 11 #include "sky/engine/tonic/dart_timer_heap.h" | 12 #include "sky/engine/tonic/dart_timer_heap.h" |
| 12 #include "sky/engine/wtf/PassOwnPtr.h" | 13 #include "sky/engine/wtf/PassOwnPtr.h" |
| 13 | 14 |
| 14 namespace blink { | 15 namespace blink { |
| 15 | 16 |
| 16 DartState::Scope::Scope(DartState* dart_state) : scope_(dart_state->isolate()) { | 17 DartState::Scope::Scope(DartState* dart_state) : scope_(dart_state->isolate()) { |
| 17 } | 18 } |
| 18 | 19 |
| 19 DartState::Scope::~Scope() { | 20 DartState::Scope::~Scope() { |
| 20 } | 21 } |
| 21 | 22 |
| 22 DartState::DartState() | 23 DartState::DartState() |
| 23 : isolate_(NULL), | 24 : isolate_(NULL), |
| 24 class_library_(adoptPtr(new DartClassLibrary)), | 25 class_library_(adoptPtr(new DartClassLibrary)), |
| 25 string_cache_(adoptPtr(new DartStringCache)), | 26 string_cache_(adoptPtr(new DartStringCache)), |
| 26 exception_factory_(adoptPtr(new DartExceptionFactory(this))), | 27 exception_factory_(adoptPtr(new DartExceptionFactory(this))), |
| 27 timer_heap_(adoptPtr(new DartTimerHeap())), | 28 timer_heap_(adoptPtr(new DartTimerHeap())), |
| 28 weak_factory_(this) { | 29 weak_factory_(this) { |
| 29 } | 30 } |
| 30 | 31 |
| 31 DartState::~DartState() { | 32 DartState::~DartState() { |
| 32 } | 33 } |
| 33 | 34 |
| 35 void DartState::DidSetIsolateInternal() { | |
| 36 Scope dart_scope(this); | |
| 37 index_handle_.Set(this, ToDart("index")); | |
| 38 | |
| 39 DidSetIsolate(); | |
|
abarth-chromium
2015/06/09 19:51:37
Do we want dart_scope to be on the stack while we'
Matt Perry
2015/06/09 19:52:47
Yeah I could go either way.
Matt Perry
2015/06/09 19:55:39
Went back to the old way since it's less mysteriou
| |
| 40 } | |
| 41 | |
| 34 DartState* DartState::From(Dart_Isolate isolate) { | 42 DartState* DartState::From(Dart_Isolate isolate) { |
| 35 return static_cast<DartState*>(Dart_IsolateData(isolate)); | 43 return static_cast<DartState*>(Dart_IsolateData(isolate)); |
| 36 } | 44 } |
| 37 | 45 |
| 38 DartState* DartState::Current() { | 46 DartState* DartState::Current() { |
| 39 return static_cast<DartState*>(Dart_CurrentIsolateData()); | 47 return static_cast<DartState*>(Dart_CurrentIsolateData()); |
| 40 } | 48 } |
| 41 | 49 |
| 42 base::WeakPtr<DartState> DartState::GetWeakPtr() { | 50 base::WeakPtr<DartState> DartState::GetWeakPtr() { |
| 43 return weak_factory_.GetWeakPtr(); | 51 return weak_factory_.GetWeakPtr(); |
| 44 } | 52 } |
| 45 | 53 |
| 46 } // namespace blink | 54 } // namespace blink |
| OLD | NEW |