Commit 82448223 authored by Minoru Chikamune's avatar Minoru Chikamune Committed by Commit Bot

[MBI] Remove IPCTaskRunner usage on StorageController

We are going to remove ipc_task_queue and ipc_task_runner. The scheduling policy of ipc_task_queue is the same as the default task queue. Nowadays, we are using per-frame task queues as much as possible. And if there are no relevant per-frame task queues, then we can use the (per-isolate) default task queues.

[related design doc section]
https://docs.google.com/document/d/1y-vHkrD1z2RtyWYwT6rJkSLHClYNjDDpUbTtBU7l95A/edit#bookmark=id.eeuir8g768ou

Bug: 1105403
Change-Id: Ie9c760ee47151c32d094e43168e8e94e561344ae
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2332088
Commit-Queue: Minoru Chikamune <chikamune@chromium.org>
Reviewed-by: default avatarAlexander Timin <altimin@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Reviewed-by: default avatarKouhei Ueno <kouhei@chromium.org>
Reviewed-by: default avatarTal Pressman <talp@chromium.org>
Cr-Commit-Position: refs/heads/master@{#794791}
parent e91d8938
...@@ -181,12 +181,12 @@ String CachedStorageArea::RegisterSource(Source* source) { ...@@ -181,12 +181,12 @@ String CachedStorageArea::RegisterSource(Source* source) {
CachedStorageArea::CachedStorageArea( CachedStorageArea::CachedStorageArea(
AreaType type, AreaType type,
scoped_refptr<const SecurityOrigin> origin, scoped_refptr<const SecurityOrigin> origin,
scoped_refptr<base::SingleThreadTaskRunner> ipc_runner, scoped_refptr<base::SingleThreadTaskRunner> task_runner,
StorageNamespace* storage_namespace) StorageNamespace* storage_namespace)
: type_(type), : type_(type),
origin_(std::move(origin)), origin_(std::move(origin)),
storage_namespace_(storage_namespace), storage_namespace_(storage_namespace),
ipc_task_runner_(std::move(ipc_runner)), task_runner_(std::move(task_runner)),
areas_(MakeGarbageCollected<HeapHashMap<WeakMember<Source>, String>>()) { areas_(MakeGarbageCollected<HeapHashMap<WeakMember<Source>, String>>()) {
BindStorageArea(); BindStorageArea();
base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider(
...@@ -204,17 +204,16 @@ void CachedStorageArea::BindStorageArea( ...@@ -204,17 +204,16 @@ void CachedStorageArea::BindStorageArea(
// Some tests may not provide a StorageNamespace. // Some tests may not provide a StorageNamespace.
DCHECK(!remote_area_); DCHECK(!remote_area_);
if (new_area) { if (new_area) {
remote_area_.Bind(std::move(new_area), ipc_task_runner_); remote_area_.Bind(std::move(new_area), task_runner_);
} else if (storage_namespace_) { } else if (storage_namespace_) {
storage_namespace_->BindStorageArea( storage_namespace_->BindStorageArea(
origin_, remote_area_.BindNewPipeAndPassReceiver(ipc_task_runner_)); origin_, remote_area_.BindNewPipeAndPassReceiver(task_runner_));
} else { } else {
return; return;
} }
receiver_.reset(); receiver_.reset();
remote_area_->AddObserver( remote_area_->AddObserver(receiver_.BindNewPipeAndPassRemote(task_runner_));
receiver_.BindNewPipeAndPassRemote(ipc_task_runner_));
} }
void CachedStorageArea::ResetConnection( void CachedStorageArea::ResetConnection(
......
...@@ -177,7 +177,7 @@ class MODULES_EXPORT CachedStorageArea ...@@ -177,7 +177,7 @@ class MODULES_EXPORT CachedStorageArea
const AreaType type_; const AreaType type_;
const scoped_refptr<const SecurityOrigin> origin_; const scoped_refptr<const SecurityOrigin> origin_;
const WeakPersistent<StorageNamespace> storage_namespace_; const WeakPersistent<StorageNamespace> storage_namespace_;
const scoped_refptr<base::SingleThreadTaskRunner> ipc_task_runner_; const scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
std::unique_ptr<StorageAreaMap> map_; std::unique_ptr<StorageAreaMap> map_;
......
...@@ -42,12 +42,13 @@ StorageController::DomStorageConnection GetDomStorageConnection() { ...@@ -42,12 +42,13 @@ StorageController::DomStorageConnection GetDomStorageConnection() {
// static // static
StorageController* StorageController::GetInstance() { StorageController* StorageController::GetInstance() {
DEFINE_STATIC_LOCAL(StorageController, gCachedStorageAreaController, DEFINE_STATIC_LOCAL(
(GetDomStorageConnection(), StorageController, gCachedStorageAreaController,
Thread::MainThread()->Scheduler()->IPCTaskRunner(), (GetDomStorageConnection(),
base::SysInfo::IsLowEndDevice() Thread::MainThread()->Scheduler()->DeprecatedDefaultTaskRunner(),
? kStorageControllerTotalCacheLimitInBytesLowEnd base::SysInfo::IsLowEndDevice()
: kStorageControllerTotalCacheLimitInBytes)); ? kStorageControllerTotalCacheLimitInBytesLowEnd
: kStorageControllerTotalCacheLimitInBytes));
return &gCachedStorageAreaController; return &gCachedStorageAreaController;
} }
...@@ -63,9 +64,9 @@ bool StorageController::CanAccessStorageArea(LocalFrame* frame, ...@@ -63,9 +64,9 @@ bool StorageController::CanAccessStorageArea(LocalFrame* frame,
StorageController::StorageController( StorageController::StorageController(
DomStorageConnection connection, DomStorageConnection connection,
scoped_refptr<base::SingleThreadTaskRunner> ipc_runner, scoped_refptr<base::SingleThreadTaskRunner> task_runner,
size_t total_cache_limit) size_t total_cache_limit)
: ipc_runner_(std::move(ipc_runner)), : task_runner_(std::move(task_runner)),
namespaces_(MakeGarbageCollected< namespaces_(MakeGarbageCollected<
HeapHashMap<String, WeakMember<StorageNamespace>>>()), HeapHashMap<String, WeakMember<StorageNamespace>>>()),
total_cache_limit_(total_cache_limit), total_cache_limit_(total_cache_limit),
......
...@@ -62,7 +62,7 @@ class MODULES_EXPORT StorageController : public mojom::blink::DomStorageClient { ...@@ -62,7 +62,7 @@ class MODULES_EXPORT StorageController : public mojom::blink::DomStorageClient {
mojo::PendingReceiver<mojom::blink::DomStorageClient> client_receiver; mojo::PendingReceiver<mojom::blink::DomStorageClient> client_receiver;
}; };
StorageController(DomStorageConnection connection, StorageController(DomStorageConnection connection,
scoped_refptr<base::SingleThreadTaskRunner> ipc_runner, scoped_refptr<base::SingleThreadTaskRunner> task_runner,
size_t total_cache_limit); size_t total_cache_limit);
// Creates a MakeGarbageCollected<StorageNamespace> for Session storage, and // Creates a MakeGarbageCollected<StorageNamespace> for Session storage, and
...@@ -92,8 +92,8 @@ class MODULES_EXPORT StorageController : public mojom::blink::DomStorageClient { ...@@ -92,8 +92,8 @@ class MODULES_EXPORT StorageController : public mojom::blink::DomStorageClient {
return dom_storage_remote_.get(); return dom_storage_remote_.get();
} }
scoped_refptr<base::SingleThreadTaskRunner> IPCTaskRunner() { scoped_refptr<base::SingleThreadTaskRunner> TaskRunner() {
return ipc_runner_; return task_runner_;
} }
private: private:
...@@ -102,7 +102,7 @@ class MODULES_EXPORT StorageController : public mojom::blink::DomStorageClient { ...@@ -102,7 +102,7 @@ class MODULES_EXPORT StorageController : public mojom::blink::DomStorageClient {
// mojom::blink::DomStorageClient: // mojom::blink::DomStorageClient:
void ResetStorageAreaAndNamespaceConnections() override; void ResetStorageAreaAndNamespaceConnections() override;
scoped_refptr<base::SingleThreadTaskRunner> ipc_runner_; scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
Persistent<HeapHashMap<String, WeakMember<StorageNamespace>>> namespaces_; Persistent<HeapHashMap<String, WeakMember<StorageNamespace>>> namespaces_;
Persistent<StorageNamespace> local_storage_namespace_; Persistent<StorageNamespace> local_storage_namespace_;
size_t total_cache_limit_; size_t total_cache_limit_;
......
...@@ -101,7 +101,7 @@ scoped_refptr<CachedStorageArea> StorageNamespace::GetCachedArea( ...@@ -101,7 +101,7 @@ scoped_refptr<CachedStorageArea> StorageNamespace::GetCachedArea(
result = base::MakeRefCounted<CachedStorageArea>( result = base::MakeRefCounted<CachedStorageArea>(
IsSessionStorage() ? CachedStorageArea::AreaType::kSessionStorage IsSessionStorage() ? CachedStorageArea::AreaType::kSessionStorage
: CachedStorageArea::AreaType::kLocalStorage, : CachedStorageArea::AreaType::kLocalStorage,
origin, controller_->IPCTaskRunner(), this); origin, controller_->TaskRunner(), this);
cached_areas_.insert(std::move(origin), result); cached_areas_.insert(std::move(origin), result);
return result; return result;
} }
...@@ -212,7 +212,7 @@ void StorageNamespace::EnsureConnected() { ...@@ -212,7 +212,7 @@ void StorageNamespace::EnsureConnected() {
return; return;
controller_->dom_storage()->BindSessionStorageNamespace( controller_->dom_storage()->BindSessionStorageNamespace(
namespace_id_, namespace_id_,
namespace_.BindNewPipeAndPassReceiver(controller_->IPCTaskRunner())); namespace_.BindNewPipeAndPassReceiver(controller_->TaskRunner()));
} }
} // namespace blink } // namespace blink
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