| 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/core/script/dom_dart_state.h" | 6 #include "sky/engine/core/script/dom_dart_state.h" |
| 7 | 7 |
| 8 #include "sky/engine/core/dom/Document.h" | 8 #include "sky/engine/core/dom/Document.h" |
| 9 #include "sky/engine/core/script/dart_loader.h" | 9 #include "sky/engine/core/script/dart_loader.h" |
| 10 | 10 |
| 11 namespace blink { | 11 namespace blink { |
| 12 | 12 |
| 13 DOMDartState::DOMDartState(Document* document) | 13 DOMDartState::DOMDartState(Document* document) |
| 14 : document_(document), loader_(adoptPtr(new DartLoader(this))) { | 14 : document_(document), |
| 15 loader_(adoptPtr(new DartLoader(this))) { |
| 15 } | 16 } |
| 16 | 17 |
| 17 DOMDartState::~DOMDartState() { | 18 DOMDartState::~DOMDartState() { |
| 18 } | 19 } |
| 19 | 20 |
| 21 void DOMDartState::DidSetIsolate() { |
| 22 Scope dart_scope(this); |
| 23 x_handle_.Set(this, Dart_NewStringFromCString("x")); |
| 24 y_handle_.Set(this, Dart_NewStringFromCString("y")); |
| 25 value_handle_.Set(this, Dart_NewStringFromCString("_value")); |
| 26 } |
| 27 |
| 20 DOMDartState* DOMDartState::Current() { | 28 DOMDartState* DOMDartState::Current() { |
| 21 return static_cast<DOMDartState*>(DartState::Current()); | 29 return static_cast<DOMDartState*>(DartState::Current()); |
| 22 } | 30 } |
| 23 | 31 |
| 24 Document* DOMDartState::CurrentDocument() { | 32 Document* DOMDartState::CurrentDocument() { |
| 25 return Current()->document_.get(); | 33 return Current()->document_.get(); |
| 26 } | 34 } |
| 27 | 35 |
| 28 LocalFrame* DOMDartState::CurrentFrame() { | 36 LocalFrame* DOMDartState::CurrentFrame() { |
| 29 DCHECK(Current()->document_); | 37 DCHECK(Current()->document_); |
| 30 return Current()->document_->frame(); | 38 return Current()->document_->frame(); |
| 31 } | 39 } |
| 32 | 40 |
| 33 LocalDOMWindow* DOMDartState::CurrentWindow() { | 41 LocalDOMWindow* DOMDartState::CurrentWindow() { |
| 34 DCHECK(Current()->document_); | 42 DCHECK(Current()->document_); |
| 35 return Current()->document_->domWindow(); | 43 return Current()->document_->domWindow(); |
| 36 } | 44 } |
| 37 | 45 |
| 38 } | 46 } // namespace blink |
| OLD | NEW |