summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authoragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-17 19:36:02 +0000
committeragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-17 19:36:02 +0000
commitcd708a9faca83c3b2d8060bba740ea7ce11894fe (patch)
tree8ec1acaa7f807bb9f772aa2838a93318e5cf480f /chrome
parent12bd0587232f99ec1ec416002e57e12c6b2bcd06 (diff)
downloadchromium_src-cd708a9faca83c3b2d8060bba740ea7ce11894fe.zip
chromium_src-cd708a9faca83c3b2d8060bba740ea7ce11894fe.tar.gz
chromium_src-cd708a9faca83c3b2d8060bba740ea7ce11894fe.tar.bz2
Use anonymous shared memory for VisitedLinks.
We already pass a handle to the shared memory via IPC but, when we create it, we create a named segment. These segments are not garbage collected on POSIX. Since nobody actually uses the name of the segment, use an anonymous segment instead and remove the functions. Review URL: http://codereview.chromium.org/48087 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11900 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/visitedlink_master.cc20
-rw-r--r--chrome/browser/visitedlink_master.h4
2 files changed, 4 insertions, 20 deletions
diff --git a/chrome/browser/visitedlink_master.cc b/chrome/browser/visitedlink_master.cc
index 5d48d63..c22e866 100644
--- a/chrome/browser/visitedlink_master.cc
+++ b/chrome/browser/visitedlink_master.cc
@@ -258,20 +258,6 @@ void VisitedLinkMaster::InitMembers(base::Thread* file_thread,
#endif
}
-// The shared memory name should be unique on the system and also needs to
-// change when we create a new table. The scheme we use includes the process
-// ID, an increasing serial number, and the profile ID.
-std::wstring VisitedLinkMaster::GetSharedMemoryName() const {
- // When unit testing, there's no profile, so use an empty ID string.
- std::wstring profile_id;
- if (profile_)
- profile_id = profile_->GetID().c_str();
-
- return StringPrintf(L"GVisitedLinks_%lu_%lu_%ls",
- base::GetCurrentProcId(), shared_memory_serial_,
- profile_id.c_str());
-}
-
bool VisitedLinkMaster::Init() {
if (!InitFromFile())
return InitFromScratch(suppress_rebuild_);
@@ -702,9 +688,11 @@ bool VisitedLinkMaster::CreateURLTable(int32 num_entries, bool init_to_empty) {
if (!shared_memory_)
return false;
- if (!shared_memory_->Create(GetSharedMemoryName().c_str(),
- false, false, alloc_size))
+ if (!shared_memory_->Create(std::wstring() /* anonymous */,
+ false /* read-write */, false /* create */,
+ alloc_size)) {
return false;
+ }
// Map into our process.
if (!shared_memory_->Map(alloc_size)) {
diff --git a/chrome/browser/visitedlink_master.h b/chrome/browser/visitedlink_master.h
index 972ce8d..7faae4f 100644
--- a/chrome/browser/visitedlink_master.h
+++ b/chrome/browser/visitedlink_master.h
@@ -81,10 +81,6 @@ class VisitedLinkMaster : public VisitedLinkCommon {
bool ShareToProcess(base::ProcessHandle process,
base::SharedMemoryHandle *new_handle);
- // returns the name of the shared memory object that slaves can use to map
- // the data
- std::wstring GetSharedMemoryName() const;
-
// Returns the handle to the shared memory
base::SharedMemoryHandle GetSharedMemoryHandle();