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 { ...@@ -66,8 +66,7 @@ struct RecordHeader {
// static // static
void StorageQueue::Create( void StorageQueue::Create(
const Options& options, const Options& options,
base::RepeatingCallback<StatusOr<scoped_refptr<UploaderInterface>>()> StartUploadCb start_upload_cb,
start_upload_cb,
base::OnceCallback<void(StatusOr<scoped_refptr<StorageQueue>>)> base::OnceCallback<void(StatusOr<scoped_refptr<StorageQueue>>)>
completion_cb) { completion_cb) {
// Initialize StorageQueue object loading the data. // Initialize StorageQueue object loading the data.
...@@ -112,10 +111,8 @@ void StorageQueue::Create( ...@@ -112,10 +111,8 @@ void StorageQueue::Create(
std::move(completion_cb)); std::move(completion_cb));
} }
StorageQueue::StorageQueue( StorageQueue::StorageQueue(const Options& options,
const Options& options, StartUploadCb start_upload_cb)
base::RepeatingCallback<StatusOr<scoped_refptr<UploaderInterface>>()>
start_upload_cb)
: options_(options), : options_(options),
start_upload_cb_(std::move(start_upload_cb)), start_upload_cb_(std::move(start_upload_cb)),
sequenced_task_runner_(base::ThreadPool::CreateSequencedTaskRunner( sequenced_task_runner_(base::ThreadPool::CreateSequencedTaskRunner(
......
...@@ -119,6 +119,10 @@ class StorageQueue : public base::RefCountedThreadSafe<StorageQueue> { ...@@ -119,6 +119,10 @@ class StorageQueue : public base::RefCountedThreadSafe<StorageQueue> {
friend class base::RefCountedThreadSafe<UploaderInterface>; 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 // Creates StorageQueue instance with the specified options, and returns it
// with the |completion_cb| callback. |start_upload_cb| is a factory callback // with the |completion_cb| callback. |start_upload_cb| is a factory callback
// that instantiates UploaderInterface every time the queue starts uploading // that instantiates UploaderInterface every time the queue starts uploading
...@@ -126,8 +130,7 @@ class StorageQueue : public base::RefCountedThreadSafe<StorageQueue> { ...@@ -126,8 +130,7 @@ class StorageQueue : public base::RefCountedThreadSafe<StorageQueue> {
// upon explicit Flush request). // upon explicit Flush request).
static void Create( static void Create(
const Options& options, const Options& options,
base::RepeatingCallback<StatusOr<scoped_refptr<UploaderInterface>>()> StartUploadCb start_upload_cb,
start_upload_cb,
base::OnceCallback<void(StatusOr<scoped_refptr<StorageQueue>>)> base::OnceCallback<void(StatusOr<scoped_refptr<StorageQueue>>)>
completion_cb); completion_cb);
...@@ -215,10 +218,7 @@ class StorageQueue : public base::RefCountedThreadSafe<StorageQueue> { ...@@ -215,10 +218,7 @@ class StorageQueue : public base::RefCountedThreadSafe<StorageQueue> {
}; };
// Private constructor, to be called by Create factory method only. // Private constructor, to be called by Create factory method only.
StorageQueue( StorageQueue(const Options& options, StartUploadCb start_upload_cb);
const Options& options,
base::RepeatingCallback<StatusOr<scoped_refptr<UploaderInterface>>()>
start_upload_cb);
// Initializes the object by enumerating files in the assigned directory // Initializes the object by enumerating files in the assigned directory
// and determines the sequencing information of the last record. // and determines the sequencing information of the last record.
...@@ -308,8 +308,7 @@ class StorageQueue : public base::RefCountedThreadSafe<StorageQueue> { ...@@ -308,8 +308,7 @@ class StorageQueue : public base::RefCountedThreadSafe<StorageQueue> {
base::RepeatingTimer upload_timer_; base::RepeatingTimer upload_timer_;
// Upload provider callback. // Upload provider callback.
base::RepeatingCallback<StatusOr<scoped_refptr<UploaderInterface>>()> const StartUploadCb start_upload_cb_;
start_upload_cb_;
// Sequential task runner for all activities in this StorageQueue. // Sequential task runner for all activities in this StorageQueue.
scoped_refptr<base::SequencedTaskRunner> sequenced_task_runner_; 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