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

Side by Side Diff: sky/engine/bindings2/builtin.dart

Issue 918333002: Add the c++ code part of bindings2/ (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Updated per earlier reviews Created 5 years, 10 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/bindings2/builtin.cc ('k') | sky/engine/bindings2/builtin_natives.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 library sky_builtin;
6
7 import "dart:async";
8
9 // Corelib 'print' implementation.
10 void _print(arg) {
11 _Logger._printString(arg.toString());
12 }
13
14 class _Logger {
15 static void _printString(String s) native "Logger_PrintString";
16 }
17
18 class _Timer implements Timer {
19 _Timer(int milliseconds,
20 void callback(Timer timer),
21 bool repeating) {
22 _id = _create(milliseconds, () {
23 if (!repeating)
24 _id = 0;
25 callback(this);
26 }, repeating);
27 }
28
29 void cancel() {
30 _cancel(_id);
31 _id = 0;
32 }
33
34 bool get isActive => _id != 0;
35
36 static int _create(int milliseconds,
37 void callback(),
38 bool repeating) native "Timer_create";
39 static void _cancel(int id) native "Timer_cancel";
40
41 int _id;
42 }
43
44 void _scheduleMicrotask(void callback()) native "ScheduleMicrotask";
45 Timer _createTimer(int milliseconds,
46 void callback(Timer timer),
47 bool repeating) {
48 return new _Timer(milliseconds, callback, repeating);
49 }
50
51 _getPrintClosure() => _print;
52 _getScheduleMicrotaskClosure() => _scheduleMicrotask;
53 _getCreateTimerClosure() => _createTimer;
OLDNEW
« no previous file with comments | « sky/engine/bindings2/builtin.cc ('k') | sky/engine/bindings2/builtin_natives.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698