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

Side by Side Diff: Source/modules/websockets/WebSocketDeflater.cpp

Issue 49093004: Move more arrays of strings to shareable memory (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 7 years, 1 month 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 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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 if (result != Z_OK) 194 if (result != Z_OK)
195 return false; 195 return false;
196 ASSERT(remainingLength > m_stream->avail_in); 196 ASSERT(remainingLength > m_stream->avail_in);
197 } 197 }
198 ASSERT(consumedSoFar == length); 198 ASSERT(consumedSoFar == length);
199 return true; 199 return true;
200 } 200 }
201 201
202 bool WebSocketInflater::finish() 202 bool WebSocketInflater::finish()
203 { 203 {
204 static const char* strippedFields = "\0\0\xff\xff"; 204 static const char strippedFields[] = "\0\0\xff\xff";
205 static const size_t strippedLength = 4; 205 static const size_t strippedLength = 4;
206 206
207 // Appends 4 octests of 0x00 0x00 0xff 0xff 207 // Appends 4 octests of 0x00 0x00 0xff 0xff
208 size_t consumedSoFar = 0; 208 size_t consumedSoFar = 0;
209 while (consumedSoFar < strippedLength) { 209 while (consumedSoFar < strippedLength) {
210 size_t writePosition = m_buffer.size(); 210 size_t writePosition = m_buffer.size();
211 m_buffer.grow(writePosition + bufferIncrementUnit); 211 m_buffer.grow(writePosition + bufferIncrementUnit);
212 size_t availableCapacity = m_buffer.size() - writePosition; 212 size_t availableCapacity = m_buffer.size() - writePosition;
213 size_t remainingLength = strippedLength - consumedSoFar; 213 size_t remainingLength = strippedLength - consumedSoFar;
214 setStreamParameter(m_stream.get(), strippedFields + consumedSoFar, remai ningLength, m_buffer.data() + writePosition, availableCapacity); 214 setStreamParameter(m_stream.get(), strippedFields + consumedSoFar, remai ningLength, m_buffer.data() + writePosition, availableCapacity);
(...skipping 11 matching lines...) Expand all
226 return true; 226 return true;
227 } 227 }
228 228
229 void WebSocketInflater::reset() 229 void WebSocketInflater::reset()
230 { 230 {
231 m_buffer.clear(); 231 m_buffer.clear();
232 } 232 }
233 233
234 } // namespace WebCore 234 } // namespace WebCore
235 235
OLDNEW
« no previous file with comments | « Source/modules/navigatorcontentutils/NavigatorContentUtils.cpp ('k') | Source/modules/websockets/WebSocketHandshake.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698