Skip to content

Commit

Permalink
Refactor QuotaManagerHost to take a StorageKey
Browse files Browse the repository at this point in the history
This CL is part of an on-going effort to migrate the Quota storage APIs
to use StorageKey instead of Origin.

Bug: 1215208
Change-Id: Ib9b7703b49790fb3e0195d4293566569511b5126
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2982920
Reviewed-by: Ayu Ishii <ayui@chromium.org>
Commit-Queue: Ali Beyad <abeyad@chromium.org>
Cr-Commit-Position: refs/heads/master@{#895426}
  • Loading branch information
abeyad authored and Chromium LUCI CQ committed Jun 24, 2021
1 parent 200f535 commit bb2172d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
2 changes: 1 addition & 1 deletion content/browser/quota/quota_context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ void QuotaContext::BindQuotaManagerHostOnIOThread(

// The quota manager currently runs on the I/O thread.
auto host = std::make_unique<QuotaManagerHost>(
process_id, render_frame_id, storage_key.origin(), quota_manager_.get(),
process_id, render_frame_id, storage_key, quota_manager_.get(),
permission_context_.get(), quota_change_dispatcher_);
auto* host_ptr = host.get();
receivers_.Add(host_ptr, std::move(receiver), std::move(host));
Expand Down
4 changes: 2 additions & 2 deletions content/browser/quota/quota_manager_host.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ namespace content {
QuotaManagerHost::QuotaManagerHost(
int process_id,
int render_frame_id,
const url::Origin& origin,
const blink::StorageKey& storage_key,
storage::QuotaManager* quota_manager,
QuotaPermissionContext* permission_context,
scoped_refptr<QuotaChangeDispatcher> quota_change_dispatcher)
: process_id_(process_id),
render_frame_id_(render_frame_id),
storage_key_(blink::StorageKey(origin)),
storage_key_(storage_key),
quota_manager_(quota_manager),
permission_context_(permission_context),
quota_change_dispatcher_(std::move(quota_change_dispatcher)) {
Expand Down
12 changes: 3 additions & 9 deletions content/browser/quota/quota_manager_host.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,10 @@ namespace storage {
class QuotaManager;
}

namespace url {
class Origin;
}

namespace content {
class QuotaPermissionContext;

// Implements the Quota (Storage) API for a single origin.
// Implements the Quota (Storage) API for a single StorageKey.
//
// QuotaContext indirectly owns all QuotaManagerHost instances associated with a
// StoragePartition. A new instance is created for every incoming mojo
Expand All @@ -41,14 +37,12 @@ class QuotaPermissionContext;
// is likely to change when QuotaManager moves to the Storage Service.
class QuotaManagerHost : public blink::mojom::QuotaManagerHost {
public:
// The owner must guarantee that |quota_manager| and |permission_context|
// The owner must guarantee that `quota_manager` and `permission_context`
// outlive this instance.
// TODO(crbug.com/1215208): Change the constructor to take a StorageKey
// instead of an Origin.
QuotaManagerHost(
int process_id,
int render_frame_id,
const url::Origin& origin,
const blink::StorageKey& storage_key,
storage::QuotaManager* quota_manager,
QuotaPermissionContext* permission_context,
scoped_refptr<QuotaChangeDispatcher> quota_change_dispatcher);
Expand Down

0 comments on commit bb2172d

Please sign in to comment.