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

Side by Side Diff: include/core/SkString.h

Issue 16356006: change impl to explicitly store length as u32, rather than size_t, so we keep a packed struct on 64… (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/core/SkString.cpp » ('j') | src/core/SkString.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #ifndef SkString_DEFINED 10 #ifndef SkString_DEFINED
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 198
199 /** 199 /**
200 * Swap contents between this and other. This function is guaranteed 200 * Swap contents between this and other. This function is guaranteed
201 * to never fail or throw. 201 * to never fail or throw.
202 */ 202 */
203 void swap(SkString& other); 203 void swap(SkString& other);
204 204
205 private: 205 private:
206 struct Rec { 206 struct Rec {
207 public: 207 public:
208 size_t fLength; 208 uint32_t fLength; // logically size_t, but we want it to stay 32bits
209 int32_t fRefCnt; 209 int32_t fRefCnt;
210 char fBeginningOfData; 210 char fBeginningOfData;
211 211
212 char* data() { return &fBeginningOfData; } 212 char* data() { return &fBeginningOfData; }
213 const char* data() const { return &fBeginningOfData; } 213 const char* data() const { return &fBeginningOfData; }
214 }; 214 };
215 Rec* fRec; 215 Rec* fRec;
216 216
217 #ifdef SK_DEBUG 217 #ifdef SK_DEBUG
218 const char* fStr; 218 const char* fStr;
(...skipping 28 matching lines...) Expand all
247 /// Creates a new string and writes into it using a printf()-style format. 247 /// Creates a new string and writes into it using a printf()-style format.
248 SkString SkStringPrintf(const char* format, ...); 248 SkString SkStringPrintf(const char* format, ...);
249 249
250 // Specialized to take advantage of SkString's fast swap path. The unspecialized function is 250 // Specialized to take advantage of SkString's fast swap path. The unspecialized function is
251 // declared in SkTypes.h and called by SkTSort. 251 // declared in SkTypes.h and called by SkTSort.
252 template <> inline void SkTSwap(SkString& a, SkString& b) { 252 template <> inline void SkTSwap(SkString& a, SkString& b) {
253 a.swap(b); 253 a.swap(b);
254 } 254 }
255 255
256 #endif 256 #endif
OLDNEW
« no previous file with comments | « no previous file | src/core/SkString.cpp » ('j') | src/core/SkString.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698