Commit 840d810e authored by yzshen@chromium.org's avatar yzshen@chromium.org

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
parent 44a016a8
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include "content/common/url_constants.h" #include "content/common/url_constants.h"
#include "content/common/view_messages.h" #include "content/common/view_messages.h"
#include "ipc/ipc_channel_handle.h" #include "ipc/ipc_channel_handle.h"
#include "ipc/ipc_platform_file.h"
#include "net/base/cookie_monster.h" #include "net/base/cookie_monster.h"
#include "net/base/host_resolver_impl.h" #include "net/base/host_resolver_impl.h"
#include "net/base/io_buffer.h" #include "net/base/io_buffer.h"
...@@ -850,15 +851,9 @@ void RenderMessageFilter::AsyncOpenFileOnFileThread(const FilePath& path, ...@@ -850,15 +851,9 @@ void RenderMessageFilter::AsyncOpenFileOnFileThread(const FilePath& path,
base::PlatformFile file = base::CreatePlatformFile( base::PlatformFile file = base::CreatePlatformFile(
path, flags, NULL, &error_code); path, flags, NULL, &error_code);
IPC::PlatformFileForTransit file_for_transit = IPC::PlatformFileForTransit file_for_transit =
IPC::InvalidPlatformFileForTransit(); file != base::kInvalidPlatformFileValue ?
if (file != base::kInvalidPlatformFileValue) { IPC::GetFileHandleForProcess(file, peer_handle(), true) :
#if defined(OS_WIN) IPC::InvalidPlatformFileForTransit();
::DuplicateHandle(::GetCurrentProcess(), file, peer_handle(),
&file_for_transit, 0, false, DUPLICATE_SAME_ACCESS);
#else
file_for_transit = base::FileDescriptor(file, true);
#endif
}
IPC::Message* reply = new ViewMsg_AsyncOpenFile_ACK( IPC::Message* reply = new ViewMsg_AsyncOpenFile_ACK(
routing_id, error_code, file_for_transit, message_id); routing_id, error_code, file_for_transit, message_id);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment