#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "net/websockets/websocket_inflater.h"
#include <string.h>
#include <algorithm>
#include <vector>
#include "base/check.h"
#include "base/check_op.h"
#include "net/base/io_buffer.h"
#include "third_party/zlib/zlib.h"
namespace net {
namespace {
class ShrinkableIOBufferWithSize : public IOBufferWithSize { … };
}
WebSocketInflater::WebSocketInflater()
: … { … }
WebSocketInflater::WebSocketInflater(size_t input_queue_capacity,
size_t output_buffer_capacity)
: … { … }
bool WebSocketInflater::Initialize(int window_bits) { … }
WebSocketInflater::~WebSocketInflater() { … }
bool WebSocketInflater::AddBytes(const char* data, size_t size) { … }
bool WebSocketInflater::Finish() { … }
scoped_refptr<IOBufferWithSize> WebSocketInflater::GetOutput(size_t size) { … }
int WebSocketInflater::InflateWithFlush(const char* next_in, size_t avail_in) { … }
int WebSocketInflater::Inflate(const char* next_in,
size_t avail_in,
int flush) { … }
int WebSocketInflater::InflateChokedInput() { … }
WebSocketInflater::OutputBuffer::OutputBuffer(size_t capacity)
: … { … }
WebSocketInflater::OutputBuffer::~OutputBuffer() = default;
size_t WebSocketInflater::OutputBuffer::Size() const { … }
std::pair<char*, size_t> WebSocketInflater::OutputBuffer::GetTail() { … }
void WebSocketInflater::OutputBuffer::Read(char* dest, size_t size) { … }
void WebSocketInflater::OutputBuffer::AdvanceHead(size_t advance) { … }
void WebSocketInflater::OutputBuffer::AdvanceTail(size_t advance) { … }
WebSocketInflater::InputQueue::InputQueue(size_t capacity)
: … { … }
WebSocketInflater::InputQueue::~InputQueue() = default;
std::pair<char*, size_t> WebSocketInflater::InputQueue::Top() { … }
void WebSocketInflater::InputQueue::Push(const char* data, size_t size) { … }
void WebSocketInflater::InputQueue::Consume(size_t size) { … }
size_t WebSocketInflater::InputQueue::PushToLastBuffer(const char* data,
size_t size) { … }
}