Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: third_party/WebKit/Source/core/layout/svg/SVGResources.cpp

Issue 2050123002: Remove OwnPtr from Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: First attempt to land. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 2 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 12 matching lines...) Expand all
23 #include "core/layout/svg/LayoutSVGResourceClipper.h" 23 #include "core/layout/svg/LayoutSVGResourceClipper.h"
24 #include "core/layout/svg/LayoutSVGResourceFilter.h" 24 #include "core/layout/svg/LayoutSVGResourceFilter.h"
25 #include "core/layout/svg/LayoutSVGResourceMarker.h" 25 #include "core/layout/svg/LayoutSVGResourceMarker.h"
26 #include "core/layout/svg/LayoutSVGResourceMasker.h" 26 #include "core/layout/svg/LayoutSVGResourceMasker.h"
27 #include "core/layout/svg/LayoutSVGResourcePaintServer.h" 27 #include "core/layout/svg/LayoutSVGResourcePaintServer.h"
28 #include "core/style/SVGComputedStyle.h" 28 #include "core/style/SVGComputedStyle.h"
29 #include "core/svg/SVGFilterElement.h" 29 #include "core/svg/SVGFilterElement.h"
30 #include "core/svg/SVGGradientElement.h" 30 #include "core/svg/SVGGradientElement.h"
31 #include "core/svg/SVGPatternElement.h" 31 #include "core/svg/SVGPatternElement.h"
32 #include "core/svg/SVGURIReference.h" 32 #include "core/svg/SVGURIReference.h"
33 #include "wtf/PtrUtil.h"
34 #include <memory>
33 35
34 #ifndef NDEBUG 36 #ifndef NDEBUG
35 #include <stdio.h> 37 #include <stdio.h>
36 #endif 38 #endif
37 39
38 namespace blink { 40 namespace blink {
39 41
40 using namespace SVGNames; 42 using namespace SVGNames;
41 43
42 SVGResources::SVGResources() 44 SVGResources::SVGResources()
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 } 190 }
189 191
190 bool SVGResources::hasResourceData() const 192 bool SVGResources::hasResourceData() const
191 { 193 {
192 return m_clipperFilterMaskerData 194 return m_clipperFilterMaskerData
193 || m_markerData 195 || m_markerData
194 || m_fillStrokeData 196 || m_fillStrokeData
195 || m_linkedResource; 197 || m_linkedResource;
196 } 198 }
197 199
198 static inline SVGResources& ensureResources(OwnPtr<SVGResources>& resources) 200 static inline SVGResources& ensureResources(std::unique_ptr<SVGResources>& resou rces)
199 { 201 {
200 if (!resources) 202 if (!resources)
201 resources = adoptPtr(new SVGResources); 203 resources = wrapUnique(new SVGResources);
202 204
203 return *resources.get(); 205 return *resources.get();
204 } 206 }
205 207
206 PassOwnPtr<SVGResources> SVGResources::buildResources(const LayoutObject* object , const SVGComputedStyle& style) 208 std::unique_ptr<SVGResources> SVGResources::buildResources(const LayoutObject* o bject, const SVGComputedStyle& style)
207 { 209 {
208 ASSERT(object); 210 ASSERT(object);
209 211
210 Node* node = object->node(); 212 Node* node = object->node();
211 ASSERT(node); 213 ASSERT(node);
212 ASSERT_WITH_SECURITY_IMPLICATION(node->isSVGElement()); 214 ASSERT_WITH_SECURITY_IMPLICATION(node->isSVGElement());
213 215
214 SVGElement* element = toSVGElement(node); 216 SVGElement* element = toSVGElement(node);
215 ASSERT(element); 217 ASSERT(element);
216 218
217 const AtomicString& tagName = element->localName(); 219 const AtomicString& tagName = element->localName();
218 ASSERT(!tagName.isNull()); 220 ASSERT(!tagName.isNull());
219 221
220 TreeScope& treeScope = element->treeScope(); 222 TreeScope& treeScope = element->treeScope();
221 SVGDocumentExtensions& extensions = element->document().accessSVGExtensions( ); 223 SVGDocumentExtensions& extensions = element->document().accessSVGExtensions( );
222 224
223 OwnPtr<SVGResources> resources; 225 std::unique_ptr<SVGResources> resources;
224 if (clipperFilterMaskerTags().contains(tagName)) { 226 if (clipperFilterMaskerTags().contains(tagName)) {
225 if (style.hasClipper()) { 227 if (style.hasClipper()) {
226 AtomicString id = style.clipperResource(); 228 AtomicString id = style.clipperResource();
227 if (!ensureResources(resources).setClipper(getLayoutSVGResourceById< LayoutSVGResourceClipper>(treeScope, id))) 229 if (!ensureResources(resources).setClipper(getLayoutSVGResourceById< LayoutSVGResourceClipper>(treeScope, id)))
228 registerPendingResource(extensions, id, element); 230 registerPendingResource(extensions, id, element);
229 } 231 }
230 232
231 if (style.hasFilter()) { 233 if (style.hasFilter()) {
232 AtomicString id = style.filterResource(); 234 AtomicString id = style.filterResource();
233 if (!ensureResources(resources).setFilter(getLayoutSVGResourceById<L ayoutSVGResourceFilter>(treeScope, id))) 235 if (!ensureResources(resources).setFilter(getLayoutSVGResourceById<L ayoutSVGResourceFilter>(treeScope, id)))
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 if (LayoutSVGResourcePaintServer* stroke = m_fillStrokeData->stroke) 666 if (LayoutSVGResourcePaintServer* stroke = m_fillStrokeData->stroke)
665 fprintf(stderr, " |-> Stroke : %p (node=%p)\n", stroke, stroke-> element()); 667 fprintf(stderr, " |-> Stroke : %p (node=%p)\n", stroke, stroke-> element());
666 } 668 }
667 669
668 if (m_linkedResource) 670 if (m_linkedResource)
669 fprintf(stderr, " |-> xlink:href : %p (node=%p)\n", m_linkedResource, m_ linkedResource->element()); 671 fprintf(stderr, " |-> xlink:href : %p (node=%p)\n", m_linkedResource, m_ linkedResource->element());
670 } 672 }
671 #endif 673 #endif
672 674
673 } // namespace blink 675 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698