OLD | NEW |
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 #ifndef UI_OZONE_OZONE_PLATFORM_H_ | 5 #ifndef UI_OZONE_OZONE_PLATFORM_H_ |
6 #define UI_OZONE_OZONE_PLATFORM_H_ | 6 #define UI_OZONE_OZONE_PLATFORM_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "ui/ozone/ozone_export.h" | 9 #include "ui/ozone/ozone_export.h" |
10 | 10 |
(...skipping 20 matching lines...) Expand all Loading... |
31 // | 31 // |
32 // A platform is free to use different implementations of each | 32 // A platform is free to use different implementations of each |
33 // interface depending on the context. You can, for example, create | 33 // interface depending on the context. You can, for example, create |
34 // different objects depending on the underlying hardware, command | 34 // different objects depending on the underlying hardware, command |
35 // line flags, or whatever is appropriate for the platform. | 35 // line flags, or whatever is appropriate for the platform. |
36 class OZONE_EXPORT OzonePlatform { | 36 class OZONE_EXPORT OzonePlatform { |
37 public: | 37 public: |
38 OzonePlatform(); | 38 OzonePlatform(); |
39 virtual ~OzonePlatform(); | 39 virtual ~OzonePlatform(); |
40 | 40 |
41 // Initialize the platform. Once complete, SurfaceFactoryOzone & | 41 // Initializes the subsystems/resources necessary for the UI process (e.g. |
42 // EventFactoryOzone will be set. | 42 // events, surface, etc.) |
43 static void Initialize(); | 43 static void InitializeForUI(); |
| 44 |
| 45 // Initializes the subsystems/resources necessary for the GPU process. |
| 46 static void InitializeForGPU(); |
44 | 47 |
45 static OzonePlatform* GetInstance(); | 48 static OzonePlatform* GetInstance(); |
46 | 49 |
47 // Factory getters to override in subclasses. The returned objects will be | 50 // Factory getters to override in subclasses. The returned objects will be |
48 // injected into the appropriate layer at startup. Subclasses should not | 51 // injected into the appropriate layer at startup. Subclasses should not |
49 // inject these objects themselves. Ownership is retained by OzonePlatform. | 52 // inject these objects themselves. Ownership is retained by OzonePlatform. |
50 virtual gfx::SurfaceFactoryOzone* GetSurfaceFactoryOzone() = 0; | 53 virtual gfx::SurfaceFactoryOzone* GetSurfaceFactoryOzone() = 0; |
51 virtual ui::EventFactoryOzone* GetEventFactoryOzone() = 0; | 54 virtual ui::EventFactoryOzone* GetEventFactoryOzone() = 0; |
52 virtual ui::InputMethodContextFactoryOzone* | 55 virtual ui::InputMethodContextFactoryOzone* |
53 GetInputMethodContextFactoryOzone() = 0; | 56 GetInputMethodContextFactoryOzone() = 0; |
54 virtual ui::CursorFactoryOzone* GetCursorFactoryOzone() = 0; | 57 virtual ui::CursorFactoryOzone* GetCursorFactoryOzone() = 0; |
55 #if defined(OS_CHROMEOS) | 58 #if defined(OS_CHROMEOS) |
56 virtual scoped_ptr<ui::NativeDisplayDelegate> | 59 virtual scoped_ptr<ui::NativeDisplayDelegate> |
57 CreateNativeDisplayDelegate() = 0; | 60 CreateNativeDisplayDelegate() = 0; |
58 #endif | 61 #endif |
59 | 62 |
60 private: | 63 private: |
| 64 virtual void InitializeUI() = 0; |
| 65 virtual void InitializeGPU() = 0; |
| 66 |
| 67 static void CreateInstance(); |
| 68 |
61 static OzonePlatform* instance_; | 69 static OzonePlatform* instance_; |
62 | 70 |
63 DISALLOW_COPY_AND_ASSIGN(OzonePlatform); | 71 DISALLOW_COPY_AND_ASSIGN(OzonePlatform); |
64 }; | 72 }; |
65 | 73 |
66 } // namespace ui | 74 } // namespace ui |
67 | 75 |
68 #endif // UI_OZONE_OZONE_PLATFORM_H_ | 76 #endif // UI_OZONE_OZONE_PLATFORM_H_ |
OLD | NEW |