summaryrefslogtreecommitdiffstats
path: root/base/sync_socket_posix.cc
Commit message (Collapse)AuthorAgeFilesLines
* Refactor AppendToFile and WriteFileDescriptorchirantan2014-10-071-2/+3
| | | | | | | | | | | | | | | - Unify the behavior of the windows and posix implementations of these functions. - Simplify the interface by having them just indicate success or failure instead of making callers deal with partial writes. BUG=418837 Signed-off-by: Chirantan Ekbote <chirantan@chromium.org> Review URL: https://codereview.chromium.org/614893004 Cr-Commit-Position: refs/heads/master@{#298604}
* Preparing |SyncSocket|'s handle for the peer process is different for POSIX ↵burnik2014-09-081-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and Windows which leads to code duplication, platform #ifdef checks on multiple levels and general confusion on how to work with the SyncSocket. Typical use case for |SyncSocket|: 1. Browser creates and connects the socket pair - one for browser and one for renderer. 2. Browser prepares the foreign socket (Windows duplicates, POSIX creates file descriptor). 3. Browser relays the foreign socket handle to the renderer via IPC. 4. Renderer receives the IPC and creates the socket using the handle provided. 5. Sockets are ready for send/receive on both ends. Steps 1-4 get simplified since there is no need to check the platform in order to prepare the socket for transit. What this CL brings: 1. Adds |SyncSocket::TransitDescriptor| type which wraps the socket handle and is cross-platform. 2. Adds |SyncSocket::PrepareTransitDescriptor| method which is implemented depending on the platform. 3. Adds |SyncSocket::UnwrapHandle| method which unwraps |SyncSocket::Handle| from |SyncSocket::TransitDescriptor|. 4. Removes #ifdefs for platform-checks in code using |SyncSocket| and simplifies preparing the SyncSocket. Note: - There is still some less evident duplication in the ppapi and pepper-broker code which should be addressed. - SyncSocket unit test should also be reviewed. - There is a similar pattern when using SharedMemory. BUG=409656 Review URL: https://codereview.chromium.org/525313002 Cr-Commit-Position: refs/heads/master@{#293680}
* Move file_util to base/files/ directory.brettw@chromium.org2014-08-131-1/+1
| | | | | | | | | | | This updates the includes in base but leaves a forwarding header for the rest of the project for now. R=yzshen@chromium.org Review URL: https://codereview.chromium.org/468253002 Cr-Commit-Position: refs/heads/master@{#289360} git-svn-id: svn://svn.chromium.org/chrome/trunk/src@289360 0039d316-1c4b-4281-b951-d872f2087c98
* Move WriteFile and WriteFileDescriptor from file_util to base namespace.brettw@chromium.org2014-03-061-1/+1
| | | | | | | | | R=viettrungluu@chromium.org TBR=viettrungluu Review URL: https://codereview.chromium.org/184563006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@255418 0039d316-1c4b-4281-b951-d872f2087c98
* Move Posix file utils to the base namespace.brettw@chromium.org2013-11-271-1/+1
| | | | | | | | | BUG= R=rvargas@chromium.org Review URL: https://codereview.chromium.org/89523002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@237642 0039d316-1c4b-4281-b951-d872f2087c98
* Don't use select() in SyncSocket when handle > FD_SETSIZE.dalecurtis@google.com2013-11-051-1/+7
| | | | | | | | | | BUG=314364 TEST=audio playback still works, just glitches in 48->44 R=ajwong@chromium.org Review URL: https://codereview.chromium.org/49303008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@232845 0039d316-1c4b-4281-b951-d872f2087c98
* Ensure handle_ fits in FD_SETSIZE.dalecurtis@chromium.org2013-11-011-21/+20
| | | | | | | | | | | Speculative attempt to diagnose stack corruption issues. BUG=313843 TEST=none Review URL: https://codereview.chromium.org/54993006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@232449 0039d316-1c4b-4281-b951-d872f2087c98
* Add SyncSocket::ReceiveWithTimeout() and SyncSocket unit tests.dalecurtis@chromium.org2013-10-191-24/+97
| | | | | | | | | | | | | | | | Method does as advertised using select() on POSIX and the existing CancelableFileOperation() wrapper on Windows since there is no select() equivalent on XP. It was also high time we had some unit tests for this class, so I added a small set which exercise almost the full functionality. BUG=289124 TEST=base_unittests! Review URL: https://codereview.chromium.org/23875019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@229621 0039d316-1c4b-4281-b951-d872f2087c98
* Revert revert 132842xians@chromium.org2012-04-191-2/+23
| | | | | | | | | | | | | | | | If we are using blocking write, when the renderer stop getting the data without notifying the browser, it will hang the browser. This happens with some plugins which use the sync sockets provided by the Pepper. This patch change CancellableSyncSocket to be non-blocking on sending, so that we don't need to worry the whole browser hangs by one plugin application. Also, we remove the lock in audio_sync_reader.cc since it is not really needed if we don't set the socket_ to NULL when calling Close(). By doing this we allow the user to close the socket while another thread is writing to the socket. BUG=121152 TEST=ipc_tests TBR=tommi@chromium.org Review URL: https://chromiumcodereview.appspot.com/10124004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@132975 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 132842 - If we are using blocking write, when the renderer stop ↵thestig@chromium.org2012-04-181-23/+2
| | | | | | | | | | | | | | | | | | | getting the data without notifying the browser, it will hang the browser. This happens with some plugins which use the sync sockets provided by the Pepper. This patch change CancellableSyncSocket to be non-blocking on sending, so that we don't need to worry the whole browser hangs by one plugin application. Also, we remove the lock in audio_sync_reader.cc since it is not really needed if we don't set the socket_ to NULL when calling Close(). By doing this we allow the user to close the socket while another thread is writing to the socket. BUG=121152 TEST=ipc_tests Review URL: http://codereview.chromium.org/10000004 TBR=xians@chromium.org Review URL: https://chromiumcodereview.appspot.com/10083064 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@132888 0039d316-1c4b-4281-b951-d872f2087c98
* If we are using blocking write, when the renderer stop getting the data ↵xians@chromium.org2012-04-181-2/+23
| | | | | | | | | | | | | | | | without notifying the browser, it will hang the browser. This happens with some plugins which use the sync sockets provided by the Pepper. This patch change CancellableSyncSocket to be non-blocking on sending, so that we don't need to worry the whole browser hangs by one plugin application. Also, we remove the lock in audio_sync_reader.cc since it is not really needed if we don't set the socket_ to NULL when calling Close(). By doing this we allow the user to close the socket while another thread is writing to the socket. BUG=121152 TEST=ipc_tests Review URL: http://codereview.chromium.org/10000004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@132842 0039d316-1c4b-4281-b951-d872f2087c98
* Implement support for a cancelable SyncSocket.tommi@chromium.org2012-01-251-25/+38
| | | | | | | | | | | | Currently, blocking SyncSocket operations can not be unblocked from other threads, but this is now supported by using the CancelableSyncSocket class. The implementation on Mac and Linux is very simple and basically consists of adding a call to shutdown(). On Windows however things are a tiny bit more complex since we use named pipes with synchronous IO and canceling synchronous IO is simply not possible on XP and arguably tricky on Vista+. So, what we do instead is to use asynchronous IO in a synchronous fashion to support the SyncSocket semantics and as well as allowing the connection to be correctly shut down from another thread. Review URL: https://chromiumcodereview.appspot.com/8965053 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@119051 0039d316-1c4b-4281-b951-d872f2087c98
* Fixed CID 102675, uninitialized member varsgroby@chromium.org2011-12-221-2/+2
| | | | | | | | | | CID=102675, 102638 TEST=none Review URL: http://codereview.chromium.org/8965049 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@115579 0039d316-1c4b-4281-b951-d872f2087c98
* Replace most LOG/CHECK statements with DLOG/DCHECK statements in base.brettw@chromium.org2011-10-261-3/+3
| | | | | | | | | | | [ Reland of 107042 http://codereview.chromium.org/8368009 ] I tried hard not to change CHECKs that had side effects. I kept fatal checks that seemed security or debugging-info (in crash reports) sensitive, and ones that seems particularly well-conceived. Review URL: http://codereview.chromium.org/8341026 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@107434 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 107042 - Replace most LOG/CHECK statements with DLOG/DCHECK ↵brettw@chromium.org2011-10-251-3/+3
| | | | | | | | | | | | | | statements in base. I tried hard not to change CHECKs that had side effects. I kept fatal checks that seemed security or debugging-info (in crash reports) sensitive, and ones that seems particularly well-conceived. Review URL: http://codereview.chromium.org/8368009 TBR=brettw@chromium.org Review URL: http://codereview.chromium.org/8351025 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@107051 0039d316-1c4b-4281-b951-d872f2087c98
* Replace most LOG/CHECK statements with DLOG/DCHECK statements in base.brettw@chromium.org2011-10-251-3/+3
| | | | | | | | | I tried hard not to change CHECKs that had side effects. I kept fatal checks that seemed security or debugging-info (in crash reports) sensitive, and ones that seems particularly well-conceived. Review URL: http://codereview.chromium.org/8368009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@107042 0039d316-1c4b-4281-b951-d872f2087c98
* Patch for Solaris support, mostly ifdefs and header files, plus adds ↵chromium@hybridsource.org2011-06-251-0/+4
| | | | | | | | | | | libevent configuration. BUG=30101 TEST=compiles Review URL: http://codereview.chromium.org/7238021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@90494 0039d316-1c4b-4281-b951-d872f2087c98
* Update DCHECK() usage to utilize the more expressive debugging functions.kushi.p@gmail.com2011-04-221-3/+3
| | | | | | | | BUG=58409 Review URL: http://codereview.chromium.org/6891008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@82639 0039d316-1c4b-4281-b951-d872f2087c98
* Dup command-buffer SHM handle before auto-closing.piman@google.com2011-02-231-5/+11
| | | | | | | | | | | This also adds error logging to the various places we close file descriptors, to help diagnosing future similar issues. BUG=none TEST=Pepper Flash + youtube in oop with --enable-accelerated-plugins Review URL: http://codereview.chromium.org/6549037 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@75792 0039d316-1c4b-4281-b951-d872f2087c98
* FBTF: Remove unneeded headers from base/ (part 2)thestig@chromium.org2010-08-061-1/+0
| | | | | | | | BUG=none TEST=none Review URL: http://codereview.chromium.org/3010052 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@55191 0039d316-1c4b-4281-b951-d872f2087c98
* Style cleanup in preparation for auto-linting base/.erg@google.com2010-01-261-1/+1
| | | | | | | | | BUG=none TEST=none Review URL: http://codereview.chromium.org/552004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@37164 0039d316-1c4b-4281-b951-d872f2087c98
* Add an implementation of base::SyncSocket::Peek for posix platforms. Alsosehr@google.com2009-12-061-3/+7
| | | | | | | | | update the unit test to test the result. TEST=ipc_tests/sync_socket_unittest.cc Review URL: http://codereview.chromium.org/468023 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33944 0039d316-1c4b-4281-b951-d872f2087c98
* Add non-blocking peek for the syncsocketcpu@chromium.org2009-12-041-0/+6
| | | | | | | | | | | | - Windows only BUG=none TEST=unit test included Review URL: http://codereview.chromium.org/464020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33876 0039d316-1c4b-4281-b951-d872f2087c98
* Implement SyncSocket class for Posix targets (Linux, Mac), and enable thesehr@google.com2009-11-261-0/+101
corresponding unittest. This feature, as a reminder, allows low-latency (blocking) send/receive between processes, and will be used for real-time thread synchronization for Pepper audio and for direct synchronization for 3D video. Review URL: http://codereview.chromium.org/431043 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33161 0039d316-1c4b-4281-b951-d872f2087c98