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

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

Issue 1764973002: WTF::HashTable: Implement move semantics for keys and values. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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) 2007 David Smith (catfish.man@gmail.com) 2 * Copyright (C) 2007 David Smith (catfish.man@gmail.com)
3 * Copyright (C) 2007, 2008, 2011, 2012 Apple Inc. All rights reserved. 3 * Copyright (C) 2007, 2008, 2011, 2012 Apple Inc. All rights reserved.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 } 167 }
168 168
169 SpaceSplitString::Data::~Data() 169 SpaceSplitString::Data::~Data()
170 { 170 {
171 if (!m_keyString.isNull()) 171 if (!m_keyString.isNull())
172 sharedDataMap().remove(m_keyString); 172 sharedDataMap().remove(m_keyString);
173 } 173 }
174 174
175 PassRefPtr<SpaceSplitString::Data> SpaceSplitString::Data::create(const AtomicSt ring& string) 175 PassRefPtr<SpaceSplitString::Data> SpaceSplitString::Data::create(const AtomicSt ring& string)
176 { 176 {
177 Data*& data = sharedDataMap().add(string, 0).storedValue->value; 177 Data*& data = sharedDataMap().add(string, nullptr).storedValue->value;
178 if (!data) { 178 if (!data) {
179 data = new Data(string); 179 data = new Data(string);
180 return adoptRef(data); 180 return adoptRef(data);
181 } 181 }
182 return data; 182 return data;
183 } 183 }
184 184
185 PassRefPtr<SpaceSplitString::Data> SpaceSplitString::Data::createUnique(const Da ta& other) 185 PassRefPtr<SpaceSplitString::Data> SpaceSplitString::Data::createUnique(const Da ta& other)
186 { 186 {
187 return adoptRef(new SpaceSplitString::Data(other)); 187 return adoptRef(new SpaceSplitString::Data(other));
188 } 188 }
189 189
190 SpaceSplitString::Data::Data(const AtomicString& string) 190 SpaceSplitString::Data::Data(const AtomicString& string)
191 : m_keyString(string) 191 : m_keyString(string)
192 { 192 {
193 ASSERT(!string.isNull()); 193 ASSERT(!string.isNull());
194 createVector(string); 194 createVector(string);
195 } 195 }
196 196
197 SpaceSplitString::Data::Data(const SpaceSplitString::Data& other) 197 SpaceSplitString::Data::Data(const SpaceSplitString::Data& other)
198 : RefCounted<Data>() 198 : RefCounted<Data>()
199 , m_vector(other.m_vector) 199 , m_vector(other.m_vector)
200 { 200 {
201 // Note that we don't copy m_keyString to indicate to the destructor that th ere's nothing 201 // Note that we don't copy m_keyString to indicate to the destructor that th ere's nothing
202 // to be removed from the sharedDataMap(). 202 // to be removed from the sharedDataMap().
203 } 203 }
204 204
205 } // namespace blink 205 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698