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

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

Issue 60323002: Revert 232547 "Pepper: Move FileIO host from renderer to browser." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 1 month 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
Index: trunk/src/content/browser/renderer_host/render_message_filter.cc
===================================================================
--- trunk/src/content/browser/renderer_host/render_message_filter.cc (revision 233010)
+++ trunk/src/content/browser/renderer_host/render_message_filter.cc (working copy)
@@ -389,6 +389,7 @@
OnDidDeleteOutOfProcessPepperInstance)
IPC_MESSAGE_HANDLER(ViewHostMsg_OpenChannelToPpapiBroker,
OnOpenChannelToPpapiBroker)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_AsyncOpenPepperFile, OnAsyncOpenPepperFile)
#endif
IPC_MESSAGE_HANDLER_GENERIC(ViewHostMsg_UpdateRect,
render_widget_helper_->DidReceiveBackingStoreMsg(message))
@@ -439,6 +440,8 @@
if (message.type() == ViewHostMsg_GetAudioHardwareConfig::ID)
return audio_manager_->GetMessageLoop().get();
#endif
+ if (message.type() == ViewHostMsg_AsyncOpenPepperFile::ID)
+ return BrowserThread::GetBlockingPool();
return NULL;
}
@@ -985,6 +988,33 @@
Send(reply_msg);
}
+void RenderMessageFilter::OnAsyncOpenPepperFile(int routing_id,
+ const base::FilePath& path,
+ int pp_open_flags) {
+ int platform_file_flags = 0;
+ if (!CanOpenWithPepperFlags(pp_open_flags, render_process_id_, path) ||
+ !ppapi::PepperFileOpenFlagsToPlatformFileFlags(
+ pp_open_flags, &platform_file_flags)) {
+ DLOG(ERROR) <<
+ "Bad pp_open_flags in ViewMsgHost_AsyncOpenPepperFile message: " <<
+ pp_open_flags;
+ RecordAction(UserMetricsAction("BadMessageTerminate_AOF"));
+ BadMessageReceived();
+ return;
+ }
+
+ base::PlatformFileError error_code = base::PLATFORM_FILE_OK;
+ base::PlatformFile file = base::CreatePlatformFile(
+ path, platform_file_flags, NULL, &error_code);
+ IPC::PlatformFileForTransit file_for_transit =
+ file != base::kInvalidPlatformFileValue ?
+ IPC::GetFileHandleForProcess(file, PeerHandle(), true) :
+ IPC::InvalidPlatformFileForTransit();
+
+ Send(new ViewMsg_AsyncOpenPepperFile_ACK(
+ routing_id, error_code, file_for_transit));
+}
+
void RenderMessageFilter::OnMediaLogEvents(
const std::vector<media::MediaLogEvent>& events) {
if (media_internals_)

Powered by Google App Engine
This is Rietveld 408576698