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

Side by Side Diff: Source/platform/graphics/ImageDecodingStore.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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 // 59 //
60 // THREAD SAFETY 60 // THREAD SAFETY
61 // 61 //
62 // All public methods can be used on any thread. 62 // All public methods can be used on any thread.
63 63
64 class PLATFORM_EXPORT ImageDecodingStore { 64 class PLATFORM_EXPORT ImageDecodingStore {
65 public: 65 public:
66 static PassOwnPtr<ImageDecodingStore> create() { return adoptPtr(new ImageDe codingStore); } 66 static PassOwnPtr<ImageDecodingStore> create() { return adoptPtr(new ImageDe codingStore); }
67 ~ImageDecodingStore(); 67 ~ImageDecodingStore();
68 68
69 static ImageDecodingStore* instance(); 69 static ImageDecodingStore& instance();
70 70
71 // Access a cached decoder object. A decoder is indexed by origin (ImageFram eGenerator) 71 // Access a cached decoder object. A decoder is indexed by origin (ImageFram eGenerator)
72 // and scaled size. Return true if the cached object is found. 72 // and scaled size. Return true if the cached object is found.
73 bool lockDecoder(const ImageFrameGenerator*, const SkISize& scaledSize, Imag eDecoder**); 73 bool lockDecoder(const ImageFrameGenerator*, const SkISize& scaledSize, Imag eDecoder**);
74 void unlockDecoder(const ImageFrameGenerator*, const ImageDecoder*); 74 void unlockDecoder(const ImageFrameGenerator*, const ImageDecoder*);
75 void insertDecoder(const ImageFrameGenerator*, PassOwnPtr<ImageDecoder>); 75 void insertDecoder(const ImageFrameGenerator*, PassOwnPtr<ImageDecoder>);
76 void removeDecoder(const ImageFrameGenerator*, const ImageDecoder*); 76 void removeDecoder(const ImageFrameGenerator*, const ImageDecoder*);
77 77
78 // Remove all cache entries indexed by ImageFrameGenerator. 78 // Remove all cache entries indexed by ImageFrameGenerator.
79 void removeCacheIndexedByGenerator(const ImageFrameGenerator*); 79 void removeCacheIndexedByGenerator(const ImageFrameGenerator*);
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 // m_heapLimitInBytes 211 // m_heapLimitInBytes
212 // m_heapMemoryUsageInBytes 212 // m_heapMemoryUsageInBytes
213 // This mutex also protects calls to underlying skBitmap's 213 // This mutex also protects calls to underlying skBitmap's
214 // lockPixels()/unlockPixels() as they are not threadsafe. 214 // lockPixels()/unlockPixels() as they are not threadsafe.
215 Mutex m_mutex; 215 Mutex m_mutex;
216 }; 216 };
217 217
218 } // namespace blink 218 } // namespace blink
219 219
220 #endif 220 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698