summaryrefslogtreecommitdiffstats
path: root/base/shared_memory_posix.cc
Commit message (Collapse)AuthorAgeFilesLines
* linux: provide a hint to people with misconfigured shmevan@chromium.org2010-01-081-1/+6
| | | | | | | | BUG=24213 Review URL: http://codereview.chromium.org/539003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35838 0039d316-1c4b-4281-b951-d872f2087c98
* Don't do work in the SharedIOBuffer constructor; use an Init method instead. ↵hawk@chromium.org2009-11-201-4/+2
| | | | | | | | | | | | This eliminates instances of allocated-but-invalid SharedIOBuffers. Also clean up some CHECKs and TODOs associated with the bug. The upshot is that we no longer crash in AsyncResourceHandler::OnResponseCompleted() when we can't allocate shared memory. We now crash (properly, I believe) in the renderer process if the shared memory that failed to allocate was the TransportDIB, since the renderer can't communicate with the browser without it. BUG=16371 TEST=none Review URL: http://codereview.chromium.org/391009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32701 0039d316-1c4b-4281-b951-d872f2087c98
* Add a CHECK() around the SharedMemory ftruncate() call to finger it as a ↵hawk@chromium.org2009-10-291-2/+4
| | | | | | | | | | crash culprit. BUG=16371 TEST=Check the crash logs to see if this CHECK() supplants the CHECK() failure in AsyncResourceHandler::OnWillRead() Review URL: http://codereview.chromium.org/347012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30530 0039d316-1c4b-4281-b951-d872f2087c98
* Eliminate all uses of strerror() in code that uses src/base. strerror() is ↵tschmelcher@chromium.org2009-10-131-3/+3
| | | | | | | | | | | inherently unsafe in multi-threaded apps because it stores the string in a global buffer. It should never be used. If you want to log an error, use PLOG and friends, or if that's too high-level then use safe_strerror(). TEST=built on Linux in 32-bit and 64-bit mode; ran base_unittests in each case; ran Chromium itself in each case; try servers BUG=none Review URL: http://codereview.chromium.org/261055 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28850 0039d316-1c4b-4281-b951-d872f2087c98
* posix: clean up shared memory codeevan@chromium.org2009-09-161-16/+18
| | | | | | | | | | | | | At first I rewrote this to use the shm_*() family of functions, but that doesn't work on OS X. Now I've just cleaned up some bits and added an extra print to help with the below bug. BUG=16371 Review URL: http://codereview.chromium.org/204024 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26361 0039d316-1c4b-4281-b951-d872f2087c98
* Use ftruncate() instead of fwrite() to extend files.pinkerton@chromium.org2009-08-261-20/+4
| | | | | | | | BUG=20249 TEST=Browser still works Review URL: http://codereview.chromium.org/174482 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24451 0039d316-1c4b-4281-b951-d872f2087c98
* Handle file descriptor exhaustions a little more gracefully. This prevents ↵stuartmorgan@chromium.org2009-06-121-1/+8
| | | | | | | | | | the browser itself from crashing in Intl2 page cycler tests on the Mac (although the renderer still dies, at least in debug), so that seems like a good idea whatever larger solution we find for the file descriptor issue. TEST=none BUG=none Review URL: http://codereview.chromium.org/125024 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18318 0039d316-1c4b-4281-b951-d872f2087c98
* Fix a memory leak in ResourceDispatcherhclam@chromium.org2009-05-181-0/+6
| | | | | | | | | | | | When we delete a ResourceLoaderBridge before OnCompletedRequest is received, bad things happen. There's a lot of leaks at the following points: 1. OnMessageReceived ignores the message. 2. RemovePendingRequest removes it's internal deferred_message_queue. But ViewHostMsg_Resource_DataReceived is not POD. We should also close the shared memory handle inside it. Review URL: http://codereview.chromium.org/115396 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16297 0039d316-1c4b-4281-b951-d872f2087c98
* Remove unused variable from POSIX SharedMemory implementation.thestig@chromium.org2009-04-041-7/+4
| | | | | | Review URL: http://codereview.chromium.org/62027 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13129 0039d316-1c4b-4281-b951-d872f2087c98
* Port visitedlink tests to Linux. Also make them pass on Linux, whichphajdan.jr@chromium.org2009-03-161-0/+5
| | | | | | | | | | | | | may fix the attached bug. The problem was that the debug check was in wrong place (too early, before every member was initialized), so it failed in the test. BUG=8710 Review URL: http://codereview.chromium.org/48005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11734 0039d316-1c4b-4281-b951-d872f2087c98
* Bitmap transportagl@chromium.org2009-02-201-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch reworks bitmap transport on all platforms. Linux and Mac are switched from serialising bitmaps over the IPC channel to using shared memory. All platforms gain a shared memory mapping cache on the host side. The concept of a TransportDIB (device independent bitmap) is added to encapsulate most of the platform specifics. On Linux, we use SysV shared memory. This is because X shared pixmaps, which predate POSIX SHM, can only use SysV. By using SysV between renderer and browser, we open up the possibility to map the shared memory directly from the renderer to the X server. On Mac, we use POSIX shared memory. However, since this needs filesystem access and the Mac renderer is sandboxed from the filesystem, we add two new messages from renderer -> browser: The first, AllocTransportDIB, synchronously creates a transport DIB in the browser and passes a handle back to the renderer. The second, FreeTransportDIB, asynchronously, notifies the browser that it may close its handle to the shared memory region. On Mac, the shared memory regions are identified by their inode numbers on the wire. This means that the browser must keep handles open to all the allocated shared memory regions (since an inode number is insufficient to map the region). The alternative design is that the renderer passes the file descriptor with each paint operation. Since passing file descriptors is special case in the code, I felt that it would be best to minimise their use. Creating and freeing transport DIBs are relatively rare operations relative to paints and scrolls. On Windows, most of the code remains the same, except that Windows now uses the mapping cache added in this patch. This allows the browser to maintain a shared memory mapping for a transport DIB over several paints. Previously it mapped and unmapped for every operation, causing lots of TLB and VM churn. Review URL: http://codereview.chromium.org/21485 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10071 0039d316-1c4b-4281-b951-d872f2087c98
* POSIX: Transfer network data using shared memoryagl@chromium.org2009-02-111-6/+20
| | | | | | | | | | | | | | | | | | | | | | This patch adds the long planned support for sharing memory on POSIX by transporting file descriptors. It largely builds on the shared memory cleanup work by jrg. We move FileDescriptor out of chrome/common/file_descriptor_posix.h and into base/file_descriptor_posix.h. Since all that's left in the chrome/common verion is the DescriptorSet, those files are renamed to descriptor_set.[h|cc]. The SharedMemoryHandle on POSIX then becomes a typedef to a FileDescriptor and thus can be serialised over IPC. After that, it's mostly a case of cleaning up those snippets of code which considered SharedMemoryHandles to be scaler values. Review URL: http://codereview.chromium.org/21208 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9580 0039d316-1c4b-4281-b951-d872f2087c98
* * Fix error checking for mmap() for POSIX shared memory.jeremy@chromium.org2009-02-111-1/+3
| | | | | | | | * Make fd-over-IPC test send multiple FDs. Review URL: http://codereview.chromium.org/21238 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9537 0039d316-1c4b-4281-b951-d872f2087c98
* Transition POSIX shmem to use lockf(), not semaphores. Eliminatesjrg@chromium.org2009-02-051-31/+23
| | | | | | | | | | | | | | resource leak possibility; allows complete sharing of shmem by fd without name. Add actual multiprocess shmem/locking unit test. Fix flaky shmem unit test. agl: please review. Amanda: please look over as you've been here before. Review URL: http://codereview.chromium.org/21063 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9235 0039d316-1c4b-4281-b951-d872f2087c98
* Properly honor base::SharedMemory semantics for name="" to meanjrg@chromium.org2009-02-041-17/+129
| | | | | | | | | | | | new/private shared memory on POSIX. Transition base::SharedMemory implementation to file/mmap() to prevent leaking of wired kernel resources and allow easier cleanup. Enable one more shared_memory unit test for POSIX. Enable stats_table_unittest.cc for Mac, and modify it so it cleans up. Review URL: http://codereview.chromium.org/19724 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9114 0039d316-1c4b-4281-b951-d872f2087c98
* Unit test addition, cleanup for render_process/thread.jrg@chromium.org2009-01-281-5/+1
| | | | | | Review URL: http://codereview.chromium.org/19606 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8782 0039d316-1c4b-4281-b951-d872f2087c98
* We need to loop on waiting as there are plenty of reasons why it might not take.avi@google.com2008-12-111-2/+6
| | | | | | Review URL: http://codereview.chromium.org/14002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6813 0039d316-1c4b-4281-b951-d872f2087c98
* addressing commentsagl@chromium.org2008-11-181-9/+8
| | | | git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5587 0039d316-1c4b-4281-b951-d872f2087c98
* Check ftruncate resultagl@chromium.org2008-11-181-13/+17
| | | | git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5586 0039d316-1c4b-4281-b951-d872f2087c98
* Add Terminate() to the Process object, have RenderProcessHost use this to ↵brettw@google.com2008-11-141-0/+3
| | | | | | | | | | avoid some more Windows specific code. Move Process and SharedMemory into the base namespace (most changes). Review URL: http://codereview.chromium.org/10895 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5446 0039d316-1c4b-4281-b951-d872f2087c98
* Removed magic number for owner rights, avoid to call close(-1).brettw@google.com2008-10-291-2/+2
| | | | | | Patch committed for mendola@gmail.com git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4128 0039d316-1c4b-4281-b951-d872f2087c98
* ensure that the shared memory has actually been created before trying to ↵pinkerton@google.com2008-09-231-1/+1
| | | | | | | | re-use it when the |open_existing| flag is passed to Create(). Review URL: http://codereview.chromium.org/4039 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2488 0039d316-1c4b-4281-b951-d872f2087c98
* Use a more compact license header in source files.license.bot2008-08-241-28/+4
| | | | git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1287 0039d316-1c4b-4281-b951-d872f2087c98
* Revving the shared memory to the comments on the list.avi@google.com2008-08-131-27/+29
| | | | git-svn-id: svn://svn.chromium.org/chrome/trunk/src@824 0039d316-1c4b-4281-b951-d872f2087c98
* Make this file compile on linux. We need fcntl.h for O_RDONLY, etc.tc@google.com2008-08-121-0/+1
| | | | git-svn-id: svn://svn.chromium.org/chrome/trunk/src@753 0039d316-1c4b-4281-b951-d872f2087c98
* The Posix shared memory implementation.avi@google.com2008-08-121-0/+189
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@742 0039d316-1c4b-4281-b951-d872f2087c98