Skip to content

Commit

Permalink
Refactor: Remove BrokerGetFileHandleForProcess.
Browse files Browse the repository at this point in the history
The method is no longer necessary, since callers can directly call
IPC::GetPlatformFileForTransit.

BUG=493414

Review URL: https://codereview.chromium.org/1869093002

Cr-Commit-Position: refs/heads/master@{#387012}
  • Loading branch information
erikchen authored and Commit bot committed Apr 13, 2016
1 parent 88283ec commit 8d5ea3d
Show file tree
Hide file tree
Showing 9 changed files with 7 additions and 83 deletions.
10 changes: 2 additions & 8 deletions content/browser/renderer_host/pepper/pepper_file_io_host.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
#include "content/browser/renderer_host/pepper/pepper_file_system_browser_host.h"
#include "content/browser/renderer_host/pepper/pepper_security_helper.h"
#include "content/common/fileapi/file_system_messages.h"
#include "content/common/sandbox_util.h"
#include "content/common/view_messages.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/storage_partition.h"
#include "content/public/common/content_client.h"
#include "ipc/ipc_platform_file.h"
#include "ppapi/c/pp_errors.h"
#include "ppapi/c/ppb_file_io.h"
#include "ppapi/host/dispatch_host_message.h"
Expand Down Expand Up @@ -480,14 +480,8 @@ void PepperFileIOHost::SendOpenErrorReply(
bool PepperFileIOHost::AddFileToReplyContext(
int32_t open_flags,
ppapi::host::ReplyMessageContext* reply_context) const {
base::ProcessId plugin_process_id =
base::GetProcId(browser_ppapi_host_->GetPluginProcess().Handle());
if (plugin_process_id == base::kNullProcessId)
plugin_process_id = resolved_render_process_id_;

IPC::PlatformFileForTransit transit_file =
BrokerGetFileHandleForProcess(file_.GetPlatformFile(), plugin_process_id,
false);
IPC::GetPlatformFileForTransit(file_.GetPlatformFile(), false);
if (transit_file == IPC::InvalidPlatformFileForTransit())
return false;

Expand Down
1 change: 0 additions & 1 deletion content/common/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,6 @@ source_set("common") {
"pepper_renderer_instance_data.h",
"plugin_list.cc",
"plugin_list.h",
"sandbox_util.cc",
]
}

Expand Down
25 changes: 0 additions & 25 deletions content/common/sandbox_util.cc

This file was deleted.

26 changes: 0 additions & 26 deletions content/common/sandbox_util.h

This file was deleted.

3 changes: 0 additions & 3 deletions content/content_common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -539,8 +539,6 @@
'common/sandbox_linux/sandbox_seccomp_bpf_linux.h',
'common/sandbox_mac.h',
'common/sandbox_mac.mm',
'common/sandbox_util.cc',
'common/sandbox_util.h',
'common/sandbox_win.cc',
'common/sandbox_win.h',
'common/savable_subframe.h',
Expand Down Expand Up @@ -707,7 +705,6 @@
'common/pepper_renderer_instance_data.h',
'common/plugin_list.cc',
'common/plugin_list.h',
'common/sandbox_util.cc',
'public/common/pepper_plugin_info.cc',
'public/common/pepper_plugin_info.h',
],
Expand Down
11 changes: 1 addition & 10 deletions content/ppapi_plugin/ppapi_thread.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
#include "content/child/child_discardable_shared_memory_manager.h"
#include "content/child/child_process.h"
#include "content/common/child_process_messages.h"
#include "content/common/sandbox_util.h"
#include "content/ppapi_plugin/broker_process_dispatcher.h"
#include "content/ppapi_plugin/plugin_process_dispatcher.h"
#include "content/ppapi_plugin/ppapi_blink_platform_impl.h"
Expand Down Expand Up @@ -192,15 +191,7 @@ IPC::PlatformFileForTransit PpapiThread::ShareHandleWithRemote(
base::PlatformFile handle,
base::ProcessId peer_pid,
bool should_close_source) {
#if defined(OS_WIN)
if (peer_handle_.IsValid()) {
DCHECK(is_broker_);
return IPC::GetPlatformFileForTransit(handle, should_close_source);
}
#endif

DCHECK(peer_pid != base::kNullProcessId);
return BrokerGetFileHandleForProcess(handle, peer_pid, should_close_source);
return IPC::GetPlatformFileForTransit(handle, should_close_source);
}

base::SharedMemoryHandle PpapiThread::ShareSharedMemoryHandleWithRemote(
Expand Down
1 change: 0 additions & 1 deletion content/renderer/pepper/host_array_buffer_var.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include "base/memory/shared_memory.h"
#include "base/process/process_handle.h"
#include "content/common/pepper_file_util.h"
#include "content/common/sandbox_util.h"
#include "content/renderer/pepper/host_globals.h"
#include "content/renderer/pepper/plugin_module.h"
#include "content/renderer/pepper/renderer_ppapi_host_impl.h"
Expand Down
8 changes: 2 additions & 6 deletions content/renderer/pepper/pepper_proxy_channel_delegate_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@

#include "build/build_config.h"
#include "content/child/child_process.h"
#include "content/common/sandbox_util.h"

#if defined(OS_WIN) || defined(OS_MACOSX)
#include "content/public/common/sandbox_init.h"
#endif // defined(OS_WIN) || defined(OS_MACOSX)
#include "ipc/ipc_platform_file.h"

namespace content {

Expand All @@ -33,7 +29,7 @@ PepperProxyChannelDelegateImpl::ShareHandleWithRemote(
base::PlatformFile handle,
base::ProcessId remote_pid,
bool should_close_source) {
return BrokerGetFileHandleForProcess(handle, remote_pid, should_close_source);
return IPC::GetPlatformFileForTransit(handle, should_close_source);
}

base::SharedMemoryHandle
Expand Down
5 changes: 2 additions & 3 deletions content/renderer/pepper/renderer_ppapi_host_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include "base/process/process_handle.h"
#include "base/single_thread_task_runner.h"
#include "base/thread_task_runner_handle.h"
#include "content/common/sandbox_util.h"
#include "content/renderer/pepper/fullscreen_container.h"
#include "content/renderer/pepper/host_globals.h"
#include "content/renderer/pepper/pepper_browser_connection.h"
Expand All @@ -23,6 +22,7 @@
#include "content/renderer/render_view_impl.h"
#include "content/renderer/render_widget_fullscreen_pepper.h"
#include "ipc/ipc_message.h"
#include "ipc/ipc_platform_file.h"
#include "ppapi/host/ppapi_host.h"
#include "ppapi/proxy/host_dispatcher.h"
#include "third_party/WebKit/public/platform/WebRect.h"
Expand Down Expand Up @@ -225,8 +225,7 @@ IPC::PlatformFileForTransit RendererPpapiHostImpl::ShareHandleWithRemote(
// Duplicate the file handle for in process mode so this function
// has the same semantics for both in process mode and out of
// process mode (i.e., the remote side must cloes the handle).
return BrokerGetFileHandleForProcess(
handle, base::GetCurrentProcId(), should_close_source);
return IPC::GetPlatformFileForTransit(handle, should_close_source);
}
return dispatcher_->ShareHandleWithRemote(handle, should_close_source);
}
Expand Down

0 comments on commit 8d5ea3d

Please sign in to comment.