OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "content/child/child_native_pixmap_manager_ozone.h" |
| 6 |
| 7 #include "base/file_descriptor_posix.h" |
| 8 #include "content/common/gpu/native_pixmap_manager_ozone_messages.h" |
| 9 |
| 10 namespace content { |
| 11 |
| 12 namespace { |
| 13 |
| 14 ChildNativePixmapManager* g_manager = nullptr; |
| 15 } |
| 16 |
| 17 // static |
| 18 ChildNativePixmapManager* ChildNativePixmapManager::CreateSingleton( |
| 19 ThreadSafeSender* sender) { |
| 20 if (g_manager) { |
| 21 return g_manager; |
| 22 } |
| 23 |
| 24 TRACE_EVENT0("renderer", "ChildNativePixmapManager::Create"); |
| 25 DCHECK(sender); |
| 26 scoped_ptr<ChildNativePixmapManager> manager(new ChildNativePixmapManager()); |
| 27 |
| 28 base::FileDescriptor virtual_device; |
| 29 IPC::Message* message = |
| 30 new BrowserNativePixmapManagerMsg_SyncGetVirtualDevice(&virtual_device); |
| 31 bool success = sender->Send(message); |
| 32 if (!success) { |
| 33 LOG(ERROR) |
| 34 << "Fail to send BrowserNativePixmapManagerMsg_SyncGetVirtualDevice"; |
| 35 return nullptr; |
| 36 } |
| 37 |
| 38 manager->Initialize(virtual_device); |
| 39 g_manager = manager.release(); |
| 40 return g_manager; |
| 41 } |
| 42 |
| 43 ChildNativePixmapManager::ChildNativePixmapManager() { |
| 44 } |
| 45 |
| 46 ChildNativePixmapManager::~ChildNativePixmapManager() { |
| 47 } |
| 48 |
| 49 void ChildNativePixmapManager::Initialize( |
| 50 const base::FileDescriptor& device_fd) { |
| 51 pixmap_manager_ = ui::NativePixmapManager::Create(device_fd); |
| 52 } |
| 53 |
| 54 std::vector<ui::NativePixmapManager::Configuration> |
| 55 ChildNativePixmapManager::GetSupportedNativePixmapConfigurations() const { |
| 56 return pixmap_manager_->GetSupportedNativePixmapConfigurations(); |
| 57 } |
| 58 |
| 59 } // namespace content |
OLD | NEW |