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

Side by Side Diff: third_party/WebKit/Source/platform/SharedBuffer.h

Issue 2253853002: Remove SharedBuffer::unlock() and keep Resource's SharedBuffer always locked (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use hasClientsOrObservers() for live_size Created 4 years, 4 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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 bool getPartAsBytes(void* dest, STRICTLY_TYPED_ARG(position), STRICTLY_TYPED _ARG(byteLength)) const 138 bool getPartAsBytes(void* dest, STRICTLY_TYPED_ARG(position), STRICTLY_TYPED _ARG(byteLength)) const
139 { 139 {
140 STRICT_ARG_TYPE(size_t); 140 STRICT_ARG_TYPE(size_t);
141 return getAsBytesInternal(dest, position, byteLength); 141 return getAsBytesInternal(dest, position, byteLength);
142 } 142 }
143 143
144 // Creates an SkData and copies this SharedBuffer's contents to that 144 // Creates an SkData and copies this SharedBuffer's contents to that
145 // SkData without merging segmented buffers into a flat buffer. 145 // SkData without merging segmented buffers into a flat buffer.
146 sk_sp<SkData> getAsSkData() const; 146 sk_sp<SkData> getAsSkData() const;
147 147
148 // See PurgeableVector::lock().
149 bool lock();
150
151 // WARNING: Calling unlock() on a SharedBuffer that wasn't created with the
152 // purgeability option does an extra memcpy(). Please use
153 // SharedBuffer::createPurgeable() if you intend to call unlock().
154 void unlock();
155
156 bool isLocked() const;
157
158 void onMemoryDump(const String& dumpPrefix, WebProcessMemoryDump*) const; 148 void onMemoryDump(const String& dumpPrefix, WebProcessMemoryDump*) const;
159 149
160 private: 150 private:
161 SharedBuffer(); 151 SharedBuffer();
162 explicit SharedBuffer(size_t); 152 explicit SharedBuffer(size_t);
163 SharedBuffer(const char*, size_t); 153 SharedBuffer(const char*, size_t);
164 SharedBuffer(const unsigned char*, size_t); 154 SharedBuffer(const unsigned char*, size_t);
165 SharedBuffer(const char*, size_t, PurgeableVector::PurgeableOption); 155 SharedBuffer(const char*, size_t, PurgeableVector::PurgeableOption);
166 156
167 // See SharedBuffer::data(). 157 // See SharedBuffer::data().
168 void mergeSegmentsIntoBuffer() const; 158 void mergeSegmentsIntoBuffer() const;
169 159
170 void appendInternal(const char* data, size_t); 160 void appendInternal(const char* data, size_t);
171 bool getAsBytesInternal(void* dest, size_t, size_t) const; 161 bool getAsBytesInternal(void* dest, size_t, size_t) const;
172 size_t getSomeDataInternal(const char*& data, size_t position) const; 162 size_t getSomeDataInternal(const char*& data, size_t position) const;
173 163
174 size_t m_size; 164 size_t m_size;
175 mutable PurgeableVector m_buffer; 165 mutable PurgeableVector m_buffer;
176 mutable Vector<char*> m_segments; 166 mutable Vector<char*> m_segments;
177 }; 167 };
178 168
179 } // namespace blink 169 } // namespace blink
180 170
181 #endif // SharedBuffer_h 171 #endif // SharedBuffer_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/PurgeableVectorTest.cpp ('k') | third_party/WebKit/Source/platform/SharedBuffer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698