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

Side by Side Diff: skia/ext/benchmarking_canvas.cc

Issue 864943002: Replaces instances of the deprecated TimeTicks::HighResNow() with TimeTicks::Now(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More changes based on review comments. Created 5 years, 11 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 | « net/base/bandwidth_metrics.h ('k') | tools/gn/trace.cc » ('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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/containers/hash_tables.h" 5 #include "base/containers/hash_tables.h"
6 #include "base/logging.h" 6 #include "base/logging.h"
7 #include "base/time/time.h" 7 #include "base/time/time.h"
8 #include "skia/ext/benchmarking_canvas.h" 8 #include "skia/ext/benchmarking_canvas.h"
9 #include "third_party/skia/include/core/SkSurface.h" 9 #include "third_party/skia/include/core/SkSurface.h"
10 #include "third_party/skia/include/utils/SkProxyCanvas.h" 10 #include "third_party/skia/include/utils/SkProxyCanvas.h"
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 TimingsMap timings_map_; 203 TimingsMap timings_map_;
204 204
205 skia::RefPtr<SkSurface> surface_; 205 skia::RefPtr<SkSurface> surface_;
206 206
207 friend class AutoStamper; 207 friend class AutoStamper;
208 const BenchmarkingCanvas* tracking_canvas_; 208 const BenchmarkingCanvas* tracking_canvas_;
209 }; 209 };
210 210
211 AutoStamper::AutoStamper(TimingCanvas *timing_canvas) 211 AutoStamper::AutoStamper(TimingCanvas *timing_canvas)
212 : timing_canvas_(timing_canvas) { 212 : timing_canvas_(timing_canvas) {
213 start_ticks_ = base::TimeTicks::HighResNow(); 213 start_ticks_ = base::TimeTicks::Now();
214 } 214 }
215 215
216 AutoStamper::~AutoStamper() { 216 AutoStamper::~AutoStamper() {
217 base::TimeDelta delta = base::TimeTicks::HighResNow() - start_ticks_; 217 base::TimeDelta delta = base::TimeTicks::Now() - start_ticks_;
218 int command_index = timing_canvas_->tracking_canvas_->CommandCount() - 1; 218 int command_index = timing_canvas_->tracking_canvas_->CommandCount() - 1;
219 DCHECK_GE(command_index, 0); 219 DCHECK_GE(command_index, 0);
220 timing_canvas_->timings_map_[command_index] = delta; 220 timing_canvas_->timings_map_[command_index] = delta;
221 } 221 }
222 222
223 BenchmarkingCanvas::BenchmarkingCanvas(int width, int height) 223 BenchmarkingCanvas::BenchmarkingCanvas(int width, int height)
224 : SkNWayCanvas(width, height) { 224 : SkNWayCanvas(width, height) {
225 debug_canvas_ = skia::AdoptRef(SkNEW_ARGS(SkDebugCanvas, (width, height))); 225 debug_canvas_ = skia::AdoptRef(SkNEW_ARGS(SkDebugCanvas, (width, height)));
226 timing_canvas_ = skia::AdoptRef(SkNEW_ARGS(TimingCanvas, (width, height, this) )); 226 timing_canvas_ = skia::AdoptRef(SkNEW_ARGS(TimingCanvas, (width, height, this) ));
227 227
(...skipping 13 matching lines...) Expand all
241 DCHECK_LT(index, static_cast<size_t>(debug_canvas_->getSize())); 241 DCHECK_LT(index, static_cast<size_t>(debug_canvas_->getSize()));
242 return debug_canvas_->getDrawCommandAt(index); 242 return debug_canvas_->getDrawCommandAt(index);
243 } 243 }
244 244
245 double BenchmarkingCanvas::GetTime(size_t index) { 245 double BenchmarkingCanvas::GetTime(size_t index) {
246 DCHECK_LT(index, static_cast<size_t>(debug_canvas_->getSize())); 246 DCHECK_LT(index, static_cast<size_t>(debug_canvas_->getSize()));
247 return timing_canvas_->GetTime(index); 247 return timing_canvas_->GetTime(index);
248 } 248 }
249 249
250 } // namespace skia 250 } // namespace skia
OLDNEW
« no previous file with comments | « net/base/bandwidth_metrics.h ('k') | tools/gn/trace.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698