OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 26 matching lines...) Expand all Loading... |
37 CanvasInterceptor<ProfilingCanvas>::CanvasInterceptor( | 37 CanvasInterceptor<ProfilingCanvas>::CanvasInterceptor( |
38 InterceptingCanvasBase* canvas) | 38 InterceptingCanvasBase* canvas) |
39 : CanvasInterceptorBase(canvas), | 39 : CanvasInterceptorBase(canvas), |
40 start_time_(WTF::MonotonicallyIncreasingTime()) {} | 40 start_time_(WTF::MonotonicallyIncreasingTime()) {} |
41 | 41 |
42 CanvasInterceptor<ProfilingCanvas>::~CanvasInterceptor() { | 42 CanvasInterceptor<ProfilingCanvas>::~CanvasInterceptor() { |
43 if (!TopLevelCall()) | 43 if (!TopLevelCall()) |
44 return; | 44 return; |
45 double delta = WTF::MonotonicallyIncreasingTime() - start_time_; | 45 double delta = WTF::MonotonicallyIncreasingTime() - start_time_; |
46 if (auto timings = Canvas()->timings_) { | 46 if (auto timings = Canvas()->timings_) { |
47 ASSERT(timings->size() == Canvas()->CallCount()); | 47 DCHECK_EQ(timings->size(), Canvas()->CallCount()); |
48 timings->push_back(delta); | 48 timings->push_back(delta); |
49 } | 49 } |
50 } | 50 } |
51 | 51 |
52 ProfilingCanvas::ProfilingCanvas(SkBitmap bitmap) | 52 ProfilingCanvas::ProfilingCanvas(SkBitmap bitmap) |
53 : InterceptingCanvas(bitmap), timings_(nullptr) {} | 53 : InterceptingCanvas(bitmap), timings_(nullptr) {} |
54 | 54 |
55 void ProfilingCanvas::SetTimings(Vector<double>* timings) { | 55 void ProfilingCanvas::SetTimings(Vector<double>* timings) { |
56 timings_ = timings; | 56 timings_ = timings; |
57 } | 57 } |
58 | 58 |
59 } // namespace blink | 59 } // namespace blink |
OLD | NEW |