Skip to content

Commit

Permalink
Moved ScopedPtrMap into base namespace.
Browse files Browse the repository at this point in the history
BUG=502128
TBR=reillyg@chromium.org

Review URL: https://codereview.chromium.org/1194373002

Cr-Commit-Position: refs/heads/master@{#335895}
  • Loading branch information
mgiuca authored and Commit bot committed Jun 24, 2015
1 parent 9e84be4 commit d6af321
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 6 deletions.
4 changes: 4 additions & 0 deletions base/containers/scoped_ptr_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
#include "base/move.h"
#include "base/stl_util.h"

namespace base {

// ScopedPtrMap provides a std::map that supports scoped_ptr values. It ensures
// that the map's values are properly deleted when removed from the map, or when
// the map is destroyed.
Expand Down Expand Up @@ -137,4 +139,6 @@ class ScopedPtrMap {
};
};

} // namespace base

#endif // BASE_CONTAINERS_SCOPED_PTR_MAP_H_
2 changes: 2 additions & 0 deletions base/containers/scoped_ptr_map_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "base/memory/scoped_ptr.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace base {
namespace {

// A ScopedDestroyer sets a Boolean to true upon destruction.
Expand Down Expand Up @@ -236,3 +237,4 @@ TEST(ScopedPtrMapTest, Passed) {
};

} // namespace
} // namespace base
5 changes: 3 additions & 2 deletions chrome/browser/media_galleries/gallery_watch_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,9 @@ class GalleryWatchManager
typedef std::map<base::FilePath, NotificationInfo> WatchedPaths;
typedef std::map<content::BrowserContext*, GalleryWatchManagerObserver*>
ObserverMap;
typedef ScopedPtrMap<content::BrowserContext*,
scoped_ptr<KeyedServiceShutdownNotifier::Subscription>>
typedef base::ScopedPtrMap<
content::BrowserContext*,
scoped_ptr<KeyedServiceShutdownNotifier::Subscription>>
BrowserContextSubscriptionMap;

// Ensure there is a subscription to shutdown notifications for
Expand Down
5 changes: 3 additions & 2 deletions chrome/browser/media_galleries/media_file_system_registry.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,9 @@ class MediaFileSystemRegistry
// Map a profile and extension to the ExtensionGalleriesHost.
typedef std::map<Profile*, ExtensionHostMap> ExtensionGalleriesHostMap;
// Map a profile to a shutdown notification subscription.
typedef ScopedPtrMap<Profile*,
scoped_ptr<KeyedServiceShutdownNotifier::Subscription>>
typedef base::ScopedPtrMap<
Profile*,
scoped_ptr<KeyedServiceShutdownNotifier::Subscription>>
ProfileSubscriptionMap;

void OnPermissionRemoved(MediaGalleriesPreferences* pref,
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/metrics/chrome_metrics_service_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ void ChromeMetricsServiceClient::CollectFinalMetrics(
new MetricsMemoryDetails(callback, &memory_growth_tracker_));
details->StartFetch(MemoryDetails::FROM_CHROME_ONLY);

ScopedPtrMap<int, scoped_ptr<ProcessResourceUsage>> current_map;
base::ScopedPtrMap<int, scoped_ptr<ProcessResourceUsage>> current_map;
host_resource_usage_map_.swap(current_map);

// Collect WebCore cache information to put into a histogram.
Expand Down
3 changes: 2 additions & 1 deletion chrome/browser/metrics/chrome_metrics_service_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,8 @@ class ChromeMetricsServiceClient
const base::TimeTicks start_time_;

// Map of ProcessResourceUsage from render process host IDs.
ScopedPtrMap<int, scoped_ptr<ProcessResourceUsage>> host_resource_usage_map_;
base::ScopedPtrMap<int, scoped_ptr<ProcessResourceUsage>>
host_resource_usage_map_;

base::WeakPtrFactory<ChromeMetricsServiceClient> weak_ptr_factory_;

Expand Down

0 comments on commit d6af321

Please sign in to comment.