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

Unified Diff: mojo/public/platform/dart/dart_handle_watcher.cc

Issue 1519213004: Roll Dart forward. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Fix comment Created 5 years 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 | « mojo/dart/packages/mojo/sdk_ext/src/natives.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/platform/dart/dart_handle_watcher.cc
diff --git a/mojo/public/platform/dart/dart_handle_watcher.cc b/mojo/public/platform/dart/dart_handle_watcher.cc
index 772f292ea9015144c6a99f6b35dcfe62e10e0520..b9217f2f30a39548bcc08120362da2b1e4749262 100644
--- a/mojo/public/platform/dart/dart_handle_watcher.cc
+++ b/mojo/public/platform/dart/dart_handle_watcher.cc
@@ -39,10 +39,7 @@ static void PostSignal(Dart_Port port, int32_t signalled) {
if (port == ILLEGAL_PORT) {
return;
}
- Dart_CObject message;
- message.type = Dart_CObject_kInt32;
- message.value.as_int32 = signalled;
- Dart_PostCObject(port, &message);
+ Dart_PostInteger(port, signalled);
}
// The internal state of the handle watcher thread.
@@ -306,16 +303,11 @@ void HandleWatcherThreadState::ProcessControlMessage() {
}
}
-// Dart's DateTime class calls gettimeofday to get the time.
-// TODO(johnmccutchan): Expose an API in |dart_api.h| that returns the same
-// value that DateTime uses.
+// Dart's Timer class uses MojoCoreNatives.timerMillisecondClock(), which
+// calls MojoGetTimeTicksNow() and divides by 1000;
static int64_t GetDartTimeInMillis() {
- struct timeval tv;
- if (gettimeofday(&tv, nullptr) < 0) {
- MOJO_CHECK(false);
- return 0;
- }
- return ((static_cast<int64_t>(tv.tv_sec) * 1000000) + tv.tv_usec) / 1000;
+ MojoTimeTicks ticks = MojoGetTimeTicksNow();
+ return static_cast<int64_t>(ticks) / 1000;
}
void HandleWatcherThreadState::ProcessTimers() {
« no previous file with comments | « mojo/dart/packages/mojo/sdk_ext/src/natives.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698