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

Unified Diff: tonic/dart_state.cc

Issue 1244493002: Wholesale move sky/engine/tonic to tonic (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tonic/dart_state.h ('k') | tonic/dart_string.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tonic/dart_state.cc
diff --git a/tonic/dart_state.cc b/tonic/dart_state.cc
new file mode 100644
index 0000000000000000000000000000000000000000..60732bd10242761f2059d2fef5fee19e83440374
--- /dev/null
+++ b/tonic/dart_state.cc
@@ -0,0 +1,64 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "tonic/dart_state.h"
+
+#include "tonic/dart_class_library.h"
+#include "tonic/dart_converter.h"
+#include "tonic/dart_exception_factory.h"
+#include "tonic/dart_library_loader.h"
+#include "tonic/dart_string_cache.h"
+#include "tonic/dart_timer_heap.h"
+
+namespace blink {
+
+DartState::Scope::Scope(DartState* dart_state) : scope_(dart_state->isolate()) {
+}
+
+DartState::Scope::~Scope() {
+}
+
+DartState::DartState()
+ : isolate_(NULL),
+ class_library_(std::unique_ptr<DartClassLibrary>(new DartClassLibrary)),
+ exception_factory_(std::unique_ptr<DartExceptionFactory>(
+ new DartExceptionFactory(this))),
+ library_loader_(std::unique_ptr<DartLibraryLoader>(
+ new DartLibraryLoader(this))),
+ string_cache_(std::unique_ptr<DartStringCache>(
+ new DartStringCache)),
+ timer_heap_(std::unique_ptr<DartTimerHeap>(
+ new DartTimerHeap())),
+ weak_factory_(this) {
+}
+
+DartState::~DartState() {
+}
+
+void DartState::SetIsolate(Dart_Isolate isolate) {
+ isolate_ = isolate;
+ if (!isolate_)
+ return;
+
+ {
+ Scope dart_scope(this);
+ index_handle_.Set(this, ToDart("index"));
+ }
+
+ DidSetIsolate();
+}
+
+DartState* DartState::From(Dart_Isolate isolate) {
+ return static_cast<DartState*>(Dart_IsolateData(isolate));
+}
+
+DartState* DartState::Current() {
+ return static_cast<DartState*>(Dart_CurrentIsolateData());
+}
+
+base::WeakPtr<DartState> DartState::GetWeakPtr() {
+ return weak_factory_.GetWeakPtr();
+}
+
+} // namespace blink
« no previous file with comments | « tonic/dart_state.h ('k') | tonic/dart_string.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698