Commit bf6484e3 authored by Leonid Baraz's avatar Leonid Baraz Committed by Commit Bot

Define an alias for start upload callback in StorageQueue.

No changes in semantics, only readability improvement.

Bug: b:153364303
Change-Id: I3f7e2b102c9ee5b34492e39872d506b205af0be8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2254465Reviewed-by: default avatarZach Trudo <zatrudo@google.com>
Commit-Queue: Leonid Baraz <lbaraz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#780446}
parent cd66c428
......@@ -66,8 +66,7 @@ struct RecordHeader {
// static
void StorageQueue::Create(
const Options& options,
base::RepeatingCallback<StatusOr<scoped_refptr<UploaderInterface>>()>
start_upload_cb,
StartUploadCb start_upload_cb,
base::OnceCallback<void(StatusOr<scoped_refptr<StorageQueue>>)>
completion_cb) {
// Initialize StorageQueue object loading the data.
......@@ -112,10 +111,8 @@ void StorageQueue::Create(
std::move(completion_cb));
}
StorageQueue::StorageQueue(
const Options& options,
base::RepeatingCallback<StatusOr<scoped_refptr<UploaderInterface>>()>
start_upload_cb)
StorageQueue::StorageQueue(const Options& options,
StartUploadCb start_upload_cb)
: options_(options),
start_upload_cb_(std::move(start_upload_cb)),
sequenced_task_runner_(base::ThreadPool::CreateSequencedTaskRunner(
......
......@@ -119,6 +119,10 @@ class StorageQueue : public base::RefCountedThreadSafe<StorageQueue> {
friend class base::RefCountedThreadSafe<UploaderInterface>;
};
// Callback type for UploadInterface provider for this queue.
using StartUploadCb =
base::RepeatingCallback<StatusOr<scoped_refptr<UploaderInterface>>()>;
// Creates StorageQueue instance with the specified options, and returns it
// with the |completion_cb| callback. |start_upload_cb| is a factory callback
// that instantiates UploaderInterface every time the queue starts uploading
......@@ -126,8 +130,7 @@ class StorageQueue : public base::RefCountedThreadSafe<StorageQueue> {
// upon explicit Flush request).
static void Create(
const Options& options,
base::RepeatingCallback<StatusOr<scoped_refptr<UploaderInterface>>()>
start_upload_cb,
StartUploadCb start_upload_cb,
base::OnceCallback<void(StatusOr<scoped_refptr<StorageQueue>>)>
completion_cb);
......@@ -215,10 +218,7 @@ class StorageQueue : public base::RefCountedThreadSafe<StorageQueue> {
};
// Private constructor, to be called by Create factory method only.
StorageQueue(
const Options& options,
base::RepeatingCallback<StatusOr<scoped_refptr<UploaderInterface>>()>
start_upload_cb);
StorageQueue(const Options& options, StartUploadCb start_upload_cb);
// Initializes the object by enumerating files in the assigned directory
// and determines the sequencing information of the last record.
......@@ -308,8 +308,7 @@ class StorageQueue : public base::RefCountedThreadSafe<StorageQueue> {
base::RepeatingTimer upload_timer_;
// Upload provider callback.
base::RepeatingCallback<StatusOr<scoped_refptr<UploaderInterface>>()>
start_upload_cb_;
const StartUploadCb start_upload_cb_;
// Sequential task runner for all activities in this StorageQueue.
scoped_refptr<base::SequencedTaskRunner> sequenced_task_runner_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment