diff options
author | yzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-08 03:09:32 +0000 |
---|---|---|
committer | yzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-08 03:09:32 +0000 |
commit | 840d810e3a4492961038387ab486fab8c5087b53 (patch) | |
tree | f81d4a48aee8c7b57f1dbd902451f3f693c85c1c /content | |
parent | 44a016a843efffc53256c862c792e53d7909c802 (diff) | |
download | chromium_src-840d810e3a4492961038387ab486fab8c5087b53.zip chromium_src-840d810e3a4492961038387ab486fab8c5087b53.tar.gz chromium_src-840d810e3a4492961038387ab486fab8c5087b53.tar.bz2 |
AsyncOpenFileOnFileThread: Properly release file handle at the browser side.
BUG=79824
TEST=None
Review URL: http://codereview.chromium.org/7326007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@91801 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r-- | content/browser/renderer_host/render_message_filter.cc | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/content/browser/renderer_host/render_message_filter.cc b/content/browser/renderer_host/render_message_filter.cc index ff4c6d2..9743088 100644 --- a/content/browser/renderer_host/render_message_filter.cc +++ b/content/browser/renderer_host/render_message_filter.cc @@ -32,6 +32,7 @@ #include "content/common/url_constants.h" #include "content/common/view_messages.h" #include "ipc/ipc_channel_handle.h" +#include "ipc/ipc_platform_file.h" #include "net/base/cookie_monster.h" #include "net/base/host_resolver_impl.h" #include "net/base/io_buffer.h" @@ -850,15 +851,9 @@ void RenderMessageFilter::AsyncOpenFileOnFileThread(const FilePath& path, base::PlatformFile file = base::CreatePlatformFile( path, flags, NULL, &error_code); IPC::PlatformFileForTransit file_for_transit = - IPC::InvalidPlatformFileForTransit(); - if (file != base::kInvalidPlatformFileValue) { -#if defined(OS_WIN) - ::DuplicateHandle(::GetCurrentProcess(), file, peer_handle(), - &file_for_transit, 0, false, DUPLICATE_SAME_ACCESS); -#else - file_for_transit = base::FileDescriptor(file, true); -#endif - } + file != base::kInvalidPlatformFileValue ? + IPC::GetFileHandleForProcess(file, peer_handle(), true) : + IPC::InvalidPlatformFileForTransit(); IPC::Message* reply = new ViewMsg_AsyncOpenFile_ACK( routing_id, error_code, file_for_transit, message_id); |