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

Side by Side Diff: Source/platform/image-decoders/ImageDecoder.h

Issue 794223003: Cheaper thread-safe atomic initialization of static references. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add type check for initial value Created 5 years, 11 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) 2006 Apple Computer, Inc. All rights reserved. 2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
3 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. 3 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 ColorProfile colorProfile; 225 ColorProfile colorProfile;
226 colorProfile.append(profile.data(), profile.size()); 226 colorProfile.append(profile.data(), profile.size());
227 return colorProfile; 227 return colorProfile;
228 } 228 }
229 229
230 qcms_profile* m_outputDeviceProfile; 230 qcms_profile* m_outputDeviceProfile;
231 }; 231 };
232 232
233 static qcms_profile* qcmsOutputDeviceProfile() 233 static qcms_profile* qcmsOutputDeviceProfile()
234 { 234 {
235 AtomicallyInitializedStatic(OutputDeviceProfile*, outputDeviceProfile = new OutputDeviceProfile()); 235 AtomicallyInitializedStaticReference(OutputDeviceProfile, outputDevicePr ofile, new OutputDeviceProfile);
236 236
237 return outputDeviceProfile->profile(); 237 return outputDeviceProfile.profile();
238 } 238 }
239 #endif 239 #endif
240 240
241 // Sets the "decode failure" flag. For caller convenience (since so 241 // Sets the "decode failure" flag. For caller convenience (since so
242 // many callers want to return false after calling this), returns false 242 // many callers want to return false after calling this), returns false
243 // to enable easy tailcalling. Subclasses may override this to also 243 // to enable easy tailcalling. Subclasses may override this to also
244 // clean up any local data. 244 // clean up any local data.
245 virtual bool setFailed() 245 virtual bool setFailed()
246 { 246 {
247 m_failed = true; 247 m_failed = true;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 322
323 IntSize m_size; 323 IntSize m_size;
324 bool m_sizeAvailable; 324 bool m_sizeAvailable;
325 bool m_isAllDataReceived; 325 bool m_isAllDataReceived;
326 bool m_failed; 326 bool m_failed;
327 }; 327 };
328 328
329 } // namespace blink 329 } // namespace blink
330 330
331 #endif 331 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698