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

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

Issue 1259083003: Do not consolidate data in BMPImageDecoder (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@SegmentedBuffer
Patch Set: Make FastSharedBufferReader a member Created 5 years, 3 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) 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 28 matching lines...) Expand all
39 namespace blink { 39 namespace blink {
40 40
41 // This class is used by image decoders to avoid memory consolidation and 41 // This class is used by image decoders to avoid memory consolidation and
42 // therefore minimizes the cost of memory copying when the decoders 42 // therefore minimizes the cost of memory copying when the decoders
43 // repeatedly read from a buffer that is continually growing due to network 43 // repeatedly read from a buffer that is continually growing due to network
44 // traffic. 44 // traffic.
45 class PLATFORM_EXPORT FastSharedBufferReader { 45 class PLATFORM_EXPORT FastSharedBufferReader {
46 public: 46 public:
47 FastSharedBufferReader(PassRefPtr<SharedBuffer> data); 47 FastSharedBufferReader(PassRefPtr<SharedBuffer> data);
48 48
49 void setData(SharedBuffer*);
Peter Kasting 2015/09/02 22:08:54 Is it really correct that the constructor takes a
scroggo_chromium 2015/09/02 23:01:07 Me neither...
Peter Kasting 2015/09/02 23:48:44 Definitely at least figure out precisely what the
scroggo_chromium 2015/09/03 22:04:19 I just talked this over with a couple of people, a
50
49 // Returns a consecutive buffer that carries the data starting 51 // Returns a consecutive buffer that carries the data starting
50 // at |dataPosition| with |length| bytes. 52 // at |dataPosition| with |length| bytes.
51 // This method returns a pointer to a memory segment stored in 53 // This method returns a pointer to a memory segment stored in
52 // |m_data| if such a consecutive buffer can be found. 54 // |m_data| if such a consecutive buffer can be found.
53 // Otherwise copies into |buffer| and returns it. 55 // Otherwise copies into |buffer| and returns it.
54 // Caller must ensure there are enough bytes in |m_data| and |buffer|. 56 // Caller must ensure there are enough bytes in |m_data| and |buffer|.
55 const char* getConsecutiveData(size_t dataPosition, size_t length, char* buf fer); 57 const char* getConsecutiveData(size_t dataPosition, size_t length, char* buf fer);
56 58
57 // Wraps SharedBuffer::getSomeData(). 59 // Wraps SharedBuffer::getSomeData().
58 size_t getSomeData(const char*& someData, size_t dataPosition); 60 size_t getSomeData(const char*& someData, size_t dataPosition);
(...skipping 20 matching lines...) Expand all
79 const char* m_segment; 81 const char* m_segment;
80 size_t m_segmentLength; 82 size_t m_segmentLength;
81 83
82 // Data position in |m_data| pointed to by |m_segment|. 84 // Data position in |m_data| pointed to by |m_segment|.
83 size_t m_dataPosition; 85 size_t m_dataPosition;
84 }; 86 };
85 87
86 } // namespace blink 88 } // namespace blink
87 89
88 #endif 90 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698