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 15 matching lines...) Expand all Loading... |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #ifndef InterceptingCanvas_h | 31 #ifndef InterceptingCanvas_h |
32 #define InterceptingCanvas_h | 32 #define InterceptingCanvas_h |
33 | 33 |
34 #include "third_party/skia/include/core/SkCanvas.h" | 34 #include "third_party/skia/include/core/SkCanvas.h" |
35 #include "third_party/skia/include/core/SkPicture.h" | 35 #include "third_party/skia/include/core/SkPicture.h" |
| 36 #include "wtf/Allocator.h" |
36 #include "wtf/Assertions.h" | 37 #include "wtf/Assertions.h" |
37 #include "wtf/Noncopyable.h" | 38 #include "wtf/Noncopyable.h" |
38 | 39 |
39 namespace blink { | 40 namespace blink { |
40 | 41 |
41 class InterceptingCanvasBase : public SkCanvas { | 42 class InterceptingCanvasBase : public SkCanvas { |
42 WTF_MAKE_NONCOPYABLE(InterceptingCanvasBase); | 43 WTF_MAKE_NONCOPYABLE(InterceptingCanvasBase); |
43 public: | 44 public: |
44 template<typename DerivedCanvas> class CanvasInterceptorBase { | 45 template<typename DerivedCanvas> class CanvasInterceptorBase { |
| 46 STACK_ALLOCATED(); |
45 WTF_MAKE_NONCOPYABLE(CanvasInterceptorBase); | 47 WTF_MAKE_NONCOPYABLE(CanvasInterceptorBase); |
46 protected: | 48 protected: |
47 CanvasInterceptorBase(InterceptingCanvasBase* canvas) | 49 CanvasInterceptorBase(InterceptingCanvasBase* canvas) |
48 : m_canvas(canvas) | 50 : m_canvas(canvas) |
49 { | 51 { |
50 ++m_canvas->m_callNestingDepth; | 52 ++m_canvas->m_callNestingDepth; |
51 } | 53 } |
52 | 54 |
53 ~CanvasInterceptorBase() | 55 ~CanvasInterceptorBase() |
54 { | 56 { |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 void willRestore() override | 291 void willRestore() override |
290 { | 292 { |
291 Interceptor interceptor(this); | 293 Interceptor interceptor(this); |
292 this->SkCanvas::willRestore(); | 294 this->SkCanvas::willRestore(); |
293 } | 295 } |
294 }; | 296 }; |
295 | 297 |
296 } // namespace blink | 298 } // namespace blink |
297 | 299 |
298 #endif // InterceptingCanvas_h | 300 #endif // InterceptingCanvas_h |
OLD | NEW |