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

Side by Side Diff: net/websockets/websocket_inflater.cc

Issue 667923003: Standardize usage of virtual/override/final in net/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/websockets/websocket_inflater.h" 5 #include "net/websockets/websocket_inflater.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <deque> 8 #include <deque>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "net/base/io_buffer.h" 12 #include "net/base/io_buffer.h"
13 #include "third_party/zlib/zlib.h" 13 #include "third_party/zlib/zlib.h"
14 14
15 namespace net { 15 namespace net {
16 16
17 namespace { 17 namespace {
18 18
19 class ShrinkableIOBufferWithSize : public IOBufferWithSize { 19 class ShrinkableIOBufferWithSize : public IOBufferWithSize {
20 public: 20 public:
21 explicit ShrinkableIOBufferWithSize(int size) 21 explicit ShrinkableIOBufferWithSize(int size)
22 : IOBufferWithSize(size) {} 22 : IOBufferWithSize(size) {}
23 23
24 void Shrink(int new_size) { 24 void Shrink(int new_size) {
25 DCHECK_LE(new_size, size_); 25 DCHECK_LE(new_size, size_);
26 size_ = new_size; 26 size_ = new_size;
27 } 27 }
28 28
29 private: 29 private:
30 virtual ~ShrinkableIOBufferWithSize() {} 30 ~ShrinkableIOBufferWithSize() override {}
31 }; 31 };
32 32
33 } // namespace 33 } // namespace
34 34
35 WebSocketInflater::WebSocketInflater() 35 WebSocketInflater::WebSocketInflater()
36 : input_queue_(kDefaultInputIOBufferCapacity), 36 : input_queue_(kDefaultInputIOBufferCapacity),
37 output_buffer_(kDefaultBufferCapacity) {} 37 output_buffer_(kDefaultBufferCapacity) {}
38 38
39 WebSocketInflater::WebSocketInflater(size_t input_queue_capacity, 39 WebSocketInflater::WebSocketInflater(size_t input_queue_capacity,
40 size_t output_buffer_capacity) 40 size_t output_buffer_capacity)
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 size_t num_bytes_to_copy = std::min(size, capacity_ - tail_of_last_buffer_); 274 size_t num_bytes_to_copy = std::min(size, capacity_ - tail_of_last_buffer_);
275 if (!num_bytes_to_copy) 275 if (!num_bytes_to_copy)
276 return 0; 276 return 0;
277 IOBufferWithSize* buffer = buffers_.back().get(); 277 IOBufferWithSize* buffer = buffers_.back().get();
278 memcpy(&buffer->data()[tail_of_last_buffer_], data, num_bytes_to_copy); 278 memcpy(&buffer->data()[tail_of_last_buffer_], data, num_bytes_to_copy);
279 tail_of_last_buffer_ += num_bytes_to_copy; 279 tail_of_last_buffer_ += num_bytes_to_copy;
280 return num_bytes_to_copy; 280 return num_bytes_to_copy;
281 } 281 }
282 282
283 } // namespace net 283 } // namespace net
OLDNEW
« no previous file with comments | « net/websockets/websocket_handshake_stream_create_helper_test.cc ('k') | net/websockets/websocket_job.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698