Index: content/child/child_client_native_pixmap_factory_message_filter_ozone.cc |
diff --git a/content/child/child_client_native_pixmap_factory_message_filter_ozone.cc b/content/child/child_client_native_pixmap_factory_message_filter_ozone.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..cd841fd157bba3c3e48c3cf16028c3c02eb6ef73 |
--- /dev/null |
+++ b/content/child/child_client_native_pixmap_factory_message_filter_ozone.cc |
@@ -0,0 +1,45 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "content/child/child_client_native_pixmap_factory_message_filter_ozone.h" |
+ |
+#include "base/files/scoped_file.h" |
+#include "content/child/child_client_native_pixmap_factory_ozone.h" |
+#include "content/common/gpu/client_native_pixmap_factory_ozone_messages.h" |
+#include "ipc/ipc_message_macros.h" |
+ |
+namespace content { |
+ |
+ChildClientNativePixmapFactoryMessageFilter:: |
+ ChildClientNativePixmapFactoryMessageFilter() {} |
+ |
+ChildClientNativePixmapFactoryMessageFilter:: |
+ ~ChildClientNativePixmapFactoryMessageFilter() {} |
+ |
+void ChildClientNativePixmapFactoryMessageFilter::OnSetVirtualDevice( |
+ const base::FileDescriptor& virtual_device) { |
+ if (!ui::ClientNativePixmapFactory::GetInstance()) { |
+ ChildClientNativePixmapFactory::GetInstance()->Initialize(virtual_device); |
+ ui::ClientNativePixmapFactory::SetInstance( |
+ ChildClientNativePixmapFactory::GetInstance()); |
reveman
2015/08/13 18:05:28
How do we make sure this happens before the render
dshwang
2015/08/14 12:40:03
Ok, now Renderer waits for vgem fd on importing Na
|
+ } else { |
+ // Many child threads can live in the same process. e.g. --single-process |
+ if (virtual_device.auto_close) { |
+ base::ScopedFD closing_fd(virtual_device.fd); |
+ } |
+ } |
+} |
+ |
+bool ChildClientNativePixmapFactoryMessageFilter::OnMessageReceived( |
+ const IPC::Message& message) { |
+ bool handled = true; |
+ IPC_BEGIN_MESSAGE_MAP(ChildClientNativePixmapFactoryMessageFilter, message) |
+ IPC_MESSAGE_HANDLER(ChildClientNativePixmapFactoryMsg_SetVirtualDevice, |
+ OnSetVirtualDevice) |
+ IPC_MESSAGE_UNHANDLED(handled = false) |
+ IPC_END_MESSAGE_MAP() |
+ return handled; |
+} |
+ |
+} // namespace content |