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

Side by Side Diff: components/cronet/android/wrapped_channel_upload_element_reader.h

Issue 2361413002: Obliterate legacy cronet API. All of its users have been migrated. (Closed)
Patch Set: Created 4 years, 3 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_CRONET_ANDROID_WRAPPED_CHANNEL_UPLOAD_ELEMENT_READER_H_
6 #define COMPONENTS_CRONET_ANDROID_WRAPPED_CHANNEL_UPLOAD_ELEMENT_READER_H_
7
8 #include <stdint.h>
9
10 #include "base/compiler_specific.h"
11 #include "base/macros.h"
12 #include "components/cronet/android/url_request_adapter.h"
13 #include "net/base/completion_callback.h"
14 #include "net/base/upload_element_reader.h"
15
16 namespace net {
17 class IOBuffer;
18 } // namespace net
19
20 namespace cronet {
21
22 // An UploadElementReader implementation for
23 // java.nio.channels.ReadableByteChannel.
24 // |channel_| should outlive this class because this class does not take the
25 // ownership of the data.
26 class WrappedChannelElementReader : public net::UploadElementReader {
27 public:
28 WrappedChannelElementReader(
29 scoped_refptr<URLRequestAdapter::URLRequestAdapterDelegate> delegate,
30 uint64_t length);
31 ~WrappedChannelElementReader() override;
32
33 // UploadElementReader overrides:
34 int Init(const net::CompletionCallback& callback) override;
35 uint64_t GetContentLength() const override;
36 uint64_t BytesRemaining() const override;
37 bool IsInMemory() const override;
38 int Read(net::IOBuffer* buf,
39 int buf_length,
40 const net::CompletionCallback& callback) override;
41
42 private:
43 const uint64_t length_;
44 uint64_t offset_;
45 scoped_refptr<URLRequestAdapter::URLRequestAdapterDelegate> delegate_;
46
47 DISALLOW_COPY_AND_ASSIGN(WrappedChannelElementReader);
48 };
49
50 } // namespace cronet
51
52 #endif // COMPONENTS_CRONET_ANDROID_WRAPPED_CHANNEL_UPLOAD_ELEMENT_READER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698