Commit de24c6dc authored by rlanday's avatar rlanday Committed by Commit bot

Part 2 of base::IDMap refactor to eliminate IDMapOwnPointer/IDMapExternalPointer modes

Now callers directly specify what type of pointer they want IDMap to
hold using the template parameter.

Part 1 is at https://codereview.chromium.org/2480293004/

BUG=647091

TBR=dbeam (for chrome/browser/ui/webui/options/certificate_manager_handler.cc)
TBR=jam (for all other non-base/ changes)

Review-Url: https://codereview.chromium.org/2496653002
Cr-Commit-Position: refs/heads/master@{#435539}
parent 34f2af6b
......@@ -63,7 +63,7 @@ class AwPermissionManager : public content::PermissionManager {
private:
class PendingRequest;
using PendingRequestsMap = IDMap<PendingRequest, IDMapOwnPointer>;
using PendingRequestsMap = IDMap<std::unique_ptr<PendingRequest>>;
virtual int GetRenderProcessID(content::RenderFrameHost* render_frame_host);
virtual int GetRenderFrameID(content::RenderFrameHost* render_frame_host);
......
......@@ -73,7 +73,7 @@ AwContentsClientBridge::~AwContentsClientBridge() {
Java_AwContentsClientBridge_setNativeContentsClientBridge(env, obj, 0);
}
for (IDMap<content::ClientCertificateDelegate>::iterator iter(
for (IDMap<content::ClientCertificateDelegate*>::iterator iter(
&pending_client_cert_request_delegates_);
!iter.IsAtEnd(); iter.Advance()) {
delete iter.GetCurrentValue();
......
......@@ -95,12 +95,12 @@ class AwContentsClientBridge : public AwContentsClientBridgeBase {
typedef const base::Callback<void(content::CertificateRequestResultType)>
CertErrorCallback;
IDMap<CertErrorCallback, IDMapOwnPointer> pending_cert_error_callbacks_;
IDMap<content::JavaScriptDialogManager::DialogClosedCallback, IDMapOwnPointer>
IDMap<std::unique_ptr<CertErrorCallback>> pending_cert_error_callbacks_;
IDMap<std::unique_ptr<content::JavaScriptDialogManager::DialogClosedCallback>>
pending_js_dialog_callbacks_;
// |pending_client_cert_request_delegates_| owns its pointers, but IDMap
// doesn't provide Release, so ownership is managed manually.
IDMap<content::ClientCertificateDelegate>
IDMap<content::ClientCertificateDelegate*>
pending_client_cert_request_delegates_;
};
......
......@@ -17,18 +17,6 @@
#include "base/macros.h"
#include "base/sequence_checker.h"
// Ownership semantics:
// - OwnPointer means we store a unique_ptr that owns the object (so the
// object is deleted in Remove() and during destruction).
// - ExternalPointer means we store a raw pointer and don't own the object
// TODO (http://crbug.com/647091): eliminate this enum, replace OwnPointer
// mode in callsites with IDMap<unique_ptr<T>>
enum IDMapOwnershipSemantics {
IDMapExternalPointer,
IDMapOwnPointer
};
// This object maintains a list of IDs that can be quickly converted to
// pointers to objects. It is implemented as a hash table, optimized for
// relatively small data sets (in the common case, there will be exactly one
......@@ -37,19 +25,16 @@ enum IDMapOwnershipSemantics {
// Items can be inserted into the container with arbitrary ID, but the caller
// must ensure they are unique. Inserting IDs and relying on automatically
// generated ones is not allowed because they can collide.
//
// This class does not have a virtual destructor, do not inherit from it when
// ownership semantics are set to own because pointers will leak.
template <typename T,
IDMapOwnershipSemantics OS = IDMapExternalPointer,
typename K = int32_t>
class IDMap {
// The map's value type (the V param) can be any dereferenceable type, such as a
// raw pointer or smart pointer
template <typename V, typename K = int32_t>
class IDMap final {
public:
using KeyType = K;
private:
using V = typename std::
conditional<OS == IDMapExternalPointer, T*, std::unique_ptr<T>>::type;
using T = typename std::remove_reference<decltype(*V())>::type;
using HashTable = base::hash_map<KeyType, V>;
public:
......@@ -149,9 +134,7 @@ class IDMap {
template<class ReturnType>
class Iterator {
public:
Iterator(IDMap<T, OS, K>* map)
: map_(map),
iter_(map_->data_.begin()) {
Iterator(IDMap<V, K>* map) : map_(map), iter_(map_->data_.begin()) {
Init();
}
......@@ -215,7 +198,7 @@ class IDMap {
}
}
IDMap<T, OS, K>* map_;
IDMap<V, K>* map_;
typename HashTable::const_iterator iter_;
};
......
......@@ -26,7 +26,7 @@ class DestructorCounter {
};
TEST(IDMapTest, Basic) {
IDMap<TestObject> map;
IDMap<TestObject*> map;
EXPECT_TRUE(map.IsEmpty());
EXPECT_EQ(0U, map.size());
......@@ -65,7 +65,7 @@ TEST(IDMapTest, Basic) {
}
TEST(IDMapTest, IteratorRemainsValidWhenRemovingCurrentElement) {
IDMap<TestObject> map;
IDMap<TestObject*> map;
TestObject obj1;
TestObject obj2;
......@@ -76,7 +76,7 @@ TEST(IDMapTest, IteratorRemainsValidWhenRemovingCurrentElement) {
map.Add(&obj3);
{
IDMap<TestObject>::const_iterator iter(&map);
IDMap<TestObject*>::const_iterator iter(&map);
EXPECT_EQ(1, map.iteration_depth());
......@@ -98,7 +98,7 @@ TEST(IDMapTest, IteratorRemainsValidWhenRemovingCurrentElement) {
}
TEST(IDMapTest, IteratorRemainsValidWhenRemovingOtherElements) {
IDMap<TestObject> map;
IDMap<TestObject*> map;
const int kCount = 5;
TestObject obj[kCount];
......@@ -110,16 +110,16 @@ TEST(IDMapTest, IteratorRemainsValidWhenRemovingOtherElements) {
int32_t ids_in_iteration_order[kCount];
const TestObject* objs_in_iteration_order[kCount];
int counter = 0;
for (IDMap<TestObject>::const_iterator iter(&map);
!iter.IsAtEnd(); iter.Advance()) {
for (IDMap<TestObject*>::const_iterator iter(&map); !iter.IsAtEnd();
iter.Advance()) {
ids_in_iteration_order[counter] = iter.GetCurrentKey();
objs_in_iteration_order[counter] = iter.GetCurrentValue();
counter++;
}
counter = 0;
for (IDMap<TestObject>::const_iterator iter(&map);
!iter.IsAtEnd(); iter.Advance()) {
for (IDMap<TestObject*>::const_iterator iter(&map); !iter.IsAtEnd();
iter.Advance()) {
EXPECT_EQ(1, map.iteration_depth());
switch (counter) {
......@@ -150,7 +150,7 @@ TEST(IDMapTest, IteratorRemainsValidWhenRemovingOtherElements) {
}
TEST(IDMapTest, CopyIterator) {
IDMap<TestObject> map;
IDMap<TestObject*> map;
TestObject obj1;
TestObject obj2;
......@@ -163,12 +163,12 @@ TEST(IDMapTest, CopyIterator) {
EXPECT_EQ(0, map.iteration_depth());
{
IDMap<TestObject>::const_iterator iter1(&map);
IDMap<TestObject*>::const_iterator iter1(&map);
EXPECT_EQ(1, map.iteration_depth());
// Make sure that copying the iterator correctly increments
// map's iteration depth.
IDMap<TestObject>::const_iterator iter2(iter1);
IDMap<TestObject*>::const_iterator iter2(iter1);
EXPECT_EQ(2, map.iteration_depth());
}
......@@ -178,7 +178,7 @@ TEST(IDMapTest, CopyIterator) {
}
TEST(IDMapTest, AssignIterator) {
IDMap<TestObject> map;
IDMap<TestObject*> map;
TestObject obj1;
TestObject obj2;
......@@ -191,10 +191,10 @@ TEST(IDMapTest, AssignIterator) {
EXPECT_EQ(0, map.iteration_depth());
{
IDMap<TestObject>::const_iterator iter1(&map);
IDMap<TestObject*>::const_iterator iter1(&map);
EXPECT_EQ(1, map.iteration_depth());
IDMap<TestObject>::const_iterator iter2(&map);
IDMap<TestObject*>::const_iterator iter2(&map);
EXPECT_EQ(2, map.iteration_depth());
// Make sure that assigning the iterator correctly updates
......@@ -208,7 +208,7 @@ TEST(IDMapTest, AssignIterator) {
}
TEST(IDMapTest, IteratorRemainsValidWhenClearing) {
IDMap<TestObject> map;
IDMap<TestObject*> map;
const int kCount = 5;
TestObject obj[kCount];
......@@ -220,16 +220,16 @@ TEST(IDMapTest, IteratorRemainsValidWhenClearing) {
int32_t ids_in_iteration_order[kCount];
const TestObject* objs_in_iteration_order[kCount];
int counter = 0;
for (IDMap<TestObject>::const_iterator iter(&map);
!iter.IsAtEnd(); iter.Advance()) {
for (IDMap<TestObject*>::const_iterator iter(&map); !iter.IsAtEnd();
iter.Advance()) {
ids_in_iteration_order[counter] = iter.GetCurrentKey();
objs_in_iteration_order[counter] = iter.GetCurrentValue();
counter++;
}
counter = 0;
for (IDMap<TestObject>::const_iterator iter(&map);
!iter.IsAtEnd(); iter.Advance()) {
for (IDMap<TestObject*>::const_iterator iter(&map); !iter.IsAtEnd();
iter.Advance()) {
switch (counter) {
case 0:
EXPECT_EQ(ids_in_iteration_order[0], iter.GetCurrentKey());
......@@ -263,8 +263,8 @@ TEST(IDMapTest, OwningPointersDeletesThemOnRemove) {
int owned_del_count = 0;
int map_owned_ids[kCount];
IDMap<DestructorCounter> map_external;
IDMap<DestructorCounter, IDMapOwnPointer> map_owned;
IDMap<DestructorCounter*> map_external;
IDMap<std::unique_ptr<DestructorCounter>> map_owned;
for (int i = 0; i < kCount; ++i) {
external_obj[i] = new DestructorCounter(&external_del_count);
......@@ -298,8 +298,8 @@ TEST(IDMapTest, OwningPointersDeletesThemOnClear) {
int owned_del_count = 0;
IDMap<DestructorCounter> map_external;
IDMap<DestructorCounter, IDMapOwnPointer> map_owned;
IDMap<DestructorCounter*> map_external;
IDMap<std::unique_ptr<DestructorCounter>> map_owned;
for (int i = 0; i < kCount; ++i) {
external_obj[i] = new DestructorCounter(&external_del_count);
......@@ -334,8 +334,8 @@ TEST(IDMapTest, OwningPointersDeletesThemOnDestruct) {
int owned_del_count = 0;
{
IDMap<DestructorCounter> map_external;
IDMap<DestructorCounter, IDMapOwnPointer> map_owned;
IDMap<DestructorCounter*> map_external;
IDMap<std::unique_ptr<DestructorCounter>> map_owned;
for (int i = 0; i < kCount; ++i) {
external_obj[i] = new DestructorCounter(&external_del_count);
......@@ -356,14 +356,14 @@ TEST(IDMapTest, OwningPointersDeletesThemOnDestruct) {
}
TEST(IDMapTest, Int64KeyType) {
IDMap<TestObject, IDMapExternalPointer, int64_t> map;
IDMap<TestObject*, int64_t> map;
TestObject obj1;
const int64_t kId1 = 999999999999999999;
map.AddWithID(&obj1, kId1);
EXPECT_EQ(&obj1, map.Lookup(kId1));
IDMap<TestObject, IDMapExternalPointer, int64_t>::const_iterator iter(&map);
IDMap<TestObject*, int64_t>::const_iterator iter(&map);
ASSERT_FALSE(iter.IsAtEnd());
EXPECT_EQ(kId1, iter.GetCurrentKey());
EXPECT_EQ(&obj1, iter.GetCurrentValue());
......
......@@ -90,7 +90,7 @@ void LayerTitleCache::UpdateFavicon(JNIEnv* env,
void LayerTitleCache::ClearExcept(JNIEnv* env,
const JavaParamRef<jobject>& obj,
jint except_id) {
IDMap<DecorationTitle, IDMapOwnPointer>::iterator iter(&layer_cache_);
IDMap<std::unique_ptr<DecorationTitle>>::iterator iter(&layer_cache_);
for (; !iter.IsAtEnd(); iter.Advance()) {
const int id = iter.GetCurrentKey();
if (id != except_id)
......@@ -112,7 +112,7 @@ void LayerTitleCache::SetResourceManager(
ui::ResourceManager* resource_manager) {
resource_manager_ = resource_manager;
IDMap<DecorationTitle, IDMapOwnPointer>::iterator iter(&layer_cache_);
IDMap<std::unique_ptr<DecorationTitle>>::iterator iter(&layer_cache_);
for (; !iter.IsAtEnd(); iter.Advance()) {
iter.GetCurrentValue()->SetResourceManager(resource_manager_);
}
......
......@@ -73,7 +73,7 @@ class LayerTitleCache {
private:
virtual ~LayerTitleCache();
IDMap<DecorationTitle, IDMapOwnPointer> layer_cache_;
IDMap<std::unique_ptr<DecorationTitle>> layer_cache_;
JavaObjectWeakGlobalRef weak_java_title_cache_;
int fade_width_;
......
......@@ -48,7 +48,7 @@ class ServiceTabLauncher {
ServiceTabLauncher();
~ServiceTabLauncher();
IDMap<TabLaunchedCallback, IDMapOwnPointer> tab_launched_callbacks_;
IDMap<std::unique_ptr<TabLaunchedCallback>> tab_launched_callbacks_;
DISALLOW_COPY_AND_ASSIGN(ServiceTabLauncher);
};
......
......@@ -160,14 +160,13 @@ class MediaRouterAndroid : public MediaRouterBase {
std::vector<MediaRouteResponseCallback> callbacks;
};
using MediaRouteRequests =
IDMap<MediaRouteRequest, IDMapOwnPointer>;
using MediaRouteRequests = IDMap<std::unique_ptr<MediaRouteRequest>>;
MediaRouteRequests route_requests_;
using MediaRoutes = std::vector<MediaRoute>;
MediaRoutes active_routes_;
using SendMessageCallbacks = IDMap<SendRouteMessageCallback, IDMapOwnPointer>;
using SendMessageCallbacks = IDMap<std::unique_ptr<SendRouteMessageCallback>>;
SendMessageCallbacks message_callbacks_;
using MessageObservers = base::ScopedPtrHashMap<
......
......@@ -93,7 +93,7 @@ class CastTransportHostFilter : public content::BrowserMessageFilter {
int32_t channel_id,
const std::vector<media::cast::FrameEvent>& events);
IDMap<media::cast::CastTransport, IDMapOwnPointer> id_map_;
IDMap<std::unique_ptr<media::cast::CastTransport>> id_map_;
// Clock used by Cast transport.
base::DefaultTickClock clock_;
......@@ -105,7 +105,7 @@ class CastTransportHostFilter : public content::BrowserMessageFilter {
// This map records all active remoting senders. It uses the unique RTP
// stream ID as the key.
IDMap<CastRemotingSender, IDMapOwnPointer> remoting_sender_map_;
IDMap<std::unique_ptr<CastRemotingSender>> remoting_sender_map_;
// This map stores all active remoting streams for each channel. It uses the
// channel ID as the key.
......
......@@ -98,7 +98,7 @@ class SubprocessMetricsProvider : public metrics::MetricsProvider,
// All of the shared-persistent-allocators for known sub-processes.
using AllocatorByIdMap =
IDMap<base::PersistentHistogramAllocator, IDMapOwnPointer, int>;
IDMap<std::unique_ptr<base::PersistentHistogramAllocator>, int>;
AllocatorByIdMap allocators_by_id_;
// Track all observed render processes to un-observe them on exit.
......
......@@ -75,10 +75,10 @@ class PermissionManager : public KeyedService,
friend class MediaPermission;
class PendingRequest;
using PendingRequestsMap = IDMap<PendingRequest, IDMapOwnPointer>;
using PendingRequestsMap = IDMap<std::unique_ptr<PendingRequest>>;
struct Subscription;
using SubscriptionsMap = IDMap<Subscription, IDMapOwnPointer>;
using SubscriptionsMap = IDMap<std::unique_ptr<Subscription>>;
PermissionContextBase* GetPermissionContext(content::PermissionType type);
......
......@@ -67,12 +67,12 @@ class ServiceProcessControl : public IPC::Sender,
SERVICE_EVENT_MAX,
};
typedef IDMap<ServiceProcessControl>::iterator iterator;
typedef std::queue<IPC::Message> MessageQueue;
typedef base::Callback<void(const cloud_print::CloudPrintProxyInfo&)>
CloudPrintProxyInfoCallback;
typedef base::Callback<void(const std::vector<std::string>&)>
PrintersCallback;
using iterator = IDMap<ServiceProcessControl*>::iterator;
using MessageQueue = std::queue<IPC::Message>;
using CloudPrintProxyInfoCallback =
base::Callback<void(const cloud_print::CloudPrintProxyInfo&)>;
using PrintersCallback =
base::Callback<void(const std::vector<std::string>&)>;
// Returns the singleton instance of this class.
static ServiceProcessControl* GetInstance();
......
......@@ -142,7 +142,7 @@ size_t PopupBlockerTabHelper::GetBlockedPopupsCount() const {
PopupBlockerTabHelper::PopupIdMap
PopupBlockerTabHelper::GetBlockedPopupRequests() {
PopupIdMap result;
for (IDMap<BlockedRequest, IDMapOwnPointer>::const_iterator iter(
for (IDMap<std::unique_ptr<BlockedRequest>>::const_iterator iter(
&blocked_popups_);
!iter.IsAtEnd();
iter.Advance()) {
......
......@@ -69,7 +69,7 @@ class PopupBlockerTabHelper
// Called when the blocked popup notification is shown or hidden.
void PopupNotificationVisibilityChanged(bool visible);
IDMap<BlockedRequest, IDMapOwnPointer> blocked_popups_;
IDMap<std::unique_ptr<BlockedRequest>> blocked_popups_;
DISALLOW_COPY_AND_ASSIGN(PopupBlockerTabHelper);
};
......
......@@ -116,7 +116,7 @@ class CoreTabHelper : public content::WebContentsObserver,
// (full-page plugins for now only) permissions.
int content_restrictions_;
IDMap<ContextNodeThumbnailCallback, IDMapOwnPointer> thumbnail_callbacks_;
IDMap<std::unique_ptr<ContextNodeThumbnailCallback>> thumbnail_callbacks_;
DISALLOW_COPY_AND_ASSIGN(CoreTabHelper);
};
......
......@@ -55,8 +55,8 @@ class CookiesTreeModelUtil {
const base::string16& title);
private:
typedef IDMap<const CookieTreeNode> CookiesTreeNodeIdMap;
typedef std::map<const CookieTreeNode*, int32_t> CookieTreeNodeMap;
using CookiesTreeNodeIdMap = IDMap<const CookieTreeNode*>;
using CookieTreeNodeMap = std::map<const CookieTreeNode*, int32_t>;
// Populate given |dict| with cookie tree node properties. |id_map| maps
// a CookieTreeNode to an ID and creates a new ID if |node| is not in the
......
......@@ -206,7 +206,7 @@ class CertIdMap {
typedef std::map<net::X509Certificate*, int32_t> CertMap;
// Creates an ID for cert and looks up the cert for an ID.
IDMap<net::X509Certificate>id_map_;
IDMap<net::X509Certificate*> id_map_;
// Finds the ID for a cert.
CertMap cert_map_;
......
......@@ -112,8 +112,8 @@ base::LazyInstance<PrintPreviewRequestIdMapWithLock>
// PrintPreviewUI IDMap used to avoid exposing raw pointer addresses to WebUI.
// Only accessed on the UI thread.
base::LazyInstance<IDMap<PrintPreviewUI> >
g_print_preview_ui_id_map = LAZY_INSTANCE_INITIALIZER;
base::LazyInstance<IDMap<PrintPreviewUI*>> g_print_preview_ui_id_map =
LAZY_INSTANCE_INITIALIZER;
// PrintPreviewUI serves data for chrome://print requests.
//
......
......@@ -208,7 +208,7 @@ class CertIdMap {
typedef std::map<net::X509Certificate*, int32_t> CertMap;
// Creates an ID for cert and looks up the cert for an ID.
IDMap<net::X509Certificate> id_map_;
IDMap<net::X509Certificate*> id_map_;
// Finds the ID for a cert.
CertMap cert_map_;
......
......@@ -68,7 +68,7 @@ class CastIPCDispatcher : public IPC::MessageFilter {
// A map of stream ids to delegates; must only be accessed on
// |io_message_loop_|.
IDMap<CastTransportIPC> id_map_;
IDMap<CastTransportIPC*> id_map_;
DISALLOW_COPY_AND_ASSIGN(CastIPCDispatcher);
};
......
......@@ -382,7 +382,7 @@ class JobScheduler
std::unique_ptr<JobQueue> queue_[NUM_QUEUES];
// The list of queued job info indexed by job IDs.
typedef IDMap<JobEntry, IDMapOwnPointer> JobIDMap;
using JobIDMap = IDMap<std::unique_ptr<JobEntry>>;
JobIDMap job_map_;
// The list of observers for the scheduler.
......
......@@ -80,11 +80,11 @@ class InstanceIDAndroid : public InstanceID {
private:
base::android::ScopedJavaGlobalRef<jobject> java_ref_;
IDMap<GetIDCallback, IDMapOwnPointer> get_id_callbacks_;
IDMap<GetCreationTimeCallback, IDMapOwnPointer> get_creation_time_callbacks_;
IDMap<GetTokenCallback, IDMapOwnPointer> get_token_callbacks_;
IDMap<DeleteTokenCallback, IDMapOwnPointer> delete_token_callbacks_;
IDMap<DeleteIDCallback, IDMapOwnPointer> delete_id_callbacks_;
IDMap<std::unique_ptr<GetIDCallback>> get_id_callbacks_;
IDMap<std::unique_ptr<GetCreationTimeCallback>> get_creation_time_callbacks_;
IDMap<std::unique_ptr<GetTokenCallback>> get_token_callbacks_;
IDMap<std::unique_ptr<DeleteTokenCallback>> delete_token_callbacks_;
IDMap<std::unique_ptr<DeleteIDCallback>> delete_id_callbacks_;
base::ThreadChecker thread_checker_;
......
......@@ -35,7 +35,7 @@ class SpellCheckProvider
public content::RenderViewObserverTracker<SpellCheckProvider>,
public blink::WebSpellCheckClient {
public:
typedef IDMap<blink::WebTextCheckingCompletion> WebTextCheckCompletions;
using WebTextCheckCompletions = IDMap<blink::WebTextCheckingCompletion*>;
SpellCheckProvider(content::RenderView* render_view,
SpellCheck* spellcheck);
......
......@@ -185,7 +185,7 @@ class CONTENT_EXPORT CacheStorageCache {
using Entries = std::vector<disk_cache::Entry*>;
using ScopedBackendPtr = std::unique_ptr<disk_cache::Backend>;
using BlobToDiskCacheIDMap =
IDMap<CacheStorageBlobToDiskCache, IDMapOwnPointer>;
IDMap<std::unique_ptr<CacheStorageBlobToDiskCache>>;
using OpenAllEntriesCallback =
base::Callback<void(std::unique_ptr<OpenAllEntriesContext>,
CacheStorageError)>;
......
......@@ -40,7 +40,7 @@ namespace {
#undef DestroyAll
#endif
base::LazyInstance<IDMap<GpuProcessHostUIShim> > g_hosts_by_id =
base::LazyInstance<IDMap<GpuProcessHostUIShim*>> g_hosts_by_id =
LAZY_INSTANCE_INITIALIZER;
void SendOnIOThreadTask(int host_id, IPC::Message* msg) {
......@@ -102,7 +102,7 @@ void GpuProcessHostUIShim::Destroy(int host_id, const std::string& message) {
void GpuProcessHostUIShim::DestroyAll() {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
while (!g_hosts_by_id.Pointer()->IsEmpty()) {
IDMap<GpuProcessHostUIShim>::iterator it(g_hosts_by_id.Pointer());
IDMap<GpuProcessHostUIShim*>::iterator it(g_hosts_by_id.Pointer());
delete it.GetCurrentValue();
}
}
......@@ -118,7 +118,7 @@ GpuProcessHostUIShim* GpuProcessHostUIShim::GetOneInstance() {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (g_hosts_by_id.Pointer()->IsEmpty())
return NULL;
IDMap<GpuProcessHostUIShim>::iterator it(g_hosts_by_id.Pointer());
IDMap<GpuProcessHostUIShim*>::iterator it(g_hosts_by_id.Pointer());
return it.GetCurrentValue();
}
......
......@@ -39,7 +39,7 @@ class ManifestManagerHost : public WebContentsObserver {
void RenderFrameDeleted(RenderFrameHost*) override;
private:
using GetCallbackMap = IDMap<GetManifestCallback, IDMapOwnPointer>;
using GetCallbackMap = IDMap<std::unique_ptr<GetManifestCallback>>;
void OnRequestManifestResponse(
RenderFrameHost*, int request_id, const GURL&, const Manifest&);
......
......@@ -55,7 +55,7 @@ class PermissionServiceImpl : public blink::mojom::PermissionService {
RequestPermissionsCallback callback;
int request_count;
};
using RequestsMap = IDMap<PendingRequest, IDMapOwnPointer>;
using RequestsMap = IDMap<std::unique_ptr<PendingRequest>>;
struct PendingSubscription {
PendingSubscription(PermissionType permission,
......@@ -69,7 +69,7 @@ class PermissionServiceImpl : public blink::mojom::PermissionService {
url::Origin origin;
PermissionStatusCallback callback;
};
using SubscriptionsMap = IDMap<PendingSubscription, IDMapOwnPointer>;
using SubscriptionsMap = IDMap<std::unique_ptr<PendingSubscription>>;
// blink::mojom::PermissionService.
void HasPermission(blink::mojom::PermissionDescriptorPtr permission,
......
......@@ -52,7 +52,7 @@ class QuotaDispatcherHost : public BrowserMessageFilter {
storage::QuotaManager* quota_manager_;
scoped_refptr<QuotaPermissionContext> permission_context_;
IDMap<RequestDispatcher, IDMapOwnPointer> outstanding_requests_;
IDMap<std::unique_ptr<RequestDispatcher>> outstanding_requests_;
base::WeakPtrFactory<QuotaDispatcherHost> weak_factory_;
......
......@@ -314,7 +314,7 @@ bool has_done_stun_trials = false;
#endif
// the global list of all renderer processes
base::LazyInstance<IDMap<RenderProcessHost>>::Leaky g_all_hosts =
base::LazyInstance<IDMap<RenderProcessHost*>>::Leaky g_all_hosts =
LAZY_INSTANCE_INITIALIZER;
// Map of site to process, to ensure we only have one RenderProcessHost per
......@@ -2678,7 +2678,7 @@ void RenderProcessHostImpl::ProcessDied(bool already_dead,
RemoveUserData(kSessionStorageHolderKey);
IDMap<IPC::Listener>::iterator iter(&listeners_);
IDMap<IPC::Listener*>::iterator iter(&listeners_);
while (!iter.IsAtEnd()) {
iter.GetCurrentValue()->OnMessageReceived(FrameHostMsg_RenderProcessGone(
iter.GetCurrentKey(), static_cast<int>(status), exit_code));
......
......@@ -432,7 +432,7 @@ class CONTENT_EXPORT RenderProcessHostImpl
// The registered IPC listener objects. When this list is empty, we should
// delete ourselves.
IDMap<IPC::Listener> listeners_;
IDMap<IPC::Listener*> listeners_;
mojo::AssociatedBinding<mojom::RouteProvider> route_provider_binding_;
mojo::AssociatedBindingSet<mojom::AssociatedInterfaceProvider>
......
......@@ -59,17 +59,18 @@ class CONTENT_EXPORT ServiceWorkerContextCore
: NON_EXPORTED_BASE(public ServiceWorkerVersion::Listener) {
public:
using BoolCallback = base::Callback<void(bool)>;
typedef base::Callback<void(ServiceWorkerStatusCode status)> StatusCallback;
typedef base::Callback<void(ServiceWorkerStatusCode status,
const std::string& status_message,
int64_t registration_id)> RegistrationCallback;
typedef base::Callback<void(ServiceWorkerStatusCode status,
const std::string& status_message,
int64_t registration_id)> UpdateCallback;
typedef base::Callback<
void(ServiceWorkerStatusCode status)> UnregistrationCallback;
typedef IDMap<ServiceWorkerProviderHost, IDMapOwnPointer> ProviderMap;