summaryrefslogtreecommitdiffstats
path: root/net/flip
diff options
context:
space:
mode:
authormbelshe@chromium.org <mbelshe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-07 22:12:33 +0000
committermbelshe@chromium.org <mbelshe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-07 22:12:33 +0000
commitba051e315ca1c305a46484f2c8f282b3ec149e7a (patch)
tree358f62eb32f69324de199b57e35b393c53670c35 /net/flip
parent5964426ee7983710f70e4168908ca693eba5327f (diff)
downloadchromium_src-ba051e315ca1c305a46484f2c8f282b3ec149e7a.zip
chromium_src-ba051e315ca1c305a46484f2c8f282b3ec149e7a.tar.gz
chromium_src-ba051e315ca1c305a46484f2c8f282b3ec149e7a.tar.bz2
Linux port for flip_session.
Several minor cleanups. BUG=none TEST=none Review URL: http://codereview.chromium.org/265004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28320 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/flip')
-rw-r--r--net/flip/flip_session.cc39
-rw-r--r--net/flip/flip_session.h4
2 files changed, 25 insertions, 18 deletions
diff --git a/net/flip/flip_session.cc b/net/flip/flip_session.cc
index 1a8b1c6..d791487 100644
--- a/net/flip/flip_session.cc
+++ b/net/flip/flip_session.cc
@@ -81,7 +81,7 @@ class FlipStreamImpl {
std::string path_;
FlipDelegate* delegate_;
scoped_ptr<HttpResponseInfo> response_;
- std::list<scoped_refptr<IOBufferWithSize>> response_body_;
+ std::list<scoped_refptr<IOBufferWithSize> > response_body_;
bool data_complete_;
};
@@ -106,14 +106,12 @@ FlipSession::FlipSession(std::string host, HttpNetworkSession* session)
session_(session),
connection_started_(false),
connection_ready_(false),
- delayed_write_pending_(false),
- write_pending_(false),
read_buffer_(new IOBuffer(kReadBufferSize)),
read_pending_(false),
- stream_hi_water_mark_(0) {
- // Always start at 1 for the first stream id.
- // TODO(mbelshe): consider randomization.
- stream_hi_water_mark_ = 1;
+ stream_hi_water_mark_(1), // Always start at 1 for the first stream id.
+ delayed_write_pending_(false),
+ write_pending_(false) {
+ // TODO(mbelshe): consider randomization of the stream_hi_water_mark.
flip_framer_.set_visitor(this);
@@ -176,8 +174,17 @@ void CreateFlipHeadersFromHttpRequest(
// up to a test server.
// For testing content on our test server, we modify the URL.
GURL url = info->url;
- FilePath path = UrlToFilenameEncoder::Encode(url.spec(), FilePath());
- std::string hack_url = "/" + WideToASCII(path.value());
+ FilePath path(UrlToFilenameEncoder::Encode(url.spec(), FilePath("/")));
+
+ // We do the unusual conversion from a FilePath::StringType to
+ // an ascii string. Recognize that StringType is a wstring on windows,
+ // so a failure is technically possible, but this is just used as a test
+ // case, so it's okay. This code will be deleted.
+#if defined(OS_WIN)
+ std::string hack_url = WideToASCII(path.value());
+#else
+ std::string hack_url = path.value();
+#endif
// switch backslashes. HACK
std::string::size_type pos(0);
@@ -185,7 +192,7 @@ void CreateFlipHeadersFromHttpRequest(
hack_url.replace(pos, 1, "/");
pos += 1;
}
-#endif
+#endif // REWRITE_URLS
(*headers)["method"] = info->method;
// (*headers)["url"] = info->url.PathForRequest();
@@ -543,7 +550,8 @@ int FlipSession::GetNewStreamId() {
return id;
}
-FlipStreamImpl* FlipSession::ActivateStream(int id, FlipDelegate* delegate) {
+FlipStreamImpl* FlipSession::ActivateStream(flip::FlipStreamId id,
+ FlipDelegate* delegate) {
DCHECK(!IsStreamActive(id));
FlipStreamImpl* stream = new FlipStreamImpl(id, delegate);
@@ -551,7 +559,7 @@ FlipStreamImpl* FlipSession::ActivateStream(int id, FlipDelegate* delegate) {
return stream;
}
-void FlipSession::DeactivateStream(int id) {
+void FlipSession::DeactivateStream(flip::FlipStreamId id) {
DCHECK(IsStreamActive(id));
// Verify it is not on the pushed_streams_ list.
@@ -681,13 +689,13 @@ void FlipSession::OnSynReply(const flip::FlipSynReplyControlFrame* frame,
std::string::size_type end = 0;
do {
end = content.find("||", start);
- if (end == -1)
+ if (end == std::string::npos)
end = content.length();
std::string url = content.substr(start, end - start);
std::string::size_type pos = url.find("??");
- if (pos == -1)
+ if (pos == std::string::npos)
break;
- url = url.substr(pos+2);
+ url = url.substr(pos + 2);
GURL gurl(url);
pending_streams_[gurl.PathForRequest()] = NULL;
start = end + 2;
@@ -700,7 +708,6 @@ void FlipSession::OnSynReply(const flip::FlipSynReplyControlFrame* frame,
void FlipSession::OnControl(const flip::FlipControlFrame* frame) {
flip::FlipHeaderBlock headers;
- bool parsed_headers = false;
uint32 type = frame->type();
if (type == flip::SYN_STREAM || type == flip::SYN_REPLY) {
if (!flip_framer_.ParseHeaderBlock(
diff --git a/net/flip/flip_session.h b/net/flip/flip_session.h
index 9f21b27..ed2c9de 100644
--- a/net/flip/flip_session.h
+++ b/net/flip/flip_session.h
@@ -158,8 +158,8 @@ class FlipSession : public base::RefCounted<FlipSession>,
int GetNewStreamId();
// Track active streams in the active stream list.
- FlipStreamImpl* ActivateStream(int id, FlipDelegate* delegate);
- void DeactivateStream(int id);
+ FlipStreamImpl* ActivateStream(flip::FlipStreamId id, FlipDelegate* delegate);
+ void DeactivateStream(flip::FlipStreamId id);
// Check if we have a pending pushed-stream for this url
// Returns the stream if found (and returns it from the pending