Index: content/child/child_native_pixmap_manager_ozone.cc |
diff --git a/content/child/child_native_pixmap_manager_ozone.cc b/content/child/child_native_pixmap_manager_ozone.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..c8afa94745d35fff07220e5391b25eafa67eb5cf |
--- /dev/null |
+++ b/content/child/child_native_pixmap_manager_ozone.cc |
@@ -0,0 +1,59 @@ |
+// 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_native_pixmap_manager_ozone.h" |
+ |
+#include "base/file_descriptor_posix.h" |
+#include "content/common/gpu/native_pixmap_manager_ozone_messages.h" |
+ |
+namespace content { |
+ |
+namespace { |
+ |
+ChildNativePixmapManager* g_manager = nullptr; |
+} |
+ |
+// static |
+ChildNativePixmapManager* ChildNativePixmapManager::CreateSingleton( |
+ ThreadSafeSender* sender) { |
+ if (g_manager) { |
+ return g_manager; |
+ } |
+ |
+ TRACE_EVENT0("renderer", "ChildNativePixmapManager::Create"); |
+ DCHECK(sender); |
+ scoped_ptr<ChildNativePixmapManager> manager(new ChildNativePixmapManager()); |
+ |
+ base::FileDescriptor virtual_device; |
+ IPC::Message* message = |
+ new BrowserNativePixmapManagerMsg_SyncGetVirtualDevice(&virtual_device); |
+ bool success = sender->Send(message); |
+ if (!success) { |
+ LOG(ERROR) |
+ << "Fail to send BrowserNativePixmapManagerMsg_SyncGetVirtualDevice"; |
+ return nullptr; |
+ } |
+ |
+ manager->Initialize(virtual_device); |
+ g_manager = manager.release(); |
+ return g_manager; |
+} |
+ |
+ChildNativePixmapManager::ChildNativePixmapManager() { |
+} |
+ |
+ChildNativePixmapManager::~ChildNativePixmapManager() { |
+} |
+ |
+void ChildNativePixmapManager::Initialize( |
+ const base::FileDescriptor& device_fd) { |
+ pixmap_manager_ = ui::NativePixmapManager::Create(device_fd); |
+} |
+ |
+std::vector<ui::NativePixmapManager::Configuration> |
+ChildNativePixmapManager::GetSupportedNativePixmapConfigurations() const { |
+ return pixmap_manager_->GetSupportedNativePixmapConfigurations(); |
+} |
+ |
+} // namespace content |