summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/render_process.cc
diff options
context:
space:
mode:
authoragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-05 21:40:11 +0000
committeragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-05 21:40:11 +0000
commit2749885f65019b0216f5c0401d0f5a28585eb83f (patch)
tree166a5090004f63ae435e434d711e2ce335909851 /chrome/renderer/render_process.cc
parent06533c0b11ce14b45eb0205fdc28a217eeba763c (diff)
downloadchromium_src-2749885f65019b0216f5c0401d0f5a28585eb83f.zip
chromium_src-2749885f65019b0216f5c0401d0f5a28585eb83f.tar.gz
chromium_src-2749885f65019b0216f5c0401d0f5a28585eb83f.tar.bz2
POSIX: Rewrite IPC's interaction with FileDescriptor
The FileDescriptor API is clearly too hard to use. It's the only IPC data type which is non-POD and serialising an invalid file descriptor is fatal to Chrome on POSIX. The use of Maybe is possibly non-obvious to non-functional programmers. This patch merges Maybe and FileDescriptor so that serialising invalid file descriptors is permitted and results in -1 at the other end. (Serialising /closed/ a file descriptor is still fatal.) Also, it adds a pointer in base/file_descriptor.h to instructions for its use with IPC. Although it's generally bad practice to mention IPC in base, in this case I cannot find another suitable location. Review URL: http://codereview.chromium.org/39208 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11041 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/render_process.cc')
-rw-r--r--chrome/renderer/render_process.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/chrome/renderer/render_process.cc b/chrome/renderer/render_process.cc
index 99b91fa..b10042b 100644
--- a/chrome/renderer/render_process.cc
+++ b/chrome/renderer/render_process.cc
@@ -190,13 +190,13 @@ TransportDIB* RenderProcess::CreateTransportDIB(size_t size) {
#elif defined(OS_MACOSX) // defined(OS_WIN) || defined(OS_LINUX)
// Mac creates transport DIBs in the browser, so we need to do a sync IPC to
// get one.
- IPC::Maybe<TransportDIB::Handle> mhandle;
- IPC::Message* msg = new ViewHostMsg_AllocTransportDIB(size, &mhandle);
+ TransportDIB::Handle handle;
+ IPC::Message* msg = new ViewHostMsg_AllocTransportDIB(size, &handle);
if (!child_thread()->Send(msg))
return NULL;
- if (!mhandle.valid)
+ if (handle.fd < 0)
return NULL;
- return TransportDIB::Map(mhandle.value);
+ return TransportDIB::Map(handle);
#endif // defined(OS_MACOSX)
}