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

Issue 12213092: Rework Timer interface. (Closed)

Created:
7 years, 10 months ago by floitsch
Modified:
7 years, 10 months ago
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Rework Timer interface. Committed: https://code.google.com/p/dart/source/detail?r=18326

Patch Set 1 #

Patch Set 2 : Clarify behavior for negative durations. #

Patch Set 3 : Fix bad capturing. #

Patch Set 4 : More comments. #

Patch Set 5 : Use stopwatch. #

Total comments: 14

Patch Set 6 : Address comments. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+281 lines, -193 lines) Patch
M pkg/unittest/lib/unittest.dart View 1 2 3 2 chunks +5 lines, -5 lines 0 comments Download
M pkg/unittest/test/test_utils.dart View 1 2 3 3 chunks +6 lines, -6 lines 0 comments Download
M runtime/lib/timer_patch.dart View 1 2 3 4 5 1 chunk +20 lines, -3 lines 0 comments Download
M samples/chat/chat_server.dart View 1 2 3 4 5 1 chunk +1 line, -1 line 0 comments Download
M samples/chat/chat_server_lib.dart View 1 2 3 2 chunks +4 lines, -3 lines 0 comments Download
M sdk/lib/_internal/compiler/implementation/lib/async_patch.dart View 1 2 3 4 5 1 chunk +22 lines, -3 lines 0 comments Download
M sdk/lib/_internal/compiler/implementation/lib/isolate_helper.dart View 1 2 3 3 chunks +5 lines, -6 lines 0 comments Download
M sdk/lib/_internal/compiler/implementation/lib/mirrors_patch.dart View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M sdk/lib/async/async_error.dart View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M sdk/lib/async/future.dart View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M sdk/lib/async/future_impl.dart View 1 2 3 4 chunks +5 lines, -5 lines 0 comments Download
M sdk/lib/async/stream_impl.dart View 1 2 3 2 chunks +2 lines, -2 lines 0 comments Download
M sdk/lib/async/timer.dart View 1 2 3 4 5 1 chunk +43 lines, -6 lines 0 comments Download
M sdk/lib/io/chunked_stream.dart View 1 2 3 4 chunks +4 lines, -4 lines 0 comments Download
M sdk/lib/io/file_impl.dart View 1 2 3 11 chunks +11 lines, -11 lines 0 comments Download
M sdk/lib/io/http_impl.dart View 1 2 3 4 chunks +5 lines, -4 lines 0 comments Download
M sdk/lib/io/http_session.dart View 1 2 3 2 chunks +3 lines, -2 lines 0 comments Download
M sdk/lib/io/list_stream_impl.dart View 1 2 3 4 chunks +6 lines, -6 lines 0 comments Download
M sdk/lib/io/secure_socket.dart View 1 2 3 2 chunks +2 lines, -2 lines 0 comments Download
M sdk/lib/io/socket_stream_impl.dart View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M sdk/lib/io/stream_util.dart View 1 2 3 3 chunks +4 lines, -4 lines 0 comments Download
M sdk/lib/io/string_stream.dart View 1 2 3 5 chunks +6 lines, -6 lines 0 comments Download
M sdk/lib/io/websocket_impl.dart View 1 2 3 1 chunk +2 lines, -6 lines 0 comments Download
M tests/compiler/dart2js_extra/timer_negative_test.dart View 1 2 3 1 chunk +6 lines, -5 lines 0 comments Download
M tests/compiler/dart2js_extra/timer_test.dart View 1 2 3 1 chunk +6 lines, -5 lines 0 comments Download
M tests/html/dromaeo_smoke_test.dart View 1 2 3 1 chunk +2 lines, -1 line 0 comments Download
M tests/isolate/multiple_timer_test.dart View 1 2 3 4 2 chunks +28 lines, -28 lines 0 comments Download
M tests/isolate/timer_cancel1_test.dart View 1 2 3 1 chunk +6 lines, -4 lines 0 comments Download
M tests/isolate/timer_cancel2_test.dart View 1 2 3 1 chunk +2 lines, -1 line 0 comments Download
M tests/isolate/timer_cancel_test.dart View 1 2 3 2 chunks +9 lines, -8 lines 0 comments Download
M tests/isolate/timer_isolate_test.dart View 1 2 3 2 chunks +4 lines, -4 lines 0 comments Download
M tests/isolate/timer_not_available_test.dart View 1 2 3 1 chunk +3 lines, -2 lines 0 comments Download
M tests/isolate/timer_repeat_test.dart View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M tests/isolate/timer_test.dart View 1 2 3 2 chunks +5 lines, -3 lines 0 comments Download
M tests/language/closure_cycles_test.dart View 1 2 3 2 chunks +2 lines, -2 lines 0 comments Download
M tests/lib/async/future_test.dart View 1 2 3 7 chunks +8 lines, -5 lines 0 comments Download
M tests/lib/async/slow_consumer2_test.dart View 1 2 3 3 chunks +5 lines, -3 lines 0 comments Download
M tests/lib/async/slow_consumer3_test.dart View 1 2 3 1 chunk +2 lines, -1 line 0 comments Download
M tests/lib/async/slow_consumer_test.dart View 1 2 3 2 chunks +3 lines, -2 lines 0 comments Download
M tests/standalone/io/http_auth_test.dart View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M tests/standalone/io/http_connection_close_test.dart View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M tests/standalone/io/http_server_early_server_close_test.dart View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M tests/standalone/io/http_shutdown_test.dart View 1 2 3 2 chunks +2 lines, -2 lines 0 comments Download
M tests/standalone/io/list_output_stream_test.dart View 1 2 3 1 chunk +2 lines, -2 lines 0 comments Download
M tests/standalone/io/secure_session_resume_test.dart View 1 2 3 4 5 1 chunk +3 lines, -3 lines 0 comments Download
M tests/standalone/io/skipping_dart2js_compilations_test.dart View 1 2 3 2 chunks +2 lines, -2 lines 0 comments Download
M tests/standalone/io/socket_close_test.dart View 1 2 3 4 chunks +5 lines, -5 lines 0 comments Download
M tests/standalone/io/socket_stream_close_test.dart View 1 2 3 4 chunks +5 lines, -5 lines 0 comments Download
M tests/standalone/io/test_extension_fail_tester.dart View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M tests/standalone/io/test_runner_test.dart View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M utils/pub/io.dart View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M utils/pub/utils.dart View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M utils/testrunner/pipeline_utils.dart View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M utils/tests/pub/version_solver_test.dart View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M utils/tests/string_encoding/benchmark_runner.dart View 1 2 3 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 6 (0 generated)
floitsch
Once you ok the change I will add one of the VM devs.
7 years, 10 months ago (2013-02-08 20:02:57 UTC) #1
floitsch
Clarified behavior for negative durations.
7 years, 10 months ago (2013-02-08 21:35:25 UTC) #2
floitsch
Fixed all users of the Timer class. More comments.
7 years, 10 months ago (2013-02-08 23:30:35 UTC) #3
floitsch
minor change to test.
7 years, 10 months ago (2013-02-08 23:46:55 UTC) #4
Lasse Reichstein Nielsen
lgtm https://codereview.chromium.org/12213092/diff/12001/runtime/lib/timer_patch.dart File runtime/lib/timer_patch.dart (right): https://codereview.chromium.org/12213092/diff/12001/runtime/lib/timer_patch.dart#newcode12 runtime/lib/timer_patch.dart:12: if (callback is! _TimerCallback0 && callback is! _TimerCallback1) ...
7 years, 10 months ago (2013-02-11 13:01:21 UTC) #5
floitsch
7 years, 10 months ago (2013-02-11 19:21:32 UTC) #6
https://codereview.chromium.org/12213092/diff/12001/runtime/lib/timer_patch.dart
File runtime/lib/timer_patch.dart (right):

