Commit d013359a authored by Joshua Bell's avatar Joshua Bell Committed by Commit Bot

Web Locks: Make LockManager non-refcounted

The manager had only a single owner (StoragePartitionImpl) so there
was no reason it needed to be refcounted. Change ownership to be
unique_ptr.

Change-Id: Iea1895ecc41cb9614ef0f5624a6b0cfbc037e6bb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2028121
Auto-Submit: Joshua Bell <jsbell@chromium.org>
Commit-Queue: Marijn Kruisselbrink <mek@chromium.org>
Reviewed-by: default avatarMarijn Kruisselbrink <mek@chromium.org>
Cr-Commit-Position: refs/heads/master@{#736634}
parent 6151a380
......@@ -9,7 +9,6 @@
#include <string>
#include "base/callback.h"
#include "base/memory/ref_counted.h"
#include "base/sequence_checker.h"
#include "content/public/browser/browser_context.h"
#include "mojo/public/cpp/bindings/receiver_set.h"
......@@ -21,10 +20,10 @@ namespace content {
// One instance of this exists per StoragePartition, and services multiple
// child processes/origins. An instance must only be used on the sequence
// it was created on.
class LockManager : public base::RefCountedThreadSafe<LockManager>,
public blink::mojom::LockManager {
class LockManager : public blink::mojom::LockManager {
public:
LockManager();
~LockManager() override;
// Binds |receiver| to this LockManager. |receiver| belongs to a frame or
// worker at |origin| hosted by |render_process_id|. If it belongs to a frame,
......@@ -48,10 +47,6 @@ class LockManager : public base::RefCountedThreadSafe<LockManager>,
// Called to request a snapshot of the current lock state for an origin.
void QueryState(QueryStateCallback callback) override;
protected:
friend class base::RefCountedThreadSafe<LockManager>;
~LockManager() override;
private:
// Internal representation of a lock request or held lock.
class Lock;
......
......@@ -1318,7 +1318,7 @@ void StoragePartitionImpl::Initialize() {
relative_partition_path_, browser_context_->GetSpecialStoragePolicy());
idle_manager_ = std::make_unique<IdleManager>();
lock_manager_ = new LockManager();
lock_manager_ = std::make_unique<LockManager>();
base::FilePath path = is_in_memory_ ? base::FilePath() : partition_path_;
indexed_db_context_ = new IndexedDBContextImpl(
......
......@@ -436,7 +436,7 @@ class CONTENT_EXPORT StoragePartitionImpl
scoped_refptr<storage::DatabaseTracker> database_tracker_;
scoped_refptr<DOMStorageContextWrapper> dom_storage_context_;
std::unique_ptr<IdleManager> idle_manager_;
scoped_refptr<LockManager> lock_manager_;
std::unique_ptr<LockManager> lock_manager_;
mojo::Remote<storage::mojom::IndexedDBControl> indexed_db_control_;
scoped_refptr<IndexedDBContextImpl> indexed_db_context_;
scoped_refptr<CacheStorageContextImpl> cache_storage_context_;
......
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