| 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 { |
| 11 | 11 |
| 12 PassRefPtrWillBeRawPtr<CSSPathValue> CSSPathValue::create(PassRefPtr<SVGPathByte
Stream> pathByteStream, StylePath* cachedPath) | 12 RawPtr<CSSPathValue> CSSPathValue::create(PassRefPtr<SVGPathByteStream> pathByte
Stream, StylePath* cachedPath) |
| 13 { | 13 { |
| 14 return adoptRefWillBeNoop(new CSSPathValue(pathByteStream, cachedPath)); | 14 return (new CSSPathValue(pathByteStream, cachedPath)); |
| 15 } | 15 } |
| 16 | 16 |
| 17 PassRefPtrWillBeRawPtr<CSSPathValue> CSSPathValue::create(const String& pathStri
ng) | 17 RawPtr<CSSPathValue> CSSPathValue::create(const String& pathString) |
| 18 { | 18 { |
| 19 RefPtr<SVGPathByteStream> byteStream = SVGPathByteStream::create(); | 19 RefPtr<SVGPathByteStream> byteStream = SVGPathByteStream::create(); |
| 20 buildByteStreamFromString(pathString, *byteStream); | 20 buildByteStreamFromString(pathString, *byteStream); |
| 21 return CSSPathValue::create(byteStream.release()); | 21 return CSSPathValue::create(byteStream.release()); |
| 22 } | 22 } |
| 23 | 23 |
| 24 CSSPathValue::CSSPathValue(PassRefPtr<SVGPathByteStream> pathByteStream, StylePa
th* cachedPath) | 24 CSSPathValue::CSSPathValue(PassRefPtr<SVGPathByteStream> pathByteStream, StylePa
th* cachedPath) |
| 25 : CSSValue(PathClass) | 25 : CSSValue(PathClass) |
| 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 { | 36 namespace { |
| 37 | 37 |
| 38 PassRefPtrWillBeRawPtr<CSSPathValue> createPathValue() | 38 RawPtr<CSSPathValue> createPathValue() |
| 39 { | 39 { |
| 40 RefPtr<SVGPathByteStream> pathByteStream = SVGPathByteStream::create(); | 40 RefPtr<SVGPathByteStream> pathByteStream = SVGPathByteStream::create(); |
| 41 // Need to be registered as LSan ignored, as it will be reachable and | 41 // Need to be registered as LSan ignored, as it will be reachable and |
| 42 // separately referred to by emptyPathValue() callers. | 42 // separately referred to by emptyPathValue() callers. |
| 43 LEAK_SANITIZER_IGNORE_OBJECT(pathByteStream.get()); | 43 LEAK_SANITIZER_IGNORE_OBJECT(pathByteStream.get()); |
| 44 return CSSPathValue::create(pathByteStream.release()); | 44 return CSSPathValue::create(pathByteStream.release()); |
| 45 } | 45 } |
| 46 | 46 |
| 47 } // namespace | 47 } // namespace |
| 48 | 48 |
| 49 CSSPathValue* CSSPathValue::emptyPathValue() | 49 CSSPathValue* CSSPathValue::emptyPathValue() |
| 50 { | 50 { |
| 51 DEFINE_STATIC_LOCAL(RefPtrWillBePersistent<CSSPathValue>, empty, (createPath
Value())); | 51 DEFINE_STATIC_LOCAL(Persistent<CSSPathValue>, empty, (createPathValue())); |
| 52 return empty.get(); | 52 return empty.get(); |
| 53 } | 53 } |
| 54 | 54 |
| 55 StylePath* CSSPathValue::cachedPath() const | 55 StylePath* CSSPathValue::cachedPath() const |
| 56 { | 56 { |
| 57 if (!m_cachedPath) | 57 if (!m_cachedPath) |
| 58 m_cachedPath = StylePath::create(m_pathByteStream); | 58 m_cachedPath = StylePath::create(m_pathByteStream); |
| 59 return m_cachedPath.get(); | 59 return m_cachedPath.get(); |
| 60 } | 60 } |
| 61 | 61 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 73 { | 73 { |
| 74 CSSValue::traceAfterDispatch(visitor); | 74 CSSValue::traceAfterDispatch(visitor); |
| 75 } | 75 } |
| 76 | 76 |
| 77 String CSSPathValue::pathString() const | 77 String CSSPathValue::pathString() const |
| 78 { | 78 { |
| 79 return buildStringFromByteStream(*m_pathByteStream); | 79 return buildStringFromByteStream(*m_pathByteStream); |
| 80 } | 80 } |
| 81 | 81 |
| 82 } // namespace blink | 82 } // namespace blink |
| OLD | NEW |