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

Unified Diff: ppapi/proxy/ppb_flash_file_proxy.cc

Issue 6580050: Factor fd sharing code in proxy and fix fd issues once and for all. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix review comments Created 9 years, 10 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 | « ppapi/proxy/ppb_context_3d_proxy.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/proxy/ppb_flash_file_proxy.cc
diff --git a/ppapi/proxy/ppb_flash_file_proxy.cc b/ppapi/proxy/ppb_flash_file_proxy.cc
index 5b83fa5cb42f9fd5c201fa4ddb1909ebc74a8e8a..0c0869af2237331640d38d57970dd6431128682c 100644
--- a/ppapi/proxy/ppb_flash_file_proxy.cc
+++ b/ppapi/proxy/ppb_flash_file_proxy.cc
@@ -18,31 +18,20 @@ namespace proxy {
namespace {
-// Given an error code and a handle result from a Pepper API call, converts
-// to a PlatformFileForTransit, possibly also updating the error value if
-// an error occurred.
+// Given an error code and a handle result from a Pepper API call, converts to a
+// PlatformFileForTransit by sharing with the other side, closing the original
+// handle, possibly also updating the error value if an error occurred.
IPC::PlatformFileForTransit PlatformFileToPlatformFileForTransit(
+ Dispatcher* dispatcher,
int32_t* error,
base::PlatformFile file) {
if (*error != PP_OK)
return IPC::InvalidPlatformFileForTransit();
-#if defined(OS_WIN)
-/* TODO(brettw): figure out how to get the target process handle.
- HANDLE result;
- if (!::DuplicateHandle(::GetCurrentProcess(), file,
- target_process, &result, 0, false,
- DUPLICATE_CLOSE_SOURCE | DUPLICATE_SAME_ACCESS)) {
+ IPC::PlatformFileForTransit out_handle =
+ dispatcher->ShareHandleWithRemote(file, true);
+ if (out_handle == IPC::InvalidPlatformFileForTransit())
*error = PP_ERROR_NOACCESS;
- return INVALID_HANDLE_VALUE;
- }
- return result;
-*/
- NOTIMPLEMENTED();
- *error = PP_ERROR_NOACCESS;
- return INVALID_HANDLE_VALUE;
-#elif defined(OS_POSIX)
- return base::FileDescriptor(file, true);
-#endif
+ return out_handle;
}
void FreeDirContents(PP_Instance /* instance */,
@@ -224,7 +213,8 @@ void PPB_Flash_File_ModuleLocal_Proxy::OnMsgOpenFile(
base::PlatformFile file;
*result = ppb_flash_file_module_local_target()->
OpenFile(instance, path.c_str(), mode, &file);
- *file_handle = PlatformFileToPlatformFileForTransit(result, file);
+ *file_handle = PlatformFileToPlatformFileForTransit(
+ dispatcher(), result, file);
}
void PPB_Flash_File_ModuleLocal_Proxy::OnMsgRenameFile(
« no previous file with comments | « ppapi/proxy/ppb_context_3d_proxy.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698