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

Side by Side Diff: third_party/WebKit/Source/platform/image-decoders/FastSharedBufferReader.h

Issue 1493633004: Make platform/image-decoders to use USING_FAST_MALLOC. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 | « no previous file | third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h » ('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) 2015 Google Inc. All rights reserved. 2 * Copyright (C) 2015 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 15 matching lines...) Expand all
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #ifndef FastSharedBufferReader_h 31 #ifndef FastSharedBufferReader_h
32 #define FastSharedBufferReader_h 32 #define FastSharedBufferReader_h
33 33
34 #include "platform/PlatformExport.h" 34 #include "platform/PlatformExport.h"
35 #include "platform/SharedBuffer.h" 35 #include "platform/SharedBuffer.h"
36 #include "wtf/Allocator.h"
37 #include "wtf/Noncopyable.h"
36 #include "wtf/PassRefPtr.h" 38 #include "wtf/PassRefPtr.h"
37 #include "wtf/RefPtr.h" 39 #include "wtf/RefPtr.h"
38 40
39 namespace blink { 41 namespace blink {
40 42
41 // This class is used by image decoders to avoid memory consolidation and 43 // This class is used by image decoders to avoid memory consolidation and
42 // therefore minimizes the cost of memory copying when the decoders 44 // therefore minimizes the cost of memory copying when the decoders
43 // repeatedly read from a buffer that is continually growing due to network 45 // repeatedly read from a buffer that is continually growing due to network
44 // traffic. 46 // traffic.
45 class PLATFORM_EXPORT FastSharedBufferReader { 47 class PLATFORM_EXPORT FastSharedBufferReader final {
48 DISALLOW_NEW();
49 WTF_MAKE_NONCOPYABLE(FastSharedBufferReader);
46 public: 50 public:
47 FastSharedBufferReader(PassRefPtr<SharedBuffer> data); 51 FastSharedBufferReader(PassRefPtr<SharedBuffer> data);
48 52
49 void setData(PassRefPtr<SharedBuffer>); 53 void setData(PassRefPtr<SharedBuffer>);
50 54
51 // Returns a consecutive buffer that carries the data starting 55 // Returns a consecutive buffer that carries the data starting
52 // at |dataPosition| with |length| bytes. 56 // at |dataPosition| with |length| bytes.
53 // This method returns a pointer to a memory segment stored in 57 // This method returns a pointer to a memory segment stored in
54 // |m_data| if such a consecutive buffer can be found. 58 // |m_data| if such a consecutive buffer can be found.
55 // Otherwise copies into |buffer| and returns it. 59 // Otherwise copies into |buffer| and returns it.
(...skipping 30 matching lines...) Expand all
86 mutable const char* m_segment; 90 mutable const char* m_segment;
87 mutable size_t m_segmentLength; 91 mutable size_t m_segmentLength;
88 92
89 // Data position in |m_data| pointed to by |m_segment|. 93 // Data position in |m_data| pointed to by |m_segment|.
90 mutable size_t m_dataPosition; 94 mutable size_t m_dataPosition;
91 }; 95 };
92 96
93 } // namespace blink 97 } // namespace blink
94 98
95 #endif 99 #endif
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698