| 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 #ifndef SKY_ENGINE_CORE_SCRIPT_DOM_DART_STATE_H_ | 5 #ifndef SKY_ENGINE_CORE_SCRIPT_DOM_DART_STATE_H_ |
| 6 #define SKY_ENGINE_CORE_SCRIPT_DOM_DART_STATE_H_ | 6 #define SKY_ENGINE_CORE_SCRIPT_DOM_DART_STATE_H_ |
| 7 | 7 |
| 8 #include "dart/runtime/include/dart_api.h" | 8 #include "dart/runtime/include/dart_api.h" |
| 9 #include "sky/engine/tonic/dart_state.h" | 9 #include "sky/engine/tonic/dart_state.h" |
| 10 #include "sky/engine/core/dom/Document.h" | 10 #include "sky/engine/core/dom/Document.h" |
| 11 #include "sky/engine/wtf/RefPtr.h" | 11 #include "sky/engine/wtf/RefPtr.h" |
| 12 | 12 |
| 13 namespace blink { | 13 namespace blink { |
| 14 class DartLoader; | |
| 15 class LocalFrame; | 14 class LocalFrame; |
| 16 class LocalDOMWindow; | 15 class LocalDOMWindow; |
| 17 | 16 |
| 18 class DOMDartState : public DartState { | 17 class DOMDartState : public DartState { |
| 19 public: | 18 public: |
| 20 explicit DOMDartState(Document* document, const KURL& url); | 19 explicit DOMDartState(Document* document, const KURL& url); |
| 21 ~DOMDartState() override; | 20 ~DOMDartState() override; |
| 22 | 21 |
| 23 virtual void DidSetIsolate(); | 22 virtual void DidSetIsolate(); |
| 24 | 23 |
| 25 static DOMDartState* Current(); | 24 static DOMDartState* Current(); |
| 26 | 25 |
| 27 static Document* CurrentDocument(); | 26 static Document* CurrentDocument(); |
| 28 static LocalFrame* CurrentFrame(); | 27 static LocalFrame* CurrentFrame(); |
| 29 static LocalDOMWindow* CurrentWindow(); | 28 static LocalDOMWindow* CurrentWindow(); |
| 30 | 29 |
| 31 const KURL& url() const { return url_; } | 30 const KURL& url() const { return url_; } |
| 32 | 31 |
| 33 Document* document() const { return document_.get(); } | 32 Document* document() const { return document_.get(); } |
| 34 DartLoader& loader() const { return *loader_; } | |
| 35 | 33 |
| 36 // Cached handles to strings used in Dart/C++ conversions. | 34 // Cached handles to strings used in Dart/C++ conversions. |
| 37 Dart_Handle x_handle() { return x_handle_.value(); } | 35 Dart_Handle x_handle() { return x_handle_.value(); } |
| 38 Dart_Handle y_handle() { return y_handle_.value(); } | 36 Dart_Handle y_handle() { return y_handle_.value(); } |
| 39 Dart_Handle value_handle() { return value_handle_.value(); } | 37 Dart_Handle value_handle() { return value_handle_.value(); } |
| 40 Dart_Handle color_class() { return color_class_.value(); } | 38 Dart_Handle color_class() { return color_class_.value(); } |
| 41 | 39 |
| 42 private: | 40 private: |
| 43 RefPtr<Document> document_; | 41 RefPtr<Document> document_; |
| 44 KURL url_; | 42 KURL url_; |
| 45 OwnPtr<DartLoader> loader_; | |
| 46 | 43 |
| 47 DartPersistentValue x_handle_; | 44 DartPersistentValue x_handle_; |
| 48 DartPersistentValue y_handle_; | 45 DartPersistentValue y_handle_; |
| 49 DartPersistentValue value_handle_; | 46 DartPersistentValue value_handle_; |
| 50 DartPersistentValue color_class_; | 47 DartPersistentValue color_class_; |
| 51 }; | 48 }; |
| 52 | 49 |
| 53 } // namespace blink | 50 } // namespace blink |
| 54 | 51 |
| 55 #endif // SKY_ENGINE_CORE_SCRIPT_DOM_DART_STATE_H_ | 52 #endif // SKY_ENGINE_CORE_SCRIPT_DOM_DART_STATE_H_ |
| OLD | NEW |