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

Unified Diff: net/server/http_connection.h

Issue 992733002: Remove //net (except for Android test stuff) and sdch (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/sdch/sdch_owner_unittest.cc ('k') | net/server/http_connection.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/server/http_connection.h
diff --git a/net/server/http_connection.h b/net/server/http_connection.h
deleted file mode 100644
index 8163ced68845ad2475394ba1b12dd93ef1df7462..0000000000000000000000000000000000000000
--- a/net/server/http_connection.h
+++ /dev/null
@@ -1,137 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef NET_SERVER_HTTP_CONNECTION_H_
-#define NET_SERVER_HTTP_CONNECTION_H_
-
-#include <queue>
-#include <string>
-
-#include "base/basictypes.h"
-#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
-#include "net/base/io_buffer.h"
-
-namespace net {
-
-class StreamSocket;
-class WebSocket;
-
-// A container which has all information of an http connection. It includes
-// id, underlying socket, and pending read/write data.
-class HttpConnection {
- public:
- // IOBuffer for data read. It's a wrapper around GrowableIOBuffer, with more
- // functions for buffer management. It moves unconsumed data to the start of
- // buffer.
- class ReadIOBuffer : public IOBuffer {
- public:
- static const int kInitialBufSize = 1024;
- static const int kMinimumBufSize = 128;
- static const int kCapacityIncreaseFactor = 2;
- static const int kDefaultMaxBufferSize = 1 * 1024 * 1024; // 1 Mbytes.
-
- ReadIOBuffer();
-
- // Capacity.
- int GetCapacity() const;
- void SetCapacity(int capacity);
- // Increases capacity and returns true if capacity is not beyond the limit.
- bool IncreaseCapacity();
-
- // Start of read data.
- char* StartOfBuffer() const;
- // Returns the bytes of read data.
- int GetSize() const;
- // More read data was appended.
- void DidRead(int bytes);
- // Capacity for which more read data can be appended.
- int RemainingCapacity() const;
-
- // Removes consumed data and moves unconsumed data to the start of buffer.
- void DidConsume(int bytes);
-
- // Limit of how much internal capacity can increase.
- int max_buffer_size() const { return max_buffer_size_; }
- void set_max_buffer_size(int max_buffer_size) {
- max_buffer_size_ = max_buffer_size;
- }
-
- private:
- ~ReadIOBuffer() override;
-
- scoped_refptr<GrowableIOBuffer> base_;
- int max_buffer_size_;
-
- DISALLOW_COPY_AND_ASSIGN(ReadIOBuffer);
- };
-
- // IOBuffer of pending data to write which has a queue of pending data. Each
- // pending data is stored in std::string. data() is the data of first
- // std::string stored.
- class QueuedWriteIOBuffer : public IOBuffer {
- public:
- static const int kDefaultMaxBufferSize = 1 * 1024 * 1024; // 1 Mbytes.
-
- QueuedWriteIOBuffer();
-
- // Whether or not pending data exists.
- bool IsEmpty() const;
-
- // Appends new pending data and returns true if total size doesn't exceed
- // the limit, |total_size_limit_|. It would change data() if new data is
- // the first pending data.
- bool Append(const std::string& data);
-
- // Consumes data and changes data() accordingly. It cannot be more than
- // GetSizeToWrite().
- void DidConsume(int size);
-
- // Gets size of data to write this time. It is NOT total data size.
- int GetSizeToWrite() const;
-
- // Total size of all pending data.
- int total_size() const { return total_size_; }
-
- // Limit of how much data can be pending.
- int max_buffer_size() const { return max_buffer_size_; }
- void set_max_buffer_size(int max_buffer_size) {
- max_buffer_size_ = max_buffer_size;
- }
-
- private:
- ~QueuedWriteIOBuffer() override;
-
- std::queue<std::string> pending_data_;
- int total_size_;
- int max_buffer_size_;
-
- DISALLOW_COPY_AND_ASSIGN(QueuedWriteIOBuffer);
- };
-
- HttpConnection(int id, scoped_ptr<StreamSocket> socket);
- ~HttpConnection();
-
- int id() const { return id_; }
- StreamSocket* socket() const { return socket_.get(); }
- ReadIOBuffer* read_buf() const { return read_buf_.get(); }
- QueuedWriteIOBuffer* write_buf() const { return write_buf_.get(); }
-
- WebSocket* web_socket() const { return web_socket_.get(); }
- void SetWebSocket(scoped_ptr<WebSocket> web_socket);
-
- private:
- const int id_;
- const scoped_ptr<StreamSocket> socket_;
- const scoped_refptr<ReadIOBuffer> read_buf_;
- const scoped_refptr<QueuedWriteIOBuffer> write_buf_;
-
- scoped_ptr<WebSocket> web_socket_;
-
- DISALLOW_COPY_AND_ASSIGN(HttpConnection);
-};
-
-} // namespace net
-
-#endif // NET_SERVER_HTTP_CONNECTION_H_
« no previous file with comments | « net/sdch/sdch_owner_unittest.cc ('k') | net/server/http_connection.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698