Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(327)

Side by Side Diff: sky/engine/core/script/dom_dart_state.h

Issue 1145103005: Add DartHandleCache and use it to cache strings used when converting Rect and (Closed) Base URL: git@github.com:/domokit/mojo.git@master
Patch Set: simplify Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sky/engine/core/painting/Rect.cpp ('k') | sky/engine/core/script/dom_dart_state.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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; 14 class DartLoader;
15 class LocalFrame; 15 class LocalFrame;
16 class LocalDOMWindow; 16 class LocalDOMWindow;
17 17
18 class DOMDartState : public DartState { 18 class DOMDartState : public DartState {
19 public: 19 public:
20 explicit DOMDartState(Document* document); 20 explicit DOMDartState(Document* document);
21 ~DOMDartState() override; 21 ~DOMDartState() override;
22 22
23 virtual void DidSetIsolate();
24
23 static DOMDartState* Current(); 25 static DOMDartState* Current();
24 26
25 static Document* CurrentDocument(); 27 static Document* CurrentDocument();
26 static LocalFrame* CurrentFrame(); 28 static LocalFrame* CurrentFrame();
27 static LocalDOMWindow* CurrentWindow(); 29 static LocalDOMWindow* CurrentWindow();
28 30
29 Document* document() const { return document_.get(); } 31 Document* document() const { return document_.get(); }
30 DartLoader& loader() const { return *loader_; } 32 DartLoader& loader() const { return *loader_; }
31 33
34 // Cached handles to strings used in Dart/C++ conversions.
35 Dart_Handle x_handle() { return x_handle_.value(); }
36 Dart_Handle y_handle() { return y_handle_.value(); }
37 Dart_Handle value_handle() { return value_handle_.value(); }
38
32 private: 39 private:
33 RefPtr<Document> document_; 40 RefPtr<Document> document_;
34 OwnPtr<DartLoader> loader_; 41 OwnPtr<DartLoader> loader_;
42
43 DartPersistentValue x_handle_;
44 DartPersistentValue y_handle_;
45 DartPersistentValue value_handle_;
35 }; 46 };
36 47
37 } 48 } // namespace blink
38 49
39 #endif // SKY_ENGINE_CORE_SCRIPT_DOM_DART_STATE_H_ 50 #endif // SKY_ENGINE_CORE_SCRIPT_DOM_DART_STATE_H_
OLDNEW
« no previous file with comments | « sky/engine/core/painting/Rect.cpp ('k') | sky/engine/core/script/dom_dart_state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698