Commit bc1d9f49 authored by Salvador Guerrero's avatar Salvador Guerrero Committed by Commit Bot

Removed unneeded taskrunner in proto db provider

ProtoDatabaseProvider had an unused refptr to a TaskRunner, this CL
removes it and updates some comments.

Bug: 870813
Change-Id: I3980842c4741f2e84f93dcd8070c338b08cf3b28
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1538996
Commit-Queue: ssid <ssid@chromium.org>
Reviewed-by: default avatarssid <ssid@chromium.org>
Cr-Commit-Position: refs/heads/master@{#644661}
parent 722f3c1c
...@@ -26,10 +26,7 @@ const char kSharedProtoDatabaseDirectory[] = "shared_proto_db"; ...@@ -26,10 +26,7 @@ const char kSharedProtoDatabaseDirectory[] = "shared_proto_db";
ProtoDatabaseProvider::ProtoDatabaseProvider(const base::FilePath& profile_dir) ProtoDatabaseProvider::ProtoDatabaseProvider(const base::FilePath& profile_dir)
: profile_dir_(profile_dir), : profile_dir_(profile_dir),
task_runner_(base::CreateSequencedTaskRunnerWithTraits( client_task_runner_(base::SequencedTaskRunnerHandle::Get()),
{base::MayBlock(), base::TaskPriority::BEST_EFFORT,
base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN})),
creation_sequence_(base::SequencedTaskRunnerHandle::Get()),
weak_factory_(this) {} weak_factory_(this) {}
ProtoDatabaseProvider::~ProtoDatabaseProvider() = default; ProtoDatabaseProvider::~ProtoDatabaseProvider() = default;
......
...@@ -62,14 +62,11 @@ class ProtoDatabaseProvider : public KeyedService { ...@@ -62,14 +62,11 @@ class ProtoDatabaseProvider : public KeyedService {
base::FilePath profile_dir_; base::FilePath profile_dir_;
scoped_refptr<SharedProtoDatabase> db_; scoped_refptr<SharedProtoDatabase> db_;
base::Lock get_db_lock_; base::Lock get_db_lock_;
// The SequencedTaskRunner used to ensure thread-safe behaviour for
// GetSharedDBInstance when called from multiple clients.
scoped_refptr<base::SequencedTaskRunner> task_runner_;
// We store the creation sequence because we want to use that to make requests // We store the creation sequence because the SharedProtoDatabaseProvider uses
// to the main provider that rely on WeakPtrs from this, so they're all // it to make requests to the main provider that rely on WeakPtrs from here,
// invalidated/checked on the same sequence. // so they're all invalidated/checked on the same sequence.
scoped_refptr<base::SequencedTaskRunner> creation_sequence_; scoped_refptr<base::SequencedTaskRunner> client_task_runner_;
base::WeakPtrFactory<ProtoDatabaseProvider> weak_factory_; base::WeakPtrFactory<ProtoDatabaseProvider> weak_factory_;
...@@ -84,7 +81,7 @@ std::unique_ptr<ProtoDatabase<P, T>> ProtoDatabaseProvider::GetDB( ...@@ -84,7 +81,7 @@ std::unique_ptr<ProtoDatabase<P, T>> ProtoDatabaseProvider::GetDB(
return base::WrapUnique(new ProtoDatabaseImpl<P, T>( return base::WrapUnique(new ProtoDatabaseImpl<P, T>(
db_type, unique_db_dir, task_runner, db_type, unique_db_dir, task_runner,
base::WrapUnique(new SharedProtoDatabaseProvider( base::WrapUnique(new SharedProtoDatabaseProvider(
creation_sequence_, weak_factory_.GetWeakPtr())))); client_task_runner_, weak_factory_.GetWeakPtr()))));
} }
} // namespace leveldb_proto } // namespace leveldb_proto
......
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