OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "core/css/CSSPathValue.h" | 5 #include "core/css/CSSPathValue.h" |
6 | 6 |
7 #include "core/style/StylePath.h" | 7 #include "core/style/StylePath.h" |
8 #include "core/svg/SVGPathUtilities.h" | 8 #include "core/svg/SVGPathUtilities.h" |
9 | 9 |
10 namespace blink { | 10 namespace blink { |
(...skipping 15 matching lines...) Expand all Loading... |
26 , m_pathByteStream(pathByteStream) | 26 , m_pathByteStream(pathByteStream) |
27 , m_cachedPath(cachedPath) | 27 , m_cachedPath(cachedPath) |
28 { | 28 { |
29 ASSERT(m_pathByteStream); | 29 ASSERT(m_pathByteStream); |
30 } | 30 } |
31 | 31 |
32 CSSPathValue::~CSSPathValue() | 32 CSSPathValue::~CSSPathValue() |
33 { | 33 { |
34 } | 34 } |
35 | 35 |
| 36 namespace { |
| 37 |
| 38 PassRefPtrWillBeRawPtr<CSSPathValue> createPathValue() |
| 39 { |
| 40 RefPtr<SVGPathByteStream> pathByteStream = SVGPathByteStream::create(); |
| 41 // Need to be registered as LSan ignored, as it will be reachable and |
| 42 // separately referred to by emptyPathValue() callers. |
| 43 LEAK_SANITIZER_IGNORE_OBJECT(pathByteStream.get()); |
| 44 return CSSPathValue::create(pathByteStream.release()); |
| 45 } |
| 46 |
| 47 } |
| 48 |
36 CSSPathValue* CSSPathValue::emptyPathValue() | 49 CSSPathValue* CSSPathValue::emptyPathValue() |
37 { | 50 { |
38 DEFINE_STATIC_LOCAL(RefPtrWillBePersistent<CSSPathValue>, empty, (CSSPathVal
ue::create(SVGPathByteStream::create()))); | 51 DEFINE_STATIC_LOCAL(RefPtrWillBePersistent<CSSPathValue>, empty, (createPath
Value())); |
39 return empty.get(); | 52 return empty.get(); |
40 } | 53 } |
41 | 54 |
42 StylePath* CSSPathValue::cachedPath() | 55 StylePath* CSSPathValue::cachedPath() |
43 { | 56 { |
44 if (!m_cachedPath) | 57 if (!m_cachedPath) |
45 m_cachedPath = StylePath::create(m_pathByteStream); | 58 m_cachedPath = StylePath::create(m_pathByteStream); |
46 return m_cachedPath.get(); | 59 return m_cachedPath.get(); |
47 } | 60 } |
48 | 61 |
(...skipping 11 matching lines...) Expand all Loading... |
60 { | 73 { |
61 CSSValue::traceAfterDispatch(visitor); | 74 CSSValue::traceAfterDispatch(visitor); |
62 } | 75 } |
63 | 76 |
64 String CSSPathValue::pathString() const | 77 String CSSPathValue::pathString() const |
65 { | 78 { |
66 return buildStringFromByteStream(*m_pathByteStream); | 79 return buildStringFromByteStream(*m_pathByteStream); |
67 } | 80 } |
68 | 81 |
69 } // namespace blink | 82 } // namespace blink |
OLD | NEW |