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

Side by Side Diff: lib/html/src/Measurement.dart

Issue 11184007: Support new named arguments. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 2 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 | Annotate | Revision Log
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 typedef Object ComputeValue(); 5 typedef Object ComputeValue();
6 6
7 class _MeasurementRequest<T> { 7 class _MeasurementRequest<T> {
8 final ComputeValue computeValue; 8 final ComputeValue computeValue;
9 final Completer<T> completer; 9 final Completer<T> completer;
10 Object value; 10 Object value;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 */ 92 */
93 class _MutationObserverScheduler extends _MeasurementScheduler { 93 class _MutationObserverScheduler extends _MeasurementScheduler {
94 MutationObserver _observer; 94 MutationObserver _observer;
95 Element _dummy; 95 Element _dummy;
96 96
97 _MutationObserverScheduler(_MeasurementCallback callback): super(callback) { 97 _MutationObserverScheduler(_MeasurementCallback callback): super(callback) {
98 // Mutation events get fired as soon as the current event stack is unwound 98 // Mutation events get fired as soon as the current event stack is unwound
99 // so we just make a dummy event and listen for that. 99 // so we just make a dummy event and listen for that.
100 _observer = new MutationObserver(this._handleMutation); 100 _observer = new MutationObserver(this._handleMutation);
101 _dummy = new DivElement(); 101 _dummy = new DivElement();
102 _observer.observe(_dummy, {}, attributes: true); 102 // OPTIONALS _observer.observe(_dummy, attributes: true);
103 _observer.observe(_dummy, {}, null, true);
103 } 104 }
104 105
105 void _schedule() { 106 void _schedule() {
106 // Toggle it to trigger the mutation event. 107 // Toggle it to trigger the mutation event.
107 _dummy.hidden = !_dummy.hidden; 108 _dummy.hidden = !_dummy.hidden;
108 } 109 }
109 110
110 _handleMutation(List<MutationRecord> mutations, MutationObserver observer) { 111 _handleMutation(List<MutationRecord> mutations, MutationObserver observer) {
111 this._onCallback(); 112 this._onCallback();
112 } 113 }
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 } 191 }
191 } 192 }
192 193
193 if (readyMeasurementFrameCallbacks !== null) { 194 if (readyMeasurementFrameCallbacks !== null) {
194 for (TimeoutHandler handler in readyMeasurementFrameCallbacks) { 195 for (TimeoutHandler handler in readyMeasurementFrameCallbacks) {
195 // TODO(jacobr): wrap each call to a handler in a try-catch block. 196 // TODO(jacobr): wrap each call to a handler in a try-catch block.
196 handler(); 197 handler();
197 } 198 }
198 } 199 }
199 } 200 }
OLDNEW
« no previous file with comments | « no previous file | tests/html/async_window_test.dart » ('j') | tests/html/canvas_pixel_array_type_alias_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698