Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(238)

Unified Diff: chrome/browser/extensions/user_script_master.cc

Issue 27265002: Implement SharedMemory::NewAnonymousReadOnly(contents). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add errno.h Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« base/memory/shared_memory_unittest.cc ('K') | « base/memory/shared_memory_win.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/user_script_master.cc
diff --git a/chrome/browser/extensions/user_script_master.cc b/chrome/browser/extensions/user_script_master.cc
index 95b8f6aa33894d95f7fc1ab43effe40573007a9e..2a680a2494aa446ebd115a1a4fa50678aa8a9732 100644
--- a/chrome/browser/extensions/user_script_master.cc
+++ b/chrome/browser/extensions/user_script_master.cc
@@ -283,16 +283,9 @@ static base::SharedMemory* Serialize(const UserScriptList& scripts) {
}
}
- // Create the shared memory object.
- scoped_ptr<base::SharedMemory> shared_memory(new base::SharedMemory());
-
- if (!shared_memory->CreateAndMapAnonymous(pickle.size()))
- return NULL;
-
- // Copy the pickle to shared memory.
- memcpy(shared_memory->memory(), pickle.data(), pickle.size());
-
- return shared_memory.release();
+ return base::SharedMemory::NewAnonymousReadOnly(
+ base::StringPiece(static_cast<const char*>(pickle.data()), pickle.size()))
+ .release();
}
// This method will be called on the file thread.
« base/memory/shared_memory_unittest.cc ('K') | « base/memory/shared_memory_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698