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

Unified Diff: tonic/dart_debugger.h

Issue 1245243002: Move dart_debugger into tonic and use it in mojo dart controller (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/BUILD.gn ('k') | tonic/dart_debugger.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tonic/dart_debugger.h
diff --git a/mojo/dart/embedder/dart_debugger.h b/tonic/dart_debugger.h
similarity index 62%
rename from mojo/dart/embedder/dart_debugger.h
rename to tonic/dart_debugger.h
index 541e6638272563005df77fe2b9213b3256036bbf..779b35d0f68658fd40a67c46f3cbce4b0a7c3485 100644
--- a/mojo/dart/embedder/dart_debugger.h
+++ b/tonic/dart_debugger.h
@@ -2,23 +2,80 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef MOJO_DART_EMBEDDER_DART_DEBUGGER_H_
-#define MOJO_DART_EMBEDDER_DART_DEBUGGER_H_
+#ifndef TONIC_DART_DEBUGGER_H_
+#define TONIC_DART_DEBUGGER_H_
#include <memory>
#include <vector>
+#include "base/synchronization/condition_variable.h"
+#include "base/synchronization/lock.h"
#include "dart/runtime/include/dart_api.h"
#include "dart/runtime/include/dart_native_api.h"
#include "dart/runtime/include/dart_tools_api.h"
-#include "mojo/dart/embedder/monitor.h"
namespace base {
class Lock;
}
-namespace mojo {
-namespace dart {
+namespace tonic {
+
+class Monitor {
+ public:
+ Monitor() {
+ lock_ = new base::Lock();
+ condition_variable_ = new base::ConditionVariable(lock_);
+ }
+
+ ~Monitor() {
+ delete condition_variable_;
+ delete lock_;
+ }
+
+ void Enter() {
+ lock_->Acquire();
+ }
+
+ void Exit() {
+ lock_->Release();
+ }
+
+ void Notify() {
+ condition_variable_->Signal();
+ }
+
+ void Wait() {
+ condition_variable_->Wait();
+ }
+
+ private:
+ base::Lock* lock_;
+ base::ConditionVariable* condition_variable_;
+ DISALLOW_COPY_AND_ASSIGN(Monitor);
+};
+
+class MonitorLocker {
+ public:
+ explicit MonitorLocker(Monitor* monitor) : monitor_(monitor) {
+ CHECK(monitor_);
+ monitor_->Enter();
+ }
+
+ virtual ~MonitorLocker();
+
+ void Wait() {
+ return monitor_->Wait();
+ }
+
+ void Notify() {
+ monitor_->Notify();
+ }
+
+ private:
+ Monitor* const monitor_;
+
+ DISALLOW_COPY_AND_ASSIGN(MonitorLocker);
+};
class DartDebuggerIsolate {
public:
@@ -77,7 +134,6 @@ class DartDebugger {
friend class DartDebuggerIsolate;
};
-} // namespace dart
-} // namespace mojo
+} // namespace tonic
-#endif // MOJO_DART_EMBEDDER_DART_DEBUGGER_H_
+#endif // TONIC_DART_DEBUGGER_H_
« no previous file with comments | « tonic/BUILD.gn ('k') | tonic/dart_debugger.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698