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

Unified Diff: content/renderer/render_thread_impl.cc

Issue 20777009: A few more cleanups to the pepper code. Dispatch IPCs in the sockets implementations directly by ha… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix tcp tests Created 7 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
Index: content/renderer/render_thread_impl.cc
===================================================================
--- content/renderer/render_thread_impl.cc (revision 214423)
+++ content/renderer/render_thread_impl.cc (working copy)
@@ -12,6 +12,7 @@
#include "base/allocator/allocator_extension.h"
#include "base/command_line.h"
#include "base/debug/trace_event.h"
+#include "base/files/file_util_proxy.h"
#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/memory/discardable_memory.h"
@@ -1137,6 +1138,7 @@
IPC_MESSAGE_HANDLER(ViewMsg_TempCrashWithData, OnTempCrashWithData)
IPC_MESSAGE_HANDLER(ViewMsg_SetWebKitSharedTimersSuspended,
OnSetWebKitSharedTimersSuspended)
+ IPC_MESSAGE_HANDLER(ViewMsg_AsyncOpenFile_ACK, OnAsyncFileOpened)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
@@ -1276,6 +1278,28 @@
ToggleWebKitSharedTimer(suspend);
}
+void RenderThreadImpl::OnAsyncFileOpened(
+ base::PlatformFileError error_code,
+ IPC::PlatformFileForTransit file_for_transit,
+ int message_id) {
+ AsyncOpenFileCallback* callback =
dmichael (off chromium) 2013/08/01 22:43:01 nit: scoped_ptr?
+ pending_async_open_files_.Lookup(message_id);
+ DCHECK(callback);
+ pending_async_open_files_.Remove(message_id);
+
+ base::PlatformFile file =
+ IPC::PlatformFileForTransitToPlatformFile(file_for_transit);
+ callback->Run(error_code, base::PassPlatformFile(&file));
+ // Make sure we won't leak file handle if the requester has died.
+ if (file != base::kInvalidPlatformFileValue) {
+ base::FileUtilProxy::Close(
+ GetFileThreadMessageLoopProxy().get(),
+ file,
+ base::FileUtilProxy::StatusCallback());
+ }
+ delete callback;
+}
+
void RenderThreadImpl::OnMemoryPressure(
base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level) {
base::allocator::ReleaseFreeMemory();
@@ -1318,7 +1342,14 @@
const std::vector<float>& new_touchscreen) {
webkit_platform_support_->SetFlingCurveParameters(new_touchpad,
new_touchscreen);
+}
+void RenderThreadImpl::AsyncOpenFile(const base::FilePath& path,
+ int flags,
+ const AsyncOpenFileCallback& callback) {
+ int message_id = pending_async_open_files_.Add(
+ new AsyncOpenFileCallback(callback));
+ Send(new ViewHostMsg_AsyncOpenFile(path, flags, message_id));
}
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698