Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(114)

Side by Side Diff: ui/ozone/platform/dri/ozone_platform_dri.cc

Issue 291473002: ozone: Initialize a subsystem only if necessary. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tot-merge-r270817 Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/ozone/platform/dri/ozone_platform_dri.h" 5 #include "ui/ozone/platform/dri/ozone_platform_dri.h"
6 6
7 #include "ui/events/ozone/device/device_manager.h" 7 #include "ui/events/ozone/device/device_manager.h"
8 #include "ui/events/ozone/evdev/cursor_delegate_evdev.h" 8 #include "ui/events/ozone/evdev/cursor_delegate_evdev.h"
9 #include "ui/events/ozone/evdev/event_factory_evdev.h" 9 #include "ui/events/ozone/evdev/event_factory_evdev.h"
10 #include "ui/ozone/ime/input_method_context_factory_ozone.h" 10 #include "ui/ozone/ime/input_method_context_factory_ozone.h"
(...skipping 15 matching lines...) Expand all
26 26
27 // OzonePlatform for Linux DRI (Direct Rendering Infrastructure) 27 // OzonePlatform for Linux DRI (Direct Rendering Infrastructure)
28 // 28 //
29 // This platform is Linux without any display server (no X, wayland, or 29 // This platform is Linux without any display server (no X, wayland, or
30 // anything). This means chrome alone owns the display and input devices. 30 // anything). This means chrome alone owns the display and input devices.
31 class OzonePlatformDri : public OzonePlatform { 31 class OzonePlatformDri : public OzonePlatform {
32 public: 32 public:
33 OzonePlatformDri() 33 OzonePlatformDri()
34 : dri_(new DriWrapper(kDefaultGraphicsCardPath)), 34 : dri_(new DriWrapper(kDefaultGraphicsCardPath)),
35 screen_manager_(new ScreenManager(dri_.get())), 35 screen_manager_(new ScreenManager(dri_.get())),
36 device_manager_(CreateDeviceManager()), 36 device_manager_(CreateDeviceManager()) {}
37 surface_factory_ozone_(dri_.get(), screen_manager_.get()),
38 cursor_factory_ozone_(&surface_factory_ozone_),
39 event_factory_ozone_(&cursor_factory_ozone_, device_manager_.get()) {}
40 virtual ~OzonePlatformDri() {} 37 virtual ~OzonePlatformDri() {}
41 38
42 // OzonePlatform: 39 // OzonePlatform:
43 virtual gfx::SurfaceFactoryOzone* GetSurfaceFactoryOzone() OVERRIDE { 40 virtual gfx::SurfaceFactoryOzone* GetSurfaceFactoryOzone() OVERRIDE {
44 return &surface_factory_ozone_; 41 return surface_factory_ozone_.get();
45 } 42 }
46 virtual ui::EventFactoryOzone* GetEventFactoryOzone() OVERRIDE { 43 virtual EventFactoryOzone* GetEventFactoryOzone() OVERRIDE {
47 return &event_factory_ozone_; 44 return event_factory_ozone_.get();
48 } 45 }
49 virtual ui::InputMethodContextFactoryOzone* 46 virtual InputMethodContextFactoryOzone* GetInputMethodContextFactoryOzone()
50 GetInputMethodContextFactoryOzone() OVERRIDE { 47 OVERRIDE {
51 return &input_method_context_factory_ozone_; 48 return input_method_context_factory_ozone_.get();
52 } 49 }
53 virtual ui::CursorFactoryOzone* GetCursorFactoryOzone() OVERRIDE { 50 virtual CursorFactoryOzone* GetCursorFactoryOzone() OVERRIDE {
54 return &cursor_factory_ozone_; 51 return cursor_factory_ozone_.get();
55 } 52 }
56 #if defined(OS_CHROMEOS) 53 #if defined(OS_CHROMEOS)
57 virtual scoped_ptr<ui::NativeDisplayDelegate> CreateNativeDisplayDelegate() 54 virtual scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate()
58 OVERRIDE { 55 OVERRIDE {
59 return scoped_ptr<ui::NativeDisplayDelegate>(new NativeDisplayDelegateDri( 56 return scoped_ptr<NativeDisplayDelegate>(new NativeDisplayDelegateDri(
60 dri_.get(), screen_manager_.get(), device_manager_.get())); 57 dri_.get(), screen_manager_.get(), device_manager_.get()));
61 } 58 }
62 #endif 59 #endif
60 virtual void InitializeUI() OVERRIDE {
61 surface_factory_ozone_.reset(
62 new DriSurfaceFactory(dri_.get(), screen_manager_.get()));
63 cursor_factory_ozone_.reset(
64 new CursorFactoryEvdevDri(surface_factory_ozone_.get()));
65 event_factory_ozone_.reset(new EventFactoryEvdev(
66 cursor_factory_ozone_.get(), device_manager_.get()));
67 input_method_context_factory_ozone_.reset(
68 new InputMethodContextFactoryOzone());
69 }
70
71 virtual void InitializeGPU() OVERRIDE {}
63 72
64 private: 73 private:
65 scoped_ptr<DriWrapper> dri_; 74 scoped_ptr<DriWrapper> dri_;
66 // TODO(dnicoara) Move ownership of |screen_manager_| to NDD. 75 // TODO(dnicoara) Move ownership of |screen_manager_| to NDD.
67 scoped_ptr<ScreenManager> screen_manager_; 76 scoped_ptr<ScreenManager> screen_manager_;
68 scoped_ptr<DeviceManager> device_manager_; 77 scoped_ptr<DeviceManager> device_manager_;
69 78
70 ui::DriSurfaceFactory surface_factory_ozone_; 79 scoped_ptr<DriSurfaceFactory> surface_factory_ozone_;
71 ui::CursorFactoryEvdevDri cursor_factory_ozone_; 80 scoped_ptr<CursorFactoryEvdevDri> cursor_factory_ozone_;
72 ui::EventFactoryEvdev event_factory_ozone_; 81 scoped_ptr<EventFactoryEvdev> event_factory_ozone_;
73 // This creates a minimal input context. 82 // This creates a minimal input context.
74 ui::InputMethodContextFactoryOzone input_method_context_factory_ozone_; 83 scoped_ptr<InputMethodContextFactoryOzone>
84 input_method_context_factory_ozone_;
75 85
76 DISALLOW_COPY_AND_ASSIGN(OzonePlatformDri); 86 DISALLOW_COPY_AND_ASSIGN(OzonePlatformDri);
77 }; 87 };
78 88
79 } // namespace 89 } // namespace
80 90
81 OzonePlatform* CreateOzonePlatformDri() { return new OzonePlatformDri; } 91 OzonePlatform* CreateOzonePlatformDri() { return new OzonePlatformDri; }
82 92
83 } // namespace ui 93 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/caca/ozone_platform_caca.cc ('k') | ui/ozone/platform/egltest/ozone_platform_egltest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698