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

Side by Side Diff: tests/Test.cpp

Issue 1811613004: Change SkTime::GetMSecs to double; ensure values stored in SkMSec do not overflow. (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: Rebase. Created 4 years, 8 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 | « tests/Test.h ('k') | tests/skia_test.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "Test.h" 8 #include "Test.h"
9 9
10 #include "SkCommandLineFlags.h" 10 #include "SkCommandLineFlags.h"
(...skipping 18 matching lines...) Expand all
29 } 29 }
30 } 30 }
31 result.append(this->condition); 31 result.append(this->condition);
32 return result; 32 return result;
33 } 33 }
34 34
35 SkString skiatest::GetTmpDir() { 35 SkString skiatest::GetTmpDir() {
36 const char* tmpDir = FLAGS_tmpDir.isEmpty() ? nullptr : FLAGS_tmpDir[0]; 36 const char* tmpDir = FLAGS_tmpDir.isEmpty() ? nullptr : FLAGS_tmpDir[0];
37 return SkString(tmpDir); 37 return SkString(tmpDir);
38 } 38 }
39
40 skiatest::Timer::Timer() : fStartNanos(SkTime::GetNSecs()) {}
41
42 double skiatest::Timer::elapsedNs() const {
43 return SkTime::GetNSecs() - fStartNanos;
44 }
45
46 double skiatest::Timer::elapsedMs() const { return this->elapsedNs() * 1e-6; }
47
48 SkMSec skiatest::Timer::elapsedMsInt() const {
49 const double elapsedMs = this->elapsedMs();
50 SkASSERT(SK_MSecMax >= elapsedMs);
51 return static_cast<SkMSec>(elapsedMs);
52 }
OLDNEW
« no previous file with comments | « tests/Test.h ('k') | tests/skia_test.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698