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

Side by Side Diff: pkg/compiler/lib/src/common/tasks.dart

Issue 2963743002: Revert "Make Zone API strong mode clean." (Closed)
Patch Set: Created 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | sdk/lib/async/future.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library dart2js.common.tasks; 5 library dart2js.common.tasks;
6 6
7 import 'dart:async' 7 import 'dart:async'
8 show Future, Zone, ZoneDelegate, ZoneSpecification, runZoned; 8 show Future, Zone, ZoneDelegate, ZoneSpecification, runZoned;
9 9
10 /// Used to measure where time is spent in the compiler. 10 /// Used to measure where time is spent in the compiler.
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 run: _run, runUnary: _runUnary, runBinary: _runBinary)); 108 run: _run, runUnary: _runUnary, runBinary: _runBinary));
109 } 109 }
110 110
111 /// Run [f] in [zone]. Running must be delegated to [parent] to ensure that 111 /// Run [f] in [zone]. Running must be delegated to [parent] to ensure that
112 /// various state is set up correctly (in particular that `Zone.current` 112 /// various state is set up correctly (in particular that `Zone.current`
113 /// has the right value). Since [_measureZoned] can be called recursively 113 /// has the right value). Since [_measureZoned] can be called recursively
114 /// (synchronously), some of the measuring zones we create will be parents 114 /// (synchronously), some of the measuring zones we create will be parents
115 /// of other measuring zones, but we still need to call through the parent 115 /// of other measuring zones, but we still need to call through the parent
116 /// chain. Consequently, we use a zone value keyed by [measurer] to see if 116 /// chain. Consequently, we use a zone value keyed by [measurer] to see if
117 /// we should measure or not when delegating. 117 /// we should measure or not when delegating.
118 R _run<R>(Zone self, ZoneDelegate parent, Zone zone, R f()) { 118 _run(Zone self, ZoneDelegate parent, Zone zone, f()) {
119 if (zone[measurer] != this) return parent.run(zone, f); 119 if (zone[measurer] != this) return parent.run(zone, f);
120 CompilerTask previous = _start(); 120 CompilerTask previous = _start();
121 try { 121 try {
122 return parent.run(zone, f); 122 return parent.run(zone, f);
123 } finally { 123 } finally {
124 _stop(previous); 124 _stop(previous);
125 } 125 }
126 } 126 }
127 127
128 /// Same as [run] except that [f] takes one argument, [arg]. 128 /// Same as [run] except that [f] takes one argument, [arg].
129 R _runUnary<R, T>( 129 _runUnary(Zone self, ZoneDelegate parent, Zone zone, f(arg), arg) {
130 Zone self, ZoneDelegate parent, Zone zone, R f(T arg), T arg) {
131 if (zone[measurer] != this) return parent.runUnary(zone, f, arg); 130 if (zone[measurer] != this) return parent.runUnary(zone, f, arg);
132 CompilerTask previous = _start(); 131 CompilerTask previous = _start();
133 try { 132 try {
134 return parent.runUnary(zone, f, arg); 133 return parent.runUnary(zone, f, arg);
135 } finally { 134 } finally {
136 _stop(previous); 135 _stop(previous);
137 } 136 }
138 } 137 }
139 138
140 /// Same as [run] except that [f] takes two arguments ([a1] and [a2]). 139 /// Same as [run] except that [f] takes two arguments ([a1] and [a2]).
141 R _runBinary<R, T1, T2>(Zone self, ZoneDelegate parent, Zone zone, 140 _runBinary(Zone self, ZoneDelegate parent, Zone zone, f(a1, a2), a1, a2) {
142 R f(T1 a1, T2 a2), T1 a1, T2 a2) {
143 if (zone[measurer] != this) return parent.runBinary(zone, f, a1, a2); 141 if (zone[measurer] != this) return parent.runBinary(zone, f, a1, a2);
144 CompilerTask previous = _start(); 142 CompilerTask previous = _start();
145 try { 143 try {
146 return parent.runBinary(zone, f, a1, a2); 144 return parent.runBinary(zone, f, a1, a2);
147 } finally { 145 } finally {
148 _stop(previous); 146 _stop(previous);
149 } 147 }
150 } 148 }
151 149
152 /// Asynchronous version of [measure]. Use this when action returns a future 150 /// Asynchronous version of [measure]. Use this when action returns a future
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 } 240 }
243 241
244 /// Call this when the eventloop returns control to us. 242 /// Call this when the eventloop returns control to us.
245 void stopAsyncWallClock() { 243 void stopAsyncWallClock() {
246 if (currentAsyncTask != null) { 244 if (currentAsyncTask != null) {
247 currentAsyncTask._watch.stop(); 245 currentAsyncTask._watch.stop();
248 } 246 }
249 asyncWallClock.stop(); 247 asyncWallClock.stop();
250 } 248 }
251 } 249 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/async/future.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698