https://codereview.chromium.org/12213092/diff/12001/runtime/lib/timer_patch.d...
runtime/lib/timer_patch.dart:12: if (callback is! _TimerCallback0 && callback
is! _TimerCallback1) {
On 2013/02/11 13:01:21, Lasse Reichstein Nielsen wrote:
> Does this work in dart2js?

It should. I tested it for dart2js.

https://codereview.chromium.org/12213092/diff/12001/runtime/lib/timer_patch.d...
runtime/lib/timer_patch.dart:15: if (duration is! Duration && duration is! int)
{
On 2013/02/11 13:01:21, Lasse Reichstein Nielsen wrote:
> Don't check for Duration, just assume it if it isn't int.
> I.e., do just what you are doing below.

Done.

https://codereview.chromium.org/12213092/diff/12001/runtime/lib/timer_patch.d...
runtime/lib/timer_patch.dart:26: }
On 2013/02/11 13:01:21, Lasse Reichstein Nielsen wrote:
> Why is this code in a patch file? Everything except _TimerFactory is generic,
> and shouldn't need to be copied.
> 
> Can you abstract the creation of the timer alone, e.g., as a private external
> method?

Filed http://dartbug.com/8467

https://codereview.chromium.org/12213092/diff/12001/samples/chat/chat_server....
File samples/chat/chat_server.dart (right):

https://codereview.chromium.org/12213092/diff/12001/samples/chat/chat_server....
samples/chat/chat_server.dart:25: new Timer(const Duration(seconds: stopAfter),
serverMain.shutdown);
On 2013/02/11 13:01:21, Lasse Reichstein Nielsen wrote:
> This can't be const. Is this code tested?

strange. I will make sure to run all the tests.
done.

https://codereview.chromium.org/12213092/diff/12001/sdk/lib/_internal/compile...
File sdk/lib/_internal/compiler/implementation/lib/async_patch.dart (right):

https://codereview.chromium.org/12213092/diff/12001/sdk/lib/_internal/compile...
sdk/lib/_internal/compiler/implementation/lib/async_patch.dart:26: callback is
_TimerCallback0 ? callback : () => callback(timer);
On 2013/02/11 13:01:21, Lasse Reichstein Nielsen wrote:
> Per VM patch file: this is duplicated code. Try to abstract the things that
> changes only.

Same issue.

https://codereview.chromium.org/12213092/diff/12001/sdk/lib/async/timer.dart
File sdk/lib/async/timer.dart (right):

https://codereview.chromium.org/12213092/diff/12001/sdk/lib/async/timer.dart#...
sdk/lib/async/timer.dart:14: static Timer run(void callback()) {
On 2013/02/11 13:01:21, Lasse Reichstein Nielsen wrote:
> Static methods below constructors.

Done.

https://codereview.chromium.org/12213092/diff/12001/tests/standalone/io/secur...
File tests/standalone/io/secure_session_resume_test.dart (right):

https://codereview.chromium.org/12213092/diff/12001/tests/standalone/io/secur...
tests/standalone/io/secure_session_resume_test.dart:126: Duration delay = const
Duration();
On 2013/02/11 13:01:21, Lasse Reichstein Nielsen wrote:
> This should not be allowed. Rally. I assume it's zero, but it's NOT obvious.

We can't really avoid it.
made it clear.

Powered by Google App Engine
This is Rietveld 408576698