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

Side by Side Diff: third_party/WebKit/Source/core/dom/SpaceSplitString.h

Issue 2405873003: Reformat a file (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008, 2010, 2011, 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008, 2010, 2011, 2012 Apple Inc. 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 return m_data && m_data->contains(string); 49 return m_data && m_data->contains(string);
50 } 50 }
51 bool containsAll(const SpaceSplitString& names) const { 51 bool containsAll(const SpaceSplitString& names) const {
52 return !names.m_data || (m_data && m_data->containsAll(*names.m_data)); 52 return !names.m_data || (m_data && m_data->containsAll(*names.m_data));
53 } 53 }
54 void add(const AtomicString&); 54 void add(const AtomicString&);
55 bool remove(const AtomicString&); 55 bool remove(const AtomicString&);
56 56
57 size_t size() const { return m_data ? m_data->size() : 0; } 57 size_t size() const { return m_data ? m_data->size() : 0; }
58 bool isNull() const { return !m_data; } 58 bool isNull() const { return !m_data; }
59 const AtomicString& operator[](size_t i) const { 59 const AtomicString& operator[](size_t i) const { return (*m_data)[i]; }
60 return (*m_data)[i];
61 }
62 60
63 private: 61 private:
64 class Data : public RefCounted<Data> { 62 class Data : public RefCounted<Data> {
65 public: 63 public:
66 static PassRefPtr<Data> create(const AtomicString&); 64 static PassRefPtr<Data> create(const AtomicString&);
67 static PassRefPtr<Data> createUnique(const Data&); 65 static PassRefPtr<Data> createUnique(const Data&);
68 66
69 ~Data(); 67 ~Data();
70 68
71 bool contains(const AtomicString& string) { 69 bool contains(const AtomicString& string) {
72 size_t size = m_vector.size(); 70 size_t size = m_vector.size();
73 for (size_t i = 0; i < size; ++i) { 71 for (size_t i = 0; i < size; ++i) {
74 if (m_vector[i] == string) 72 if (m_vector[i] == string)
75 return true; 73 return true;
76 } 74 }
77 return false; 75 return false;
78 } 76 }
79 77
80 bool containsAll(Data&); 78 bool containsAll(Data&);
81 79
82 void add(const AtomicString&); 80 void add(const AtomicString&);
83 void remove(unsigned index); 81 void remove(unsigned index);
84 82
85 bool isUnique() const { return m_keyString.isNull(); } 83 bool isUnique() const { return m_keyString.isNull(); }
86 size_t size() const { return m_vector.size(); } 84 size_t size() const { return m_vector.size(); }
87 const AtomicString& operator[](size_t i) { 85 const AtomicString& operator[](size_t i) { return m_vector[i]; }
88 return m_vector[i];
89 }
90 86
91 private: 87 private:
92 explicit Data(const AtomicString&); 88 explicit Data(const AtomicString&);
93 explicit Data(const Data&); 89 explicit Data(const Data&);
94 90
95 void createVector(const String&); 91 void createVector(const String&);
96 template <typename CharacterType> 92 template <typename CharacterType>
97 inline void createVector(const CharacterType*, unsigned); 93 inline void createVector(const CharacterType*, unsigned);
98 94
99 AtomicString m_keyString; 95 AtomicString m_keyString;
100 Vector<AtomicString, 4> m_vector; 96 Vector<AtomicString, 4> m_vector;
101 }; 97 };
102 typedef HashMap<AtomicString, Data*> DataMap; 98 typedef HashMap<AtomicString, Data*> DataMap;
103 99
104 static DataMap& sharedDataMap(); 100 static DataMap& sharedDataMap();
105 101
106 void ensureUnique() { 102 void ensureUnique() {
107 if (m_data && !m_data->isUnique()) 103 if (m_data && !m_data->isUnique())
108 m_data = Data::createUnique(*m_data); 104 m_data = Data::createUnique(*m_data);
109 } 105 }
110 106
111 RefPtr<Data> m_data; 107 RefPtr<Data> m_data;
112 }; 108 };
113 109
114 } // namespace blink 110 } // namespace blink
115 111
116 #endif // SpaceSplitString_h 112 #endif // SpaceSplitString_h
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698