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

Issue 2485063003: Make `Stopwatch` logic simpler. (Closed)

Created:
4 years, 1 month ago by Lasse Reichstein Nielsen
Modified:
4 years, 1 month ago
Reviewers:
floitsch
CC:
reviews_dartlang.org
Target Ref:
refs/heads/master
Visibility:
Public.

Description

Make `Stopwatch` logic simpler. The `Stopwatch` class had more states than necessary because it started with the `_start` and `_stop` fields being `null`, a state that couldn't happen later, and it had to handle those cases specially. Now just starts in a state equivalent to a stopped, reset timer. Also use ?? and ??= because they are there,and don't call the overridable `isRunning` from other methods. R=floitsch@google.com Committed: https://github.com/dart-lang/sdk/commit/c3bb3ddb4184d8bd707a6752741c549c17f9c55e

Patch Set 1 #

Patch Set 2 : Rearrange declarations. #

Total comments: 13
Unified diffs Side-by-side diffs Delta from patch set Stats (+22 lines, -39 lines) Patch
M sdk/lib/core/stopwatch.dart View 1 6 chunks +22 lines, -39 lines 13 comments Download

Messages

Total messages: 10 (4 generated)
Lasse Reichstein Nielsen
I looked at the class for another reason and thought it looked too complicated.
4 years, 1 month ago (2016-11-08 14:23:49 UTC) #2
Lasse Reichstein Nielsen
Would it make sense to add a method that stops *and* resets at the same ...
4 years, 1 month ago (2016-11-09 11:35:10 UTC) #4
Lasse Reichstein Nielsen
https://codereview.chromium.org/2485063003/diff/20001/sdk/lib/core/stopwatch.dart File sdk/lib/core/stopwatch.dart (right): https://codereview.chromium.org/2485063003/diff/20001/sdk/lib/core/stopwatch.dart#newcode14 sdk/lib/core/stopwatch.dart:14: static int _frequency; Moved field to here, getter below ...
4 years, 1 month ago (2016-11-09 13:29:08 UTC) #6
floitsch
LGTM. https://codereview.chromium.org/2485063003/diff/20001/sdk/lib/core/stopwatch.dart File sdk/lib/core/stopwatch.dart (right): https://codereview.chromium.org/2485063003/diff/20001/sdk/lib/core/stopwatch.dart#newcode14 sdk/lib/core/stopwatch.dart:14: static int _frequency; On 2016/11/09 13:29:08, Lasse Reichstein ...
4 years, 1 month ago (2016-11-10 16:31:57 UTC) #7
Lasse Reichstein Nielsen
https://codereview.chromium.org/2485063003/diff/20001/sdk/lib/core/stopwatch.dart File sdk/lib/core/stopwatch.dart (right): https://codereview.chromium.org/2485063003/diff/20001/sdk/lib/core/stopwatch.dart#newcode27 sdk/lib/core/stopwatch.dart:27: * ```dart On 2016/11/10 16:31:57, floitsch wrote: > No ...
4 years, 1 month ago (2016-11-11 09:00:55 UTC) #8
Lasse Reichstein Nielsen
4 years, 1 month ago (2016-11-11 09:01:42 UTC) #10
Message was sent while issue was closed.
Committed patchset #2 (id:20001) manually as
c3bb3ddb4184d8bd707a6752741c549c17f9c55e (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698