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

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

Issue 138643003: Simpler return value of HashTable::add/HashMap:add and others (Closed)
Patch Set: Daily master update (now with base url?) Created 6 years, 10 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 | « Source/core/dom/QualifiedName.cpp ('k') | Source/core/dom/StyleEngine.cpp » ('j') | 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 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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 } 168 }
169 169
170 SpaceSplitStringData::~SpaceSplitStringData() 170 SpaceSplitStringData::~SpaceSplitStringData()
171 { 171 {
172 if (!m_keyString.isNull()) 172 if (!m_keyString.isNull())
173 sharedDataMap().remove(m_keyString); 173 sharedDataMap().remove(m_keyString);
174 } 174 }
175 175
176 PassRefPtr<SpaceSplitStringData> SpaceSplitStringData::create(const AtomicString & string) 176 PassRefPtr<SpaceSplitStringData> SpaceSplitStringData::create(const AtomicString & string)
177 { 177 {
178 SpaceSplitStringData*& data = sharedDataMap().add(string, 0).iterator->value ; 178 SpaceSplitStringData*& data = sharedDataMap().add(string, 0).storedValue->va lue;
179 if (!data) { 179 if (!data) {
180 data = new SpaceSplitStringData(string); 180 data = new SpaceSplitStringData(string);
181 return adoptRef(data); 181 return adoptRef(data);
182 } 182 }
183 return data; 183 return data;
184 } 184 }
185 185
186 PassRefPtr<SpaceSplitStringData> SpaceSplitStringData::createUnique(const SpaceS plitStringData& other) 186 PassRefPtr<SpaceSplitStringData> SpaceSplitStringData::createUnique(const SpaceS plitStringData& other)
187 { 187 {
188 return adoptRef(new SpaceSplitStringData(other)); 188 return adoptRef(new SpaceSplitStringData(other));
189 } 189 }
190 190
191 SpaceSplitStringData::SpaceSplitStringData(const AtomicString& string) 191 SpaceSplitStringData::SpaceSplitStringData(const AtomicString& string)
192 : m_keyString(string) 192 : m_keyString(string)
193 { 193 {
194 ASSERT(!string.isNull()); 194 ASSERT(!string.isNull());
195 createVector(string); 195 createVector(string);
196 } 196 }
197 197
198 SpaceSplitStringData::SpaceSplitStringData(const SpaceSplitStringData& other) 198 SpaceSplitStringData::SpaceSplitStringData(const SpaceSplitStringData& other)
199 : RefCounted<SpaceSplitStringData>() 199 : RefCounted<SpaceSplitStringData>()
200 , m_vector(other.m_vector) 200 , m_vector(other.m_vector)
201 { 201 {
202 // Note that we don't copy m_keyString to indicate to the destructor that th ere's nothing 202 // Note that we don't copy m_keyString to indicate to the destructor that th ere's nothing
203 // to be removed from the sharedDataMap(). 203 // to be removed from the sharedDataMap().
204 } 204 }
205 205
206 } // namespace WebCore 206 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/QualifiedName.cpp ('k') | Source/core/dom/StyleEngine.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698