Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(578)

Unified Diff: content/browser/renderer_host/render_message_filter.cc

Issue 7326007: AsyncOpenFileOnFileThread: Properly release file handle at the browser side. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Fix style issue. Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/render_message_filter.cc
diff --git a/content/browser/renderer_host/render_message_filter.cc b/content/browser/renderer_host/render_message_filter.cc
index ff4c6d21f93a28e598f1d07fc87fd942ec36fd19..9743088ce7b8cd90d0e4141f8d417bfb862e1933 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);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698