summaryrefslogtreecommitdiffstats
path: root/net/base/upload_data.cc
blob: 48cb2020f985d514f3340c1db9e94dcf34ef92e6 (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
// 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/base/upload_data.h"

#include "base/logging.h"

namespace net {

UploadData::UploadData()
    : identifier_(0),
      is_chunked_(false),
      last_chunk_appended_(false) {
}

void UploadData::AppendBytes(const char* bytes, int bytes_len) {
  DCHECK(!is_chunked_);
  if (bytes_len > 0) {
    elements_.push_back(new UploadElement());
    elements_.back()->SetToBytes(bytes, bytes_len);
  }
}

void UploadData::AppendFileRange(const base::FilePath& file_path,
                                 uint64 offset, uint64 length,
                                 const base::Time& expected_modification_time) {
  DCHECK(!is_chunked_);
  elements_.push_back(new UploadElement());
  elements_.back()->SetToFilePathRange(file_path, offset, length,
                                       expected_modification_time);
}

UploadData::~UploadData() {
}

}  // namespace net