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_converter.h" |
| 10 #include "sky/engine/tonic/dart_exception_factory.h" | 10 #include "sky/engine/tonic/dart_exception_factory.h" |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 25 class_library_(adoptPtr(new DartClassLibrary)), | 25 class_library_(adoptPtr(new DartClassLibrary)), |
| 26 string_cache_(adoptPtr(new DartStringCache)), | 26 string_cache_(adoptPtr(new DartStringCache)), |
| 27 exception_factory_(adoptPtr(new DartExceptionFactory(this))), | 27 exception_factory_(adoptPtr(new DartExceptionFactory(this))), |
| 28 timer_heap_(adoptPtr(new DartTimerHeap())), | 28 timer_heap_(adoptPtr(new DartTimerHeap())), |
| 29 weak_factory_(this) { | 29 weak_factory_(this) { |
| 30 } | 30 } |
| 31 | 31 |
| 32 DartState::~DartState() { | 32 DartState::~DartState() { |
| 33 } | 33 } |
| 34 | 34 |
| 35 void DartState::DidSetIsolateInternal() { | 35 void DartState::SetIsolate(Dart_Isolate isolate) { |
| 36 { | 36 CHECK(!isolate_); |
| 37 Scope dart_scope(this); | 37 isolate_ = isolate; |
| 38 index_handle_.Set(this, ToDart("index")); | 38 if (isolate_) { |
|
eseidel
2015/06/10 19:56:41
I might have early returned instead. but ok.
| |
| 39 { | |
| 40 Scope dart_scope(this); | |
| 41 index_handle_.Set(this, ToDart("index")); | |
| 42 } | |
| 43 DidSetIsolate(); | |
| 39 } | 44 } |
| 40 DidSetIsolate(); | |
| 41 } | 45 } |
| 42 | 46 |
| 43 DartState* DartState::From(Dart_Isolate isolate) { | 47 DartState* DartState::From(Dart_Isolate isolate) { |
| 44 return static_cast<DartState*>(Dart_IsolateData(isolate)); | 48 return static_cast<DartState*>(Dart_IsolateData(isolate)); |
| 45 } | 49 } |
| 46 | 50 |
| 47 DartState* DartState::Current() { | 51 DartState* DartState::Current() { |
| 48 return static_cast<DartState*>(Dart_CurrentIsolateData()); | 52 return static_cast<DartState*>(Dart_CurrentIsolateData()); |
| 49 } | 53 } |
| 50 | 54 |
| 51 base::WeakPtr<DartState> DartState::GetWeakPtr() { | 55 base::WeakPtr<DartState> DartState::GetWeakPtr() { |
| 52 return weak_factory_.GetWeakPtr(); | 56 return weak_factory_.GetWeakPtr(); |
| 53 } | 57 } |
| 54 | 58 |
| 55 } // namespace blink | 59 } // namespace blink |
| OLD | NEW |