| Index: content/child/child_client_native_pixmap_manager_message_filter_ozone.cc
|
| diff --git a/content/child/child_client_native_pixmap_manager_message_filter_ozone.cc b/content/child/child_client_native_pixmap_manager_message_filter_ozone.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..7378a4d4d7cd4f01b82d3a468d1db30615504550
|
| --- /dev/null
|
| +++ b/content/child/child_client_native_pixmap_manager_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_manager_message_filter_ozone.h"
|
| +
|
| +#include "base/files/scoped_file.h"
|
| +#include "content/child/child_client_native_pixmap_manager_ozone.h"
|
| +#include "content/common/gpu/client_native_pixmap_manager_ozone_messages.h"
|
| +#include "ipc/ipc_message_macros.h"
|
| +
|
| +namespace content {
|
| +
|
| +ChildClientNativePixmapManagerMessageFilter::
|
| + ChildClientNativePixmapManagerMessageFilter() {}
|
| +
|
| +ChildClientNativePixmapManagerMessageFilter::
|
| + ~ChildClientNativePixmapManagerMessageFilter() {}
|
| +
|
| +void ChildClientNativePixmapManagerMessageFilter::OnSetVirtualDevice(
|
| + const base::FileDescriptor& virtual_device) {
|
| + if (!ui::ClientNativePixmapManager::GetInstance()) {
|
| + ChildClientNativePixmapManager::GetInstance()->Initialize(virtual_device);
|
| + ui::ClientNativePixmapManager::SetInstance(
|
| + ChildClientNativePixmapManager::GetInstance());
|
| + } 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 ChildClientNativePixmapManagerMessageFilter::OnMessageReceived(
|
| + const IPC::Message& message) {
|
| + bool handled = true;
|
| + IPC_BEGIN_MESSAGE_MAP(ChildClientNativePixmapManagerMessageFilter, message)
|
| + IPC_MESSAGE_HANDLER(ChildClientNativePixmapManagerMsg_SetVirtualDevice,
|
| + OnSetVirtualDevice)
|
| + IPC_MESSAGE_UNHANDLED(handled = false)
|
| + IPC_END_MESSAGE_MAP()
|
| + return handled;
|
| +}
|
| +
|
| +} // namespace content
|
|
|