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

Side by Side Diff: third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.cpp.tmpl

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 {% from "macros.tmpl" import license %} 1 {% from "macros.tmpl" import license %}
2 {{ license() }} 2 {{ license() }}
3 3
4 #include "{{namespace}}Names.h" 4 #include "{{namespace}}Names.h"
5 5
6 #include "wtf/PtrUtil.h"
6 #include "wtf/StaticConstructors.h" 7 #include "wtf/StaticConstructors.h"
7 #include "wtf/StdLibExtras.h" 8 #include "wtf/StdLibExtras.h"
9 #include <memory>
8 10
9 namespace blink { 11 namespace blink {
10 namespace {{namespace}}Names { 12 namespace {{namespace}}Names {
11 13
12 using namespace blink; 14 using namespace blink;
13 15
14 DEFINE_GLOBAL(AtomicString, {{namespace_prefix}}NamespaceURI) 16 DEFINE_GLOBAL(AtomicString, {{namespace_prefix}}NamespaceURI)
15 17
16 {% if tags %} 18 {% if tags %}
17 // Tags 19 // Tags
18 20
19 void* {{suffix}}TagStorage[{{namespace}}TagsCount * ((sizeof({{namespace}}Qualif iedName) + sizeof(void *) - 1) / sizeof(void *))]; 21 void* {{suffix}}TagStorage[{{namespace}}TagsCount * ((sizeof({{namespace}}Qualif iedName) + sizeof(void *) - 1) / sizeof(void *))];
20 {% for tag in tags|sort(attribute='name', case_sensitive=True) %} 22 {% for tag in tags|sort(attribute='name', case_sensitive=True) %}
21 const {{namespace}}QualifiedName& {{tag|symbol}}Tag = reinterpret_cast<{{namespa ce}}QualifiedName*>(&{{suffix}}TagStorage)[{{loop.index0}}]; 23 const {{namespace}}QualifiedName& {{tag|symbol}}Tag = reinterpret_cast<{{namespa ce}}QualifiedName*>(&{{suffix}}TagStorage)[{{loop.index0}}];
22 {% endfor %} 24 {% endfor %}
23 25
24 26
25 PassOwnPtr<const {{namespace}}QualifiedName*[]> get{{namespace}}Tags() 27 std::unique_ptr<const {{namespace}}QualifiedName*[]> get{{namespace}}Tags()
26 { 28 {
27 OwnPtr<const {{namespace}}QualifiedName*[]> tags = adoptArrayPtr(new const { {namespace}}QualifiedName*[{{namespace}}TagsCount]); 29 std::unique_ptr<const {{namespace}}QualifiedName*[]> tags = wrapArrayUnique( new const {{namespace}}QualifiedName*[{{namespace}}TagsCount]);
28 for (size_t i = 0; i < {{namespace}}TagsCount; i++) 30 for (size_t i = 0; i < {{namespace}}TagsCount; i++)
29 tags[i] = reinterpret_cast<{{namespace}}QualifiedName*>(&{{suffix}}TagSt orage) + i; 31 tags[i] = reinterpret_cast<{{namespace}}QualifiedName*>(&{{suffix}}TagSt orage) + i;
30 return tags; 32 return tags;
31 } 33 }
32 34
33 {% endif %} 35 {% endif %}
34 // Attributes 36 // Attributes
35 37
36 void* {{suffix}}AttrStorage[{{namespace}}AttrsCount * ((sizeof(QualifiedName) + sizeof(void *) - 1) / sizeof(void *))]; 38 void* {{suffix}}AttrStorage[{{namespace}}AttrsCount * ((sizeof(QualifiedName) + sizeof(void *) - 1) / sizeof(void *))];
37 39
38 {% for attr in attrs|sort(attribute='name', case_sensitive=True) %} 40 {% for attr in attrs|sort(attribute='name', case_sensitive=True) %}
39 const QualifiedName& {{attr|symbol}}Attr = reinterpret_cast<QualifiedName*>(&{{s uffix}}AttrStorage)[{{loop.index0}}]; 41 const QualifiedName& {{attr|symbol}}Attr = reinterpret_cast<QualifiedName*>(&{{s uffix}}AttrStorage)[{{loop.index0}}];
40 {% endfor %} 42 {% endfor %}
41 43
42 {% if namespace != 'HTML' %} 44 {% if namespace != 'HTML' %}
43 PassOwnPtr<const QualifiedName*[]> get{{namespace}}Attrs() 45 std::unique_ptr<const QualifiedName*[]> get{{namespace}}Attrs()
44 { 46 {
45 OwnPtr<const QualifiedName*[]> attrs = adoptArrayPtr(new const QualifiedName *[{{namespace}}AttrsCount]); 47 std::unique_ptr<const QualifiedName*[]> attrs = wrapArrayUnique(new const Qu alifiedName*[{{namespace}}AttrsCount]);
46 for (size_t i = 0; i < {{namespace}}AttrsCount; i++) 48 for (size_t i = 0; i < {{namespace}}AttrsCount; i++)
47 attrs[i] = reinterpret_cast<QualifiedName*>(&{{suffix}}AttrStorage) + i; 49 attrs[i] = reinterpret_cast<QualifiedName*>(&{{suffix}}AttrStorage) + i;
48 return attrs; 50 return attrs;
49 } 51 }
50 {% endif %} 52 {% endif %}
51 53
52 54
53 void init() 55 void init()
54 { 56 {
55 struct NameEntry { 57 struct NameEntry {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 attr_i++; 100 attr_i++;
99 } 101 }
100 {% if tags %} 102 {% if tags %}
101 ASSERT(tag_i == {{namespace}}TagsCount); 103 ASSERT(tag_i == {{namespace}}TagsCount);
102 {% endif %} 104 {% endif %}
103 ASSERT(attr_i == {{namespace}}AttrsCount); 105 ASSERT(attr_i == {{namespace}}AttrsCount);
104 } 106 }
105 107
106 } // {{namespace}} 108 } // {{namespace}}
107 } // namespace blink 109 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698