5
5
#include " net/filter/fuzzed_source_stream.h"
6
6
7
7
#include < algorithm>
8
+ #include < utility>
8
9
9
10
#include " base/test/fuzzed_data_provider.h"
10
11
#include " base/threading/thread_task_runner_handle.h"
@@ -32,7 +33,7 @@ FuzzedSourceStream::~FuzzedSourceStream() {
32
33
33
34
int FuzzedSourceStream::Read (IOBuffer* buf,
34
35
int buf_len,
35
- const CompletionCallback& callback) {
36
+ CompletionOnceCallback callback) {
36
37
DCHECK (!read_pending_);
37
38
DCHECK (!end_returned_);
38
39
DCHECK_LE (0 , buf_len);
@@ -59,17 +60,17 @@ int FuzzedSourceStream::Read(IOBuffer* buf,
59
60
read_pending_ = true ;
60
61
// |this| is owned by the caller so use base::Unretained is safe.
61
62
base::ThreadTaskRunnerHandle::Get ()->PostTask (
62
- FROM_HERE,
63
- base::Bind (&FuzzedSourceStream::OnReadComplete, base::Unretained ( this ),
64
- callback, data, pending_read_buf, result));
63
+ FROM_HERE, base::BindOnce (&FuzzedSourceStream::OnReadComplete,
64
+ base::Unretained ( this ), std::move (callback ),
65
+ data, pending_read_buf, result));
65
66
return ERR_IO_PENDING;
66
67
}
67
68
68
69
std::string FuzzedSourceStream::Description () const {
69
70
return " " ;
70
71
}
71
72
72
- void FuzzedSourceStream::OnReadComplete (const CompletionCallback& callback,
73
+ void FuzzedSourceStream::OnReadComplete (CompletionOnceCallback callback,
73
74
const std::string& fuzzed_data,
74
75
scoped_refptr<IOBuffer> read_buf,
75
76
int result) {
@@ -82,7 +83,7 @@ void FuzzedSourceStream::OnReadComplete(const CompletionCallback& callback,
82
83
end_returned_ = true ;
83
84
}
84
85
read_pending_ = false ;
85
- callback.Run (result);
86
+ std::move ( callback) .Run (result);
86
87
}
87
88
88
89
} // namespace net
0 commit comments