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 "ui/ozone/public/native_pixmap_manager.h" | |
6 | |
7 #include "base/command_line.h" | |
8 #include "base/logging.h" | |
9 #include "base/trace_event/trace_event.h" | |
10 #include "ui/ozone/platform_object.h" | |
11 #include "ui/ozone/platform_selection.h" | |
12 #include "ui/ozone/public/ozone_platform.h" | |
13 #include "ui/ozone/public/ozone_switches.h" | |
reveman
2015/07/22 16:59:55
do you need all these includes? base/command_line.
dshwang
2015/07/23 14:02:28
Done.
| |
14 | |
15 namespace ui { | |
16 | |
17 namespace { | |
18 | |
19 class StubNativePixmapManager : public NativePixmapManager { | |
20 public: | |
21 StubNativePixmapManager() {} | |
22 ~StubNativePixmapManager() override {} | |
23 | |
24 void Initialize(const base::FileDescriptor& device_fd) override {} | |
25 | |
26 std::vector<Configuration> GetSupportedNativePixmapConfigurations() | |
27 const override { | |
28 return std::vector<Configuration>(); | |
29 } | |
30 | |
31 private: | |
32 DISALLOW_COPY_AND_ASSIGN(StubNativePixmapManager); | |
33 }; | |
34 | |
35 NativePixmapManager* g_instance = nullptr; | |
36 | |
37 } // namespace | |
38 | |
39 // static | |
40 NativePixmapManager* NativePixmapManager::GetInstance() { | |
41 return g_instance; | |
42 } | |
43 | |
44 // static | |
45 void NativePixmapManager::SetInstance(NativePixmapManager* instance) { | |
46 DCHECK(!g_instance); | |
47 DCHECK(instance); | |
48 g_instance = instance; | |
49 } | |
50 | |
51 // static | |
52 scoped_ptr<NativePixmapManager> NativePixmapManager::Create( | |
53 const base::FileDescriptor& device_fd) { | |
54 TRACE_EVENT1("ozone", "NativePixmapManager::Create", "platform", | |
55 GetOzonePlatformName()); | |
56 scoped_ptr<NativePixmapManager> manager = | |
57 PlatformObject<NativePixmapManager>::Create(); | |
58 manager->Initialize(device_fd); | |
59 return manager.Pass(); | |
60 } | |
61 | |
62 NativePixmapManager::NativePixmapManager() {} | |
63 | |
64 NativePixmapManager::~NativePixmapManager() {} | |
65 | |
66 NativePixmapManager* CreateStubNativePixmapManager() { | |
67 return new StubNativePixmapManager; | |
68 } | |
69 | |
70 } // namespace ui | |
OLD | NEW |