summaryrefslogtreecommitdiffstats
path: root/net/spdy/spdy_io_buffer.cc
blob: f0c14b12f6aad8852d194cf8dec673937e60eb3b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// 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.

#include "net/spdy/spdy_io_buffer.h"
#include "net/spdy/spdy_stream.h"

namespace net {

// static
uint64 SpdyIOBuffer::order_ = 0;

SpdyIOBuffer::SpdyIOBuffer(
    IOBuffer* buffer, int size, RequestPriority priority, SpdyStream* stream)
  : buffer_(new DrainableIOBuffer(buffer, size)),
    priority_(priority),
    position_(++order_),
    stream_(stream) {}

SpdyIOBuffer::SpdyIOBuffer() : priority_(HIGHEST), position_(0), stream_(NULL) {
}

SpdyIOBuffer::SpdyIOBuffer(const SpdyIOBuffer& rhs) {
  buffer_ = rhs.buffer_;
  priority_ = rhs.priority_;
  position_ = rhs.position_;
  stream_ = rhs.stream_;
}

SpdyIOBuffer::~SpdyIOBuffer() {}

SpdyIOBuffer& SpdyIOBuffer::operator=(const SpdyIOBuffer& rhs) {
  buffer_ = rhs.buffer_;
  priority_ = rhs.priority_;
  position_ = rhs.position_;
  stream_ = rhs.stream_;
  return *this;
}

void SpdyIOBuffer::release() {
  buffer_ = NULL;
  stream_ = NULL;
}

}  // namespace net