summaryrefslogtreecommitdiffstats
path: root/net/flip
diff options
context:
space:
mode:
authormbelshe@google.com <mbelshe@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-02 04:31:31 +0000
committermbelshe@google.com <mbelshe@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-02 04:31:31 +0000
commitac790b4ed41d0bfdf3636c7744618af01bcaa4d5 (patch)
tree9bf2d8fed0e83ef1c615972303cb93217c721a43 /net/flip
parent7753c3f48f5d3fea1ac91575de75d78f8085be83 (diff)
downloadchromium_src-ac790b4ed41d0bfdf3636c7744618af01bcaa4d5.zip
chromium_src-ac790b4ed41d0bfdf3636c7744618af01bcaa4d5.tar.gz
chromium_src-ac790b4ed41d0bfdf3636c7744618af01bcaa4d5.tar.bz2
Update network priorities to support better granularity
of resource loading from WebKit into the network stack. In order to fully make these work, webkit changes are needed as well. BUG=none TEST=none Review URL: http://codereview.chromium.org/452033 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33546 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/flip')
-rw-r--r--net/flip/flip_session.cc26
-rw-r--r--net/flip/flip_session.h4
2 files changed, 9 insertions, 21 deletions
diff --git a/net/flip/flip_session.cc b/net/flip/flip_session.cc
index fc446f4..f501b58 100644
--- a/net/flip/flip_session.cc
+++ b/net/flip/flip_session.cc
@@ -210,8 +210,8 @@ FlipSession::~FlipSession() {
net::Error FlipSession::Connect(const std::string& group_name,
const HostResolver::RequestInfo& host,
- int priority) {
- DCHECK(priority >= FLIP_PRIORITY_HIGHEST && priority < FLIP_PRIORITY_LOWEST);
+ RequestPriority priority) {
+ DCHECK(priority >= FLIP_PRIORITY_HIGHEST && priority <= FLIP_PRIORITY_LOWEST);
// If the connect process is started, let the caller continue.
if (state_ > IDLE)
@@ -271,22 +271,8 @@ scoped_refptr<FlipStream> FlipSession::GetOrCreateStream(
LOG(INFO) << "FlipStream: Creating stream " << stream_id << " for " << url;
// TODO(mbelshe): Optimize memory allocations
- int priority = request.priority;
-
- // Hack for the priorities
- // TODO(mbelshe): These need to be plumbed through the Http Network Stack.
- if (path.find(".css") != path.npos) {
- priority = 1;
- } else if (path.find(".html") != path.npos) {
- priority = 0;
- } else if (path.find(".js") != path.npos) {
- priority = 1;
- } else {
- priority = 3;
- }
-
- DCHECK(priority >= FLIP_PRIORITY_HIGHEST &&
- priority <= FLIP_PRIORITY_LOWEST);
+ DCHECK(request.priority >= FLIP_PRIORITY_HIGHEST &&
+ request.priority <= FLIP_PRIORITY_LOWEST);
// Convert from HttpRequestHeaders to Flip Headers.
flip::FlipHeaderBlock headers;
@@ -298,12 +284,12 @@ scoped_refptr<FlipStream> FlipSession::GetOrCreateStream(
// Create a SYN_STREAM packet and add to the output queue.
scoped_ptr<flip::FlipSynStreamControlFrame> syn_frame(
- flip_framer_.CreateSynStream(stream_id, priority, flags, false,
+ flip_framer_.CreateSynStream(stream_id, request.priority, flags, false,
&headers));
int length = flip::FlipFrame::size() + syn_frame->length();
IOBuffer* buffer = new IOBuffer(length);
memcpy(buffer->data(), syn_frame->data(), length);
- queue_.push(FlipIOBuffer(buffer, length, priority, stream));
+ queue_.push(FlipIOBuffer(buffer, length, request.priority, stream));
static StatsCounter flip_requests("flip.requests");
flip_requests.Increment();
diff --git a/net/flip/flip_session.h b/net/flip/flip_session.h
index 545b902..a0be118 100644
--- a/net/flip/flip_session.h
+++ b/net/flip/flip_session.h
@@ -15,6 +15,7 @@
#include "net/base/io_buffer.h"
#include "net/base/load_states.h"
#include "net/base/net_errors.h"
+#include "net/base/request_priority.h"
#include "net/base/ssl_config_service.h"
#include "net/base/upload_data_stream.h"
#include "net/flip/flip_framer.h"
@@ -43,7 +44,8 @@ class FlipSession : public base::RefCounted<FlipSession>,
// Note that this call does not wait for the connect to complete. Callers can
// immediately start using the FlipSession while it connects.
net::Error Connect(const std::string& group_name,
- const HostResolver::RequestInfo& host, int priority);
+ const HostResolver::RequestInfo& host,
+ RequestPriority priority);
// Get a stream for a given |request|. In the typical case, this will involve
// the creation of a new stream (and will send the SYN frame). If the server