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_client_native_pixmap_factory_ozone.h" |
| 6 |
| 7 #include "base/file_descriptor_posix.h" |
| 8 #include "base/memory/singleton.h" |
| 9 |
| 10 namespace content { |
| 11 |
| 12 struct ChildClientNativePixmapFactoryTrait |
| 13 : public DefaultSingletonTraits<ChildClientNativePixmapFactory> { |
| 14 static ChildClientNativePixmapFactory* New() { |
| 15 ChildClientNativePixmapFactory* manager = |
| 16 new ChildClientNativePixmapFactory(); |
| 17 return manager; |
| 18 } |
| 19 }; |
| 20 |
| 21 // static |
| 22 ChildClientNativePixmapFactory* ChildClientNativePixmapFactory::GetInstance() { |
| 23 return Singleton<ChildClientNativePixmapFactory, |
| 24 ChildClientNativePixmapFactoryTrait>::get(); |
| 25 } |
| 26 |
| 27 ChildClientNativePixmapFactory::ChildClientNativePixmapFactory() {} |
| 28 |
| 29 ChildClientNativePixmapFactory::~ChildClientNativePixmapFactory() {} |
| 30 |
| 31 void ChildClientNativePixmapFactory::Initialize( |
| 32 const base::FileDescriptor& virtual_device) { |
| 33 pixmap_factory_ = ui::ClientNativePixmapFactory::Create(virtual_device); |
| 34 } |
| 35 |
| 36 std::vector<ui::ClientNativePixmapFactory::Configuration> |
| 37 ChildClientNativePixmapFactory::GetSupportedConfigurations() const { |
| 38 return pixmap_factory_->GetSupportedConfigurations(); |
| 39 } |
| 40 |
| 41 scoped_ptr<ui::ClientNativePixmap> |
| 42 ChildClientNativePixmapFactory::ImportNativePixmap( |
| 43 const base::FileDescriptor& handle, |
| 44 const gfx::Size& size, |
| 45 gfx::BufferFormat format, |
| 46 gfx::BufferUsage usage) { |
| 47 return pixmap_factory_->ImportNativePixmap(handle, size, format, usage); |
| 48 } |
| 49 |
| 50 } // namespace content |
OLD | NEW |