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

Side by Side Diff: third_party/WebKit/Source/wtf/HashMap.h

Issue 1363653006: Reserve capacity for static strings HashMap. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2005, 2006, 2007, 2008, 2011 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 void swap(typename Allocator::template OtherType<HashMap>::Type other) 91 void swap(typename Allocator::template OtherType<HashMap>::Type other)
92 { 92 {
93 HashMap& ref = Allocator::getOther(other); 93 HashMap& ref = Allocator::getOther(other);
94 m_impl.swap(ref.m_impl); 94 m_impl.swap(ref.m_impl);
95 } 95 }
96 96
97 unsigned size() const; 97 unsigned size() const;
98 unsigned capacity() const; 98 unsigned capacity() const;
99 bool isEmpty() const; 99 bool isEmpty() const;
100 100
101 void reserveCapacityForSize(unsigned size)
102 {
103 m_impl.reserveCapacityForSize(size);
104 }
105
101 // iterators iterate over pairs of keys and values 106 // iterators iterate over pairs of keys and values
102 iterator begin(); 107 iterator begin();
103 iterator end(); 108 iterator end();
104 const_iterator begin() const; 109 const_iterator begin() const;
105 const_iterator end() const; 110 const_iterator end() const;
106 111
107 HashMapKeysProxy& keys() { return static_cast<HashMapKeysProxy&>(*this); } 112 HashMapKeysProxy& keys() { return static_cast<HashMapKeysProxy&>(*this); }
108 const HashMapKeysProxy& keys() const { return static_cast<const HashMapK eysProxy&>(*this); } 113 const HashMapKeysProxy& keys() const { return static_cast<const HashMapK eysProxy&>(*this); }
109 114
110 HashMapValuesProxy& values() { return static_cast<HashMapValuesProxy&>(* this); } 115 HashMapValuesProxy& values() { return static_cast<HashMapValuesProxy&>(* this); }
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 struct NeedsTracing<HashMap<T, U, V, W, X>> { 503 struct NeedsTracing<HashMap<T, U, V, W, X>> {
499 static const bool value = false; 504 static const bool value = false;
500 }; 505 };
501 #endif 506 #endif
502 507
503 } // namespace WTF 508 } // namespace WTF
504 509
505 using WTF::HashMap; 510 using WTF::HashMap;
506 511
507 #endif /* WTF_HashMap_h */ 512 #endif /* WTF_HashMap_h */
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698