Skip to content

Commit

Permalink
Revert "Migrate ConnectionTypeObserver to NetworkChangeObserver in jo…
Browse files Browse the repository at this point in the history
…b_scheduler.h"

This reverts commit 817fd56.

Reason for revert: This change will cause scheduler to run even when internet is disconnected

Original change's description:
> Migrate ConnectionTypeObserver to NetworkChangeObserver in job_scheduler.h
> 
> Bug: 780475
> Change-Id: Ie6250fd2ea9221fe0bcd3578be0012527efaf11f
> Reviewed-on: https://chromium-review.googlesource.com/752941
> Reviewed-by: Ryo Hashimoto <hashimoto@chromium.org>
> Commit-Queue: Ryo Hashimoto <hashimoto@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#514108}

TBR=hashimoto@chromium.org,hirono@chromium.org,fukino@chromium.org,hidehiko@chromium.org,apenr1234@gmail.com

Change-Id: I3484058e3078193aa8651bd8f9c8e08671741d60
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 780475
Reviewed-on: https://chromium-review.googlesource.com/753710
Reviewed-by: Helen Li <xunjieli@chromium.org>
Commit-Queue: Helen Li <xunjieli@chromium.org>
Cr-Commit-Position: refs/heads/master@{#514131}
  • Loading branch information
xunjieli authored and Commit Bot committed Nov 6, 2017
1 parent 2733687 commit 71ae178
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
1 change: 0 additions & 1 deletion AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -890,7 +890,6 @@ Jan Rucka <ruckajan10@gmail.com>
Yannic Bonenberger <contact@yannic-bonenberger.com>
Kyoungdeok Kwon <kkd927@gmail.com>
Kyungyoung Heo <bbvch13531@gmail.com>
Minjeong Lee <apenr1234@gmail.com>

ACCESS CO., LTD. <*@access-company.com>
BlackBerry Limited <*@blackberry.com>
Expand Down
6 changes: 3 additions & 3 deletions components/drive/job_scheduler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ JobScheduler::JobScheduler(
queue_[i].reset(new JobQueue(kMaxJobCount[i], NUM_CONTEXT_TYPES,
kMaxBatchCount, kMaxBatchSize));

net::NetworkChangeNotifier::AddNetworkChangeObserver(this);
net::NetworkChangeNotifier::AddConnectionTypeObserver(this);
}

JobScheduler::~JobScheduler() {
Expand All @@ -208,7 +208,7 @@ JobScheduler::~JobScheduler() {
num_queued_jobs += queue_[i]->GetNumberOfJobs();
DCHECK_EQ(num_queued_jobs, job_map_.size());

net::NetworkChangeNotifier::RemoveNetworkChangeObserver(this);
net::NetworkChangeNotifier::RemoveConnectionTypeObserver(this);
}

std::vector<JobInfo> JobScheduler::GetJobInfoList() {
Expand Down Expand Up @@ -1145,7 +1145,7 @@ void JobScheduler::UpdateProgress(JobID job_id,
NotifyJobUpdated(job_entry->job_info);
}

void JobScheduler::OnNetworkChanged(
void JobScheduler::OnConnectionTypeChanged(
net::NetworkChangeNotifier::ConnectionType type) {
DCHECK(thread_checker_.CalledOnValidThread());

Expand Down
7 changes: 4 additions & 3 deletions components/drive/job_scheduler.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ struct ClientContext {
// On offline case, no jobs run. USER_INITIATED jobs fail immediately.
// BACKGROUND jobs stay in the queue and wait for network connection.
class JobScheduler
: public net::NetworkChangeNotifier::NetworkChangeObserver,
: public net::NetworkChangeNotifier::ConnectionTypeObserver,
public JobListInterface {
public:
JobScheduler(PrefService* pref_service,
Expand Down Expand Up @@ -362,8 +362,9 @@ class JobScheduler
// Updates the progress status of the specified job.
void UpdateProgress(JobID job_id, int64_t progress, int64_t total);

// net::NetworkChangeNotifier::NetworkChangeObserver override.
void OnNetworkChanged(net::NetworkChangeNotifier::ConnectionType type) override;
// net::NetworkChangeNotifier::ConnectionTypeObserver override.
void OnConnectionTypeChanged(
net::NetworkChangeNotifier::ConnectionType type) override;

// Get the type of queue the specified job should be put in.
QueueType GetJobQueueType(JobType type);
Expand Down

0 comments on commit 71ae178

Please sign in to comment.