Roll Dart forward.
- Embedder provides the timer function.
- Performance boost (10 - 20%) in IPC RTT benchmark from using new
isolate messaging natives in the handle watcher.
R=johnmccutchan@google.com
Review URL: https://codereview.chromium.org/1519213004 .
diff --git a/DEPS b/DEPS
index 1485066..56870ab 100644
--- a/DEPS
+++ b/DEPS
@@ -23,7 +23,7 @@
'v8_revision': '3f036fc0ba4ca4483fe77822f8605c277d37ee24',
'angle_revision': 'bdd419f9f5b006e913606e7363125942c8ae06bc',
'buildtools_revision': 'ef7f1f539cff0441c4401d8c052e54cfd01bff07',
- 'dart_revision': 'eab11aaac5add1b4146cfef32ac4f15054b352b4',
+ 'dart_revision': 'ad0e9622e9211c9593f5e51789fa6ff3c9c43e3a',
'dart_root_certificates_revision': 'c3a41df63afacec62fcb8135196177e35fe72f71',
'dart_observatory_packages_revision': '5c199c5954146747f75ed127871207718dc87786',
'pdfium_revision': 'ae4256f45df69bbfdf722a6ec17e1e851911ae4e',
diff --git a/mojo/dart/embedder/builtin.dart b/mojo/dart/embedder/builtin.dart
index 2ad9c15..59d0e39 100644
--- a/mojo/dart/embedder/builtin.dart
+++ b/mojo/dart/embedder/builtin.dart
@@ -37,6 +37,7 @@
_setupHooks() {
VMLibraryHooks.eventHandlerSendData = MojoHandleWatcher.timer;
+ VMLibraryHooks.timerMillisecondClock = MojoCoreNatives.timerMillisecondClock;
}
String _rawCwd;
diff --git a/mojo/dart/packages/mojo/sdk_ext/src/natives.dart b/mojo/dart/packages/mojo/sdk_ext/src/natives.dart
index 442b342..2171c8f 100644
--- a/mojo/dart/packages/mojo/sdk_ext/src/natives.dart
+++ b/mojo/dart/packages/mojo/sdk_ext/src/natives.dart
@@ -13,6 +13,7 @@
class MojoCoreNatives {
static int getTimeTicksNow() native "Mojo_GetTimeTicksNow";
+ static int timerMillisecondClock() => getTimeTicksNow() ~/ 1000;
}
class MojoHandleNatives {
diff --git a/mojo/public/platform/dart/dart_handle_watcher.cc b/mojo/public/platform/dart/dart_handle_watcher.cc
index 772f292..b9217f2 100644
--- a/mojo/public/platform/dart/dart_handle_watcher.cc
+++ b/mojo/public/platform/dart/dart_handle_watcher.cc
@@ -39,10 +39,7 @@
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 @@
}
}
-// 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() {