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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 class CanvasInterceptorBase { | 47 class CanvasInterceptorBase { |
48 STACK_ALLOCATED(); | 48 STACK_ALLOCATED(); |
49 WTF_MAKE_NONCOPYABLE(CanvasInterceptorBase); | 49 WTF_MAKE_NONCOPYABLE(CanvasInterceptorBase); |
50 | 50 |
51 protected: | 51 protected: |
52 CanvasInterceptorBase(InterceptingCanvasBase* canvas) : m_canvas(canvas) { | 52 CanvasInterceptorBase(InterceptingCanvasBase* canvas) : m_canvas(canvas) { |
53 ++m_canvas->m_callNestingDepth; | 53 ++m_canvas->m_callNestingDepth; |
54 } | 54 } |
55 | 55 |
56 ~CanvasInterceptorBase() { | 56 ~CanvasInterceptorBase() { |
57 ASSERT(m_canvas->m_callNestingDepth > 0); | 57 DCHECK_GT(m_canvas->m_callNestingDepth, 0u); |
58 if (!--m_canvas->m_callNestingDepth) | 58 if (!--m_canvas->m_callNestingDepth) |
59 m_canvas->m_callCount++; | 59 m_canvas->m_callCount++; |
60 } | 60 } |
61 | 61 |
62 DerivedCanvas* canvas() { return static_cast<DerivedCanvas*>(m_canvas); } | 62 DerivedCanvas* canvas() { return static_cast<DerivedCanvas*>(m_canvas); } |
63 bool topLevelCall() const { return m_canvas->callNestingDepth() == 1; } | 63 bool topLevelCall() const { return m_canvas->callNestingDepth() == 1; } |
64 InterceptingCanvasBase* m_canvas; | 64 InterceptingCanvasBase* m_canvas; |
65 }; | 65 }; |
66 | 66 |
67 void resetStepCount() { m_callCount = 0; } | 67 void resetStepCount() { m_callCount = 0; } |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 | 358 |
359 void willRestore() override { | 359 void willRestore() override { |
360 Interceptor interceptor(this); | 360 Interceptor interceptor(this); |
361 this->SkCanvas::willRestore(); | 361 this->SkCanvas::willRestore(); |
362 } | 362 } |
363 }; | 363 }; |
364 | 364 |
365 } // namespace blink | 365 } // namespace blink |
366 | 366 |
367 #endif // InterceptingCanvas_h | 367 #endif // InterceptingCanvas_h |
OLD | NEW |